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

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

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: 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
Index: content/browser/renderer_host/compositing_iosurface_mac.mm
diff --git a/content/browser/renderer_host/compositing_iosurface_mac.mm b/content/browser/renderer_host/compositing_iosurface_mac.mm
index 8059e11686da59b4cdbccda39010a6a24446091f..1c28289bac2d0f85974204c1ad83ce10ce3dcae4 100644
--- a/content/browser/renderer_host/compositing_iosurface_mac.mm
+++ b/content/browser/renderer_host/compositing_iosurface_mac.mm
@@ -12,6 +12,7 @@
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
#include "content/public/browser/browser_thread.h"
#include "gpu/command_buffer/service/gpu_switches.h"
+#include "ui/gfx/rect.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_switches.h"
@@ -303,7 +304,10 @@ void CompositingIOSurfaceMac::DrawIOSurface(NSView* view, float scale_factor) {
CGLSetCurrentContext(0);
}
-bool CompositingIOSurfaceMac::CopyTo(const gfx::Size& dst_size, void* out) {
+bool CompositingIOSurfaceMac::CopyTo(
+ const gfx::Rect& src_subrect,
+ const gfx::Size& dst_size,
Nico 2012/07/26 23:45:48 Can you call the parameters src_pixel_subrect and
mazda 2012/07/27 00:00:35 Done.
+ void* out) {
if (!MapIOSurfaceToTexture(io_surface_handle_))
return false;
@@ -353,7 +357,9 @@ bool CompositingIOSurfaceMac::CopyTo(const gfx::Size& dst_size, void* out) {
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture_);
SurfaceQuad quad;
- quad.set_size(dst_size, pixel_io_surface_size_);
+ quad.set_rect(0.0f, 0.0f, dst_size.width(), dst_size.height());
+ quad.set_texcoord_rect(src_subrect.x(), src_subrect.y(),
+ src_subrect.right(), src_subrect.bottom());
DrawQuad(quad);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); CHECK_GL_ERROR();

Powered by Google App Engine
This is Rietveld 408576698