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 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
10 | 10 |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 } | 1231 } |
1232 | 1232 |
1233 bool RenderWidgetHostViewMac::IsPopup() const { | 1233 bool RenderWidgetHostViewMac::IsPopup() const { |
1234 return popup_type_ != blink::WebPopupTypeNone; | 1234 return popup_type_ != blink::WebPopupTypeNone; |
1235 } | 1235 } |
1236 | 1236 |
1237 void RenderWidgetHostViewMac::CopyFromCompositingSurface( | 1237 void RenderWidgetHostViewMac::CopyFromCompositingSurface( |
1238 const gfx::Rect& src_subrect, | 1238 const gfx::Rect& src_subrect, |
1239 const gfx::Size& dst_size, | 1239 const gfx::Size& dst_size, |
1240 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1240 const base::Callback<void(bool, const SkBitmap&)>& callback, |
1241 const SkBitmap::Config config) { | 1241 const SkColorType color_type) { |
1242 if (delegated_frame_host_) { | 1242 if (delegated_frame_host_) { |
1243 delegated_frame_host_->CopyFromCompositingSurface( | 1243 delegated_frame_host_->CopyFromCompositingSurface( |
1244 src_subrect, dst_size, callback, config); | 1244 src_subrect, dst_size, callback, color_type); |
1245 return; | 1245 return; |
1246 } | 1246 } |
1247 | 1247 |
1248 if (config != SkBitmap::kARGB_8888_Config) { | 1248 if (color_type != kN32_SkColorType) { |
1249 NOTIMPLEMENTED(); | 1249 NOTIMPLEMENTED(); |
1250 callback.Run(false, SkBitmap()); | 1250 callback.Run(false, SkBitmap()); |
1251 } | 1251 } |
1252 base::ScopedClosureRunner scoped_callback_runner( | 1252 base::ScopedClosureRunner scoped_callback_runner( |
1253 base::Bind(callback, false, SkBitmap())); | 1253 base::Bind(callback, false, SkBitmap())); |
1254 float scale = ui::GetScaleFactorForNativeView(cocoa_view_); | 1254 float scale = ui::GetScaleFactorForNativeView(cocoa_view_); |
1255 gfx::Size dst_pixel_size = gfx::ToFlooredSize( | 1255 gfx::Size dst_pixel_size = gfx::ToFlooredSize( |
1256 gfx::ScaleSize(dst_size, scale)); | 1256 gfx::ScaleSize(dst_size, scale)); |
1257 if (compositing_iosurface_ && compositing_iosurface_->HasIOSurface()) { | 1257 if (compositing_iosurface_ && compositing_iosurface_->HasIOSurface()) { |
1258 ignore_result(scoped_callback_runner.Release()); | 1258 ignore_result(scoped_callback_runner.Release()); |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 // setNeedsDisplay calls are dropped on the floor, and stale content is | 2335 // setNeedsDisplay calls are dropped on the floor, and stale content is |
2336 // displayed. Calling displayIfNeeded will ensure that the right size | 2336 // displayed. Calling displayIfNeeded will ensure that the right size |
2337 // frame is drawn to the screen. | 2337 // frame is drawn to the screen. |
2338 // http://crbug.com/350817 | 2338 // http://crbug.com/350817 |
2339 [compositing_iosurface_layer_ setNeedsDisplay]; | 2339 [compositing_iosurface_layer_ setNeedsDisplay]; |
2340 [compositing_iosurface_layer_ displayIfNeeded]; | 2340 [compositing_iosurface_layer_ displayIfNeeded]; |
2341 } | 2341 } |
2342 } | 2342 } |
2343 } | 2343 } |
2344 | 2344 |
2345 SkBitmap::Config RenderWidgetHostViewMac::PreferredReadbackFormat() { | 2345 SkColorType RenderWidgetHostViewMac::PreferredReadbackFormat() { |
2346 return SkBitmap::kARGB_8888_Config; | 2346 return kN32_SkColorType; |
2347 } | 2347 } |
2348 | 2348 |
2349 //////////////////////////////////////////////////////////////////////////////// | 2349 //////////////////////////////////////////////////////////////////////////////// |
2350 // CompositingIOSurfaceLayerClient, public: | 2350 // CompositingIOSurfaceLayerClient, public: |
2351 | 2351 |
2352 void RenderWidgetHostViewMac::AcceleratedLayerDidDrawFrame(bool succeeded) { | 2352 void RenderWidgetHostViewMac::AcceleratedLayerDidDrawFrame(bool succeeded) { |
2353 if (!render_widget_host_) | 2353 if (!render_widget_host_) |
2354 return; | 2354 return; |
2355 | 2355 |
2356 SendPendingLatencyInfoToHost(); | 2356 SendPendingLatencyInfoToHost(); |
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4034 | 4034 |
4035 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 4035 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
4036 // regions that are not draggable. (See ControlRegionView in | 4036 // regions that are not draggable. (See ControlRegionView in |
4037 // native_app_window_cocoa.mm). This requires the render host view to be | 4037 // native_app_window_cocoa.mm). This requires the render host view to be |
4038 // draggable by default. | 4038 // draggable by default. |
4039 - (BOOL)mouseDownCanMoveWindow { | 4039 - (BOOL)mouseDownCanMoveWindow { |
4040 return YES; | 4040 return YES; |
4041 } | 4041 } |
4042 | 4042 |
4043 @end | 4043 @end |
OLD | NEW |