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

Side by Side Diff: skia/ext/platform_canvas.cc

Issue 1869753003: Replace many skia::RefPtr with sk_sp<> in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fmalita review - deconstify sk_sp<>s Created 4 years, 8 months 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/platform_canvas.h" 5 #include "skia/ext/platform_canvas.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "skia/ext/platform_device.h" 9 #include "skia/ext/platform_device.h"
10 #include "third_party/skia/include/core/SkMetaData.h" 10 #include "third_party/skia/include/core/SkMetaData.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 bool SupportsPlatformPaint(const SkCanvas* canvas) { 64 bool SupportsPlatformPaint(const SkCanvas* canvas) {
65 return GetPlatformDevice(GetTopDevice(*canvas)) != nullptr; 65 return GetPlatformDevice(GetTopDevice(*canvas)) != nullptr;
66 } 66 }
67 67
68 size_t PlatformCanvasStrideForWidth(unsigned width) { 68 size_t PlatformCanvasStrideForWidth(unsigned width) {
69 return 4 * width; 69 return 4 * width;
70 } 70 }
71 71
72 SkCanvas* CreateCanvas(const sk_sp<SkBaseDevice>& device, 72 SkCanvas* CreateCanvas(sk_sp<SkBaseDevice>& device,
73 OnFailureType failureType) { 73 OnFailureType failureType) {
74 if (!device) { 74 if (!device) {
75 if (CRASH_ON_FAILURE == failureType) 75 if (CRASH_ON_FAILURE == failureType)
76 SK_CRASH(); 76 SK_CRASH();
77 return nullptr; 77 return nullptr;
78 } 78 }
79 return new SkCanvas(device.get()); 79 return new SkCanvas(device.get());
80 } 80 }
81 81
82 SkMetaData& GetMetaData(const SkCanvas& canvas) { 82 SkMetaData& GetMetaData(const SkCanvas& canvas) {
(...skipping 22 matching lines...) Expand all
105 105
106 ScopedPlatformPaint::ScopedPlatformPaint(SkCanvas* canvas) : 106 ScopedPlatformPaint::ScopedPlatformPaint(SkCanvas* canvas) :
107 canvas_(canvas), 107 canvas_(canvas),
108 platform_surface_(nullptr) { 108 platform_surface_(nullptr) {
109 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas)); 109 PlatformDevice* platform_device = GetPlatformDevice(GetTopDevice(*canvas));
110 if (platform_device) 110 if (platform_device)
111 platform_surface_ = platform_device->BeginPlatformPaint(); 111 platform_surface_ = platform_device->BeginPlatformPaint();
112 } 112 }
113 113
114 } // namespace skia 114 } // namespace skia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698