| 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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 } | 1204 } |
| 1205 | 1205 |
| 1206 bool RenderWidgetHostViewMac::IsPopup() const { | 1206 bool RenderWidgetHostViewMac::IsPopup() const { |
| 1207 return popup_type_ != blink::WebPopupTypeNone; | 1207 return popup_type_ != blink::WebPopupTypeNone; |
| 1208 } | 1208 } |
| 1209 | 1209 |
| 1210 void RenderWidgetHostViewMac::CopyFromCompositingSurface( | 1210 void RenderWidgetHostViewMac::CopyFromCompositingSurface( |
| 1211 const gfx::Rect& src_subrect, | 1211 const gfx::Rect& src_subrect, |
| 1212 const gfx::Size& dst_size, | 1212 const gfx::Size& dst_size, |
| 1213 const base::Callback<void(bool, const SkBitmap&)>& callback, | 1213 const base::Callback<void(bool, const SkBitmap&)>& callback, |
| 1214 const SkBitmap::Config config) { | 1214 const SkColorType color_type) { |
| 1215 if (delegated_frame_host_) { | 1215 if (delegated_frame_host_) { |
| 1216 delegated_frame_host_->CopyFromCompositingSurface( | 1216 delegated_frame_host_->CopyFromCompositingSurface( |
| 1217 src_subrect, dst_size, callback, config); | 1217 src_subrect, dst_size, callback, color_type); |
| 1218 return; | 1218 return; |
| 1219 } | 1219 } |
| 1220 | 1220 |
| 1221 if (config != SkBitmap::kARGB_8888_Config) { | 1221 if (color_type != kN32_SkColorType) { |
| 1222 NOTIMPLEMENTED(); | 1222 NOTIMPLEMENTED(); |
| 1223 callback.Run(false, SkBitmap()); | 1223 callback.Run(false, SkBitmap()); |
| 1224 } | 1224 } |
| 1225 base::ScopedClosureRunner scoped_callback_runner( | 1225 base::ScopedClosureRunner scoped_callback_runner( |
| 1226 base::Bind(callback, false, SkBitmap())); | 1226 base::Bind(callback, false, SkBitmap())); |
| 1227 float scale = ui::GetScaleFactorForNativeView(cocoa_view_); | 1227 float scale = ui::GetScaleFactorForNativeView(cocoa_view_); |
| 1228 gfx::Size dst_pixel_size = gfx::ToFlooredSize( | 1228 gfx::Size dst_pixel_size = gfx::ToFlooredSize( |
| 1229 gfx::ScaleSize(dst_size, scale)); | 1229 gfx::ScaleSize(dst_size, scale)); |
| 1230 if (compositing_iosurface_ && compositing_iosurface_->HasIOSurface()) { | 1230 if (compositing_iosurface_ && compositing_iosurface_->HasIOSurface()) { |
| 1231 ignore_result(scoped_callback_runner.Release()); | 1231 ignore_result(scoped_callback_runner.Release()); |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2251 // setNeedsDisplay calls are dropped on the floor, and stale content is | 2251 // setNeedsDisplay calls are dropped on the floor, and stale content is |
| 2252 // displayed. Calling displayIfNeeded will ensure that the right size | 2252 // displayed. Calling displayIfNeeded will ensure that the right size |
| 2253 // frame is drawn to the screen. | 2253 // frame is drawn to the screen. |
| 2254 // http://crbug.com/350817 | 2254 // http://crbug.com/350817 |
| 2255 [compositing_iosurface_layer_ setNeedsDisplay]; | 2255 [compositing_iosurface_layer_ setNeedsDisplay]; |
| 2256 [compositing_iosurface_layer_ displayIfNeeded]; | 2256 [compositing_iosurface_layer_ displayIfNeeded]; |
| 2257 } | 2257 } |
| 2258 } | 2258 } |
| 2259 } | 2259 } |
| 2260 | 2260 |
| 2261 SkBitmap::Config RenderWidgetHostViewMac::PreferredReadbackFormat() { | 2261 SkColorType RenderWidgetHostViewMac::PreferredReadbackFormat() { |
| 2262 return SkBitmap::kARGB_8888_Config; | 2262 return kN32_SkColorType; |
| 2263 } | 2263 } |
| 2264 | 2264 |
| 2265 //////////////////////////////////////////////////////////////////////////////// | 2265 //////////////////////////////////////////////////////////////////////////////// |
| 2266 // CompositingIOSurfaceLayerClient, public: | 2266 // CompositingIOSurfaceLayerClient, public: |
| 2267 | 2267 |
| 2268 void RenderWidgetHostViewMac::AcceleratedLayerDidDrawFrame(bool succeeded) { | 2268 void RenderWidgetHostViewMac::AcceleratedLayerDidDrawFrame(bool succeeded) { |
| 2269 if (!render_widget_host_) | 2269 if (!render_widget_host_) |
| 2270 return; | 2270 return; |
| 2271 | 2271 |
| 2272 SendPendingLatencyInfoToHost(); | 2272 SendPendingLatencyInfoToHost(); |
| (...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3950 | 3950 |
| 3951 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3951 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3952 // regions that are not draggable. (See ControlRegionView in | 3952 // regions that are not draggable. (See ControlRegionView in |
| 3953 // native_app_window_cocoa.mm). This requires the render host view to be | 3953 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3954 // draggable by default. | 3954 // draggable by default. |
| 3955 - (BOOL)mouseDownCanMoveWindow { | 3955 - (BOOL)mouseDownCanMoveWindow { |
| 3956 return YES; | 3956 return YES; |
| 3957 } | 3957 } |
| 3958 | 3958 |
| 3959 @end | 3959 @end |
| OLD | NEW |