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

Unified Diff: ui/accelerated_widget_mac/io_surface_ns_gl_surface.mm

Issue 1161853006: Mac: Add partial swap support to NSOpenGLContext path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 5 years, 6 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: ui/accelerated_widget_mac/io_surface_ns_gl_surface.mm
diff --git a/ui/accelerated_widget_mac/io_surface_ns_gl_surface.mm b/ui/accelerated_widget_mac/io_surface_ns_gl_surface.mm
index ed1050f4bfe2a4f36a0d69f0cc87c7ca2b143ed4..68d00bdf017b86d5d2db81a3f8f313c653b8d296 100644
--- a/ui/accelerated_widget_mac/io_surface_ns_gl_surface.mm
+++ b/ui/accelerated_widget_mac/io_surface_ns_gl_surface.mm
@@ -65,7 +65,8 @@ IOSurfaceNSGLSurface::~IOSurfaceNSGLSurface() {
bool IOSurfaceNSGLSurface::GotFrame(IOSurfaceID io_surface_id,
gfx::Size frame_pixel_size,
- float frame_scale_factor) {
+ float frame_scale_factor,
+ gfx::Rect pixel_damage_rect) {
// The OpenGL framebuffer's scale factor and pixel size are updated to match
// the CALayer's contentsScale and bounds at setView. The pixel size is the
// stored in the GL_VIEWPORT state of the context.
@@ -82,18 +83,26 @@ bool IOSurfaceNSGLSurface::GotFrame(IOSurfaceID io_surface_id,
// If the OpenGL framebuffer does not match the frame in scale factor or
// pixel size, then re-latch them. Note that they will latch to the layer's
// bounds, which will not necessarily match the frame's pixel size.
+ bool full_damage = false;
if (frame_pixel_size != contents_pixel_size ||
frame_scale_factor != contents_scale_factor) {
ScopedCAActionDisabler disabler;
[ns_gl_context_ clearDrawable];
[[view_ layer] setContentsScale:frame_scale_factor];
[ns_gl_context_ setView:view_];
+
+ // The front buffer may have been destroyed at re-creation, so re-draw
+ // everything.
+ full_damage = true;
}
bool result = true;
[ns_gl_context_ makeCurrentContext];
result &= iosurface_->SetIOSurface(io_surface_id, frame_pixel_size);
- result &= iosurface_->DrawIOSurface();
+ if (full_damage)
+ result &= iosurface_->DrawIOSurface();
+ else
+ result &= iosurface_->DrawIOSurfaceWithDamageRect(pixel_damage_rect);
glFlush();
[NSOpenGLContext clearCurrentContext];
return result;
« no previous file with comments | « ui/accelerated_widget_mac/io_surface_ns_gl_surface.h ('k') | ui/accelerated_widget_mac/io_surface_texture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698