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

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

Issue 10835014: Support copying a partial rectangle region from the compositing surface on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 float scale = ScaleFactor(cocoa_view_); 815 float scale = ScaleFactor(cocoa_view_);
816 return new BackingStoreMac(render_widget_host_, size, scale); 816 return new BackingStoreMac(render_widget_host_, size, scale);
817 } 817 }
818 818
819 void RenderWidgetHostViewMac::CopyFromCompositingSurface( 819 void RenderWidgetHostViewMac::CopyFromCompositingSurface(
820 const gfx::Rect& src_subrect, 820 const gfx::Rect& src_subrect,
821 const gfx::Size& dst_size, 821 const gfx::Size& dst_size,
822 const base::Callback<void(bool)>& callback, 822 const base::Callback<void(bool)>& callback,
823 skia::PlatformCanvas* output) { 823 skia::PlatformCanvas* output) {
824 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); 824 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
825 // TODO(mazda): Support copying a partial rectangle from the compositing
826 // surface with |src_subrect| (http://crbug.com/118571).
827 if (!src_subrect.IsEmpty()) {
828 NOTIMPLEMENTED();
829 return;
830 }
831
832 if (!compositing_iosurface_.get() || 825 if (!compositing_iosurface_.get() ||
833 !compositing_iosurface_->HasIOSurface()) 826 !compositing_iosurface_->HasIOSurface())
834 return; 827 return;
835 828
836 if (!output->initialize(dst_size.width(), dst_size.height(), true)) 829 float scale = ScaleFactor(cocoa_view_);
830 gfx::Size dst_size_in_pixel = dst_size.Scale(scale);
831 if (!output->initialize(
832 dst_size_in_pixel.width(), dst_size_in_pixel.height(), true))
837 return; 833 return;
838 834
835 gfx::Rect src_subrect_in_pixel(src_subrect.origin().Scale(scale),
Nico 2012/07/26 23:45:48 src_pixel_subrect is more consistent with the rest
mazda 2012/07/27 00:00:35 Done.
836 src_subrect.size().Scale(scale));
839 const bool result = compositing_iosurface_->CopyTo( 837 const bool result = compositing_iosurface_->CopyTo(
840 dst_size, output->getTopDevice()->accessBitmap(true).getPixels()); 838 src_subrect_in_pixel,
839 dst_size_in_pixel,
840 output->getTopDevice()->accessBitmap(true).getPixels());
841 scoped_callback_runner.Release(); 841 scoped_callback_runner.Release();
842 callback.Run(result); 842 callback.Run(result);
843 } 843 }
844 844
845 // Sets whether or not to accept first responder status. 845 // Sets whether or not to accept first responder status.
846 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { 846 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) {
847 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; 847 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag];
848 } 848 }
849 849
850 void RenderWidgetHostViewMac::ForwardMouseEvent(const WebMouseEvent& event) { 850 void RenderWidgetHostViewMac::ForwardMouseEvent(const WebMouseEvent& event) {
(...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after
3212 if (!string) return NO; 3212 if (!string) return NO;
3213 3213
3214 // If the user is currently using an IME, confirm the IME input, 3214 // If the user is currently using an IME, confirm the IME input,
3215 // and then insert the text from the service, the same as TextEdit and Safari. 3215 // and then insert the text from the service, the same as TextEdit and Safari.
3216 [self confirmComposition]; 3216 [self confirmComposition];
3217 [self insertText:string]; 3217 [self insertText:string];
3218 return YES; 3218 return YES;
3219 } 3219 }
3220 3220
3221 @end 3221 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698