| 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 #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 | 19 |
| 19 /////////////////////////////////////////////////////////////////////////////// | 20 /////////////////////////////////////////////////////////////////////////////// |
| 20 class SkSpecialImage_Base : public SkSpecialImage { | 21 class SkSpecialImage_Base : public SkSpecialImage { |
| 21 public: | 22 public: |
| 22 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint
32_t uniqueID) | 23 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint
32_t uniqueID) |
| 23 : INHERITED(proxy, subset, uniqueID) { | 24 : INHERITED(proxy, subset, uniqueID) { |
| 24 } | 25 } |
| 25 virtual ~SkSpecialImage_Base() { } | 26 virtual ~SkSpecialImage_Base() { } |
| 26 | 27 |
| 27 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const
= 0; | 28 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const
= 0; |
| 28 | 29 |
| 29 virtual bool onPeekPixels(SkPixmap*) const { return false; } | 30 virtual bool onGetROPixels(SkBitmap*) const = 0; |
| 30 | 31 |
| 31 virtual GrTexture* onPeekTexture() const { return nullptr; } | 32 virtual GrTexture* onPeekTexture() const { return nullptr; } |
| 32 | 33 |
| 33 virtual bool testingOnlyOnGetROPixels(SkBitmap*) const = 0; | 34 virtual GrTexture* onAsTextureRef(GrContext* context) const = 0; |
| 34 | 35 |
| 35 // Delete this entry point ASAP (see skbug.com/4965) | 36 // Delete this entry point ASAP (see skbug.com/4965) |
| 36 virtual bool getBitmapDeprecated(SkBitmap* result) const = 0; | 37 virtual bool getBitmapDeprecated(SkBitmap* result) const = 0; |
| 37 | 38 |
| 38 virtual sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const = 0; | 39 virtual sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const = 0; |
| 39 | 40 |
| 40 virtual sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const
= 0; | 41 virtual sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const
= 0; |
| 41 | 42 |
| 42 virtual sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const = 0; | 43 virtual sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const = 0; |
| 43 | 44 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 resultTex, at); | 86 resultTex, at); |
| 86 #else | 87 #else |
| 87 return nullptr; | 88 return nullptr; |
| 88 #endif | 89 #endif |
| 89 } | 90 } |
| 90 | 91 |
| 91 void SkSpecialImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPain
t* paint) const { | 92 void SkSpecialImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPain
t* paint) const { |
| 92 return as_SIB(this)->onDraw(canvas, x, y, paint); | 93 return as_SIB(this)->onDraw(canvas, x, y, paint); |
| 93 } | 94 } |
| 94 | 95 |
| 95 bool SkSpecialImage::peekPixels(SkPixmap* pixmap) const { | 96 bool SkSpecialImage::getROPixels(SkBitmap* bm) const { |
| 96 return as_SIB(this)->onPeekPixels(pixmap); | 97 return as_SIB(this)->onGetROPixels(bm); |
| 97 } | 98 } |
| 98 | 99 |
| 99 GrTexture* SkSpecialImage::peekTexture() const { | 100 GrTexture* SkSpecialImage::peekTexture() const { |
| 100 return as_SIB(this)->onPeekTexture(); | 101 return as_SIB(this)->onPeekTexture(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 bool SkSpecialImage::testingOnlyGetROPixels(SkBitmap* result) const { | 104 GrTexture* SkSpecialImage::asTextureRef(GrContext* context) const { |
| 104 return as_SIB(this)->testingOnlyOnGetROPixels(result); | 105 return as_SIB(this)->onAsTextureRef(context); |
| 105 } | 106 } |
| 106 | 107 |
| 107 sk_sp<SkSpecialSurface> SkSpecialImage::makeSurface(const SkImageInfo& info) con
st { | 108 sk_sp<SkSpecialSurface> SkSpecialImage::makeSurface(const SkImageInfo& info) con
st { |
| 108 return as_SIB(this)->onMakeSurface(info); | 109 return as_SIB(this)->onMakeSurface(info); |
| 109 } | 110 } |
| 110 | 111 |
| 111 sk_sp<SkSurface> SkSpecialImage::makeTightSurface(const SkImageInfo& info) const
{ | 112 sk_sp<SkSurface> SkSpecialImage::makeTightSurface(const SkImageInfo& info) const
{ |
| 112 return as_SIB(this)->onMakeTightSurface(info); | 113 return as_SIB(this)->onMakeTightSurface(info); |
| 113 } | 114 } |
| 114 | 115 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return 0; | 185 return 0; |
| 185 } | 186 } |
| 186 | 187 |
| 187 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { | 188 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { |
| 188 SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset
().height()); | 189 SkRect dst = SkRect::MakeXYWH(x, y, this->subset().width(), this->subset
().height()); |
| 189 | 190 |
| 190 canvas->drawImageRect(fImage.get(), this->subset(), | 191 canvas->drawImageRect(fImage.get(), this->subset(), |
| 191 dst, paint, SkCanvas::kStrict_SrcRectConstraint); | 192 dst, paint, SkCanvas::kStrict_SrcRectConstraint); |
| 192 } | 193 } |
| 193 | 194 |
| 194 bool onPeekPixels(SkPixmap* pixmap) const override { | 195 bool onGetROPixels(SkBitmap* bm) const override { |
| 195 return fImage->peekPixels(pixmap); | 196 return as_IB(fImage)->getROPixels(bm); |
| 196 } | 197 } |
| 197 | 198 |
| 198 GrTexture* onPeekTexture() const override { return as_IB(fImage.get())->peek
Texture(); } | 199 GrTexture* onPeekTexture() const override { return as_IB(fImage)->peekTextur
e(); } |
| 200 |
| 201 GrTexture* onAsTextureRef(GrContext* context) const override { |
| 202 #if SK_SUPPORT_GPU |
| 203 return as_IB(fImage)->asTextureRef(context, GrTextureParams::ClampNoFilt
er()); |
| 204 #else |
| 205 return nullptr; |
| 206 #endif |
| 207 } |
| 199 | 208 |
| 200 bool getBitmapDeprecated(SkBitmap* result) const override { | 209 bool getBitmapDeprecated(SkBitmap* result) const override { |
| 201 #if SK_SUPPORT_GPU | 210 #if SK_SUPPORT_GPU |
| 202 if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) { | 211 if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) { |
| 203 const SkImageInfo info = GrMakeInfoFromTexture(texture, | 212 const SkImageInfo info = GrMakeInfoFromTexture(texture, |
| 204 fImage->width(), fIma
ge->height(), | 213 fImage->width(), fIma
ge->height(), |
| 205 fImage->isOpaque()); | 214 fImage->isOpaque()); |
| 206 if (!result->setInfo(info)) { | 215 if (!result->setInfo(info)) { |
| 207 return false; | 216 return false; |
| 208 } | 217 } |
| 209 | 218 |
| 210 result->setPixelRef(new SkGrPixelRef(info, texture))->unref(); | 219 result->setPixelRef(new SkGrPixelRef(info, texture))->unref(); |
| 211 return true; | 220 return true; |
| 212 } | 221 } |
| 213 #endif | 222 #endif |
| 214 | 223 |
| 215 return as_IB(fImage.get())->asBitmapForImageFilters(result); | 224 return as_IB(fImage.get())->asBitmapForImageFilters(result); |
| 216 } | 225 } |
| 217 | 226 |
| 218 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { | |
| 219 return fImage->asLegacyBitmap(result, SkImage::kRO_LegacyBitmapMode); | |
| 220 } | |
| 221 | |
| 222 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { | 227 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { |
| 223 #if SK_SUPPORT_GPU | 228 #if SK_SUPPORT_GPU |
| 224 GrTexture* texture = as_IB(fImage.get())->peekTexture(); | 229 GrTexture* texture = as_IB(fImage.get())->peekTexture(); |
| 225 if (texture) { | 230 if (texture) { |
| 226 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *texture->getCon
text()->caps()); | 231 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *texture->getCon
text()->caps()); |
| 227 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 232 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 228 | 233 |
| 229 return SkSpecialSurface::MakeRenderTarget(this->proxy(), texture->ge
tContext(), desc); | 234 return SkSpecialSurface::MakeRenderTarget(this->proxy(), texture->ge
tContext(), desc); |
| 230 } | 235 } |
| 231 #endif | 236 #endif |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 size_t getSize() const override { return fBitmap.getSize(); } | 325 size_t getSize() const override { return fBitmap.getSize(); } |
| 321 | 326 |
| 322 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { | 327 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { |
| 323 SkRect dst = SkRect::MakeXYWH(x, y, | 328 SkRect dst = SkRect::MakeXYWH(x, y, |
| 324 this->subset().width(), this->subset().hei
ght()); | 329 this->subset().width(), this->subset().hei
ght()); |
| 325 | 330 |
| 326 canvas->drawBitmapRect(fBitmap, this->subset(), | 331 canvas->drawBitmapRect(fBitmap, this->subset(), |
| 327 dst, paint, SkCanvas::kStrict_SrcRectConstraint); | 332 dst, paint, SkCanvas::kStrict_SrcRectConstraint); |
| 328 } | 333 } |
| 329 | 334 |
| 330 bool onPeekPixels(SkPixmap* pixmap) const override { | 335 bool onGetROPixels(SkBitmap* bm) const override { |
| 331 const SkImageInfo info = fBitmap.info(); | 336 *bm = fBitmap; |
| 337 return true; |
| 338 } |
| 332 | 339 |
| 333 if (kUnknown_SkColorType == info.colorType()) { | 340 GrTexture* onAsTextureRef(GrContext* context) const override { |
| 334 return false; | 341 #if SK_SUPPORT_GPU |
| 342 if (!context) { |
| 343 return nullptr; |
| 335 } | 344 } |
| 336 | 345 |
| 337 if (!fBitmap.peekPixels(pixmap)) { | 346 return GrRefCachedBitmapTexture(context, fBitmap, GrTextureParams::Clamp
NoFilter()); |
| 338 fBitmap.lockPixels(); | 347 #endif |
| 339 } | |
| 340 | 348 |
| 341 return fBitmap.peekPixels(pixmap); | 349 return nullptr; |
| 342 } | 350 } |
| 343 | 351 |
| 344 bool getBitmapDeprecated(SkBitmap* result) const override { | 352 bool getBitmapDeprecated(SkBitmap* result) const override { |
| 345 *result = fBitmap; | 353 *result = fBitmap; |
| 346 return true; | 354 return true; |
| 347 } | 355 } |
| 348 | 356 |
| 349 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { | |
| 350 *result = fBitmap; | |
| 351 return true; | |
| 352 } | |
| 353 | |
| 354 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { | 357 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { |
| 355 return SkSpecialSurface::MakeRaster(this->proxy(), info, nullptr); | 358 return SkSpecialSurface::MakeRaster(this->proxy(), info, nullptr); |
| 356 } | 359 } |
| 357 | 360 |
| 358 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { | 361 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { |
| 359 SkBitmap subsetBM; | 362 SkBitmap subsetBM; |
| 360 | 363 |
| 361 if (!fBitmap.extractSubset(&subsetBM, subset)) { | 364 if (!fBitmap.extractSubset(&subsetBM, subset)) { |
| 362 return nullptr; | 365 return nullptr; |
| 363 } | 366 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 /////////////////////////////////////////////////////////////////////////////// | 416 /////////////////////////////////////////////////////////////////////////////// |
| 414 #include "GrTexture.h" | 417 #include "GrTexture.h" |
| 415 #include "SkImage_Gpu.h" | 418 #include "SkImage_Gpu.h" |
| 416 | 419 |
| 417 class SkSpecialImage_Gpu : public SkSpecialImage_Base { | 420 class SkSpecialImage_Gpu : public SkSpecialImage_Base { |
| 418 public: | 421 public: |
| 419 SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset, | 422 SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset, |
| 420 uint32_t uniqueID, GrTexture* tex, SkAlphaType at) | 423 uint32_t uniqueID, GrTexture* tex, SkAlphaType at) |
| 421 : INHERITED(proxy, subset, uniqueID) | 424 : INHERITED(proxy, subset, uniqueID) |
| 422 , fTexture(SkRef(tex)) | 425 , fTexture(SkRef(tex)) |
| 423 , fAlphaType(at) { | 426 , fAlphaType(at) |
| 427 , fAddedRasterVersionToCache(false) { |
| 424 } | 428 } |
| 425 | 429 |
| 426 ~SkSpecialImage_Gpu() override { } | 430 ~SkSpecialImage_Gpu() override { |
| 431 if (fAddedRasterVersionToCache.load()) { |
| 432 SkNotifyBitmapGenIDIsStale(this->uniqueID()); |
| 433 } |
| 434 } |
| 427 | 435 |
| 428 bool isOpaque() const override { | 436 bool isOpaque() const override { |
| 429 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaqu
e_SkAlphaType; | 437 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaqu
e_SkAlphaType; |
| 430 } | 438 } |
| 431 | 439 |
| 432 size_t getSize() const override { return fTexture->gpuMemorySize(); } | 440 size_t getSize() const override { return fTexture->gpuMemorySize(); } |
| 433 | 441 |
| 434 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { | 442 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { |
| 435 SkRect dst = SkRect::MakeXYWH(x, y, | 443 SkRect dst = SkRect::MakeXYWH(x, y, |
| 436 this->subset().width(), this->subset().hei
ght()); | 444 this->subset().width(), this->subset().hei
ght()); |
| 437 | 445 |
| 438 SkBitmap bm; | 446 SkBitmap bm; |
| 439 | 447 |
| 440 GrWrapTextureInBitmap(fTexture, | 448 GrWrapTextureInBitmap(fTexture, |
| 441 fTexture->width(), fTexture->height(), this->isOpa
que(), &bm); | 449 fTexture->width(), fTexture->height(), this->isOpa
que(), &bm); |
| 442 | 450 |
| 443 canvas->drawBitmapRect(bm, this->subset(), | 451 canvas->drawBitmapRect(bm, this->subset(), |
| 444 dst, paint, SkCanvas::kStrict_SrcRectConstraint); | 452 dst, paint, SkCanvas::kStrict_SrcRectConstraint); |
| 445 } | 453 } |
| 446 | 454 |
| 447 GrTexture* onPeekTexture() const override { return fTexture; } | 455 GrTexture* onPeekTexture() const override { return fTexture; } |
| 448 | 456 |
| 457 GrTexture* onAsTextureRef(GrContext*) const override { return SkRef(fTexture
.get()); } |
| 458 |
| 459 bool onGetROPixels(SkBitmap* dst) const override { |
| 460 if (SkBitmapCache::Find(this->uniqueID(), dst)) { |
| 461 SkASSERT(dst->getGenerationID() == this->uniqueID()); |
| 462 SkASSERT(dst->isImmutable()); |
| 463 SkASSERT(dst->getPixels()); |
| 464 return true; |
| 465 } |
| 466 |
| 467 SkImageInfo info = SkImageInfo::MakeN32(this->width(), this->height(), |
| 468 this->isOpaque() ? kOpaque_SkAlp
haType |
| 469 : kPremul_SkAlp
haType); |
| 470 |
| 471 if (!dst->tryAllocPixels(info)) { |
| 472 return false; |
| 473 } |
| 474 |
| 475 if (!fTexture->readPixels(0, 0, dst->width(), dst->height(), kSkia8888_G
rPixelConfig, |
| 476 dst->getPixels(), dst->rowBytes())) { |
| 477 return false; |
| 478 } |
| 479 |
| 480 dst->pixelRef()->setImmutableWithID(this->uniqueID()); |
| 481 SkBitmapCache::Add(this->uniqueID(), *dst); |
| 482 fAddedRasterVersionToCache.store(true); |
| 483 return true; |
| 484 } |
| 485 |
| 449 bool getBitmapDeprecated(SkBitmap* result) const override { | 486 bool getBitmapDeprecated(SkBitmap* result) const override { |
| 450 const SkImageInfo info = GrMakeInfoFromTexture(fTexture, | 487 const SkImageInfo info = GrMakeInfoFromTexture(fTexture, |
| 451 this->width(), this->heig
ht(), | 488 this->width(), this->heig
ht(), |
| 452 this->isOpaque()); | 489 this->isOpaque()); |
| 453 if (!result->setInfo(info)) { | 490 if (!result->setInfo(info)) { |
| 454 return false; | 491 return false; |
| 455 } | 492 } |
| 456 | 493 |
| 457 const SkImageInfo prInfo = info.makeWH(fTexture->width(), fTexture->heig
ht()); | 494 const SkImageInfo prInfo = info.makeWH(fTexture->width(), fTexture->heig
ht()); |
| 458 | 495 |
| 459 SkAutoTUnref<SkGrPixelRef> pixelRef(new SkGrPixelRef(prInfo, fTexture)); | 496 SkAutoTUnref<SkGrPixelRef> pixelRef(new SkGrPixelRef(prInfo, fTexture)); |
| 460 result->setPixelRef(pixelRef, this->subset().fLeft, this->subset().fTop)
; | 497 result->setPixelRef(pixelRef, this->subset().fLeft, this->subset().fTop)
; |
| 461 return true; | 498 return true; |
| 462 } | 499 } |
| 463 | 500 |
| 464 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { | |
| 465 | |
| 466 const SkImageInfo info = SkImageInfo::MakeN32(this->width(), | |
| 467 this->height(), | |
| 468 this->isOpaque() ? kOpaque
_SkAlphaType | |
| 469 : kPremul
_SkAlphaType); | |
| 470 if (!result->tryAllocPixels(info)) { | |
| 471 return false; | |
| 472 } | |
| 473 | |
| 474 if (!fTexture->readPixels(0, 0, result->width(), result->height(), kSkia
8888_GrPixelConfig, | |
| 475 result->getPixels(), result->rowBytes())) { | |
| 476 return false; | |
| 477 } | |
| 478 | |
| 479 result->pixelRef()->setImmutable(); | |
| 480 return true; | |
| 481 } | |
| 482 | |
| 483 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { | 501 sk_sp<SkSpecialSurface> onMakeSurface(const SkImageInfo& info) const overrid
e { |
| 484 if (!fTexture->getContext()) { | 502 if (!fTexture->getContext()) { |
| 485 return nullptr; | 503 return nullptr; |
| 486 } | 504 } |
| 487 | 505 |
| 488 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *fTexture->getContex
t()->caps()); | 506 GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(info, *fTexture->getContex
t()->caps()); |
| 489 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 507 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 490 | 508 |
| 491 return SkSpecialSurface::MakeRenderTarget(this->proxy(), fTexture->getCo
ntext(), desc); | 509 return SkSpecialSurface::MakeRenderTarget(this->proxy(), fTexture->getCo
ntext(), desc); |
| 492 } | 510 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 fAlphaType, subTx, SkBudgeted::kYes); | 542 fAlphaType, subTx, SkBudgeted::kYes); |
| 525 } | 543 } |
| 526 | 544 |
| 527 sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override
{ | 545 sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override
{ |
| 528 return SkSurface::MakeRenderTarget(fTexture->getContext(), SkBudgeted::k
Yes, info); | 546 return SkSurface::MakeRenderTarget(fTexture->getContext(), SkBudgeted::k
Yes, info); |
| 529 } | 547 } |
| 530 | 548 |
| 531 private: | 549 private: |
| 532 SkAutoTUnref<GrTexture> fTexture; | 550 SkAutoTUnref<GrTexture> fTexture; |
| 533 const SkAlphaType fAlphaType; | 551 const SkAlphaType fAlphaType; |
| 552 mutable SkAtomic<bool> fAddedRasterVersionToCache; |
| 534 | 553 |
| 535 typedef SkSpecialImage_Base INHERITED; | 554 typedef SkSpecialImage_Base INHERITED; |
| 536 }; | 555 }; |
| 537 | 556 |
| 538 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, | 557 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, |
| 539 const SkIRect& subset, | 558 const SkIRect& subset, |
| 540 uint32_t uniqueID, | 559 uint32_t uniqueID, |
| 541 GrTexture* tex, | 560 GrTexture* tex, |
| 542 SkAlphaType at) { | 561 SkAlphaType at) { |
| 543 SkASSERT(rect_fits(subset, tex->width(), tex->height())); | 562 SkASSERT(rect_fits(subset, tex->width(), tex->height())); |
| 544 return sk_make_sp<SkSpecialImage_Gpu>(proxy, subset, uniqueID, tex, at); | 563 return sk_make_sp<SkSpecialImage_Gpu>(proxy, subset, uniqueID, tex, at); |
| 545 } | 564 } |
| 546 | 565 |
| 547 #else | 566 #else |
| 548 | 567 |
| 549 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, | 568 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, |
| 550 const SkIRect& subset, | 569 const SkIRect& subset, |
| 551 uint32_t uniqueID, | 570 uint32_t uniqueID, |
| 552 GrTexture* tex, | 571 GrTexture* tex, |
| 553 SkAlphaType at) { | 572 SkAlphaType at) { |
| 554 return nullptr; | 573 return nullptr; |
| 555 } | 574 } |
| 556 | 575 |
| 557 #endif | 576 #endif |
| OLD | NEW |