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 "SkImage_Base.h" | 9 #include "SkImage_Base.h" |
10 #include "SkSpecialImage.h" | 10 #include "SkSpecialImage.h" |
11 #include "SkSpecialSurface.h" | 11 #include "SkSpecialSurface.h" |
12 | 12 |
13 /////////////////////////////////////////////////////////////////////////////// | 13 /////////////////////////////////////////////////////////////////////////////// |
14 class SkSpecialImage_Base : public SkSpecialImage { | 14 class SkSpecialImage_Base : public SkSpecialImage { |
15 public: | 15 public: |
16 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint
32_t uniqueID) | 16 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint
32_t uniqueID) |
17 : INHERITED(proxy, subset, uniqueID) { | 17 : INHERITED(proxy, subset, uniqueID) { |
18 } | 18 } |
19 virtual ~SkSpecialImage_Base() { } | 19 virtual ~SkSpecialImage_Base() { } |
20 | 20 |
21 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const
= 0; | 21 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const
= 0; |
22 | 22 |
23 virtual bool onPeekPixels(SkPixmap*) const { return false; } | 23 virtual bool testingOnlyOnPeekPixels(SkPixmap*) const { return false; } |
24 | 24 |
25 virtual GrTexture* onPeekTexture() const { return nullptr; } | 25 virtual GrTexture* onPeekTexture() const { return nullptr; } |
26 | 26 |
27 virtual bool testingOnlyOnGetROPixels(SkBitmap*) const = 0; | 27 virtual bool testingOnlyOnGetROPixels(SkBitmap*) const = 0; |
28 | 28 |
29 // Delete this entry point ASAP (see skbug.com/4965) | 29 // Delete this entry point ASAP (see skbug.com/4965) |
30 virtual bool getBitmapDeprecated(SkBitmap* result) const = 0; | 30 virtual bool getBitmapDeprecated(SkBitmap* result) const = 0; |
31 | 31 |
32 virtual SkSpecialSurface* onNewSurface(const SkImageInfo& info) const = 0; | 32 virtual SkSpecialSurface* onNewSurface(const SkImageInfo& info) const { retu
rn nullptr; } |
33 | |
34 virtual SkSpecialImage* onExtractSubset(const SkIRect& subset) const = 0; | |
35 | 33 |
36 private: | 34 private: |
37 typedef SkSpecialImage INHERITED; | 35 typedef SkSpecialImage INHERITED; |
38 }; | 36 }; |
39 | 37 |
40 /////////////////////////////////////////////////////////////////////////////// | 38 /////////////////////////////////////////////////////////////////////////////// |
41 static inline const SkSpecialImage_Base* as_SIB(const SkSpecialImage* image) { | 39 static inline const SkSpecialImage_Base* as_SIB(const SkSpecialImage* image) { |
42 return static_cast<const SkSpecialImage_Base*>(image); | 40 return static_cast<const SkSpecialImage_Base*>(image); |
43 } | 41 } |
44 | 42 |
45 void SkSpecialImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPain
t* paint) const { | 43 void SkSpecialImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPain
t* paint) const { |
46 return as_SIB(this)->onDraw(canvas, x, y, paint); | 44 return as_SIB(this)->onDraw(canvas, x, y, paint); |
47 } | 45 } |
48 | 46 |
49 bool SkSpecialImage::peekPixels(SkPixmap* pixmap) const { | 47 bool SkSpecialImage::testingOnlyPeekPixels(SkPixmap* pixmap) const { |
50 return as_SIB(this)->onPeekPixels(pixmap); | 48 return as_SIB(this)->testingOnlyOnPeekPixels(pixmap); |
51 } | 49 } |
52 | 50 |
53 GrTexture* SkSpecialImage::peekTexture() const { | 51 GrTexture* SkSpecialImage::peekTexture() const { |
54 return as_SIB(this)->onPeekTexture(); | 52 return as_SIB(this)->onPeekTexture(); |
55 } | 53 } |
56 | 54 |
57 bool SkSpecialImage::testingOnlyGetROPixels(SkBitmap* result) const { | 55 bool SkSpecialImage::testingOnlyGetROPixels(SkBitmap* result) const { |
58 return as_SIB(this)->testingOnlyOnGetROPixels(result); | 56 return as_SIB(this)->testingOnlyOnGetROPixels(result); |
59 } | 57 } |
60 | 58 |
61 SkSpecialSurface* SkSpecialImage::newSurface(const SkImageInfo& info) const { | 59 SkSpecialSurface* SkSpecialImage::newSurface(const SkImageInfo& info) const { |
62 return as_SIB(this)->onNewSurface(info); | 60 return as_SIB(this)->onNewSurface(info); |
63 } | 61 } |
64 | 62 |
65 SkSpecialImage* SkSpecialImage::extractSubset(const SkIRect& subset) const { | |
66 return as_SIB(this)->onExtractSubset(subset); | |
67 } | |
68 | |
69 #if SK_SUPPORT_GPU | 63 #if SK_SUPPORT_GPU |
70 #include "SkGr.h" | 64 #include "SkGr.h" |
71 #include "SkGrPixelRef.h" | 65 #include "SkGrPixelRef.h" |
72 #endif | 66 #endif |
73 | 67 |
74 SkSpecialImage* SkSpecialImage::internal_fromBM(SkImageFilter::Proxy* proxy, | 68 SkSpecialImage* SkSpecialImage::internal_fromBM(SkImageFilter::Proxy* proxy, |
75 const SkBitmap& src) { | 69 const SkBitmap& src) { |
76 // Need to test offset case! (see skbug.com/4967) | 70 // Need to test offset case! (see skbug.com/4967) |
77 if (src.getTexture()) { | 71 if (src.getTexture()) { |
78 return SkSpecialImage::NewFromGpu(proxy, | 72 return SkSpecialImage::NewFromGpu(proxy, |
79 src.bounds(), | 73 src.bounds(), |
80 src.getGenerationID(), | 74 src.getGenerationID(), |
81 src.getTexture()); | 75 src.getTexture()); |
82 } | 76 } |
83 | 77 |
84 return SkSpecialImage::NewFromRaster(proxy, src.bounds(), src); | 78 return SkSpecialImage::NewFromRaster(proxy, src.bounds(), src); |
85 } | 79 } |
86 | 80 |
87 bool SkSpecialImage::internal_getBM(SkBitmap* result) { | 81 bool SkSpecialImage::internal_getBM(SkBitmap* result) { |
88 const SkSpecialImage_Base* ib = as_SIB(this); | 82 const SkSpecialImage_Base* ib = as_SIB(this); |
89 | 83 |
90 // TODO: need to test offset case! (see skbug.com/4967) | 84 // TODO: need to test offset case! (see skbug.com/4967) |
91 return ib->getBitmapDeprecated(result); | 85 return ib->getBitmapDeprecated(result); |
92 } | 86 } |
93 | 87 |
94 SkImageFilter::Proxy* SkSpecialImage::internal_getProxy() const { | 88 SkImageFilter::Proxy* SkSpecialImage::internal_getProxy() { |
| 89 SkASSERT(fProxy); |
95 return fProxy; | 90 return fProxy; |
96 } | 91 } |
97 | 92 |
98 /////////////////////////////////////////////////////////////////////////////// | 93 /////////////////////////////////////////////////////////////////////////////// |
99 #include "SkImage.h" | 94 #include "SkImage.h" |
100 #if SK_SUPPORT_GPU | 95 #if SK_SUPPORT_GPU |
101 #include "SkGrPriv.h" | 96 #include "SkGrPriv.h" |
102 #endif | 97 #endif |
103 | 98 |
104 class SkSpecialImage_Image : public SkSpecialImage_Base { | 99 class SkSpecialImage_Image : public SkSpecialImage_Base { |
(...skipping 22 matching lines...) Expand all Loading... |
127 return 0; | 122 return 0; |
128 } | 123 } |
129 | 124 |
130 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { | 125 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { |
131 SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset
().height()); | 126 SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset
().height()); |
132 | 127 |
133 canvas->drawImageRect(fImage, this->subset(), | 128 canvas->drawImageRect(fImage, this->subset(), |
134 dst, paint, SkCanvas::kStrict_SrcRectConstraint); | 129 dst, paint, SkCanvas::kStrict_SrcRectConstraint); |
135 } | 130 } |
136 | 131 |
137 bool onPeekPixels(SkPixmap* pixmap) const override { | 132 bool testingOnlyOnPeekPixels(SkPixmap* pixmap) const override { |
138 return fImage->peekPixels(pixmap); | 133 return fImage->peekPixels(pixmap); |
139 } | 134 } |
140 | 135 |
141 GrTexture* onPeekTexture() const override { return as_IB(fImage.get())->peek
Texture(); } | 136 GrTexture* onPeekTexture() const override { return as_IB(fImage.get())->peek
Texture(); } |
142 | 137 |
143 bool getBitmapDeprecated(SkBitmap* result) const override { | 138 bool getBitmapDeprecated(SkBitmap* result) const override { |
144 #if SK_SUPPORT_GPU | 139 #if SK_SUPPORT_GPU |
145 if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) { | 140 if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) { |
146 const SkImageInfo info = GrMakeInfoFromTexture(texture, | 141 const SkImageInfo info = GrMakeInfoFromTexture(texture, |
147 fImage->width(), fIma
ge->height(), | 142 fImage->width(), fIma
ge->height(), |
(...skipping 20 matching lines...) Expand all Loading... |
168 if (texture) { | 163 if (texture) { |
169 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info); | 164 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info); |
170 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 165 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
171 | 166 |
172 return SkSpecialSurface::NewRenderTarget(this->proxy(), texture->get
Context(), desc); | 167 return SkSpecialSurface::NewRenderTarget(this->proxy(), texture->get
Context(), desc); |
173 } | 168 } |
174 #endif | 169 #endif |
175 return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); | 170 return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); |
176 } | 171 } |
177 | 172 |
178 SkSpecialImage* onExtractSubset(const SkIRect& subset) const override { | |
179 SkAutoTUnref<SkImage> subsetImg(fImage->newSubset(subset)); | |
180 if (!subsetImg) { | |
181 return nullptr; | |
182 } | |
183 | |
184 return SkSpecialImage::NewFromImage(this->internal_getProxy(), | |
185 SkIRect::MakeWH(subset.width(), subs
et.height()), | |
186 subsetImg); | |
187 } | |
188 | |
189 private: | 173 private: |
190 SkAutoTUnref<const SkImage> fImage; | 174 SkAutoTUnref<const SkImage> fImage; |
191 | 175 |
192 typedef SkSpecialImage_Base INHERITED; | 176 typedef SkSpecialImage_Base INHERITED; |
193 }; | 177 }; |
194 | 178 |
195 #ifdef SK_DEBUG | 179 #ifdef SK_DEBUG |
196 static bool rect_fits(const SkIRect& rect, int width, int height) { | 180 static bool rect_fits(const SkIRect& rect, int width, int height) { |
197 if (0 == width && 0 == height) { | 181 if (0 == width && 0 == height) { |
198 SkASSERT(0 == rect.fLeft && 0 == rect.fRight && 0 == rect.fTop && 0 == r
ect.fBottom); | 182 SkASSERT(0 == rect.fLeft && 0 == rect.fRight && 0 == rect.fTop && 0 == r
ect.fBottom); |
(...skipping 24 matching lines...) Expand all Loading... |
223 SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, const SkIRect& subset, co
nst SkBitmap& bm) | 207 SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, const SkIRect& subset, co
nst SkBitmap& bm) |
224 : INHERITED(proxy, subset, bm.getGenerationID()) | 208 : INHERITED(proxy, subset, bm.getGenerationID()) |
225 , fBitmap(bm) { | 209 , fBitmap(bm) { |
226 if (bm.pixelRef() && bm.pixelRef()->isPreLocked()) { | 210 if (bm.pixelRef() && bm.pixelRef()->isPreLocked()) { |
227 // we only preemptively lock if there is no chance of triggering som
ething expensive | 211 // we only preemptively lock if there is no chance of triggering som
ething expensive |
228 // like a lazy decode or imagegenerator. PreLocked means it is flat
pixels already. | 212 // like a lazy decode or imagegenerator. PreLocked means it is flat
pixels already. |
229 fBitmap.lockPixels(); | 213 fBitmap.lockPixels(); |
230 } | 214 } |
231 } | 215 } |
232 | 216 |
233 SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, | |
234 const SkIRect& subset, | |
235 const SkPixmap& pixmap, | |
236 void (*releaseProc)(void* addr, void* context), | |
237 void* context) | |
238 : INHERITED(proxy, subset, kNeedNewImageUniqueID_SpecialImage) { | |
239 fBitmap.installPixels(pixmap.info(), pixmap.writable_addr(), | |
240 pixmap.rowBytes(), pixmap.ctable(), | |
241 releaseProc, context); | |
242 } | |
243 | |
244 ~SkSpecialImage_Raster() override { } | 217 ~SkSpecialImage_Raster() override { } |
245 | 218 |
246 bool isOpaque() const override { return fBitmap.isOpaque(); } | 219 bool isOpaque() const override { return fBitmap.isOpaque(); } |
247 | 220 |
248 size_t getSize() const override { return fBitmap.getSize(); } | 221 size_t getSize() const override { return fBitmap.getSize(); } |
249 | 222 |
250 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { | 223 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { |
251 SkRect dst = SkRect::MakeXYWH(x, y, | 224 SkRect dst = SkRect::MakeXYWH(x, y, |
252 this->subset().width(), this->subset().hei
ght()); | 225 this->subset().width(), this->subset().hei
ght()); |
253 | 226 |
254 canvas->drawBitmapRect(fBitmap, this->subset(), | 227 canvas->drawBitmapRect(fBitmap, this->subset(), |
255 dst, paint, SkCanvas::kStrict_SrcRectConstraint); | 228 dst, paint, SkCanvas::kStrict_SrcRectConstraint); |
256 } | 229 } |
257 | 230 |
258 bool onPeekPixels(SkPixmap* pixmap) const override { | 231 bool testingOnlyOnPeekPixels(SkPixmap* pixmap) const override { |
259 const SkImageInfo info = fBitmap.info(); | 232 const SkImageInfo info = fBitmap.info(); |
260 if ((kUnknown_SkColorType == info.colorType()) || !fBitmap.getPixels())
{ | 233 if ((kUnknown_SkColorType == info.colorType()) || !fBitmap.getPixels())
{ |
261 return false; | 234 return false; |
262 } | 235 } |
263 | 236 const void* pixels = fBitmap.getPixels(); |
264 return fBitmap.peekPixels(pixmap); | 237 if (pixels) { |
| 238 if (pixmap) { |
| 239 pixmap->reset(info, pixels, fBitmap.rowBytes()); |
| 240 } |
| 241 return true; |
| 242 } |
| 243 return false; |
265 } | 244 } |
266 | 245 |
267 bool getBitmapDeprecated(SkBitmap* result) const override { | 246 bool getBitmapDeprecated(SkBitmap* result) const override { |
268 *result = fBitmap; | 247 *result = fBitmap; |
269 return true; | 248 return true; |
270 } | 249 } |
271 | 250 |
272 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { | 251 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { |
273 *result = fBitmap; | 252 *result = fBitmap; |
274 return true; | 253 return true; |
275 } | 254 } |
276 | 255 |
277 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { | 256 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { |
278 return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); | 257 return SkSpecialSurface::NewRaster(this->proxy(), info, nullptr); |
279 } | 258 } |
280 | 259 |
281 SkSpecialImage* onExtractSubset(const SkIRect& subset) const override { | |
282 SkBitmap subsetBM; | |
283 | |
284 if (!fBitmap.extractSubset(&subsetBM, subset)) { | |
285 return nullptr; | |
286 } | |
287 | |
288 return SkSpecialImage::NewFromRaster(this->internal_getProxy(), | |
289 SkIRect::MakeWH(subset.width(), sub
set.height()), | |
290 subsetBM); | |
291 } | |
292 | |
293 private: | 260 private: |
294 SkBitmap fBitmap; | 261 SkBitmap fBitmap; |
295 | 262 |
296 typedef SkSpecialImage_Base INHERITED; | 263 typedef SkSpecialImage_Base INHERITED; |
297 }; | 264 }; |
298 | 265 |
299 SkSpecialImage* SkSpecialImage::NewFromRaster(SkImageFilter::Proxy* proxy, | 266 SkSpecialImage* SkSpecialImage::NewFromRaster(SkImageFilter::Proxy* proxy, |
300 const SkIRect& subset, | 267 const SkIRect& subset, |
301 const SkBitmap& bm) { | 268 const SkBitmap& bm) { |
302 SkASSERT(nullptr == bm.getTexture()); | 269 SkASSERT(nullptr == bm.getTexture()); |
303 SkASSERT(rect_fits(subset, bm.width(), bm.height())); | 270 SkASSERT(rect_fits(subset, bm.width(), bm.height())); |
304 return new SkSpecialImage_Raster(proxy, subset, bm); | 271 return new SkSpecialImage_Raster(proxy, subset, bm); |
305 } | 272 } |
306 | 273 |
307 SkSpecialImage* SkSpecialImage::NewFromPixmap(SkImageFilter::Proxy* proxy, | |
308 const SkIRect& subset, | |
309 const SkPixmap& src, | |
310 void (*releaseProc)(void* addr, vo
id* context), | |
311 void* context) { | |
312 return new SkSpecialImage_Raster(proxy, subset, src, releaseProc, context); | |
313 } | |
314 | |
315 | |
316 #if SK_SUPPORT_GPU | 274 #if SK_SUPPORT_GPU |
317 /////////////////////////////////////////////////////////////////////////////// | 275 /////////////////////////////////////////////////////////////////////////////// |
318 #include "GrTexture.h" | 276 #include "GrTexture.h" |
319 | 277 |
320 class SkSpecialImage_Gpu : public SkSpecialImage_Base { | 278 class SkSpecialImage_Gpu : public SkSpecialImage_Base { |
321 public: | 279 public: |
322 SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset, | 280 SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset, |
323 uint32_t uniqueID, GrTexture* tex, SkAlphaType at) | 281 uint32_t uniqueID, GrTexture* tex, SkAlphaType at) |
324 : INHERITED(proxy, subset, uniqueID) | 282 : INHERITED(proxy, subset, uniqueID) |
325 , fTexture(SkRef(tex)) | 283 , fTexture(SkRef(tex)) |
(...skipping 24 matching lines...) Expand all Loading... |
350 GrTexture* onPeekTexture() const override { return fTexture; } | 308 GrTexture* onPeekTexture() const override { return fTexture; } |
351 | 309 |
352 bool getBitmapDeprecated(SkBitmap* result) const override { | 310 bool getBitmapDeprecated(SkBitmap* result) const override { |
353 const SkImageInfo info = GrMakeInfoFromTexture(fTexture, | 311 const SkImageInfo info = GrMakeInfoFromTexture(fTexture, |
354 this->width(), this->heig
ht(), | 312 this->width(), this->heig
ht(), |
355 this->isOpaque()); | 313 this->isOpaque()); |
356 if (!result->setInfo(info)) { | 314 if (!result->setInfo(info)) { |
357 return false; | 315 return false; |
358 } | 316 } |
359 | 317 |
360 const SkImageInfo prInfo = info.makeWH(fTexture->width(), fTexture->heig
ht()); | 318 result->setPixelRef(new SkGrPixelRef(info, fTexture))->unref(); |
361 | |
362 SkAutoTUnref<SkGrPixelRef> pixelRef(new SkGrPixelRef(prInfo, fTexture)); | |
363 result->setPixelRef(pixelRef, this->subset().fLeft, this->subset().fTop)
; | |
364 return true; | 319 return true; |
365 } | 320 } |
366 | 321 |
367 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { | 322 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { |
368 | 323 |
369 const SkImageInfo info = SkImageInfo::MakeN32(this->width(), | 324 const SkImageInfo info = SkImageInfo::MakeN32(this->width(), |
370 this->height(), | 325 this->height(), |
371 this->isOpaque() ? kOpaque
_SkAlphaType | 326 this->isOpaque() ? kOpaque
_SkAlphaType |
372 : kPremul
_SkAlphaType); | 327 : kPremul
_SkAlphaType); |
373 if (!result->tryAllocPixels(info)) { | 328 if (!result->tryAllocPixels(info)) { |
374 return false; | 329 return false; |
375 } | 330 } |
376 | 331 |
377 if (!fTexture->readPixels(0, 0, result->width(), result->height(), kSkia
8888_GrPixelConfig, | 332 if (!fTexture->readPixels(0, 0, result->width(), result->height(), kSkia
8888_GrPixelConfig, |
378 result->getPixels(), result->rowBytes())) { | 333 result->getPixels(), result->rowBytes())) { |
379 return false; | 334 return false; |
380 } | 335 } |
381 | 336 |
382 result->pixelRef()->setImmutable(); | 337 result->pixelRef()->setImmutable(); |
383 return true; | 338 return true; |
384 } | 339 } |
385 | 340 |
386 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { | 341 SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override { |
387 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info); | 342 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info); |
388 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 343 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
389 | 344 |
390 return SkSpecialSurface::NewRenderTarget(this->proxy(), fTexture->getCon
text(), desc); | 345 return SkSpecialSurface::NewRenderTarget(this->proxy(), fTexture->getCon
text(), desc); |
391 } | 346 } |
392 | 347 |
393 SkSpecialImage* onExtractSubset(const SkIRect& subset) const override { | |
394 return SkSpecialImage::NewFromGpu(this->internal_getProxy(), | |
395 subset, | |
396 this->uniqueID(), | |
397 fTexture, | |
398 fAlphaType); | |
399 } | |
400 | |
401 private: | 348 private: |
402 SkAutoTUnref<GrTexture> fTexture; | 349 SkAutoTUnref<GrTexture> fTexture; |
403 const SkAlphaType fAlphaType; | 350 const SkAlphaType fAlphaType; |
404 | 351 |
405 typedef SkSpecialImage_Base INHERITED; | 352 typedef SkSpecialImage_Base INHERITED; |
406 }; | 353 }; |
407 | 354 |
408 SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, | 355 SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, |
409 const SkIRect& subset, | 356 const SkIRect& subset, |
410 uint32_t uniqueID, | 357 uint32_t uniqueID, |
411 GrTexture* tex, | 358 GrTexture* tex, |
412 SkAlphaType at) { | 359 SkAlphaType at) { |
413 SkASSERT(rect_fits(subset, tex->width(), tex->height())); | 360 SkASSERT(rect_fits(subset, tex->width(), tex->height())); |
414 return new SkSpecialImage_Gpu(proxy, subset, uniqueID, tex, at); | 361 return new SkSpecialImage_Gpu(proxy, subset, uniqueID, tex, at); |
415 } | 362 } |
416 | 363 |
417 #else | 364 #else |
418 | 365 |
419 SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, | 366 SkSpecialImage* SkSpecialImage::NewFromGpu(SkImageFilter::Proxy* proxy, |
420 const SkIRect& subset, | 367 const SkIRect& subset, |
421 uint32_t uniqueID, | 368 uint32_t uniqueID, |
422 GrTexture* tex, | 369 GrTexture* tex, |
423 SkAlphaType at) { | 370 SkAlphaType at) { |
424 return nullptr; | 371 return nullptr; |
425 } | 372 } |
426 | 373 |
427 #endif | 374 #endif |
OLD | NEW |