Changeset 105314 in webkit
- Timestamp:
- Jan 18, 2012 1:41:51 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r105311 r105314 1 2012-01-18 Dana Jansens <danakj@chromium.org> 2 3 [chromium] Enable tracking opaque region in Skia graphics context, return it from LayerTextureUpdater 4 https://bugs.webkit.org/show_bug.cgi?id=76211 5 6 Reviewed by James Robinson. 7 8 New unit tests in LayerTextureUpdaterTest.cpp 9 10 * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp: 11 (WebCore::BitmapCanvasLayerTextureUpdater::prepareToUpdate): 12 * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h: 13 * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp: 14 (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::prepareToUpdate): 15 * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h: 16 * platform/graphics/chromium/ContentLayerChromium.cpp: 17 (WebCore::ContentLayerChromium::createTextureUpdater): 18 * platform/graphics/chromium/LayerTextureUpdater.h: 19 (WebCore::LayerTextureUpdater::prepareToUpdate): 20 * platform/graphics/chromium/PlatformCanvas.h: 21 (WebCore::PlatformCanvas::Painter::skiaContext): 22 * platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp: 23 (WebCore::SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater): 24 (WebCore::SkPictureCanvasLayerTextureUpdater::prepareToUpdate): 25 (WebCore::SkPictureCanvasLayerTextureUpdater::setOpaque): 26 * platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h: 27 * platform/graphics/chromium/TiledLayerChromium.cpp: 28 (WebCore::TiledLayerChromium::prepareToUpdateTiles): 29 1 30 2012-01-18 Tim Dresser <tdresser@chromium.org> 2 31 -
trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp
r104742 r105314 33 33 #include "LayerPainterChromium.h" 34 34 #include "PlatformColor.h" 35 #include "PlatformContextSkia.h" 35 36 36 37 namespace WebCore { … … 78 79 } 79 80 80 void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale )81 void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale, IntRect* resultingOpaqueRect) 81 82 { 82 83 m_texSubImage.setSubImageSize(tileSize); 84 85 bool layerIsOpaque = m_canvas.opaque(); 83 86 84 87 m_canvas.resize(contentRect.size()); … … 89 92 borderTexels ? PlatformCanvas::Painter::GrayscaleText : PlatformCanvas::Painter::SubpixelText; 90 93 PlatformCanvas::Painter canvasPainter(&m_canvas, textOption); 94 canvasPainter.skiaContext()->setTrackOpaqueRegion(!layerIsOpaque); 91 95 paintContents(*canvasPainter.context(), contentRect, contentsScale); 96 97 if (!layerIsOpaque) 98 *resultingOpaqueRect = canvasPainter.skiaContext()->opaqueRegion().asRect(); 92 99 } 93 100 -
trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h
r104742 r105314 61 61 virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*); 62 62 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); 63 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale );63 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale, IntRect* resultingOpaqueRect); 64 64 void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect); 65 65 -
trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp
r102181 r105314 87 87 } 88 88 89 void BitmapSkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale )89 void BitmapSkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale, IntRect* resultingOpaqueRect) 90 90 { 91 91 m_texSubImage.setSubImageSize(tileSize); 92 SkPictureCanvasLayerTextureUpdater::prepareToUpdate(contentRect, tileSize, borderTexels, contentsScale );92 SkPictureCanvasLayerTextureUpdater::prepareToUpdate(contentRect, tileSize, borderTexels, contentsScale, resultingOpaqueRect); 93 93 } 94 94 -
trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h
r104522 r105314 60 60 virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*); 61 61 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat); 62 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale );62 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale, IntRect* resultingOpaqueRect); 63 63 void paintContentsRect(SkCanvas*, const IntRect& sourceRect); 64 64 void updateTextureRect(GraphicsContext3D*, GC3Denum format, const IntRect& destRect, const uint8_t* pixels); -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
r104742 r105314 120 120 { 121 121 #if USE(SKIA) 122 if (host->settings().acceleratePainting) {122 if (host->settings().acceleratePainting) 123 123 m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); 124 return; 125 } 126 127 if (host->settings().perTilePainting) { 124 else if (host->settings().perTilePainting) 128 125 m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub); 129 return; 130 } 126 else 131 127 #endif // USE(SKIA) 132 133 m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub); 128 m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub); 134 129 m_textureUpdater->setOpaque(opaque()); 135 130 } -
trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h
r104742 r105314 72 72 // If the format is TexelFormatBGRA, vec4.x is blue and vec4.z is red. 73 73 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0; 74 virtual void prepareToUpdate(const IntRect& /* contentRect */, const IntSize& /* tileSize */, int /* borderTexels */, float /* contentsScale */) { } 74 // The |resultingOpaqueRect| gives back a region of the layer that was painted opaque. If the layer is marked opaque in the updater, 75 // then this region should be ignored in preference for the entire layer's area. 76 virtual void prepareToUpdate(const IntRect& /* contentRect */, const IntSize& /* tileSize */, int /* borderTexels */, float /* contentsScale */, 77 IntRect* /* resultingOpaqueRect */) { } 75 78 79 // Set true by the layer when it is known that the entire output is going to be opaque. 76 80 virtual void setOpaque(bool) { } 77 81 }; -
trunk/Source/WebCore/platform/graphics/chromium/PlatformCanvas.h
r104742 r105314 86 86 87 87 GraphicsContext* context() const { return m_context.get(); } 88 PlatformContextSkia* skiaContext() const { return m_skiaContext.get(); } 88 89 private: 89 90 OwnPtr<GraphicsContext> m_context; -
trunk/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp
r101600 r105314 42 42 SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) 43 43 : CanvasLayerTextureUpdater(painter) 44 , m_layerIsOpaque(false) 44 45 { 45 46 } … … 49 50 } 50 51 51 void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& /* tileSize */, int /* borderTexels */, float contentsScale )52 void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& /* tileSize */, int /* borderTexels */, float contentsScale, IntRect* resultingOpaqueRect) 52 53 { 53 54 SkCanvas* canvas = m_picture.beginRecording(contentRect.width(), contentRect.height()); 54 55 PlatformContextSkia platformContext(canvas); 55 56 platformContext.setDeferred(true); 57 platformContext.setTrackOpaqueRegion(!m_layerIsOpaque); 56 58 GraphicsContext graphicsContext(&platformContext); 57 59 paintContents(graphicsContext, contentRect, contentsScale); 58 60 m_picture.endRecording(); 61 62 if (!m_layerIsOpaque) 63 *resultingOpaqueRect = platformContext.opaqueRegion().asRect(); 59 64 } 60 65 … … 65 70 } 66 71 72 void SkPictureCanvasLayerTextureUpdater::setOpaque(bool opaque) 73 { 74 m_layerIsOpaque = opaque; 75 } 76 67 77 } // namespace WebCore 68 78 #endif // USE(SKIA) -
trunk/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.h
r104522 r105314 52 52 explicit SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); 53 53 54 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale );54 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale, IntRect* resultingOpaqueRect); 55 55 void drawPicture(SkCanvas*); 56 56 57 virtual void setOpaque(bool); 58 57 59 private: 58 SkPicture m_picture; // Recording canvas. 60 // Recording canvas. 61 SkPicture m_picture; 62 // True when it is known that all output pixels will be opaque. 63 bool m_layerIsOpaque; 59 64 }; 60 65 -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
r104780 r105314 413 413 // so we grab a local reference here to hold the updater alive until the paint completes. 414 414 RefPtr<LayerTextureUpdater> protector(textureUpdater()); 415 textureUpdater()->prepareToUpdate(m_paintRect, m_tiler->tileSize(), m_tiler->hasBorderTexels(), contentsScale()); 415 IntRect opaqueRect; // FIXME: unused. remove this and store in the layer to pass to impl for draw culling 416 textureUpdater()->prepareToUpdate(m_paintRect, m_tiler->tileSize(), m_tiler->hasBorderTexels(), contentsScale(), &opaqueRect); 416 417 for (int j = top; j <= bottom; ++j) { 417 418 for (int i = left; i <= right; ++i) { -
trunk/Source/WebKit/chromium/ChangeLog
r105311 r105314 1 2012-01-18 Dana Jansens <danakj@chromium.org> 2 3 [chromium] Enable tracking opaque region in Skia graphics context, return it from LayerTextureUpdater 4 https://bugs.webkit.org/show_bug.cgi?id=76211 5 6 Reviewed by James Robinson. 7 8 * WebKit.gypi: 9 * tests/LayerTextureUpdaterTest.cpp: Added. 10 (WebCore::TestLayerPainterChromium::TestLayerPainterChromium): 11 (WebCore::TestLayerPainterChromium::paint): 12 (WebCore::PaintFillOpaque::operator()): 13 (WebCore::PaintFillAlpha::operator()): 14 (WebCore::TEST): 15 * tests/TiledLayerChromiumTest.cpp: 16 (WTF::FakeLayerTextureUpdater::prepareToUpdate): 17 1 18 2012-01-18 Tim Dresser <tdresser@chromium.org> 2 19 -
trunk/Source/WebKit/chromium/WebKit.gypi
r105051 r105314 94 94 'tests/KURLTest.cpp', 95 95 'tests/LayerChromiumTest.cpp', 96 'tests/LayerTextureUpdaterTest.cpp', 96 97 'tests/PODArenaTest.cpp', 97 98 'tests/PODIntervalTreeTest.cpp', -
trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
r104780 r105314 73 73 virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager* manager) { return adoptPtr(new Texture(ManagedTexture::create(manager))); } 74 74 virtual SampledTexelFormat sampledTexelFormat(GC3Denum) { return SampledTexelFormatRGBA; } 75 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float );75 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect*); 76 76 77 77 private: … … 150 150 } 151 151 152 void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float )152 void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect* resultingOpaqueRect) 153 153 { 154 154 m_prepareCount++; … … 159 159 m_layer = 0; 160 160 } 161 *resultingOpaqueRect = IntRect(); 161 162 } 162 163
Note: See TracChangeset
for help on using the changeset viewer.