WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
shared-memory-painting.diff (text/plain), 5.81 KB, created by
David Reveman
on 2011-11-18 17:04:20 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
David Reveman
Created:
2011-11-18 17:04:20 PST
Size:
5.81 KB
patch
obsolete
>diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp >index af7a09d..9b14f5c 100644 >--- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp >+++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp >@@ -31,6 +31,7 @@ > > #include "BitmapSkPictureCanvasLayerTextureUpdater.h" > >+#include "Extensions3DChromium.h" > #include "LayerPainterChromium.h" > #include "SkCanvas.h" > #include "skia/ext/platform_canvas.h" >@@ -39,20 +40,42 @@ namespace WebCore { > > BitmapSkPictureCanvasLayerTextureUpdater::Texture::Texture(BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater, PassOwnPtr<ManagedTexture> texture) > : CanvasLayerTextureUpdater::Texture(texture) >+ , m_mappedBuffer(0) > , m_textureUpdater(textureUpdater) > { > } > >-void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(GraphicsContext3D*, TextureAllocator*, const IntRect& sourceRect, const IntRect& /* destRect */) >+bool BitmapSkPictureCanvasLayerTextureUpdater::Texture::needPrepareRect() > { >- size_t bufferSize = sourceRect.width() * sourceRect.height() * 4; >- m_pixelData = adoptArrayPtr(new uint8_t[bufferSize]); >+ if (textureUpdater()->useMapTexSubImage()) >+ return true; >+ >+ return !texture()->textureId(); >+} >+ >+void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) >+{ >+ ASSERT(!m_mappedBuffer); >+ ASSERT(!m_pixelData.get()); >+ >+ texture()->bindTexture(context, allocator); >+ >+ if (textureUpdater()->useMapTexSubImage()) { >+ Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions()); >+ m_mappedBuffer = static_cast<uint8_t*>(extensions->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), texture()->format(), GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); >+ } > } > > void BitmapSkPictureCanvasLayerTextureUpdater::Texture::paintContentsRect(const IntRect& sourceRect) > { >- ASSERT(m_pixelData.get()); >- OwnPtr<SkCanvas> canvas = adoptPtr(new skia::PlatformCanvas(sourceRect.width(), sourceRect.height(), false, m_pixelData.get())); >+ uint8_t* pixels = m_mappedBuffer; >+ if (!pixels) { >+ size_t bufferSize = sourceRect.width() * sourceRect.height() * 4; >+ m_pixelData = adoptArrayPtr(new uint8_t[bufferSize]); >+ pixels = m_pixelData.get(); >+ } >+ >+ OwnPtr<SkCanvas> canvas = adoptPtr(new skia::PlatformCanvas(sourceRect.width(), sourceRect.height(), false, pixels)); > textureUpdater()->paintContentsRect(canvas.get(), sourceRect); > } > >@@ -60,8 +83,14 @@ void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(GraphicsConte > { > ASSERT(texture()->textureId()); > context->bindTexture(GraphicsContext3D::TEXTURE_2D, texture()->textureId()); >- textureUpdater()->updateTextureRect(context, texture()->format(), destRect, m_pixelData.get()); >- m_pixelData.clear(); >+ if (m_mappedBuffer) { >+ Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions()); >+ extensions->unmapTexSubImage2DCHROMIUM(m_mappedBuffer); >+ m_mappedBuffer = NULL; >+ } else { >+ textureUpdater()->updateTextureRect(context, texture()->format(), destRect, m_pixelData.get()); >+ m_pixelData.clear(); >+ } > } > > PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) >@@ -71,6 +100,7 @@ PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerT > > BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) > : SkPictureCanvasLayerTextureUpdater(painter) >+ , m_useMapTexSubImage(useMapTexSubImage) > , m_texSubImage(useMapTexSubImage) > { > } >diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h >index fe6d348..51c6f1f 100644 >--- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h >+++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h >@@ -42,6 +42,7 @@ public: > public: > Texture(BitmapSkPictureCanvasLayerTextureUpdater*, PassOwnPtr<ManagedTexture>); > >+ virtual bool needPrepareRect(); > virtual void prepareRect(GraphicsContext3D*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect); > virtual void paintContentsRect(const IntRect& sourceRect); > virtual void updateRect(GraphicsContext3D*, const IntRect& sourceRect, const IntRect& destRect); >@@ -49,6 +50,7 @@ public: > private: > BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } > >+ uint8_t* m_mappedBuffer; > OwnArrayPtr<uint8_t> m_pixelData; > BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater; > }; >@@ -62,10 +64,12 @@ public: > virtual void paintContents(const IntRect& contentRect, const IntSize& tileSize, int borderTexels); > void paintContentsRect(SkCanvas*, const IntRect& sourceRect); > void updateTextureRect(GraphicsContext3D*, GC3Denum format, const IntRect& destRect, const uint8_t* pixels); >+ bool useMapTexSubImage() { return m_useMapTexSubImage; } > > private: > explicit BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); > >+ bool m_useMapTexSubImage; > LayerTextureSubImage m_texSubImage; > }; > } // namespace WebCore
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 72191
:
114788
|
115222
|
115896
|
115911
|
116008
|
117654
|
118717
|
127419
|
127420
|
128291
|
128292
|
129061
|
129062
|
129496
|
129497
|
132906
|
132907
|
135196
|
135198
|
135345
|
135346
|
143867