summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/compositing_iosurface_mac.h
diff options
context:
space:
mode:
authormazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 03:58:59 +0000
committermazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 03:58:59 +0000
commita2a1f48277a24594cecd4b90585ec95923101128 (patch)
tree394b797212f48d6ae3c00485be443e48f0463d09 /content/browser/renderer_host/compositing_iosurface_mac.h
parentbd985a221a00d320a4fb585c3a5a920724d79621 (diff)
downloadchromium_src-a2a1f48277a24594cecd4b90585ec95923101128.zip
chromium_src-a2a1f48277a24594cecd4b90585ec95923101128.tar.gz
chromium_src-a2a1f48277a24594cecd4b90585ec95923101128.tar.bz2
Implement RenderWidgetHostViewMac::CopyFromCompositingSurface.
This adds the support of the browser side thumbailing to Mac Chrome. BUG=120001 TEST=Manually tested that thumbnails are properly generated on GPU composited pages with --enable-in-browser-thumbnailing. Review URL: http://codereview.chromium.org/10022007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131710 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/compositing_iosurface_mac.h')
-rw-r--r--content/browser/renderer_host/compositing_iosurface_mac.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/content/browser/renderer_host/compositing_iosurface_mac.h b/content/browser/renderer_host/compositing_iosurface_mac.h
index b81b286..6f0d8da 100644
--- a/content/browser/renderer_host/compositing_iosurface_mac.h
+++ b/content/browser/renderer_host/compositing_iosurface_mac.h
@@ -32,6 +32,12 @@ class CompositingIOSurfaceMac {
// be white.
void DrawIOSurface(NSView* view);
+ // Copy the data of the "live" OpenGL texture referring to this IOSurfaceRef
+ // into |out|. The image data is transformed so that it fits in |dst_size|.
+ // Caller must ensure that |out| is allocated with the size no less than
+ // |4 * dst_size.width() * dst_size.height()| bytes.
+ bool CopyTo(const gfx::Size& dst_size, void* out);
+
// Unref the IOSurface and delete the associated GL texture. If the GPU
// process is no longer referencing it, this will delete the IOSurface.
void UnrefIOSurface();
@@ -66,15 +72,17 @@ class CompositingIOSurfaceMac {
// Counter-clockwise verts starting from upper-left corner (0, 0).
struct SurfaceQuad {
- void set_size(gfx::Size size) {
+ void set_size(gfx::Size vertex_size, gfx::Size texcoord_size) {
// Texture coordinates are flipped vertically so they can be drawn on
// a projection with a flipped y-axis (origin is top left).
- float w = static_cast<float>(size.width());
- float h = static_cast<float>(size.height());
- verts_[0].set(0.0f, 0.0f, 0.0f, h);
- verts_[1].set(0.0f, h, 0.0f, 0.0f);
- verts_[2].set(w, h, w, 0.0f);
- verts_[3].set(w, 0.0f, w, h);
+ float vw = static_cast<float>(vertex_size.width());
+ float vh = static_cast<float>(vertex_size.height());
+ float tw = static_cast<float>(texcoord_size.width());
+ float th = static_cast<float>(texcoord_size.height());
+ verts_[0].set(0.0f, 0.0f, 0.0f, th);
+ verts_[1].set(0.0f, vh, 0.0f, 0.0f);
+ verts_[2].set(vw, vh, tw, 0.0f);
+ verts_[3].set(vw, 0.0f, tw, th);
}
SurfaceVertex verts_[4];
};
@@ -88,6 +96,8 @@ class CompositingIOSurfaceMac {
void UnrefIOSurfaceWithContextCurrent();
+ void DrawQuad(const SurfaceQuad& quad);
+
// Cached pointer to IOSurfaceSupport Singleton.
IOSurfaceSupport* io_surface_support_;