Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: content/browser/renderer_host/compositing_iosurface_mac.h

Issue 10835014: Support copying a partial rectangle region from the compositing surface on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/compositing_iosurface_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/compositing_iosurface_mac.h
diff --git a/content/browser/renderer_host/compositing_iosurface_mac.h b/content/browser/renderer_host/compositing_iosurface_mac.h
index 59d6f26c048d179ccdcebb7a3319b9b08adfec1b..24aebd527928dff44c7103b092df5a3b6c31fae5 100644
--- a/content/browser/renderer_host/compositing_iosurface_mac.h
+++ b/content/browser/renderer_host/compositing_iosurface_mac.h
@@ -15,6 +15,10 @@
class IOSurfaceSupport;
+namespace gfx {
+class Rect;
+}
+
namespace content {
// This class manages an OpenGL context and IOSurface for the accelerated
@@ -35,10 +39,14 @@ class CompositingIOSurfaceMac {
void DrawIOSurface(NSView* view, float scale_factor);
// 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|.
+ // into |out|. The copied region is specified with |src_pixel_subrect| and
+ // the data is transformed so that it fits in |dst_pixel_size|.
+ // |src_pixel_subrect| and |dst_pixel_size| are not in DIP but in pixel.
// 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);
+ // |4 * dst_pixel_size.width() * dst_pixel_size.height()| bytes.
+ bool CopyTo(const gfx::Rect& src_pixel_subrect,
+ const gfx::Size& dst_pixel_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.
@@ -65,7 +73,6 @@ class CompositingIOSurfaceMac {
// Vertex structure for use in glDraw calls.
struct SurfaceVertex {
SurfaceVertex() : x_(0.0f), y_(0.0f), tx_(0.0f), ty_(0.0f) { }
- // Currently the texture coords are always the same as vertex coords.
void set(float x, float y, float tx, float ty) {
x_ = x;
y_ = y;
@@ -76,6 +83,10 @@ class CompositingIOSurfaceMac {
x_ = x;
y_ = y;
}
+ void set_texcoord(float tx, float ty) {
+ tx_ = tx;
+ ty_ = ty;
+ }
float x_;
float y_;
float tx_;
@@ -102,6 +113,14 @@ class CompositingIOSurfaceMac {
verts_[2].set_position(x2, y2);
verts_[3].set_position(x2, y1);
}
+ void set_texcoord_rect(float tx1, float ty1, float tx2, float ty2) {
+ // Texture coordinates are flipped vertically so they can be drawn on
+ // a projection with a flipped y-axis (origin is top left).
+ verts_[0].set_texcoord(tx1, ty2);
+ verts_[1].set_texcoord(tx1, ty1);
+ verts_[2].set_texcoord(tx2, ty1);
+ verts_[3].set_texcoord(tx2, ty2);
+ }
SurfaceVertex verts_[4];
};
« no previous file with comments | « no previous file | content/browser/renderer_host/compositing_iosurface_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698