Changeset 99813 in webkit
- Timestamp:
- Nov 9, 2011, 9:45:25 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 1 deleted
- 9 edited
- 6 copied
- 1 moved
-
ChangeLog (modified) (1 diff)
-
WebCore.gypi (modified) (4 diffs)
-
platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp (added)
-
platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h (copied) (copied from trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h ) (1 diff)
-
platform/graphics/chromium/CanvasLayerTextureUpdater.cpp (copied) (copied from trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h ) (1 diff)
-
platform/graphics/chromium/CanvasLayerTextureUpdater.h (copied) (copied from trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h ) (1 diff)
-
platform/graphics/chromium/ContentLayerChromium.cpp (modified) (2 diffs)
-
platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp (moved) (moved from trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp ) (4 diffs)
-
platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h (copied) (copied from trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h ) (1 diff)
-
platform/graphics/chromium/ImageLayerChromium.cpp (modified) (3 diffs)
-
platform/graphics/chromium/LayerRendererChromium.cpp (modified) (2 diffs)
-
platform/graphics/chromium/LayerTextureUpdater.h (modified) (4 diffs)
-
platform/graphics/chromium/LayerTextureUpdaterCanvas.h (deleted)
-
platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp (copied) (copied from trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h ) (1 diff)
-
platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h (copied) (copied from trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h ) (1 diff)
-
platform/graphics/chromium/TiledLayerChromium.cpp (modified) (9 diffs)
-
platform/graphics/chromium/cc/CCTextureUpdater.cpp (modified) (2 diffs)
-
platform/graphics/chromium/cc/CCTextureUpdater.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r99809 r99813 1 2011-11-09 David Reveman <reveman@chromium.org> 2 3 [Chromium] Add support for painting into an SkPicture and then rasterizing into tile-sized chunks. 4 https://bugs.webkit.org/show_bug.cgi?id=71388 5 6 Reviewed by James Robinson. 7 8 Add UpdatableTexture class, which allows texture updater to 9 allocate tile specific resources and paint tiles separately. 10 Rename texture uploader classes and move them to separate files. 11 12 No new tests. Covered by existing tests. 13 14 * WebCore.gypi: 15 * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp: Added. 16 (WebCore::BitmapCanvasLayerTextureUpdater::Texture::Texture): 17 (WebCore::BitmapCanvasLayerTextureUpdater::Texture::~Texture): 18 (WebCore::BitmapCanvasLayerTextureUpdater::Texture::updateRect): 19 (WebCore::BitmapCanvasLayerTextureUpdater::create): 20 (WebCore::BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater): 21 (WebCore::BitmapCanvasLayerTextureUpdater::~BitmapCanvasLayerTextureUpdater): 22 (WebCore::BitmapCanvasLayerTextureUpdater::createTexture): 23 (WebCore::BitmapCanvasLayerTextureUpdater::sampledTexelFormat): 24 (WebCore::BitmapCanvasLayerTextureUpdater::prepareToUpdate): 25 (WebCore::BitmapCanvasLayerTextureUpdater::updateTextureRect): 26 * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h: Copied from Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h. 27 (WebCore::BitmapCanvasLayerTextureUpdater::Texture::textureUpdater): 28 (WebCore::BitmapCanvasLayerTextureUpdater::orientation): 29 * platform/graphics/chromium/ContentLayerChromium.cpp: 30 (WebCore::ContentLayerChromium::createTextureUpdater): 31 * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp: Renamed from Source/WebCore/platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp. 32 (WebCore::FrameBuffer::FrameBuffer::FrameBuffer): 33 (WebCore::FrameBuffer::FrameBuffer::~FrameBuffer): 34 (WebCore::FrameBuffer::FrameBuffer::initialize): 35 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::Texture): 36 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::~Texture): 37 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect): 38 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::create): 39 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::FrameBufferSkPictureCanvasLayerTextureUpdater): 40 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::~FrameBufferSkPictureCanvasLayerTextureUpdater): 41 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::createTexture): 42 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::sampledTexelFormat): 43 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect): 44 * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h: Copied from Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h. 45 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::textureUpdater): 46 (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::orientation): 47 * platform/graphics/chromium/ImageLayerChromium.cpp: 48 (WebCore::ImageLayerTextureUpdater::Texture::Texture): 49 (WebCore::ImageLayerTextureUpdater::Texture::updateRect): 50 (WebCore::ImageLayerTextureUpdater::Texture::textureUpdater): 51 (WebCore::ImageLayerTextureUpdater::createTexture): 52 (WebCore::ImageLayerTextureUpdater::prepareToUpdate): 53 * platform/graphics/chromium/LayerRendererChromium.cpp: 54 * platform/graphics/chromium/LayerTextureUpdater.h: 55 (WebCore::LayerTextureUpdater::Texture::~Texture): 56 (WebCore::LayerTextureUpdater::Texture::texture): 57 (WebCore::LayerTextureUpdater::Texture::prepareRect): 58 (WebCore::LayerTextureUpdater::Texture::Texture): 59 (WebCore::LayerTextureUpdater::prepareToUpdate): 60 * platform/graphics/chromium/LayerTextureUpdaterCanvas.h: Removed. 61 * platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp: Copied from Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h. 62 (WebCore::SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater): 63 (WebCore::SkPictureCanvasLayerTextureUpdater::~SkPictureCanvasLayerTextureUpdater): 64 (WebCore::SkPictureCanvasLayerTextureUpdater::prepareToUpdate): 65 (WebCore::SkPictureCanvasLayerTextureUpdater::drawPicture): 66 * platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h. 67 * platform/graphics/chromium/TiledLayerChromium.cpp: 68 (WebCore::UpdatableTile::UpdatableTile): 69 (WebCore::UpdatableTile::texture): 70 (WebCore::UpdatableTile::managedTexture): 71 (WebCore::TiledLayerChromium::updateCompositorResources): 72 (WebCore::TiledLayerChromium::pushPropertiesTo): 73 (WebCore::TiledLayerChromium::createTile): 74 (WebCore::TiledLayerChromium::protectTileTextures): 75 (WebCore::TiledLayerChromium::prepareToUpdate): 76 * platform/graphics/chromium/cc/CCTextureUpdater.cpp: 77 (WebCore::CCTextureUpdater::append): 78 (WebCore::CCTextureUpdater::update): 79 * platform/graphics/chromium/cc/CCTextureUpdater.h: 80 1 81 2011-11-09 Kevin Ollivier <kevino@theolliviers.com> 2 82 -
trunk/Source/WebCore/WebCore.gypi
r99750 r99813 3448 3448 'platform/graphics/cg/PatternCG.cpp', 3449 3449 'platform/graphics/cg/TransformationMatrixCG.cpp', 3450 'platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp', 3451 'platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h', 3450 3452 'platform/graphics/chromium/Canvas2DLayerChromium.cpp', 3451 3453 'platform/graphics/chromium/Canvas2DLayerChromium.h', 3452 3454 'platform/graphics/chromium/CanvasLayerChromium.cpp', 3453 3455 'platform/graphics/chromium/CanvasLayerChromium.h', 3456 'platform/graphics/chromium/CanvasLayerTextureUpdater.cpp', 3457 'platform/graphics/chromium/CanvasLayerTextureUpdater.h', 3454 3458 'platform/graphics/chromium/ComplexTextControllerLinux.cpp', 3455 3459 'platform/graphics/chromium/ComplexTextControllerLinux.h', … … 3472 3476 'platform/graphics/chromium/FontUtilsChromiumWin.cpp', 3473 3477 'platform/graphics/chromium/FontUtilsChromiumWin.h', 3478 'platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp', 3479 'platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h', 3474 3480 'platform/graphics/chromium/GeometryBinding.cpp', 3475 3481 'platform/graphics/chromium/GeometryBinding.h', … … 3495 3501 'platform/graphics/chromium/LayerTextureSubImage.h', 3496 3502 'platform/graphics/chromium/LayerTextureUpdater.h', 3497 'platform/graphics/chromium/LayerTextureUpdaterCanvas.cpp',3498 'platform/graphics/chromium/LayerTextureUpdaterCanvas.h',3499 3503 'platform/graphics/chromium/NonCompositedContentHost.cpp', 3500 3504 'platform/graphics/chromium/NonCompositedContentHost.h', … … 3518 3522 'platform/graphics/chromium/SimpleFontDataChromiumWin.cpp', 3519 3523 'platform/graphics/chromium/SimpleFontDataLinux.cpp', 3524 'platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp', 3525 'platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h', 3520 3526 'platform/graphics/chromium/TrackingTextureAllocator.cpp', 3521 3527 'platform/graphics/chromium/TrackingTextureAllocator.h', -
trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h
r99812 r99813 25 25 26 26 27 #ifndef LayerTextureUpdater_h28 #define LayerTextureUpdater_h27 #ifndef BitmapCanvasLayerTextureUpdater_h 28 #define BitmapCanvasLayerTextureUpdater_h 29 29 30 30 #if USE(ACCELERATED_COMPOSITING) 31 31 32 #include "GraphicsTypes3D.h" 33 #include <wtf/RefCounted.h> 32 #include "CanvasLayerTextureUpdater.h" 33 #include "LayerTextureSubImage.h" 34 #include "PlatformCanvas.h" 34 35 35 36 namespace WebCore { 36 37 37 class GraphicsContext3D; 38 class IntRect; 39 class IntSize; 40 class ManagedTexture; 41 class TextureAllocator; 38 class LayerPainterChromium; 42 39 43 class LayerTextureUpdater : public RefCounted<LayerTextureUpdater> { 40 // A CanvasLayerTextureUpdater with an internal bitmap. 41 class BitmapCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { 44 42 public: 45 virtual ~LayerTextureUpdater() { } 43 class Texture : public LayerTextureUpdater::Texture { 44 public: 45 Texture(BitmapCanvasLayerTextureUpdater*, PassOwnPtr<ManagedTexture>); 46 virtual ~Texture(); 46 47 47 enum Orientation { 48 BottomUpOrientation, 49 TopDownOrientation, 50 InvalidOrientation, 48 virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect); 49 50 private: 51 BitmapCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } 52 53 BitmapCanvasLayerTextureUpdater* m_textureUpdater; 51 54 }; 52 enum SampledTexelFormat { 53 SampledTexelFormatRGBA, 54 SampledTexelFormatBGRA, 55 SampledTexelFormatInvalid, 56 }; 57 // Returns the orientation of the texture uploaded by this interface. 58 virtual Orientation orientation() = 0; 59 // Returns the format of the texel uploaded by this interface. 60 // This format should not be confused by texture internal format. 61 // This format specifies the component order in the sampled texel. 62 // If the format is TexelFormatBGRA, vec4.x is blue and vec4.z is red. 63 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0; 64 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels) = 0; 65 virtual void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect) = 0; 55 56 static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); 57 virtual ~BitmapCanvasLayerTextureUpdater(); 58 59 virtual PassRefPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*); 60 virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrientation; } 61 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); 62 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels); 63 void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect); 64 65 private: 66 BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); 67 68 PlatformCanvas m_canvas; 69 LayerTextureSubImage m_texSubImage; 66 70 }; 67 71 68 72 } // namespace WebCore 69 73 #endif // USE(ACCELERATED_COMPOSITING) 70 #endif // LayerTextureUpdater_h74 #endif // BitmapCanvasLayerTextureUpdater_h -
trunk/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp
r99812 r99813 24 24 */ 25 25 26 #ifndef CCTextureUpdater_h27 #define CCTextureUpdater_h28 26 29 #include "IntRect.h" 30 #include <wtf/Vector.h> 27 #include "config.h" 28 29 #if USE(ACCELERATED_COMPOSITING) 30 31 #include "CanvasLayerTextureUpdater.h" 32 33 #include "GraphicsContext.h" 34 #include "LayerPainterChromium.h" 35 #include "TraceEvent.h" 31 36 32 37 namespace WebCore { 33 38 34 class GraphicsContext3D; 35 class LayerTextureUpdater; 36 class ManagedTexture; 37 class TextureAllocator; 38 39 class CCTextureUpdater { 40 public: 41 CCTextureUpdater(TextureAllocator*); 42 ~CCTextureUpdater(); 43 44 void append(ManagedTexture*, LayerTextureUpdater*, const IntRect& sourceRect, const IntRect& destRect); 45 46 bool hasMoreUpdates() const; 47 48 // Update some textures. Returns true if more textures left to process. 49 bool update(GraphicsContext3D*, size_t count); 50 51 void clear(); 52 53 TextureAllocator* allocator() { return m_allocator; } 54 55 private: 56 struct UpdateEntry { 57 ManagedTexture* m_texture; 58 LayerTextureUpdater* m_updater; 59 IntRect m_sourceRect; 60 IntRect m_destRect; 61 }; 62 63 TextureAllocator* m_allocator; 64 size_t m_entryIndex; 65 Vector<UpdateEntry> m_entries; 66 }; 67 39 CanvasLayerTextureUpdater::CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) 40 : m_painter(painter) 41 { 68 42 } 69 43 70 #endif // CCTextureUpdater_h 44 CanvasLayerTextureUpdater::~CanvasLayerTextureUpdater() 45 { 46 } 47 48 void CanvasLayerTextureUpdater::paintContents(GraphicsContext& context, const IntRect& contentRect) 49 { 50 context.translate(-contentRect.x(), -contentRect.y()); 51 { 52 TRACE_EVENT("CanvasLayerTextureUpdater::paint", this, 0); 53 m_painter->paint(context, contentRect); 54 } 55 m_contentRect = contentRect; 56 } 57 58 } // namespace WebCore 59 #endif // USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h
r99812 r99813 24 24 */ 25 25 26 #ifndef CCTextureUpdater_h27 #define CCTextureUpdater_h28 26 29 #include "IntRect.h" 30 #include <wtf/Vector.h> 27 #ifndef CanvasLayerTextureUpdater_h 28 #define CanvasLayerTextureUpdater_h 29 30 #if USE(ACCELERATED_COMPOSITING) 31 32 #include "LayerTextureUpdater.h" 31 33 32 34 namespace WebCore { 33 35 34 36 class GraphicsContext3D; 35 class LayerTextureUpdater; 36 class ManagedTexture; 37 class TextureAllocator; 37 class LayerPainterChromium; 38 38 39 class CCTextureUpdater { 39 // A LayerTextureUpdater with an internal canvas. 40 class CanvasLayerTextureUpdater : public LayerTextureUpdater { 40 41 public: 41 CCTextureUpdater(TextureAllocator*); 42 ~CCTextureUpdater(); 42 virtual ~CanvasLayerTextureUpdater(); 43 43 44 void append(ManagedTexture*, LayerTextureUpdater*, const IntRect& sourceRect, const IntRect& destRect); 44 protected: 45 explicit CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); 45 46 46 bool hasMoreUpdates() const; 47 48 // Update some textures. Returns true if more textures left to process. 49 bool update(GraphicsContext3D*, size_t count); 50 51 void clear(); 52 53 TextureAllocator* allocator() { return m_allocator; } 47 void paintContents(GraphicsContext&, const IntRect& contentRect); 48 const IntRect& contentRect() const { return m_contentRect; } 54 49 55 50 private: 56 struct UpdateEntry { 57 ManagedTexture* m_texture; 58 LayerTextureUpdater* m_updater; 59 IntRect m_sourceRect; 60 IntRect m_destRect; 61 }; 62 63 TextureAllocator* m_allocator; 64 size_t m_entryIndex; 65 Vector<UpdateEntry> m_entries; 51 IntRect m_contentRect; 52 OwnPtr<LayerPainterChromium> m_painter; 66 53 }; 67 54 68 } 69 70 #endif // C CTextureUpdater_h55 } // namespace WebCore 56 #endif // USE(ACCELERATED_COMPOSITING) 57 #endif // CanvasLayerTextureUpdater_h -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
r98277 r99813 35 35 #include "ContentLayerChromium.h" 36 36 37 #include "BitmapCanvasLayerTextureUpdater.h" 38 #include "FrameBufferSkPictureCanvasLayerTextureUpdater.h" 37 39 #include "LayerPainterChromium.h" 38 40 #include "LayerRendererChromium.h" 39 #include "LayerTextureUpdaterCanvas.h"40 41 #include "PlatformSupport.h" 41 42 #include "cc/CCLayerTreeHost.h" … … 123 124 #if USE(SKIA) 124 125 if (host->settings().acceleratePainting) { 125 m_textureUpdater = LayerTextureUpdaterSkPicture::create(ContentLayerPainter::create(m_delegate));126 m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); 126 127 return; 127 128 } 128 129 #endif // USE(SKIA) 129 130 130 m_textureUpdater = LayerTextureUpdaterBitmap::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub);131 m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub); 131 132 } 132 133 -
trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp
r99812 r99813 28 28 29 29 #if USE(ACCELERATED_COMPOSITING) 30 #if USE(SKIA) 30 31 31 #include " LayerTextureUpdaterCanvas.h"32 #include "FrameBufferSkPictureCanvasLayerTextureUpdater.h" 32 33 33 #include "Extensions3D.h"34 #include "GraphicsContext.h"35 34 #include "LayerPainterChromium.h" 36 #include "ManagedTexture.h"37 #include "PlatformColor.h"38 #include "TraceEvent.h"39 40 #if USE(SKIA)41 #include "GrContext.h"42 #include "PlatformContextSkia.h"43 35 #include "SkCanvas.h" 44 36 #include "SkGpuDevice.h" 45 #endif // USE(SKIA)46 37 47 38 namespace WebCore { 48 39 49 #if USE(SKIA)50 40 namespace { 51 41 … … 105 95 106 96 } // namespace 107 #endif // USE(SKIA)108 97 109 LayerTextureUpdaterCanvas::LayerTextureUpdaterCanvas(PassOwnPtr<LayerPainterChromium> painter) 110 : m_painter(painter) 98 FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::Texture(FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater, PassOwnPtr<ManagedTexture> texture) 99 : LayerTextureUpdater::Texture(texture) 100 , m_textureUpdater(textureUpdater) 111 101 { 112 102 } 113 103 114 void LayerTextureUpdaterCanvas::paintContents(GraphicsContext& context, const IntRect& contentRect) 115 { 116 context.translate(-contentRect.x(), -contentRect.y()); 117 { 118 TRACE_EVENT("LayerTextureUpdaterCanvas::paint", this, 0); 119 m_painter->paint(context, contentRect); 120 } 121 m_contentRect = contentRect; 122 } 123 124 PassRefPtr<LayerTextureUpdaterBitmap> LayerTextureUpdaterBitmap::create(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) 125 { 126 return adoptRef(new LayerTextureUpdaterBitmap(painter, useMapTexSubImage)); 127 } 128 129 LayerTextureUpdaterBitmap::LayerTextureUpdaterBitmap(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) 130 : LayerTextureUpdaterCanvas(painter) 131 , m_texSubImage(useMapTexSubImage) 104 FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::~Texture() 132 105 { 133 106 } 134 107 135 LayerTextureUpdater::SampledTexelFormat LayerTextureUpdaterBitmap::sampledTexelFormat(GC3Denum textureFormat)108 void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) 136 109 { 137 // The component order may be bgra if we uploaded bgra pixels to rgba textures. 138 return PlatformColor::sameComponentOrder(textureFormat) ? 139 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; 110 textureUpdater()->updateTextureRect(context, allocator, texture(), sourceRect, destRect); 140 111 } 141 112 142 void LayerTextureUpdaterBitmap::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels)113 PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) 143 114 { 144 m_texSubImage.setSubImageSize(tileSize); 145 146 m_canvas.resize(contentRect.size()); 147 // Assumption: if a tiler is using border texels, then it is because the 148 // layer is likely to be filtered or transformed. Because of it might be 149 // transformed, draw the text in grayscale instead of subpixel antialiasing. 150 PlatformCanvas::Painter::TextOption textOption = 151 borderTexels ? PlatformCanvas::Painter::GrayscaleText : PlatformCanvas::Painter::SubpixelText; 152 PlatformCanvas::Painter canvasPainter(&m_canvas, textOption); 153 paintContents(*canvasPainter.context(), contentRect); 115 return adoptRef(new FrameBufferSkPictureCanvasLayerTextureUpdater(painter)); 154 116 } 155 117 156 void LayerTextureUpdaterBitmap::updateTextureRect(GraphicsContext3D* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) 157 { 158 PlatformCanvas::AutoLocker locker(&m_canvas); 159 160 texture->bindTexture(context, allocator); 161 m_texSubImage.upload(locker.pixels(), contentRect(), sourceRect, destRect, texture->format(), context); 162 } 163 164 #if USE(SKIA) 165 PassRefPtr<LayerTextureUpdaterSkPicture> LayerTextureUpdaterSkPicture::create(PassOwnPtr<LayerPainterChromium> painter) 166 { 167 return adoptRef(new LayerTextureUpdaterSkPicture(painter)); 168 } 169 170 LayerTextureUpdaterSkPicture::LayerTextureUpdaterSkPicture(PassOwnPtr<LayerPainterChromium> painter) 171 : LayerTextureUpdaterCanvas(painter) 118 FrameBufferSkPictureCanvasLayerTextureUpdater::FrameBufferSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) 119 : SkPictureCanvasLayerTextureUpdater(painter) 172 120 { 173 121 } 174 122 175 LayerTextureUpdaterSkPicture::~LayerTextureUpdaterSkPicture()123 FrameBufferSkPictureCanvasLayerTextureUpdater::~FrameBufferSkPictureCanvasLayerTextureUpdater() 176 124 { 177 125 } 178 126 179 LayerTextureUpdater::SampledTexelFormat LayerTextureUpdaterSkPicture::sampledTexelFormat(GC3Denum textureFormat) 127 PassRefPtr<LayerTextureUpdater::Texture> FrameBufferSkPictureCanvasLayerTextureUpdater::createTexture(TextureManager* manager) 128 { 129 return adoptRef(new Texture(this, ManagedTexture::create(manager))); 130 } 131 132 LayerTextureUpdater::SampledTexelFormat FrameBufferSkPictureCanvasLayerTextureUpdater::sampledTexelFormat(GC3Denum textureFormat) 180 133 { 181 134 // Here we directly render to the texture, so the component order is always correct. … … 183 136 } 184 137 185 void LayerTextureUpdaterSkPicture::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels) 186 { 187 SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect.height()); 188 PlatformContextSkia platformContext(canvas); 189 GraphicsContext graphicsContext(&platformContext); 190 paintContents(graphicsContext, contentRect); 191 m_picture.endRecording(); 192 } 193 194 void LayerTextureUpdaterSkPicture::updateTextureRect(GraphicsContext3D* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) 138 void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(GraphicsContext3D* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect) 195 139 { 196 140 // Make sure SKIA uses the correct GL context. … … 208 152 canvas->translate(contentRect().x() - sourceRect.x() + destRect.x(), 209 153 contentRect().y() - sourceRect.y() + destRect.y()); 210 canvas->drawPicture(m_picture);154 drawPicture(canvas); 211 155 212 156 // Flush SKIA context so that all the rendered stuff appears on the texture. 213 157 context->grContext()->flush(); 214 158 } 215 #endif // USE(SKIA)216 159 217 160 } // namespace WebCore 161 #endif // USE(SKIA) 218 162 #endif // USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h
r99812 r99813 25 25 26 26 27 #ifndef LayerTextureUpdater_h28 #define LayerTextureUpdater_h27 #ifndef FrameBufferSkPictureCanvasLayerTextureUpdater_h 28 #define FrameBufferSkPictureCanvasLayerTextureUpdater_h 29 29 30 30 #if USE(ACCELERATED_COMPOSITING) 31 #if USE(SKIA) 31 32 32 #include "GraphicsTypes3D.h" 33 #include <wtf/RefCounted.h> 33 #include "SkPictureCanvasLayerTextureUpdater.h" 34 34 35 35 namespace WebCore { 36 36 37 class GraphicsContext3D; 38 class IntRect; 39 class IntSize; 40 class ManagedTexture; 41 class TextureAllocator; 37 class FrameBufferSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater { 38 public: 39 class Texture : public LayerTextureUpdater::Texture { 40 public: 41 Texture(FrameBufferSkPictureCanvasLayerTextureUpdater*, PassOwnPtr<ManagedTexture>); 42 virtual ~Texture(); 42 43 43 class LayerTextureUpdater : public RefCounted<LayerTextureUpdater> { 44 public: 45 virtual ~LayerTextureUpdater() { } 44 virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect); 46 45 47 enum Orientation {48 BottomUpOrientation,49 TopDownOrientation, 50 InvalidOrientation,46 private: 47 FrameBufferSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } 48 49 FrameBufferSkPictureCanvasLayerTextureUpdater* m_textureUpdater; 51 50 }; 52 enum SampledTexelFormat { 53 SampledTexelFormatRGBA, 54 SampledTexelFormatBGRA, 55 SampledTexelFormatInvalid, 56 }; 57 // Returns the orientation of the texture uploaded by this interface. 58 virtual Orientation orientation() = 0; 59 // Returns the format of the texel uploaded by this interface. 60 // This format should not be confused by texture internal format. 61 // This format specifies the component order in the sampled texel. 62 // If the format is TexelFormatBGRA, vec4.x is blue and vec4.z is red. 63 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0; 64 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels) = 0; 65 virtual void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect) = 0; 51 52 static PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>); 53 virtual ~FrameBufferSkPictureCanvasLayerTextureUpdater(); 54 55 virtual PassRefPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*); 56 virtual Orientation orientation() { return LayerTextureUpdater::TopDownOrientation; } 57 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); 58 void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect); 59 60 private: 61 explicit FrameBufferSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); 66 62 }; 67 68 63 } // namespace WebCore 64 #endif // USE(SKIA) 69 65 #endif // USE(ACCELERATED_COMPOSITING) 70 #endif // LayerTextureUpdater_h66 #endif // FrameBufferSkPictureCanvasLayerTextureUpdater_h -
trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
r98055 r99813 47 47 class ImageLayerTextureUpdater : public LayerTextureUpdater { 48 48 public: 49 class Texture : public LayerTextureUpdater::Texture { 50 public: 51 Texture(ImageLayerTextureUpdater* textureUpdater, PassOwnPtr<ManagedTexture> texture) 52 : LayerTextureUpdater::Texture(texture) 53 , m_textureUpdater(textureUpdater) 54 { 55 } 56 57 virtual void updateRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) 58 { 59 textureUpdater()->updateTextureRect(context, allocator, texture(), sourceRect, destRect); 60 } 61 62 private: 63 ImageLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } 64 65 ImageLayerTextureUpdater* m_textureUpdater; 66 }; 67 49 68 static PassRefPtr<ImageLayerTextureUpdater> create(bool useMapTexSubImage) 50 69 { … … 53 72 54 73 virtual ~ImageLayerTextureUpdater() { } 74 75 virtual PassRefPtr<LayerTextureUpdater::Texture> createTexture(TextureManager* manager) 76 { 77 return adoptRef(new Texture(this, ManagedTexture::create(manager))); 78 } 55 79 56 80 virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrientation; } … … 62 86 } 63 87 64 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int /* borderTexels */)88 virtual void prepareToUpdate(const IntRect& /* contentRect */, const IntSize& tileSize, int /* borderTexels */) 65 89 { 66 90 m_texSubImage.setSubImageSize(tileSize); -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r99774 r99813 36 36 37 37 #include "Canvas2DLayerChromium.h" 38 #include "CanvasLayerTextureUpdater.h" 38 39 #include "Extensions3DChromium.h" 39 40 #include "FloatQuad.h" … … 42 43 #include "LayerChromium.h" 43 44 #include "LayerPainterChromium.h" 44 #include "LayerTextureUpdaterCanvas.h"45 45 #include "ManagedTexture.h" 46 46 #include "NonCompositedContentHost.h" -
trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h
r96186 r99813 30 30 #if USE(ACCELERATED_COMPOSITING) 31 31 32 #include "ManagedTexture.h" 32 33 #include "GraphicsTypes3D.h" 33 34 #include <wtf/RefCounted.h> … … 38 39 class IntRect; 39 40 class IntSize; 40 class ManagedTexture;41 41 class TextureAllocator; 42 class TextureManager; 42 43 43 44 class LayerTextureUpdater : public RefCounted<LayerTextureUpdater> { 44 45 public: 46 // Allows texture uploaders to store per-tile resources. 47 class Texture : public RefCounted<Texture> { 48 public: 49 virtual ~Texture() { } 50 51 ManagedTexture* texture() { return m_texture.get(); } 52 virtual void prepareRect(const IntRect& /* sourceRect */) { } 53 virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) = 0; 54 protected: 55 explicit Texture(PassOwnPtr<ManagedTexture> texture) : m_texture(texture) { } 56 57 private: 58 OwnPtr<ManagedTexture> m_texture; 59 }; 60 45 61 virtual ~LayerTextureUpdater() { } 46 62 … … 55 71 SampledTexelFormatInvalid, 56 72 }; 73 virtual PassRefPtr<Texture> createTexture(TextureManager*) = 0; 57 74 // Returns the orientation of the texture uploaded by this interface. 58 75 virtual Orientation orientation() = 0; … … 62 79 // If the format is TexelFormatBGRA, vec4.x is blue and vec4.z is red. 63 80 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0; 64 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels) = 0; 65 virtual void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect) = 0; 81 virtual void prepareToUpdate(const IntRect& /* contentRect */, const IntSize& /* tileSize */, int /* borderTexels */) { } 66 82 }; 67 83 -
trunk/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp
r99812 r99813 24 24 */ 25 25 26 #ifndef CCTextureUpdater_h27 #define CCTextureUpdater_h28 26 29 #include "IntRect.h" 30 #include <wtf/Vector.h> 27 #include "config.h" 28 29 #if USE(ACCELERATED_COMPOSITING) 30 #if USE(SKIA) 31 32 #include "SkPictureCanvasLayerTextureUpdater.h" 33 34 #include "GraphicsContext.h" 35 #include "LayerPainterChromium.h" 36 #include "PlatformContextSkia.h" 37 #include "SkCanvas.h" 38 #include "TraceEvent.h" 31 39 32 40 namespace WebCore { 33 41 34 class GraphicsContext3D; 35 class LayerTextureUpdater; 36 class ManagedTexture; 37 class TextureAllocator; 38 39 class CCTextureUpdater { 40 public: 41 CCTextureUpdater(TextureAllocator*); 42 ~CCTextureUpdater(); 43 44 void append(ManagedTexture*, LayerTextureUpdater*, const IntRect& sourceRect, const IntRect& destRect); 45 46 bool hasMoreUpdates() const; 47 48 // Update some textures. Returns true if more textures left to process. 49 bool update(GraphicsContext3D*, size_t count); 50 51 void clear(); 52 53 TextureAllocator* allocator() { return m_allocator; } 54 55 private: 56 struct UpdateEntry { 57 ManagedTexture* m_texture; 58 LayerTextureUpdater* m_updater; 59 IntRect m_sourceRect; 60 IntRect m_destRect; 61 }; 62 63 TextureAllocator* m_allocator; 64 size_t m_entryIndex; 65 Vector<UpdateEntry> m_entries; 66 }; 67 42 SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) 43 : CanvasLayerTextureUpdater(painter) 44 { 68 45 } 69 46 70 #endif // CCTextureUpdater_h 47 SkPictureCanvasLayerTextureUpdater::~SkPictureCanvasLayerTextureUpdater() 48 { 49 } 50 51 void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& /* tileSize */, int /* borderTexels */) 52 { 53 SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect.height()); 54 PlatformContextSkia platformContext(canvas); 55 GraphicsContext graphicsContext(&platformContext); 56 paintContents(graphicsContext, contentRect); 57 m_picture.endRecording(); 58 } 59 60 void SkPictureCanvasLayerTextureUpdater::drawPicture(SkCanvas* canvas) 61 { 62 TRACE_EVENT("SkPictureCanvasLayerTextureUpdater::drawPicture", this, 0); 63 canvas->drawPicture(m_picture); 64 } 65 66 } // namespace WebCore 67 #endif // USE(SKIA) 68 #endif // USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h
r99812 r99813 24 24 */ 25 25 26 #ifndef CCTextureUpdater_h27 #define CCTextureUpdater_h28 26 29 #include "IntRect.h" 30 #include <wtf/Vector.h> 27 #ifndef SkPictureCanvasLayerTextureUpdater_h 28 #define SkPictureCanvasLayerTextureUpdater_h 29 30 #if USE(ACCELERATED_COMPOSITING) 31 #if USE(SKIA) 32 33 #include "CanvasLayerTextureUpdater.h" 34 #include "SkPicture.h" 35 36 class SkCanvas; 31 37 32 38 namespace WebCore { 33 39 34 class GraphicsContext3D; 35 class LayerTextureUpdater; 36 class ManagedTexture; 37 class TextureAllocator; 40 class LayerPainterChromium; 38 41 39 class CCTextureUpdater {42 class SkPictureCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { 40 43 public: 41 CCTextureUpdater(TextureAllocator*); 42 ~CCTextureUpdater(); 44 virtual ~SkPictureCanvasLayerTextureUpdater(); 43 45 44 void append(ManagedTexture*, LayerTextureUpdater*, const IntRect& sourceRect, const IntRect& destRect); 46 protected: 47 explicit SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); 45 48 46 bool hasMoreUpdates() const; 47 48 // Update some textures. Returns true if more textures left to process. 49 bool update(GraphicsContext3D*, size_t count); 50 51 void clear(); 52 53 TextureAllocator* allocator() { return m_allocator; } 49 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels); 50 void drawPicture(SkCanvas*); 54 51 55 52 private: 56 struct UpdateEntry { 57 ManagedTexture* m_texture; 58 LayerTextureUpdater* m_updater; 59 IntRect m_sourceRect; 60 IntRect m_destRect; 61 }; 62 63 TextureAllocator* m_allocator; 64 size_t m_entryIndex; 65 Vector<UpdateEntry> m_entries; 53 SkPicture m_picture; // Recording canvas. 66 54 }; 67 55 68 } 69 70 #endif // CCTextureUpdater_h 56 } // namespace WebCore 57 #endif // USE(SKIA) 58 #endif // USE(ACCELERATED_COMPOSITING) 59 #endif // SkPictureCanvasLayerTextureUpdater_h -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
r98360 r99813 52 52 WTF_MAKE_NONCOPYABLE(UpdatableTile); 53 53 public: 54 explicit UpdatableTile(PassOwnPtr<ManagedTexture> tex) : m_tex(tex) { } 55 56 ManagedTexture* texture() { return m_tex.get(); } 54 explicit UpdatableTile(PassRefPtr<LayerTextureUpdater::Texture> texture) : m_texture(texture) { } 55 56 LayerTextureUpdater::Texture* texture() { return m_texture.get(); } 57 ManagedTexture* managedTexture() { return m_texture->texture(); } 57 58 58 59 bool dirty() const { return !m_dirtyLayerRect.isEmpty(); } … … 61 62 // Layer-space dirty rectangle that needs to be repainted. 62 63 IntRect m_dirtyLayerRect; 64 // Content-space rectangle that needs to be updated. 65 IntRect m_updateRect; 63 66 private: 64 OwnPtr<ManagedTexture> m_tex;67 RefPtr<LayerTextureUpdater::Texture> m_texture; 65 68 }; 66 69 … … 168 171 continue; 169 172 170 // Calculate page-space rectangle to copy from. 171 IntRect sourceRect = m_tiler->tileContentRect(tile); 172 const IntPoint anchor = sourceRect.location(); 173 sourceRect.intersect(m_tiler->layerRectToContentRect(tile->m_dirtyLayerRect)); 174 // Paint rect not guaranteed to line up on tile boundaries, so 175 // make sure that sourceRect doesn't extend outside of it. 176 sourceRect.intersect(m_paintRect); 177 if (sourceRect.isEmpty()) 178 continue; 179 180 ASSERT(tile->texture()->isReserved()); 173 IntRect sourceRect = tile->m_updateRect; 174 if (tile->m_updateRect.isEmpty()) 175 continue; 176 177 ASSERT(tile->managedTexture()->isReserved()); 178 const IntPoint anchor = m_tiler->tileContentRect(tile).location(); 181 179 182 180 // Calculate tile-space rectangle to upload into. … … 198 196 CRASH(); 199 197 200 tile-> texture()->bindTexture(context, updater.allocator());198 tile->managedTexture()->bindTexture(context, updater.allocator()); 201 199 const GC3Dint filter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; 202 200 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, filter)); 203 201 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, filter)); 204 202 205 updater.append(tile->texture(), textureUpdater(),sourceRect, destRect);203 updater.append(tile->texture(), sourceRect, destRect); 206 204 tile->clearDirty(); 207 205 } … … 241 239 int j = iter->first.second; 242 240 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); 243 if (!tile-> texture()->isValid(m_tiler->tileSize(), m_textureFormat))241 if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) 244 242 continue; 245 243 246 tiledLayer->syncTextureId(i, j, tile-> texture()->textureId());244 tiledLayer->syncTextureId(i, j, tile->managedTexture()->textureId()); 247 245 } 248 246 } … … 262 260 UpdatableTile* TiledLayerChromium::createTile(int i, int j) 263 261 { 264 RefPtr<UpdatableTile> tile = adoptRef(new UpdatableTile( ManagedTexture::create(textureManager())));262 RefPtr<UpdatableTile> tile = adoptRef(new UpdatableTile(textureUpdater()->createTexture(textureManager()))); 265 263 m_tiler->addTile(tile, i, j); 266 264 tile->m_dirtyLayerRect = m_tiler->tileLayerRect(tile.get()); … … 310 308 for (int i = left; i <= right; ++i) { 311 309 UpdatableTile* tile = tileAt(i, j); 312 if (!tile || !tile-> texture()->isValid(m_tiler->tileSize(), m_textureFormat))313 continue; 314 315 tile-> texture()->reserve(m_tiler->tileSize(), m_textureFormat);310 if (!tile || !tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) 311 continue; 312 313 tile->managedTexture()->reserve(m_tiler->tileSize(), m_textureFormat); 316 314 } 317 315 } … … 347 345 tile = createTile(i, j); 348 346 349 if (!tile-> texture()->isValid(m_tiler->tileSize(), m_textureFormat))347 if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) 350 348 tile->m_dirtyLayerRect = m_tiler->tileLayerRect(tile); 351 349 352 if (!tile-> texture()->reserve(m_tiler->tileSize(), m_textureFormat)) {350 if (!tile->managedTexture()->reserve(m_tiler->tileSize(), m_textureFormat)) { 353 351 m_skipsDraw = true; 354 352 cleanupResources(); … … 375 373 RefPtr<LayerTextureUpdater> protector(textureUpdater()); 376 374 textureUpdater()->prepareToUpdate(m_paintRect, m_tiler->tileSize(), m_tiler->hasBorderTexels()); 375 376 m_tiler->contentRectToTileIndices(m_requestedUpdateRect, left, top, right, bottom); 377 for (int j = top; j <= bottom; ++j) { 378 for (int i = left; i <= right; ++i) { 379 UpdatableTile* tile = tileAt(i, j); 380 if (!tile) 381 tile = createTile(i, j); 382 else if (!tile->dirty()) 383 continue; 384 385 // Calculate content-space rectangle to copy from. 386 IntRect sourceRect = m_tiler->tileContentRect(tile); 387 const IntPoint anchor = sourceRect.location(); 388 sourceRect.intersect(m_tiler->layerRectToContentRect(tile->m_dirtyLayerRect)); 389 // Paint rect not guaranteed to line up on tile boundaries, so 390 // make sure that sourceRect doesn't extend outside of it. 391 sourceRect.intersect(m_paintRect); 392 393 tile->m_updateRect = sourceRect; 394 if (sourceRect.isEmpty()) 395 continue; 396 397 tile->texture()->prepareRect(sourceRect); 398 } 399 } 377 400 } 378 401 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp
r98915 r99813 49 49 } 50 50 51 void CCTextureUpdater::append( ManagedTexture* texture, LayerTextureUpdater* updater, const IntRect& sourceRect, const IntRect& destRect)51 void CCTextureUpdater::append(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect) 52 52 { 53 53 ASSERT(texture); 54 ASSERT(updater);55 54 56 55 UpdateEntry entry; 57 56 entry.m_texture = texture; 58 entry.m_updater = updater;59 57 entry.m_sourceRect = sourceRect; 60 58 entry.m_destRect = destRect; … … 72 70 for (; m_entryIndex < maxIndex; ++m_entryIndex) { 73 71 UpdateEntry& entry = m_entries[m_entryIndex]; 74 entry.m_ updater->updateTextureRect(context, m_allocator, entry.m_texture, entry.m_sourceRect, entry.m_destRect);72 entry.m_texture->updateRect(context, m_allocator, entry.m_sourceRect, entry.m_destRect); 75 73 } 76 74 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h
r98915 r99813 28 28 29 29 #include "IntRect.h" 30 #include "LayerTextureUpdater.h" 30 31 #include <wtf/Vector.h> 31 32 … … 33 34 34 35 class GraphicsContext3D; 35 class LayerTextureUpdater;36 class ManagedTexture;37 36 class TextureAllocator; 38 37 … … 42 41 ~CCTextureUpdater(); 43 42 44 void append( ManagedTexture*, LayerTextureUpdater*, const IntRect& sourceRect, const IntRect& destRect);43 void append(LayerTextureUpdater::Texture*, const IntRect& sourceRect, const IntRect& destRect); 45 44 46 45 bool hasMoreUpdates() const; … … 55 54 private: 56 55 struct UpdateEntry { 57 ManagedTexture* m_texture; 58 LayerTextureUpdater* m_updater; 56 LayerTextureUpdater::Texture* m_texture; 59 57 IntRect m_sourceRect; 60 58 IntRect m_destRect;
Note:
See TracChangeset
for help on using the changeset viewer.