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

Side by Side Diff: skia/ext/skia_utils_mac.mm

Issue 2476113002: Change call-sites now that SkCanvas is not ref-counted (Closed)
Patch Set: try fixing win again 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 (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 "skia/ext/skia_utils_mac.h" 5 #include "skia/ext/skia_utils_mac.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 count:4]; 183 count:4];
184 } 184 }
185 185
186 SkBitmap CGImageToSkBitmap(CGImageRef image) { 186 SkBitmap CGImageToSkBitmap(CGImageRef image) {
187 if (!image) 187 if (!image)
188 return SkBitmap(); 188 return SkBitmap();
189 189
190 int width = CGImageGetWidth(image); 190 int width = CGImageGetWidth(image);
191 int height = CGImageGetHeight(image); 191 int height = CGImageGetHeight(image);
192 192
193 sk_sp<SkCanvas> canvas(skia::CreatePlatformCanvas( 193 std::unique_ptr<SkCanvas> canvas(skia::CreatePlatformCanvas(
194 nullptr, width, height, false, RETURN_NULL_ON_FAILURE)); 194 nullptr, width, height, false, RETURN_NULL_ON_FAILURE));
195 ScopedPlatformPaint p(canvas.get()); 195 ScopedPlatformPaint p(canvas.get());
196 CGContextRef context = p.GetNativeDrawingContext(); 196 CGContextRef context = p.GetNativeDrawingContext();
197 197
198 // We need to invert the y-axis of the canvas so that Core Graphics drawing 198 // We need to invert the y-axis of the canvas so that Core Graphics drawing
199 // happens right-side up. Skia has an upper-left origin and CG has a lower- 199 // happens right-side up. Skia has an upper-left origin and CG has a lower-
200 // left one. 200 // left one.
201 CGContextScaleCTM(context, 1.0, -1.0); 201 CGContextScaleCTM(context, 1.0, -1.0);
202 CGContextTranslateCTM(context, 0, -height); 202 CGContextTranslateCTM(context, 0, -height);
203 203
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 CGContextConcatCTM(cgContext_, SkMatrixToCGAffineTransform(matrix)); 378 CGContextConcatCTM(cgContext_, SkMatrixToCGAffineTransform(matrix));
379 379
380 return cgContext_; 380 return cgContext_;
381 } 381 }
382 382
383 bool SkiaBitLocker::hasEmptyClipRegion() const { 383 bool SkiaBitLocker::hasEmptyClipRegion() const {
384 return canvas_->isClipEmpty(); 384 return canvas_->isClipEmpty();
385 } 385 }
386 386
387 } // namespace skia 387 } // namespace skia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698