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(this->subset(), | 141 sk_sp<SkSpecialImage> tmp(SkSpecialImage::MakeFromGpu(this->subset(), |
141 kNeedNewImageUniqu
eID_SpecialImage, | 142 kNeedNewImageUniqu
eID_SpecialImage, |
142 fDrawContext->asTe
xture(), | 143 fDrawContext->asTe
xture(), |
| 144 nullptr, |
143 &this->props())); | 145 &this->props())); |
144 fDrawContext = nullptr; | 146 fDrawContext = nullptr; |
145 return tmp; | 147 return tmp; |
146 } | 148 } |
147 | 149 |
148 private: | 150 private: |
149 sk_sp<GrDrawContext> fDrawContext; | 151 sk_sp<GrDrawContext> fDrawContext; |
150 | 152 |
151 typedef SkSpecialSurface_Base INHERITED; | 153 typedef SkSpecialSurface_Base INHERITED; |
152 }; | 154 }; |
(...skipping 10 matching lines...) Expand all Loading... |
163 if (!drawContext) { | 165 if (!drawContext) { |
164 return nullptr; | 166 return nullptr; |
165 } | 167 } |
166 | 168 |
167 const SkIRect subset = SkIRect::MakeWH(width, height); | 169 const SkIRect subset = SkIRect::MakeWH(width, height); |
168 | 170 |
169 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(drawContext), width, heigh
t, subset); | 171 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(drawContext), width, heigh
t, subset); |
170 } | 172 } |
171 | 173 |
172 #endif | 174 #endif |
OLD | NEW |