OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/accelerated_widget_mac/accelerated_widget_mac.h" | 5 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // If there is not a layer for software frames, create one. | 277 // If there is not a layer for software frames, create one. |
278 if (!software_layer_) { | 278 if (!software_layer_) { |
279 software_layer_.reset([[SoftwareLayer alloc] init]); | 279 software_layer_.reset([[SoftwareLayer alloc] init]); |
280 [flipped_layer_ addSublayer:software_layer_]; | 280 [flipped_layer_ addSublayer:software_layer_]; |
281 } | 281 } |
282 | 282 |
283 // Set the software layer to draw the provided canvas. | 283 // Set the software layer to draw the provided canvas. |
284 SkImageInfo info; | 284 SkImageInfo info; |
285 size_t row_bytes; | 285 size_t row_bytes; |
286 const void* pixels = canvas->peekPixels(&info, &row_bytes); | 286 const void* pixels = canvas->peekPixels(&info, &row_bytes); |
287 gfx::Size pixel_size(info.fWidth, info.fHeight); | 287 gfx::Size pixel_size(info.width(), info.height()); |
288 [software_layer_ setContentsToData:pixels | 288 [software_layer_ setContentsToData:pixels |
289 withRowBytes:row_bytes | 289 withRowBytes:row_bytes |
290 withPixelSize:pixel_size | 290 withPixelSize:pixel_size |
291 withScaleFactor:scale_factor]; | 291 withScaleFactor:scale_factor]; |
292 last_swap_size_dip_ = gfx::ConvertSizeToDIP(scale_factor, pixel_size); | 292 last_swap_size_dip_ = gfx::ConvertSizeToDIP(scale_factor, pixel_size); |
293 | 293 |
294 // Remove any different-type layers that this is replacing. | 294 // Remove any different-type layers that this is replacing. |
295 DestroyCAContextLayer(ca_context_layer_); | 295 DestroyCAContextLayer(ca_context_layer_); |
296 DestroyIOSurfaceLayer(io_surface_layer_); | 296 DestroyIOSurfaceLayer(io_surface_layer_); |
297 } | 297 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 378 |
379 void AcceleratedWidgetMacGotSoftwareFrame( | 379 void AcceleratedWidgetMacGotSoftwareFrame( |
380 gfx::AcceleratedWidget widget, float scale_factor, SkCanvas* canvas) { | 380 gfx::AcceleratedWidget widget, float scale_factor, SkCanvas* canvas) { |
381 AcceleratedWidgetMac* accelerated_widget_mac = | 381 AcceleratedWidgetMac* accelerated_widget_mac = |
382 GetHelperFromAcceleratedWidget(widget); | 382 GetHelperFromAcceleratedWidget(widget); |
383 if (accelerated_widget_mac) | 383 if (accelerated_widget_mac) |
384 accelerated_widget_mac->GotSoftwareFrame(scale_factor, canvas); | 384 accelerated_widget_mac->GotSoftwareFrame(scale_factor, canvas); |
385 } | 385 } |
386 | 386 |
387 } // namespace ui | 387 } // namespace ui |
OLD | NEW |