| 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 "content/browser/compositor/software_output_device_mac.h" | 5 #include "content/browser/compositor/software_output_device_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 if (io_result) { | 116 if (io_result) { |
| 117 DLOG(ERROR) << "Failed to lock IOSurface " << io_result; | 117 DLOG(ERROR) << "Failed to lock IOSurface " << io_result; |
| 118 return nullptr; | 118 return nullptr; |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 SkPMColor* pixels = static_cast<SkPMColor*>( | 122 SkPMColor* pixels = static_cast<SkPMColor*>( |
| 123 IOSurfaceGetBaseAddress(io_surfaces_[current_index_])); | 123 IOSurfaceGetBaseAddress(io_surfaces_[current_index_])); |
| 124 size_t stride = IOSurfaceGetBytesPerRow(io_surfaces_[current_index_]); | 124 size_t stride = IOSurfaceGetBytesPerRow(io_surfaces_[current_index_]); |
| 125 | 125 |
| 126 canvas_ = skia::AdoptRef(SkCanvas::NewRasterDirectN32( | 126 canvas_ = sk_sp<SkCanvas>(SkCanvas::NewRasterDirectN32( |
| 127 pixel_size_.width(), pixel_size_.height(), pixels, stride)); | 127 pixel_size_.width(), pixel_size_.height(), pixels, stride)); |
| 128 | 128 |
| 129 CopyPreviousBufferDamage(SkRegion(gfx::RectToSkIRect(new_damage_rect))); | 129 CopyPreviousBufferDamage(SkRegion(gfx::RectToSkIRect(new_damage_rect))); |
| 130 | 130 |
| 131 return canvas_.get(); | 131 return canvas_.get(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void SoftwareOutputDeviceMac::EndPaint() { | 134 void SoftwareOutputDeviceMac::EndPaint() { |
| 135 SoftwareOutputDevice::EndPaint(); | 135 SoftwareOutputDevice::EndPaint(); |
| 136 { | 136 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 163 gfx::VSyncProvider* SoftwareOutputDeviceMac::GetVSyncProvider() { | 163 gfx::VSyncProvider* SoftwareOutputDeviceMac::GetVSyncProvider() { |
| 164 return this; | 164 return this; |
| 165 } | 165 } |
| 166 | 166 |
| 167 void SoftwareOutputDeviceMac::GetVSyncParameters( | 167 void SoftwareOutputDeviceMac::GetVSyncParameters( |
| 168 const gfx::VSyncProvider::UpdateVSyncCallback& callback) { | 168 const gfx::VSyncProvider::UpdateVSyncCallback& callback) { |
| 169 update_vsync_callback_ = callback; | 169 update_vsync_callback_ = callback; |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace content | 172 } // namespace content |
| OLD | NEW |