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

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

Issue 14846015: Update IOSurface scale factor before compare (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comment Created 7 years, 7 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 510e479d36fb5d1a09e82422436d8ea0e74951dc..978bcc5ed231ef66b9dd8019ce0df7dc1cbff167 100644
--- a/content/browser/renderer_host/compositing_iosurface_mac.mm
+++ b/content/browser/renderer_host/compositing_iosurface_mac.mm
@@ -324,6 +324,13 @@ void CompositingIOSurfaceMac::SwitchToContextOnNewWindow(
context_ = new_context;
}
+void CompositingIOSurfaceMac::SetDeviceScaleFactor(float scale_factor) {
+ // TODO: After a resolution change, the DPI-ness of the view and the
+ // IOSurface might not be in sync.
+ io_surface_size_ = gfx::ToFlooredSize(
+ gfx::ScaleSize(pixel_io_surface_size_, 1.0 / scale_factor));
+}
+
bool CompositingIOSurfaceMac::is_vsync_disabled() const {
return context_->is_vsync_disabled();
}
@@ -384,11 +391,10 @@ void CompositingIOSurfaceMac::DrawIOSurface(
gfx::ScaleSize(window_size, scale_factor));
glViewport(0, 0, pixel_window_size.width(), pixel_window_size.height());
- // TODO: After a resolution change, the DPI-ness of the view and the
- // IOSurface might not be in sync.
- io_surface_size_ = gfx::ToFlooredSize(
- gfx::ScaleSize(pixel_io_surface_size_, 1.0 / scale_factor));
- quad_.set_size(io_surface_size_, pixel_io_surface_size_);
+ SetDeviceScaleFactor(scale_factor);
+
+ SurfaceQuad quad;
+ quad.set_size(io_surface_size_, pixel_io_surface_size_);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -408,7 +414,7 @@ void CompositingIOSurfaceMac::DrawIOSurface(
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture_);
- DrawQuad(quad_);
+ DrawQuad(quad);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); CHECK_GL_ERROR();

Powered by Google App Engine
This is Rietveld 408576698