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

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

Issue 1861643003: Upgrade SkSpecialImage to have getTextureRef & getROPixels entry points (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review comments Created 4 years, 8 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 | « src/core/SkSpecialImage.h ('k') | src/effects/SkBlurImageFilter.cpp » ('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 #include "SkSpecialImage.h" 7 #include "SkSpecialImage.h"
8 8
9 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 #include "GrTexture.h" 10 #include "GrTexture.h"
11 #include "GrTextureParams.h" 11 #include "GrTextureParams.h"
12 #include "SkGr.h" 12 #include "SkGr.h"
13 #endif 13 #endif
14 14
15 #include "SkBitmapCache.h"
15 #include "SkCanvas.h" 16 #include "SkCanvas.h"
16 #include "SkImage_Base.h" 17 #include "SkImage_Base.h"
17 #include "SkSpecialSurface.h" 18 #include "SkSpecialSurface.h"
18 #include "SkSurfacePriv.h" 19 #include "SkSurfacePriv.h"
19 20
20 /////////////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////////////
21 class SkSpecialImage_Base : public SkSpecialImage { 22 class SkSpecialImage_Base : public SkSpecialImage {
22 public: 23 public:
23 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint 32_t uniqueID, 24 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint 32_t uniqueID,
24 const SkSurfaceProps* props) 25 const SkSurfaceProps* props)
25 : INHERITED(proxy, subset, uniqueID, props) { 26 : INHERITED(proxy, subset, uniqueID, props) {
26 } 27 }
27 virtual ~SkSpecialImage_Base() { } 28 virtual ~SkSpecialImage_Base() { }
28 29
29 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const = 0; 30 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const = 0;
30 31
31 virtual bool onPeekPixels(SkPixmap*) const { return false; } 32 virtual bool onGetROPixels(SkBitmap*) const = 0;
32 33
33 virtual GrTexture* onPeekTexture() const { return nullptr; } 34 virtual GrTexture* onPeekTexture() const { return nullptr; }
34 35
35 virtual bool testingOnlyOnGetROPixels(SkBitmap*) const = 0; 36 virtual GrTexture* onAsTextureRef(GrContext* context) const = 0;
36 37
37 // Delete this entry point ASAP (see skbug.com/4965) 38 // Delete this entry point ASAP (see skbug.com/4965)
38 virtual bool getBitmapDeprecated(SkBitmap* result) const = 0; 39 virtual bool getBitmapDeprecated(SkBitmap* result) const = 0;
39 40
40 virtual sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const = 0; 41 virtual sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const = 0;
41 42
42 virtual sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const = 0; 43 virtual sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const = 0;
43 44
44 virtual sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const = 0; 45 virtual sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const = 0;
45 46
(...skipping 17 matching lines...) Expand all
63 , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::Image ID() : uniqueID) 64 , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::Image ID() : uniqueID)
64 , fProxy(proxy) { 65 , fProxy(proxy) {
65 } 66 }
66 67
67 sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(SkImageFilter::Proxy* pro xy, 68 sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(SkImageFilter::Proxy* pro xy,
68 GrContext* context) { 69 GrContext* context) {
69 #if SK_SUPPORT_GPU 70 #if SK_SUPPORT_GPU
70 if (!context) { 71 if (!context) {
71 return nullptr; 72 return nullptr;
72 } 73 }
73 if (GrTexture* peek = as_SIB(this)->peekTexture()) { 74 if (GrTexture* peek = as_SIB(this)->onPeekTexture()) {
74 return peek->getContext() == context ? sk_sp<SkSpecialImage>(SkRef(this) ) : nullptr; 75 return peek->getContext() == context ? sk_sp<SkSpecialImage>(SkRef(this) ) : nullptr;
75 } 76 }
76 77
77 SkBitmap bmp; 78 SkBitmap bmp;
78 if (!this->internal_getBM(&bmp)) { 79 if (!this->internal_getBM(&bmp)) {
79 return nullptr; 80 return nullptr;
80 } 81 }
81 82
82 if (bmp.empty()) { 83 if (bmp.empty()) {
83 return SkSpecialImage::MakeFromRaster(proxy, SkIRect::MakeEmpty(), bmp, &this->props()); 84 return SkSpecialImage::MakeFromRaster(proxy, SkIRect::MakeEmpty(), bmp, &this->props());
(...skipping 13 matching lines...) Expand all
97 resultTex, &this->props(), at); 98 resultTex, &this->props(), at);
98 #else 99 #else
99 return nullptr; 100 return nullptr;
100 #endif 101 #endif
101 } 102 }
102 103
103 void SkSpecialImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPain t* paint) const { 104 void SkSpecialImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPain t* paint) const {
104 return as_SIB(this)->onDraw(canvas, x, y, paint); 105 return as_SIB(this)->onDraw(canvas, x, y, paint);
105 } 106 }
106 107
107 bool SkSpecialImage::peekPixels(SkPixmap* pixmap) const { 108 bool SkSpecialImage::getROPixels(SkBitmap* bm) const {
108 return as_SIB(this)->onPeekPixels(pixmap); 109 return as_SIB(this)->onGetROPixels(bm);
109 } 110 }
110 111
111 GrTexture* SkSpecialImage::peekTexture() const { 112 bool SkSpecialImage::isTextureBacked() const {
112 return as_SIB(this)->onPeekTexture(); 113 #if SK_SUPPORT_GPU
114 return as_SIB(this)->onPeekTexture() && as_SIB(this)->onPeekTexture()->getCo ntext();
115 #else
116 return nullptr;
Stephen White 2016/04/08 18:23:20 Nit: return false?
robertphillips 2016/04/08 18:57:50 Done.
117 #endif
113 } 118 }
114 119
115 bool SkSpecialImage::testingOnlyGetROPixels(SkBitmap* result) const { 120 GrContext* SkSpecialImage::getContext() const {
116 return as_SIB(this)->testingOnlyOnGetROPixels(result); 121 #if SK_SUPPORT_GPU
122 GrTexture* texture = as_SIB(this)->onPeekTexture();
123
124 if (texture) {
125 return texture->getContext();
126 }
127 #endif
128 return nullptr;
129 }
130
131
132 GrTexture* SkSpecialImage::asTextureRef(GrContext* context) const {
133 return as_SIB(this)->onAsTextureRef(context);
117 } 134 }
118 135
119 sk_sp<SkSpecialSurface> SkSpecialImage::makeSurface(const SkImageInfo& info) con st { 136 sk_sp<SkSpecialSurface> SkSpecialImage::makeSurface(const SkImageInfo& info) con st {
120 return as_SIB(this)->onMakeSurface(info); 137 return as_SIB(this)->onMakeSurface(info);
121 } 138 }
122 139
123 sk_sp<SkSurface> SkSpecialImage::makeTightSurface(const SkImageInfo& info) const { 140 sk_sp<SkSurface> SkSpecialImage::makeTightSurface(const SkImageInfo& info) const {
124 return as_SIB(this)->onMakeTightSurface(info); 141 return as_SIB(this)->onMakeTightSurface(info);
125 } 142 }
126 143
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 return 0; 216 return 0;
200 } 217 }
201 218
202 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const override { 219 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const override {
203 SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset ().height()); 220 SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset ().height());
204 221
205 canvas->drawImageRect(fImage.get(), this->subset(), 222 canvas->drawImageRect(fImage.get(), this->subset(),
206 dst, paint, SkCanvas::kStrict_SrcRectConstraint); 223 dst, paint, SkCanvas::kStrict_SrcRectConstraint);
207 } 224 }
208 225
209 bool onPeekPixels(SkPixmap* pixmap) const override { 226 bool onGetROPixels(SkBitmap* bm) const override {
210 return fImage->peekPixels(pixmap); 227 return as_IB(fImage)->getROPixels(bm);
211 } 228 }
212 229
213 GrTexture* onPeekTexture() const override { return as_IB(fImage.get())->peek Texture(); } 230 GrTexture* onPeekTexture() const override { return as_IB(fImage)->peekTextur e(); }
231
232 GrTexture* onAsTextureRef(GrContext* context) const override {
233 #if SK_SUPPORT_GPU
234 return as_IB(fImage)->asTextureRef(context, GrTextureParams::ClampNoFilt er());
235 #else
236 return nullptr;
237 #endif
238 }
214 239
215 bool getBitmapDeprecated(SkBitmap* result) const override { 240 bool getBitmapDeprecated(SkBitmap* result) const override {
216 #if SK_SUPPORT_GPU 241 #if SK_SUPPORT_GPU
217 if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) { 242 if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) {
218 const SkImageInfo info = GrMakeInfoFromTexture(texture, 243 const SkImageInfo info = GrMakeInfoFromTexture(texture,
219 fImage->width(), fIma ge->height(), 244 fImage->width(), fIma ge->height(),
220 fImage->isOpaque()); 245 fImage->isOpaque());
221 if (!result->setInfo(info)) { 246 if (!result->setInfo(info)) {
222 return false; 247 return false;
223 } 248 }
224 249
225 result->setPixelRef(new SkGrPixelRef(info, texture))->unref(); 250 result->setPixelRef(new SkGrPixelRef(info, texture))->unref();
226 return true; 251 return true;
227 } 252 }
228 #endif 253 #endif
229 254
230 return as_IB(fImage.get())->asBitmapForImageFilters(result); 255 return as_IB(fImage.get())->asBitmapForImageFilters(result);
231 } 256 }
232 257
233 bool testingOnlyOnGetROPixels(SkBitmap* result) const override {
234 return fImage->asLegacyBitmap(result, SkImage::kRO_LegacyBitmapMode);
235 }
236
237 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid e { 258 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid e {
238 #if SK_SUPPORT_GPU 259 #if SK_SUPPORT_GPU
239 GrTexture* texture = as_IB(fImage.get())->peekTexture(); 260 GrTexture* texture = as_IB(fImage.get())->peekTexture();
240 if (texture) { 261 if (texture) {
241 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *texture->getCon text()->caps()); 262 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *texture->getCon text()->caps());
242 desc.fFlags = kRenderTarget_GrSurfaceFlag; 263 desc.fFlags = kRenderTarget_GrSurfaceFlag;
243 264
244 return SkSpecialSurface::MakeRenderTarget(this->proxy(), texture->ge tContext(), desc); 265 return SkSpecialSurface::MakeRenderTarget(this->proxy(), texture->ge tContext(), desc);
245 } 266 }
246 #endif 267 #endif
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 size_t getSize() const override { return fBitmap.getSize(); } 360 size_t getSize() const override { return fBitmap.getSize(); }
340 361
341 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const override { 362 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const override {
342 SkRect dst = SkRect::MakeXYWH(x, y, 363 SkRect dst = SkRect::MakeXYWH(x, y,
343 this->subset().width(), this->subset().hei ght()); 364 this->subset().width(), this->subset().hei ght());
344 365
345 canvas->drawBitmapRect(fBitmap, this->subset(), 366 canvas->drawBitmapRect(fBitmap, this->subset(),
346 dst, paint, SkCanvas::kStrict_SrcRectConstraint); 367 dst, paint, SkCanvas::kStrict_SrcRectConstraint);
347 } 368 }
348 369
349 bool onPeekPixels(SkPixmap* pixmap) const override { 370 bool onGetROPixels(SkBitmap* bm) const override {
350 const SkImageInfo info = fBitmap.info(); 371 *bm = fBitmap;
372 return true;
373 }
351 374
352 if (kUnknown_SkColorType == info.colorType()) { 375 GrTexture* onAsTextureRef(GrContext* context) const override {
353 return false; 376 #if SK_SUPPORT_GPU
377 if (!context) {
Stephen White 2016/04/08 18:23:20 micronit: for brevity, this could be #if SK_SUPPO
robertphillips 2016/04/08 18:57:50 Done.
378 return nullptr;
354 } 379 }
355 380
356 if (!fBitmap.peekPixels(pixmap)) { 381 return GrRefCachedBitmapTexture(context, fBitmap, GrTextureParams::Clamp NoFilter());
357 fBitmap.lockPixels(); 382 #endif
358 }
359 383
360 return fBitmap.peekPixels(pixmap); 384 return nullptr;
361 } 385 }
362 386
363 bool getBitmapDeprecated(SkBitmap* result) const override { 387 bool getBitmapDeprecated(SkBitmap* result) const override {
364 *result = fBitmap; 388 *result = fBitmap;
365 return true; 389 return true;
366 } 390 }
367 391
368 bool testingOnlyOnGetROPixels(SkBitmap* result) const override {
369 *result = fBitmap;
370 return true;
371 }
372
373 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid e { 392 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid e {
374 return SkSpecialSurface::MakeRaster(this->proxy(), info, nullptr); 393 return SkSpecialSurface::MakeRaster(this->proxy(), info, nullptr);
375 } 394 }
376 395
377 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { 396 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
378 SkBitmap subsetBM; 397 SkBitmap subsetBM;
379 398
380 if (!fBitmap.extractSubset(&subsetBM, subset)) { 399 if (!fBitmap.extractSubset(&subsetBM, subset)) {
381 return nullptr; 400 return nullptr;
382 } 401 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 #include "GrTexture.h" 455 #include "GrTexture.h"
437 #include "SkImage_Gpu.h" 456 #include "SkImage_Gpu.h"
438 457
439 class SkSpecialImage_Gpu : public SkSpecialImage_Base { 458 class SkSpecialImage_Gpu : public SkSpecialImage_Base {
440 public: 459 public:
441 SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset, 460 SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset,
442 uint32_t uniqueID, GrTexture* tex, SkAlphaType at, 461 uint32_t uniqueID, GrTexture* tex, SkAlphaType at,
443 const SkSurfaceProps* props) 462 const SkSurfaceProps* props)
444 : INHERITED(proxy, subset, uniqueID, props) 463 : INHERITED(proxy, subset, uniqueID, props)
445 , fTexture(SkRef(tex)) 464 , fTexture(SkRef(tex))
446 , fAlphaType(at) { 465 , fAlphaType(at)
466 , fAddedRasterVersionToCache(false) {
447 } 467 }
448 468
449 ~SkSpecialImage_Gpu() override { } 469 ~SkSpecialImage_Gpu() override {
470 if (fAddedRasterVersionToCache.load()) {
471 SkNotifyBitmapGenIDIsStale(this->uniqueID());
472 }
473 }
450 474
451 bool isOpaque() const override { 475 bool isOpaque() const override {
452 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaqu e_SkAlphaType; 476 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaqu e_SkAlphaType;
453 } 477 }
454 478
455 size_t getSize() const override { return fTexture->gpuMemorySize(); } 479 size_t getSize() const override { return fTexture->gpuMemorySize(); }
456 480
457 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const override { 481 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const override {
458 SkRect dst = SkRect::MakeXYWH(x, y, 482 SkRect dst = SkRect::MakeXYWH(x, y,
459 this->subset().width(), this->subset().hei ght()); 483 this->subset().width(), this->subset().hei ght());
460 484
461 SkBitmap bm; 485 SkBitmap bm;
462 486
463 GrWrapTextureInBitmap(fTexture, 487 GrWrapTextureInBitmap(fTexture,
464 fTexture->width(), fTexture->height(), this->isOpa que(), &bm); 488 fTexture->width(), fTexture->height(), this->isOpa que(), &bm);
465 489
466 canvas->drawBitmapRect(bm, this->subset(), 490 canvas->drawBitmapRect(bm, this->subset(),
467 dst, paint, SkCanvas::kStrict_SrcRectConstraint); 491 dst, paint, SkCanvas::kStrict_SrcRectConstraint);
468 } 492 }
469 493
470 GrTexture* onPeekTexture() const override { return fTexture; } 494 GrTexture* onPeekTexture() const override { return fTexture; }
471 495
496 GrTexture* onAsTextureRef(GrContext*) const override { return SkRef(fTexture .get()); }
497
498 bool onGetROPixels(SkBitmap* dst) const override {
499 if (SkBitmapCache::Find(this->uniqueID(), dst)) {
500 SkASSERT(dst->getGenerationID() == this->uniqueID());
501 SkASSERT(dst->isImmutable());
502 SkASSERT(dst->getPixels());
503 return true;
504 }
505
506 SkImageInfo info = SkImageInfo::MakeN32(this->width(), this->height(),
507 this->isOpaque() ? kOpaque_SkAlp haType
508 : kPremul_SkAlp haType);
509
510 if (!dst->tryAllocPixels(info)) {
511 return false;
512 }
513
514 if (!fTexture->readPixels(0, 0, dst->width(), dst->height(), kSkia8888_G rPixelConfig,
515 dst->getPixels(), dst->rowBytes())) {
516 return false;
517 }
518
519 dst->pixelRef()->setImmutableWithID(this->uniqueID());
520 SkBitmapCache::Add(this->uniqueID(), *dst);
521 fAddedRasterVersionToCache.store(true);
522 return true;
523 }
524
472 bool getBitmapDeprecated(SkBitmap* result) const override { 525 bool getBitmapDeprecated(SkBitmap* result) const override {
473 const SkImageInfo info = GrMakeInfoFromTexture(fTexture, 526 const SkImageInfo info = GrMakeInfoFromTexture(fTexture,
474 this->width(), this->heig ht(), 527 this->width(), this->heig ht(),
475 this->isOpaque()); 528 this->isOpaque());
476 if (!result->setInfo(info)) { 529 if (!result->setInfo(info)) {
477 return false; 530 return false;
478 } 531 }
479 532
480 const SkImageInfo prInfo = info.makeWH(fTexture->width(), fTexture->heig ht()); 533 const SkImageInfo prInfo = info.makeWH(fTexture->width(), fTexture->heig ht());
481 534
482 SkAutoTUnref<SkGrPixelRef> pixelRef(new SkGrPixelRef(prInfo, fTexture)); 535 SkAutoTUnref<SkGrPixelRef> pixelRef(new SkGrPixelRef(prInfo, fTexture));
483 result->setPixelRef(pixelRef, this->subset().fLeft, this->subset().fTop) ; 536 result->setPixelRef(pixelRef, this->subset().fLeft, this->subset().fTop) ;
484 return true; 537 return true;
485 } 538 }
486 539
487 bool testingOnlyOnGetROPixels(SkBitmap* result) const override {
488
489 const SkImageInfo info = SkImageInfo::MakeN32(this->width(),
490 this->height(),
491 this->isOpaque() ? kOpaque _SkAlphaType
492 : kPremul _SkAlphaType);
493 if (!result->tryAllocPixels(info)) {
494 return false;
495 }
496
497 if (!fTexture->readPixels(0, 0, result->width(), result->height(), kSkia 8888_GrPixelConfig,
498 result->getPixels(), result->rowBytes())) {
499 return false;
500 }
501
502 result->pixelRef()->setImmutable();
503 return true;
504 }
505
506 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid e { 540 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid e {
507 if (!fTexture->getContext()) { 541 if (!fTexture->getContext()) {
508 return nullptr; 542 return nullptr;
509 } 543 }
510 544
511 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *fTexture->getContex t()->caps()); 545 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *fTexture->getContex t()->caps());
512 desc.fFlags = kRenderTarget_GrSurfaceFlag; 546 desc.fFlags = kRenderTarget_GrSurfaceFlag;
513 547
514 return SkSpecialSurface::MakeRenderTarget(this->proxy(), fTexture->getCo ntext(), desc); 548 return SkSpecialSurface::MakeRenderTarget(this->proxy(), fTexture->getCo ntext(), desc);
515 } 549 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 fAlphaType, subTx, SkBudgeted::kYes); 582 fAlphaType, subTx, SkBudgeted::kYes);
549 } 583 }
550 584
551 sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override { 585 sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override {
552 return SkSurface::MakeRenderTarget(fTexture->getContext(), SkBudgeted::k Yes, info); 586 return SkSurface::MakeRenderTarget(fTexture->getContext(), SkBudgeted::k Yes, info);
553 } 587 }
554 588
555 private: 589 private:
556 SkAutoTUnref<GrTexture> fTexture; 590 SkAutoTUnref<GrTexture> fTexture;
557 const SkAlphaType fAlphaType; 591 const SkAlphaType fAlphaType;
592 mutable SkAtomic<bool> fAddedRasterVersionToCache;
558 593
559 typedef SkSpecialImage_Base INHERITED; 594 typedef SkSpecialImage_Base INHERITED;
560 }; 595 };
561 596
562 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, 597 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy,
563 const SkIRect& subset, 598 const SkIRect& subset,
564 uint32_t uniqueID, 599 uint32_t uniqueID,
565 GrTexture* tex, 600 GrTexture* tex,
566 const SkSurfaceProps* props, 601 const SkSurfaceProps* props,
567 SkAlphaType at) { 602 SkAlphaType at) {
568 SkASSERT(rect_fits(subset, tex->width(), tex->height())); 603 SkASSERT(rect_fits(subset, tex->width(), tex->height()));
569 return sk_make_sp<SkSpecialImage_Gpu>(proxy, subset, uniqueID, tex, at, prop s); 604 return sk_make_sp<SkSpecialImage_Gpu>(proxy, subset, uniqueID, tex, at, prop s);
570 } 605 }
571 606
572 #else 607 #else
573 608
574 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, 609 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy,
575 const SkIRect& subset, 610 const SkIRect& subset,
576 uint32_t uniqueID, 611 uint32_t uniqueID,
577 GrTexture* tex, 612 GrTexture* tex,
578 const SkSurfaceProps* props, 613 const SkSurfaceProps* props,
579 SkAlphaType at) { 614 SkAlphaType at) {
580 return nullptr; 615 return nullptr;
581 } 616 }
582 617
583 #endif 618 #endif
OLDNEW
« no previous file with comments | « src/core/SkSpecialImage.h ('k') | src/effects/SkBlurImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698