[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
eric at webkit.org
eric at webkit.org
Tue Jan 5 23:55:10 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit c85ce993d033f10ff62eb5b8b4e8b7fd28561ef8
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Dec 19 07:12:47 2009 +0000
2009-12-18 Kenneth Russell <kbr at google.com>
Reviewed by Darin Fisher.
[Chromium] Eliminate redundant data copy in GraphicsContext3D readback
https://bugs.webkit.org/show_bug.cgi?id=32763
Eliminated useless creation of a CGBitmapContext and from there a
CGImage. Now create CGImage directly from data. Also changed
readPixels parameters and CGImage alpha info to try to avoid byte
swapping, and disabled interpolation when drawing the GL content.
Some test cases run twice as fast with these changes, though more
work is needed to achieve desired performance.
No test case; performance optimization only. Ran WebGL demos from
Khronos site to verify changes.
* src/GraphicsContext3D.cpp:
(WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
(WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal):
(WebCore::GraphicsContext3DInternal::reshape):
(WebCore::GraphicsContext3DInternal::beginPaint):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52380 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index efe8fdc..2d3e88e 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,26 @@
+2009-12-18 Kenneth Russell <kbr at google.com>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Eliminate redundant data copy in GraphicsContext3D readback
+ https://bugs.webkit.org/show_bug.cgi?id=32763
+
+ Eliminated useless creation of a CGBitmapContext and from there a
+ CGImage. Now create CGImage directly from data. Also changed
+ readPixels parameters and CGImage alpha info to try to avoid byte
+ swapping, and disabled interpolation when drawing the GL content.
+ Some test cases run twice as fast with these changes, though more
+ work is needed to achieve desired performance.
+
+ No test case; performance optimization only. Ran WebGL demos from
+ Khronos site to verify changes.
+
+ * src/GraphicsContext3D.cpp:
+ (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
+ (WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal):
+ (WebCore::GraphicsContext3DInternal::reshape):
+ (WebCore::GraphicsContext3DInternal::beginPaint):
+
2009-12-18 Peter Kasting <pkasting at google.com>
Reviewed by Adam Barth.
diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp
index dbaabe5..56b8333 100644
--- a/WebKit/chromium/src/GraphicsContext3D.cpp
+++ b/WebKit/chromium/src/GraphicsContext3D.cpp
@@ -189,7 +189,6 @@ private:
CGLPBufferObj m_pbuffer;
CGLContextObj m_contextObj;
unsigned char* m_renderOutput;
- CGContextRef m_cgContext;
#elif PLATFORM(LINUX)
Display* m_display;
GLXContext m_contextObj;
@@ -255,7 +254,6 @@ GraphicsContext3DInternal::GraphicsContext3DInternal()
, m_pbuffer(0)
, m_contextObj(0)
, m_renderOutput(0)
- , m_cgContext(0)
#elif PLATFORM(LINUX)
, m_display(0)
, m_contextObj(0)
@@ -510,8 +508,6 @@ GraphicsContext3DInternal::~GraphicsContext3DInternal()
CGLSetCurrentContext(0);
CGLDestroyContext(m_contextObj);
CGLDestroyPBuffer(m_pbuffer);
- if (m_cgContext)
- CGContextRelease(m_cgContext);
if (m_renderOutput)
delete[] m_renderOutput;
#elif PLATFORM(LINUX)
@@ -630,20 +626,12 @@ void GraphicsContext3DInternal::reshape(int width, int height)
#if PLATFORM(CG)
// Need to reallocate the client-side backing store.
// FIXME: make this more efficient.
- if (m_cgContext) {
- CGContextRelease(m_cgContext);
- m_cgContext = 0;
- }
if (m_renderOutput) {
delete[] m_renderOutput;
m_renderOutput = 0;
}
int rowBytes = width * 4;
m_renderOutput = new unsigned char[height * rowBytes];
- CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
- m_cgContext = CGBitmapContextCreate(m_renderOutput, width, height, 8, rowBytes,
- colorSpace, kCGImageAlphaPremultipliedLast);
- CGColorSpaceRelease(colorSpace);
#endif // PLATFORM(CG)
}
@@ -731,10 +719,8 @@ void GraphicsContext3DInternal::beginPaint(WebGLRenderingContext* context)
glReadPixels(0, 0, m_cachedWidth, m_cachedHeight, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
#elif PLATFORM(CG)
if (m_renderOutput) {
- ASSERT(CGBitmapContextGetWidth(m_cgContext) == m_cachedWidth);
- ASSERT(CGBitmapContextGetHeight(m_cgContext) == m_cachedHeight);
pixels = m_renderOutput;
- glReadPixels(0, 0, m_cachedWidth, m_cachedHeight, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+ glReadPixels(0, 0, m_cachedWidth, m_cachedHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pixels);
}
#else
#error Must port to your platform
@@ -758,7 +744,20 @@ void GraphicsContext3DInternal::beginPaint(WebGLRenderingContext* context)
}
#elif PLATFORM(CG)
if (m_renderOutput) {
- CGImageRef cgImage = CGBitmapContextCreateImage(m_cgContext);
+ int rowBytes = m_cachedWidth * 4;
+ CGDataProviderRef dataProvider = CGDataProviderCreateWithData(0, m_renderOutput, rowBytes * m_cachedHeight, 0);
+ CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+ CGImageRef cgImage = CGImageCreate(m_cachedWidth,
+ m_cachedHeight,
+ 8,
+ 32,
+ rowBytes,
+ colorSpace,
+ kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
+ dataProvider,
+ 0,
+ false,
+ kCGRenderingIntentDefault);
// CSS styling may cause the canvas's content to be resized on
// the page. Go back to the Canvas to figure out the correct
// width and height to draw.
@@ -769,9 +768,13 @@ void GraphicsContext3DInternal::beginPaint(WebGLRenderingContext* context)
// rendering results.
CGContextSetBlendMode(imageBuffer->context()->platformContext(),
kCGBlendModeCopy);
+ CGContextSetInterpolationQuality(imageBuffer->context()->platformContext(),
+ kCGInterpolationNone);
CGContextDrawImage(imageBuffer->context()->platformContext(),
rect, cgImage);
CGImageRelease(cgImage);
+ CGColorSpaceRelease(colorSpace);
+ CGDataProviderRelease(dataProvider);
}
#else
#error Must port to your platform
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list