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

Side by Side Diff: src/core/SkSpecialSurface.cpp

Issue 1925803004: Add sk_sp to SkSurface_Gpu and SkGpuDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review issues Created 4 years, 7 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
« no previous file with comments | « no previous file | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file 5 * found in the LICENSE file
6 */ 6 */
7 7
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkSpecialImage.h" 9 #include "SkSpecialImage.h"
10 #include "SkSpecialSurface.h" 10 #include "SkSpecialSurface.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 public: 114 public:
115 SkSpecialSurface_Gpu(sk_sp<GrTexture> texture, 115 SkSpecialSurface_Gpu(sk_sp<GrTexture> texture,
116 int width, int height, 116 int width, int height,
117 const SkIRect& subset, 117 const SkIRect& subset,
118 const SkSurfaceProps* props) 118 const SkSurfaceProps* props)
119 : INHERITED(subset, props) 119 : INHERITED(subset, props)
120 , fTexture(std::move(texture)) { 120 , fTexture(std::move(texture)) {
121 121
122 SkASSERT(fTexture->asRenderTarget()); 122 SkASSERT(fTexture->asRenderTarget());
123 123
124 sk_sp<SkGpuDevice> device(SkGpuDevice::Create(fTexture->asRenderTarget() , width, height, 124 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(sk_ref_sp(fTexture->asRender Target()),
125 props, 125 width, height, props,
126 SkGpuDevice::kUninit_InitC ontents)); 126 SkGpuDevice::kUninit_InitCon tents));
127 if (!device) { 127 if (!device) {
128 return; 128 return;
129 } 129 }
130 130
131 fCanvas.reset(new SkCanvas(device.get())); 131 fCanvas.reset(new SkCanvas(device.get()));
132 fCanvas->clipRect(SkRect::Make(subset)); 132 fCanvas->clipRect(SkRect::Make(subset));
133 } 133 }
134 134
135 ~SkSpecialSurface_Gpu() override { } 135 ~SkSpecialSurface_Gpu() override { }
136 136
(...skipping 28 matching lines...) Expand all
165 if (!tex) { 165 if (!tex) {
166 return nullptr; 166 return nullptr;
167 } 167 }
168 168
169 const SkIRect subset = SkIRect::MakeWH(width, height); 169 const SkIRect subset = SkIRect::MakeWH(width, height);
170 170
171 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(tex), width, height, subse t, nullptr); 171 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(tex), width, height, subse t, nullptr);
172 } 172 }
173 173
174 #endif 174 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698