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

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

Issue 11031055: Introduce PlatformBitmap, which is a minimal helper class that wraps an SkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 BackingStore* RenderWidgetHostViewMac::AllocBackingStore( 826 BackingStore* RenderWidgetHostViewMac::AllocBackingStore(
827 const gfx::Size& size) { 827 const gfx::Size& size) {
828 float scale = ScaleFactor(cocoa_view_); 828 float scale = ScaleFactor(cocoa_view_);
829 return new BackingStoreMac(render_widget_host_, size, scale); 829 return new BackingStoreMac(render_widget_host_, size, scale);
830 } 830 }
831 831
832 void RenderWidgetHostViewMac::CopyFromCompositingSurface( 832 void RenderWidgetHostViewMac::CopyFromCompositingSurface(
833 const gfx::Rect& src_subrect, 833 const gfx::Rect& src_subrect,
834 const gfx::Size& dst_size, 834 const gfx::Size& dst_size,
835 const base::Callback<void(bool)>& callback, 835 const base::Callback<void(bool)>& callback,
836 skia::PlatformCanvas* output) { 836 skia::PlatformBitmap* output) {
837 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); 837 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
838 if (!compositing_iosurface_.get() || 838 if (!compositing_iosurface_.get() ||
839 !compositing_iosurface_->HasIOSurface()) 839 !compositing_iosurface_->HasIOSurface())
840 return; 840 return;
841 841
842 float scale = ScaleFactor(cocoa_view_); 842 float scale = ScaleFactor(cocoa_view_);
843 gfx::Size dst_pixel_size = dst_size.Scale(scale); 843 gfx::Size dst_pixel_size = dst_size.Scale(scale);
844 if (!output->initialize( 844 if (!output->Allocate(
845 dst_pixel_size.width(), dst_pixel_size.height(), true)) 845 dst_pixel_size.width(), dst_pixel_size.height(), true))
846 return; 846 return;
847 scoped_callback_runner.Release(); 847 scoped_callback_runner.Release();
848 848
849 // Convert |src_subrect| from the views coordinate (upper-left origin) into 849 // Convert |src_subrect| from the views coordinate (upper-left origin) into
850 // the OpenGL coordinate (lower-left origin). 850 // the OpenGL coordinate (lower-left origin).
851 gfx::Rect src_gl_subrect = src_subrect; 851 gfx::Rect src_gl_subrect = src_subrect;
852 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom()); 852 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom());
853 853
854 gfx::Rect src_pixel_gl_subrect = 854 gfx::Rect src_pixel_gl_subrect =
855 gfx::ToEnclosingRect(src_gl_subrect.Scale(scale)); 855 gfx::ToEnclosingRect(src_gl_subrect.Scale(scale));
856 compositing_iosurface_->CopyTo( 856 compositing_iosurface_->CopyTo(
857 src_pixel_gl_subrect, 857 src_pixel_gl_subrect,
858 dst_pixel_size, 858 dst_pixel_size,
859 output->getTopDevice()->accessBitmap(true).getPixels(), 859 output->GetBitmap().getPixels(),
860 callback); 860 callback);
861 } 861 }
862 862
863 // Sets whether or not to accept first responder status. 863 // Sets whether or not to accept first responder status.
864 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { 864 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) {
865 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; 865 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag];
866 } 866 }
867 867
868 void RenderWidgetHostViewMac::ForwardMouseEvent(const WebMouseEvent& event) { 868 void RenderWidgetHostViewMac::ForwardMouseEvent(const WebMouseEvent& event) {
869 if (render_widget_host_) 869 if (render_widget_host_)
(...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after
3299 if (!string) return NO; 3299 if (!string) return NO;
3300 3300
3301 // If the user is currently using an IME, confirm the IME input, 3301 // If the user is currently using an IME, confirm the IME input,
3302 // and then insert the text from the service, the same as TextEdit and Safari. 3302 // and then insert the text from the service, the same as TextEdit and Safari.
3303 [self confirmComposition]; 3303 [self confirmComposition];
3304 [self insertText:string]; 3304 [self insertText:string];
3305 return YES; 3305 return YES;
3306 } 3306 }
3307 3307
3308 @end 3308 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698