Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: content/browser/compositor/software_output_device_mac.mm

Issue 2509983004: Revert "Change call-sites now that SkCanvas is not ref-counted" (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_ = SkCanvas::MakeRasterDirectN32(pixel_size_.width(), 117 canvas_ = sk_sp<SkCanvas>(SkCanvas::NewRasterDirectN32(
118 pixel_size_.height(), pixels, stride); 118 pixel_size_.width(), 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
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
OLDNEW
« no previous file with comments | « content/browser/compositor/software_output_device_mac.h ('k') | content/browser/compositor/software_output_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698