[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 13:23:56 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit dc09c82a0bf830c408ad7aa70d7ac2a8c006ff4f
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Sep 14 05:26:24 2010 +0000
2010-09-13 W. James MacLean <wjmaclean at google.com>
Reviewed by Darin Fisher.
[chromium] Thumbnails not generated for GPU Rendered Pages
https://bugs.webkit.org/show_bug.cgi?id=44127
Replicates existing functionality, use existing tests.
Adds pixel-readback for GPU composited pages to allow for thumbnailing,
printing and other services to work with GPU rendered pages.
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::getFramebufferPixels):
* platform/graphics/chromium/LayerRendererChromium.h:
(WebCore::LayerRendererChromium::rootLayerTextureSize):
2010-09-13 W. James MacLean <wjmaclean at google.com>
Reviewed by Darin Fisher.
[chromium] Thumbnails not generated for GPU Rendered Pages
https://bugs.webkit.org/show_bug.cgi?id=44127
Modified WebViewImpl::paint() to detect non-null canvas pointers when
accelerated compositing is active, and instead fills the pixel buffer
from the GPU framebuffer. Includes re-scaling support when provided
canvas does not match size of current render layer. Limits pixel
readback to rect passed to paint(), clipped by size of rootLayerTexture.
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::doPixelReadbackToCanvas):
(WebKit::WebViewImpl::paint):
* src/WebViewImpl.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67445 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ed6d451..48afca0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-09-13 W. James MacLean <wjmaclean at google.com>
+
+ Reviewed by Darin Fisher.
+
+ [chromium] Thumbnails not generated for GPU Rendered Pages
+ https://bugs.webkit.org/show_bug.cgi?id=44127
+
+ Replicates existing functionality, use existing tests.
+ Adds pixel-readback for GPU composited pages to allow for thumbnailing,
+ printing and other services to work with GPU rendered pages.
+
+ * platform/graphics/chromium/LayerRendererChromium.cpp:
+ (WebCore::LayerRendererChromium::getFramebufferPixels):
+ * platform/graphics/chromium/LayerRendererChromium.h:
+ (WebCore::LayerRendererChromium::rootLayerTextureSize):
+
2010-09-13 Kinuko Yasuda <kinuko at chromium.org>
Unreviewed, build fix for Gtk.
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index 8960841..51c0e49 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -356,6 +356,20 @@ void LayerRendererChromium::present()
m_needsDisplay = false;
}
+void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& rect)
+{
+ ASSERT(rect.right() <= rootLayerTextureSize().width()
+ && rect.bottom() <= rootLayerTextureSize().height());
+
+ if (!pixels)
+ return;
+
+ makeContextCurrent();
+
+ GLC(glReadPixels(rect.x(), rect.y(), rect.width(), rect.height(),
+ GL_RGBA, GL_UNSIGNED_BYTE, pixels));
+}
+
// FIXME: This method should eventually be replaced by a proper texture manager.
unsigned LayerRendererChromium::createLayerTexture()
{
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
index 274815f..b4574b2 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
@@ -98,6 +98,9 @@ public:
const ContentLayerChromium::SharedValues* contentLayerSharedValues() const { return m_contentLayerSharedValues.get(); }
const CanvasLayerChromium::SharedValues* canvasLayerSharedValues() const { return m_canvasLayerSharedValues.get(); }
+ IntSize rootLayerTextureSize() const { return IntSize(m_rootLayerTextureWidth, m_rootLayerTextureHeight); }
+ void getFramebufferPixels(void *pixels, const IntRect& rect);
+
private:
void updateLayersRecursive(LayerChromium* layer, const TransformationMatrix& parentMatrix, float opacity);
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 9801a10..f11256b 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,21 @@
+2010-09-13 W. James MacLean <wjmaclean at google.com>
+
+ Reviewed by Darin Fisher.
+
+ [chromium] Thumbnails not generated for GPU Rendered Pages
+ https://bugs.webkit.org/show_bug.cgi?id=44127
+
+ Modified WebViewImpl::paint() to detect non-null canvas pointers when
+ accelerated compositing is active, and instead fills the pixel buffer
+ from the GPU framebuffer. Includes re-scaling support when provided
+ canvas does not match size of current render layer. Limits pixel
+ readback to rect passed to paint(), clipped by size of rootLayerTexture.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::doPixelReadbackToCanvas):
+ (WebKit::WebViewImpl::paint):
+ * src/WebViewImpl.h:
+
2010-09-13 James Robinson <jamesr at chromium.org>
Reviewed by Dimitri Glazkov.
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index 213cc12..2bb763e 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -34,6 +34,7 @@
#include "AutoFillPopupMenuClient.h"
#include "AXObjectCache.h"
#include "Chrome.h"
+#include "ColorSpace.h"
#include "CompositionUnderlineVectorBuilder.h"
#include "ContextMenu.h"
#include "ContextMenuController.h"
@@ -64,8 +65,9 @@
#include "HitTestResult.h"
#include "HTMLNames.h"
#include "Image.h"
+#include "ImageBuffer.h"
+#include "ImageData.h"
#include "InspectorController.h"
-#include "IntRect.h"
#include "KeyboardCodes.h"
#include "KeyboardEvent.h"
#include "MIMETypeRegistry.h"
@@ -115,7 +117,11 @@
#include "WebString.h"
#include "WebVector.h"
#include "WebViewClient.h"
-#include "wtf/OwnPtr.h"
+#include <wtf/RefPtr.h>
+
+#if PLATFORM(CG)
+#include <CoreGraphics/CGContext.h>
+#endif
#if OS(WINDOWS)
#include "RenderThemeChromiumWin.h"
@@ -950,14 +956,57 @@ void WebViewImpl::layout()
}
}
+#if USE(ACCELERATED_COMPOSITING)
+void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect)
+{
+ ASSERT(rect.right() <= m_layerRenderer->rootLayerTextureSize().width()
+ && rect.bottom() <= m_layerRenderer->rootLayerTextureSize().height());
+
+#if PLATFORM(SKIA)
+ PlatformContextSkia context(canvas);
+
+ // PlatformGraphicsContext is actually a pointer to PlatformContextSkia
+ GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context));
+ int bitmapHeight = canvas->getDevice()->accessBitmap(false).height();
+#elif PLATFORM(CG)
+ GraphicsContext gc(canvas);
+ int bitmapHeight = CGBitmapContextGetHeight(reinterpret_cast<CGContextRef>(canvas));
+#else
+ notImplemented();
+#endif
+ // Compute rect to sample from inverted GPU buffer.
+ IntRect invertRect(rect.x(), bitmapHeight - rect.bottom(), rect.width(), rect.height());
+
+ OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(rect.size()));
+ RefPtr<ImageData> imageData(ImageData::create(rect.width(), rect.height()));
+ if (imageBuffer.get() && imageData.get()) {
+ m_layerRenderer->getFramebufferPixels(imageData->data()->data()->data(), invertRect);
+ imageBuffer->putPremultipliedImageData(imageData.get(), IntRect(IntPoint(), rect.size()), IntPoint());
+ gc.save();
+ gc.translate(FloatSize(0.0f, bitmapHeight));
+ gc.scale(FloatSize(1.0f, -1.0f));
+ // Use invertRect in next line, so that transform above inverts it back to
+ // desired destination rect.
+ gc.drawImageBuffer(imageBuffer.get(), DeviceColorSpace, invertRect.location());
+ gc.restore();
+ }
+}
+#endif
+
void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
{
if (isAcceleratedCompositingActive()) {
#if USE(ACCELERATED_COMPOSITING)
doComposite();
- // Readback into the canvas
- // FIXME Insert wjmaclean's readback code here for webkit bug 44127
+ // If a canvas was passed in, we use it to grab a copy of the
+ // freshly-rendered pixels.
+ if (canvas) {
+ // Clip rect to the confines of the rootLayerTexture.
+ IntRect resizeRect(rect);
+ resizeRect.intersect(IntRect(IntPoint(), m_layerRenderer->rootLayerTextureSize()));
+ doPixelReadbackToCanvas(canvas, resizeRect);
+ }
// Temporarily present so the downstream Chromium renderwidget still renders.
// FIXME: remove this call once the changes to Chromium's renderwidget have landed.
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index c2ef313..f2530af 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -46,6 +46,7 @@
#include "EditorClientImpl.h"
#include "GraphicsLayer.h"
#include "InspectorClientImpl.h"
+#include "IntRect.h"
#include "LayerRendererChromium.h"
#include "NotificationPresenterImpl.h"
#include "SpeechInputClientImpl.h"
@@ -395,6 +396,7 @@ private:
void setIsAcceleratedCompositingActive(bool);
void updateRootLayerContents(const WebCore::IntRect&);
void doComposite();
+ void doPixelReadbackToCanvas(WebCanvas*, const WebCore::IntRect&);
#endif
WebViewClient* m_client;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list