[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
simon.fraser at apple.com
simon.fraser at apple.com
Thu Oct 29 20:52:08 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 2a706d60d61859224156bcf17489b0440a91f445
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 26 16:31:49 2009 +0000
2009-10-26 Simon Fraser <simon.fraser at apple.com>
Reviewed by Sam Weinig.
<rdar://problem/6988966> Hardware layers do not show up in page snapshots
* WebView/WebHTMLViewPrivate.h:
* WebView/WebHTMLView.mm:
(-[WebHTMLView _compositingLayersHostingView]):
Add a private method that returns the NSView used to host compositing layers.
* platform/graphics/mac/Canvas3DLayer.h:
* platform/graphics/mac/Canvas3DLayer.mm:
(-[Canvas3DLayer copyImageSnapshotWithColorSpace:]):
Add a method that gets called when snapshotting Canvas3DLayers for page snapshots,
that allows the layer to return a CGImageRef of its contents.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50067 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 098c345..62915eb 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2009-10-26 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/6988966> Hardware layers do not show up in page snapshots
+
+ Add a method that gets called when snapshotting Canvas3DLayers for page snapshots,
+ that allows the layer to return a CGImageRef of its contents.
+
+ * platform/graphics/mac/Canvas3DLayer.h:
+ * platform/graphics/mac/Canvas3DLayer.mm:
+ (-[Canvas3DLayer copyImageSnapshotWithColorSpace:]):
+
2009-10-26 Yury Semikhatsky <yurys at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/WebCore/platform/graphics/mac/Canvas3DLayer.h b/WebCore/platform/graphics/mac/Canvas3DLayer.h
index 6c65676..122ef39 100644
--- a/WebCore/platform/graphics/mac/Canvas3DLayer.h
+++ b/WebCore/platform/graphics/mac/Canvas3DLayer.h
@@ -41,7 +41,9 @@ namespace WebCore {
GLuint m_texture;
}
--(id)initWithContext:(CGLContextObj)context texture:(GLuint)texture;
+- (id)initWithContext:(CGLContextObj)context texture:(GLuint)texture;
+
+- (CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace;
@end
diff --git a/WebCore/platform/graphics/mac/Canvas3DLayer.mm b/WebCore/platform/graphics/mac/Canvas3DLayer.mm
index f34eba7..517e03f 100644
--- a/WebCore/platform/graphics/mac/Canvas3DLayer.mm
+++ b/WebCore/platform/graphics/mac/Canvas3DLayer.mm
@@ -33,6 +33,8 @@
#import "GraphicsLayer.h"
#import <QuartzCore/QuartzCore.h>
#import <OpenGL/OpenGL.h>
+#import <wtf/RetainPtr.h>
+#include <wtf/FastMalloc.h>
using namespace WebCore;
@@ -107,6 +109,42 @@ using namespace WebCore;
[super drawInCGLContext:glContext pixelFormat:pixelFormat forLayerTime:timeInterval displayTime:timeStamp];
}
+static void freeData(void *, const void *data, size_t /* size */)
+{
+ fastFree(const_cast<void *>(data));
+}
+
+-(CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace
+{
+ CGLSetCurrentContext(m_contextObj);
+
+ RetainPtr<CGColorSpaceRef> imageColorSpace = colorSpace;
+ if (!imageColorSpace)
+ imageColorSpace.adoptCF(CGColorSpaceCreateDeviceRGB());
+
+ CGRect layerBounds = CGRectIntegral([self bounds]);
+
+ size_t width = layerBounds.size.width;
+ size_t height = layerBounds.size.height;
+
+ size_t rowBytes = (width * 4 + 15) & ~15;
+ size_t dataSize = rowBytes * height;
+ void* data = fastMalloc(dataSize);
+ if (!data)
+ return 0;
+
+ glPixelStorei(GL_PACK_ROW_LENGTH, rowBytes / 4);
+ glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
+
+ CGDataProviderRef provider = CGDataProviderCreateWithData(0, data, dataSize, freeData);
+ CGImageRef image = CGImageCreate(width, height, 8, 32, rowBytes, imageColorSpace.get(),
+ kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
+ provider, 0, true,
+ kCGRenderingIntentDefault);
+ CGDataProviderRelease(provider);
+ return image;
+}
+
@end
@implementation Canvas3DLayer(WebLayerAdditions)
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 11d43a7..ef49f18 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,14 @@
+2009-10-26 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ <rdar://problem/6988966> Hardware layers do not show up in page snapshots
+
+ * WebView/WebHTMLViewPrivate.h:
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _compositingLayersHostingView]):
+ Add a private method that returns the NSView used to host compositing layers.
+
2009-10-23 Mark Rowe <mrowe at apple.com>
Fix engineering builds in the mysterious future.
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index 102f630..936b6d7 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -2173,6 +2173,15 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
#endif
}
+- (NSView *)_compositingLayersHostingView
+{
+#if USE(ACCELERATED_COMPOSITING)
+ return _private->layerHostingView;
+#else
+ return 0;
+#endif
+}
+
@end
@implementation NSView (WebHTMLViewFileInternal)
diff --git a/WebKit/mac/WebView/WebHTMLViewPrivate.h b/WebKit/mac/WebView/WebHTMLViewPrivate.h
index bb59a7b..cb121d8 100644
--- a/WebKit/mac/WebView/WebHTMLViewPrivate.h
+++ b/WebKit/mac/WebView/WebHTMLViewPrivate.h
@@ -117,8 +117,8 @@
- (void)_pauseNullEventsForAllNetscapePlugins;
#endif
-// SPI for DumpRenderTree
- (BOOL)_isUsingAcceleratedCompositing;
+- (NSView *)_compositingLayersHostingView;
// SPI for printing (should be converted to API someday). When the WebHTMLView isn't being printed
// directly, this method must be called before paginating, or the computed height might be incorrect.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list