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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_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/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include <QuartzCore/QuartzCore.h> 7 #include <QuartzCore/QuartzCore.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 const gfx::Rect& src_subrect, 851 const gfx::Rect& src_subrect,
852 const gfx::Size& dst_size, 852 const gfx::Size& dst_size,
853 const base::Callback<void(bool)>& callback, 853 const base::Callback<void(bool)>& callback,
854 skia::PlatformBitmap* output) { 854 skia::PlatformBitmap* output) {
855 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); 855 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
856 if (!compositing_iosurface_.get() || 856 if (!compositing_iosurface_.get() ||
857 !compositing_iosurface_->HasIOSurface()) 857 !compositing_iosurface_->HasIOSurface())
858 return; 858 return;
859 859
860 float scale = ScaleFactor(cocoa_view_); 860 float scale = ScaleFactor(cocoa_view_);
861 gfx::Size dst_pixel_size = gfx::ToFlooredSize(dst_size.Scale(scale)); 861 gfx::Size dst_pixel_size = gfx::ToFlooredSize(
862 gfx::ScaleSize(dst_size, scale));
862 if (!output->Allocate( 863 if (!output->Allocate(
863 dst_pixel_size.width(), dst_pixel_size.height(), true)) 864 dst_pixel_size.width(), dst_pixel_size.height(), true))
864 return; 865 return;
865 scoped_callback_runner.Release(); 866 scoped_callback_runner.Release();
866 867
867 // Convert |src_subrect| from the views coordinate (upper-left origin) into 868 // Convert |src_subrect| from the views coordinate (upper-left origin) into
868 // the OpenGL coordinate (lower-left origin). 869 // the OpenGL coordinate (lower-left origin).
869 gfx::Rect src_gl_subrect = src_subrect; 870 gfx::Rect src_gl_subrect = src_subrect;
870 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom()); 871 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom());
871 872
(...skipping 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after
3360 if (!string) return NO; 3361 if (!string) return NO;
3361 3362
3362 // If the user is currently using an IME, confirm the IME input, 3363 // If the user is currently using an IME, confirm the IME input,
3363 // and then insert the text from the service, the same as TextEdit and Safari. 3364 // and then insert the text from the service, the same as TextEdit and Safari.
3364 [self confirmComposition]; 3365 [self confirmComposition];
3365 [self insertText:string]; 3366 [self insertText:string];
3366 return YES; 3367 return YES;
3367 } 3368 }
3368 3369
3369 @end 3370 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698