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
0001-Chromium-Add-support-for-painting-directly-to-shared.patch (text/plain), 5.83 KB, created by
David Reveman
on 2011-11-18 15:53:16 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
David Reveman
Created:
2011-11-18 15:53:16 PST
Size:
5.83 KB
patch
obsolete
>From 2856c73b24d703edc0692f447bd04aac05169470 Mon Sep 17 00:00:00 2001 >From: David Reveman <reveman@chromium.org> >Date: Mon, 14 Nov 2011 21:33:45 -0800 >Subject: [PATCH] [Chromium] Add support for painting directly to shared memory. > https://bugs.webkit.org/show_bug.cgi?id=72191 > >Source/WebCore: > >Map shared memory buffers prior to painting tile-sized chunks using >SkPicture. Allows us to paint directly to shared memory instead >of temporary buffers. > >No new tests. Covered by existing tests. >--- > .../BitmapSkPictureCanvasLayerTextureUpdater.cpp | 35 ++++++++++++++++---- > .../BitmapSkPictureCanvasLayerTextureUpdater.h | 3 ++ > 2 files changed, 31 insertions(+), 7 deletions(-) > >diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp >index af7a09d..91f46db 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,33 @@ 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 */) >+void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) > { >- size_t bufferSize = sourceRect.width() * sourceRect.height() * 4; >- m_pixelData = adoptArrayPtr(new uint8_t[bufferSize]); >+ ASSERT(!m_mappedBuffer); >+ ASSERT(!m_pixelData.get()); >+ >+ 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)); >+ } >+ >+ if (!m_mappedBuffer) { >+ size_t bufferSize = sourceRect.width() * sourceRect.height() * 4; >+ m_pixelData = adoptArrayPtr(new uint8_t[bufferSize]); >+ } > } > > 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 ? m_mappedBuffer : m_pixelData.get(); >+ ASSERT(pixels); >+ >+ OwnPtr<SkCanvas> canvas = adoptPtr(new skia::PlatformCanvas(sourceRect.width(), sourceRect.height(), false, pixels)); > textureUpdater()->paintContentsRect(canvas.get(), sourceRect); > } > >@@ -60,8 +74,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 +91,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..95a3791 100644 >--- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h >+++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h >@@ -49,6 +49,7 @@ public: > private: > BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } > >+ uint8_t* m_mappedBuffer; > OwnArrayPtr<uint8_t> m_pixelData; > BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater; > }; >@@ -62,10 +63,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 >-- >1.7.3.1 >
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