| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 fCanvas.reset(new SkCanvas(device.get())); | 130 fCanvas.reset(new SkCanvas(device.get())); |
| 131 fCanvas->clipRect(SkRect::Make(subset)); | 131 fCanvas->clipRect(SkRect::Make(subset)); |
| 132 #ifdef SK_IS_BOT | 132 #ifdef SK_IS_BOT |
| 133 fCanvas->clear(SK_ColorRED); // catch any imageFilter sloppiness | 133 fCanvas->clear(SK_ColorRED); // catch any imageFilter sloppiness |
| 134 #endif | 134 #endif |
| 135 } | 135 } |
| 136 | 136 |
| 137 ~SkSpecialSurface_Gpu() override { } | 137 ~SkSpecialSurface_Gpu() override { } |
| 138 | 138 |
| 139 sk_sp<SkSpecialImage> onMakeImageSnapshot() override { | 139 sk_sp<SkSpecialImage> onMakeImageSnapshot() override { |
| 140 // TODO: Supply color space from fDrawContext, once it's present | 140 sk_sp<SkSpecialImage> tmp(SkSpecialImage::MakeFromGpu( |
| 141 sk_sp<SkSpecialImage> tmp(SkSpecialImage::MakeFromGpu(this->subset(), | 141 this->subset(), |
| 142 kNeedNewImageUniqu
eID_SpecialImage, | 142 kNeedNewImageUniqueID
_SpecialImage, |
| 143 fDrawContext->asTe
xture(), | 143 fDrawContext->asTextu
re(), |
| 144 nullptr, | 144 sk_ref_sp(fDrawContex
t->getColorSpace()), |
| 145 &this->props())); | 145 &this->props())); |
| 146 fDrawContext = nullptr; | 146 fDrawContext = nullptr; |
| 147 return tmp; | 147 return tmp; |
| 148 } | 148 } |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 sk_sp<GrDrawContext> fDrawContext; | 151 sk_sp<GrDrawContext> fDrawContext; |
| 152 | 152 |
| 153 typedef SkSpecialSurface_Base INHERITED; | 153 typedef SkSpecialSurface_Base INHERITED; |
| 154 }; | 154 }; |
| 155 | 155 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 167 if (!drawContext) { | 167 if (!drawContext) { |
| 168 return nullptr; | 168 return nullptr; |
| 169 } | 169 } |
| 170 | 170 |
| 171 const SkIRect subset = SkIRect::MakeWH(width, height); | 171 const SkIRect subset = SkIRect::MakeWH(width, height); |
| 172 | 172 |
| 173 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(drawContext), width, heigh
t, subset); | 173 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(drawContext), width, heigh
t, subset); |
| 174 } | 174 } |
| 175 | 175 |
| 176 #endif | 176 #endif |
| OLD | NEW |