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 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" | 10 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (io_result) { | 107 if (io_result) { |
108 DLOG(ERROR) << "Failed to lock IOSurface " << io_result; | 108 DLOG(ERROR) << "Failed to lock IOSurface " << io_result; |
109 return nullptr; | 109 return nullptr; |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 SkPMColor* pixels = static_cast<SkPMColor*>( | 113 SkPMColor* pixels = static_cast<SkPMColor*>( |
114 IOSurfaceGetBaseAddress(io_surfaces_[current_index_])); | 114 IOSurfaceGetBaseAddress(io_surfaces_[current_index_])); |
115 size_t stride = IOSurfaceGetBytesPerRow(io_surfaces_[current_index_]); | 115 size_t stride = IOSurfaceGetBytesPerRow(io_surfaces_[current_index_]); |
116 | 116 |
117 canvas_ = sk_sp<SkCanvas>(SkCanvas::NewRasterDirectN32( | 117 canvas_ = SkCanvas::MakeRasterDirectN32(pixel_size_.width(), |
118 pixel_size_.width(), pixel_size_.height(), pixels, stride)); | 118 pixel_size_.height(), pixels, stride); |
119 | 119 |
120 CopyPreviousBufferDamage(SkRegion(gfx::RectToSkIRect(new_damage_rect))); | 120 CopyPreviousBufferDamage(SkRegion(gfx::RectToSkIRect(new_damage_rect))); |
121 | 121 |
122 return canvas_.get(); | 122 return canvas_.get(); |
123 } | 123 } |
124 | 124 |
125 void SoftwareOutputDeviceMac::EndPaint() { | 125 void SoftwareOutputDeviceMac::EndPaint() { |
126 SoftwareOutputDevice::EndPaint(); | 126 SoftwareOutputDevice::EndPaint(); |
127 { | 127 { |
128 TRACE_EVENT0("browser", "IOSurfaceUnlock"); | 128 TRACE_EVENT0("browser", "IOSurfaceUnlock"); |
(...skipping 29 matching lines...) Expand all Loading... |
158 gfx::VSyncProvider* SoftwareOutputDeviceMac::GetVSyncProvider() { | 158 gfx::VSyncProvider* SoftwareOutputDeviceMac::GetVSyncProvider() { |
159 return this; | 159 return this; |
160 } | 160 } |
161 | 161 |
162 void SoftwareOutputDeviceMac::GetVSyncParameters( | 162 void SoftwareOutputDeviceMac::GetVSyncParameters( |
163 const gfx::VSyncProvider::UpdateVSyncCallback& callback) { | 163 const gfx::VSyncProvider::UpdateVSyncCallback& callback) { |
164 update_vsync_callback_ = callback; | 164 update_vsync_callback_ = callback; |
165 } | 165 } |
166 | 166 |
167 } // namespace content | 167 } // namespace content |
OLD | NEW |