OLD | NEW |
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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 if (!compositing_iosurface_.get() || | 825 if (!compositing_iosurface_.get() || |
826 !compositing_iosurface_->HasIOSurface()) | 826 !compositing_iosurface_->HasIOSurface()) |
827 return; | 827 return; |
828 | 828 |
829 float scale = ScaleFactor(cocoa_view_); | 829 float scale = ScaleFactor(cocoa_view_); |
830 gfx::Size dst_pixel_size = dst_size.Scale(scale); | 830 gfx::Size dst_pixel_size = dst_size.Scale(scale); |
831 if (!output->initialize( | 831 if (!output->initialize( |
832 dst_pixel_size.width(), dst_pixel_size.height(), true)) | 832 dst_pixel_size.width(), dst_pixel_size.height(), true)) |
833 return; | 833 return; |
834 | 834 |
835 gfx::Rect src_pixel_subrect(src_subrect.origin().Scale(scale), | 835 // Convert |src_subrect| from the views coordinate (upper-left origin) into |
836 src_subrect.size().Scale(scale)); | 836 // the OpenGL coordinate (lower-left origin). |
| 837 gfx::Rect src_gl_subrect = src_subrect; |
| 838 src_gl_subrect.set_y(GetViewBounds().height() - src_subrect.bottom()); |
| 839 |
| 840 gfx::Rect src_pixel_gl_subrect = src_gl_subrect.Scale(scale); |
837 const bool result = compositing_iosurface_->CopyTo( | 841 const bool result = compositing_iosurface_->CopyTo( |
838 src_pixel_subrect, | 842 src_pixel_gl_subrect, |
839 dst_pixel_size, | 843 dst_pixel_size, |
840 output->getTopDevice()->accessBitmap(true).getPixels()); | 844 output->getTopDevice()->accessBitmap(true).getPixels()); |
841 scoped_callback_runner.Release(); | 845 scoped_callback_runner.Release(); |
842 callback.Run(result); | 846 callback.Run(result); |
843 } | 847 } |
844 | 848 |
845 // Sets whether or not to accept first responder status. | 849 // Sets whether or not to accept first responder status. |
846 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { | 850 void RenderWidgetHostViewMac::SetTakesFocusOnlyOnMouseDown(bool flag) { |
847 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; | 851 [cocoa_view_ setTakesFocusOnlyOnMouseDown:flag]; |
848 } | 852 } |
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3212 if (!string) return NO; | 3216 if (!string) return NO; |
3213 | 3217 |
3214 // If the user is currently using an IME, confirm the IME input, | 3218 // 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. | 3219 // and then insert the text from the service, the same as TextEdit and Safari. |
3216 [self confirmComposition]; | 3220 [self confirmComposition]; |
3217 [self insertText:string]; | 3221 [self insertText:string]; |
3218 return YES; | 3222 return YES; |
3219 } | 3223 } |
3220 | 3224 |
3221 @end | 3225 @end |
OLD | NEW |