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

Side by Side Diff: content/browser/renderer_host/compositing_iosurface_mac.mm

Issue 11377068: ui: Make gfx::Size::Scale() mutate the class. Add gfx::ScaleSize() similar to Rect/Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseTOGO Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/compositing_iosurface_mac.h" 5 #include "content/browser/renderer_host/compositing_iosurface_mac.h"
6 6
7 #include <OpenGL/OpenGL.h> 7 #include <OpenGL/OpenGL.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 CGLSetCurrentContext(cglContext_); 322 CGLSetCurrentContext(cglContext_);
323 323
324 bool has_io_surface = MapIOSurfaceToTexture(io_surface_handle_); 324 bool has_io_surface = MapIOSurfaceToTexture(io_surface_handle_);
325 325
326 TRACE_EVENT1("browser", "CompositingIOSurfaceMac::DrawIOSurface", 326 TRACE_EVENT1("browser", "CompositingIOSurfaceMac::DrawIOSurface",
327 "has_io_surface", has_io_surface); 327 "has_io_surface", has_io_surface);
328 328
329 [glContext_ setView:view]; 329 [glContext_ setView:view];
330 gfx::Size window_size(NSSizeToCGSize([view frame].size)); 330 gfx::Size window_size(NSSizeToCGSize([view frame].size));
331 gfx::Size pixel_window_size = gfx::ToFlooredSize( 331 gfx::Size pixel_window_size = gfx::ToFlooredSize(
332 window_size.Scale(scale_factor)); 332 gfx::ScaleSize(window_size, scale_factor));
333 glViewport(0, 0, pixel_window_size.width(), pixel_window_size.height()); 333 glViewport(0, 0, pixel_window_size.width(), pixel_window_size.height());
334 334
335 // TODO: After a resolution change, the DPI-ness of the view and the 335 // TODO: After a resolution change, the DPI-ness of the view and the
336 // IOSurface might not be in sync. 336 // IOSurface might not be in sync.
337 io_surface_size_ = gfx::ToFlooredSize( 337 io_surface_size_ = gfx::ToFlooredSize(
338 pixel_io_surface_size_.Scale(1.0 / scale_factor)); 338 gfx::ScaleSize(pixel_io_surface_size_, 1.0 / scale_factor));
339 quad_.set_size(io_surface_size_, pixel_io_surface_size_); 339 quad_.set_size(io_surface_size_, pixel_io_surface_size_);
340 340
341 glMatrixMode(GL_PROJECTION); 341 glMatrixMode(GL_PROJECTION);
342 glLoadIdentity(); 342 glLoadIdentity();
343 343
344 // Note that the projection keeps things in view units, so the use of 344 // Note that the projection keeps things in view units, so the use of
345 // window_size / io_surface_size_ (as opposed to the pixel_ variants) below is 345 // window_size / io_surface_size_ (as opposed to the pixel_ variants) below is
346 // correct. 346 // correct.
347 glOrtho(0, window_size.width(), window_size.height(), 0, -1, 1); 347 glOrtho(0, window_size.width(), window_size.height(), 0, -1, 1);
348 glMatrixMode(GL_MODELVIEW); 348 glMatrixMode(GL_MODELVIEW);
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 glDeleteFramebuffersEXT(1, &copy_context_.frame_buffer); CHECK_GL_ERROR(); 838 glDeleteFramebuffersEXT(1, &copy_context_.frame_buffer); CHECK_GL_ERROR();
839 glDeleteTextures(1, &copy_context_.frame_buffer_texture); CHECK_GL_ERROR(); 839 glDeleteTextures(1, &copy_context_.frame_buffer_texture); CHECK_GL_ERROR();
840 glDeleteBuffers(1, &copy_context_.pixel_buffer); CHECK_GL_ERROR(); 840 glDeleteBuffers(1, &copy_context_.pixel_buffer); CHECK_GL_ERROR();
841 if (copy_context_.use_fence) { 841 if (copy_context_.use_fence) {
842 glDeleteFencesAPPLE(1, &copy_context_.fence); CHECK_GL_ERROR(); 842 glDeleteFencesAPPLE(1, &copy_context_.fence); CHECK_GL_ERROR();
843 } 843 }
844 copy_context_.Reset(); 844 copy_context_.Reset();
845 } 845 }
846 846
847 } // namespace content 847 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/backing_store_mac.mm ('k') | content/browser/renderer_host/dip_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698