Modified: trunk/Source/WebCore/ChangeLog (128268 => 128269)
--- trunk/Source/WebCore/ChangeLog 2012-09-12 06:46:24 UTC (rev 128268)
+++ trunk/Source/WebCore/ChangeLog 2012-09-12 07:02:02 UTC (rev 128269)
@@ -1,3 +1,22 @@
+2012-09-12 Alexandre Elias <ael...@chromium.org>
+
+ [chromium] Flip Y and swizzle inside compositeAndReadback implementation
+ https://bugs.webkit.org/show_bug.cgi?id=96458
+
+ Reviewed by James Robinson.
+
+ Currently, compositeAndReadback API assumes a GL-style texture
+ and is converted to the normal software format in WebViewImpl.
+ For the software implementation, this API would result in two
+ redundant conversions. This patch makes the conversion inside
+ CCRendererGL instead. I rolled my own for loop as I didn't find the
+ appropriate function within raw Skia.
+
+ No new tests (covered by existing layout tests).
+
+ * platform/graphics/chromium/cc/CCRendererGL.cpp:
+ (WebCore::CCRendererGL::getFramebufferPixels):
+
2012-09-11 Ryuan Choi <ryuan.c...@samsung.com>
[CMAKE] Supply feature defines to CodeGeneratorTestRunner.
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.cpp (128268 => 128269)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.cpp 2012-09-12 06:46:24 UTC (rev 128268)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRendererGL.cpp 2012-09-12 07:02:02 UTC (rev 128269)
@@ -1160,7 +1160,7 @@
GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
// Copy the contents of the current (IOSurface-backed) framebuffer into a temporary texture.
- GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, 0, 0, rect.maxX(), rect.maxY(), 0));
+ GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, 0, 0, viewportSize().width(), viewportSize().height(), 0));
temporaryFBO = m_context->createFramebuffer();
// Attach this texture to an FBO, and perform the readback from that FBO.
GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, temporaryFBO));
@@ -1169,9 +1169,26 @@
ASSERT(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE);
}
- GLC(m_context, m_context->readPixels(rect.x(), rect.y(), rect.width(), rect.height(),
- GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels));
+ OwnPtr<uint8_t> srcPixels = adoptPtr(new uint8_t[rect.width() * rect.height() * 4]);
+ GLC(m_context, m_context->readPixels(rect.x(), viewportSize().height() - rect.maxY(), rect.width(), rect.height(),
+ GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, srcPixels.get()));
+ uint8_t* destPixels = static_cast<uint8_t*>(pixels);
+ size_t rowBytes = rect.width() * 4;
+ int numRows = rect.height();
+ size_t totalBytes = numRows * rowBytes;
+ for (size_t destY = 0; destY < totalBytes; destY += rowBytes) {
+ // Flip Y axis.
+ size_t srcY = totalBytes - destY - rowBytes;
+ // Swizzle BGRA -> RGBA.
+ for (size_t x = 0; x < rowBytes; x += 4) {
+ destPixels[destY + (x+0)] = srcPixels.get()[srcY + (x+2)];
+ destPixels[destY + (x+1)] = srcPixels.get()[srcY + (x+1)];
+ destPixels[destY + (x+2)] = srcPixels.get()[srcY + (x+0)];
+ destPixels[destY + (x+3)] = srcPixels.get()[srcY + (x+3)];
+ }
+ }
+
if (doWorkaround) {
// Clean up.
GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
Modified: trunk/Source/WebKit/chromium/ChangeLog (128268 => 128269)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-09-12 06:46:24 UTC (rev 128268)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-09-12 07:02:02 UTC (rev 128269)
@@ -1,3 +1,22 @@
+2012-09-12 Alexandre Elias <ael...@chromium.org>
+
+ [chromium] Flip Y and swizzle inside compositeAndReadback implementation
+ https://bugs.webkit.org/show_bug.cgi?id=96458
+
+ Reviewed by James Robinson.
+
+ Currently, compositeAndReadback API assumes a GL-style texture
+ and is converted to the normal software format in WebViewImpl.
+ For the software implementation, this API would result in two
+ redundant conversions. This patch makes the conversion inside
+ CCRendererGL instead. I rolled my own for loop as I didn't find the
+ appropriate function within raw Skia.
+
+ No new tests (covered by existing layout tests).
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::doPixelReadbackToCanvas):
+
2012-09-11 Taiju Tsuiki <t...@chromium.org>
WebFrameImpl::client() needs NULL check in WebWorkerClientImpl::openFileSystem
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (128268 => 128269)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-09-12 06:46:24 UTC (rev 128268)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-09-12 07:02:02 UTC (rev 128269)
@@ -1741,28 +1741,11 @@
{
ASSERT(m_layerTreeView);
- PlatformContextSkia context(canvas);
-
- // PlatformGraphicsContext is actually a pointer to PlatformContextSkia
- GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context));
- int bitmapHeight = canvas->getDevice()->accessBitmap(false).height();
-
- // Compute rect to sample from inverted GPU buffer.
- IntRect invertRect(rect.x(), bitmapHeight - rect.maxY(), rect.width(), rect.height());
-
- OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(rect.size()));
- RefPtr<Uint8ClampedArray> pixelArray(Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4));
- if (imageBuffer && pixelArray) {
- m_layerTreeView->compositeAndReadback(pixelArray->data(), invertRect);
- imageBuffer->putByteArray(Premultiplied, pixelArray.get(), rect.size(), IntRect(IntPoint(), rect.size()), IntPoint());
- gc.save();
- gc.translate(IntSize(0, 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(), ColorSpaceDeviceRGB, invertRect.location());
- gc.restore();
- }
+ SkBitmap target;
+ target.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height(), rect.width() * 4);
+ target.allocPixels();
+ m_layerTreeView->compositeAndReadback(target.getPixels(), rect);
+ canvas->writePixels(target, rect.x(), rect.y());
}
#endif