| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |