diff options
-rw-r--r-- | gm/deferredtextureimage.cpp | 7 | ||||
-rw-r--r-- | include/core/SkImage.h | 8 | ||||
-rw-r--r-- | src/core/SkAutoPixmapStorage.cpp | 10 | ||||
-rw-r--r-- | src/core/SkAutoPixmapStorage.h | 5 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 30 | ||||
-rw-r--r-- | tests/ImageTest.cpp | 7 |
6 files changed, 11 insertions, 56 deletions
diff --git a/gm/deferredtextureimage.cpp b/gm/deferredtextureimage.cpp index db070fc654..9c1fe6a6f2 100644 --- a/gm/deferredtextureimage.cpp +++ b/gm/deferredtextureimage.cpp @@ -154,13 +154,6 @@ DEF_SIMPLE_GM(deferred_texture_image_low, canvas, 512 + 512 + 30, 512 + 20) { DrawDeferredTextureImageData(canvas, ¶ms); } -DEF_SIMPLE_GM(deferred_texture_image_low_dithered, canvas, 512 + 512 + 30, 512 + 20) { - auto params = SkImage::DeferredTextureImageUsageParams(SkMatrix::MakeScale(0.25f, 0.25f), - kLow_SkFilterQuality, 0, - kARGB_4444_SkColorType); - DrawDeferredTextureImageData(canvas, ¶ms); -} - DEF_SIMPLE_GM(deferred_texture_image_medium_encoded, canvas, 512 + 512 + 30, 1110) { sk_sp<SkImage> encodedImage = GetResourceAsImage("mandrill_512.png"); if (!encodedImage) { diff --git a/include/core/SkImage.h b/include/core/SkImage.h index b896856b68..bc0597c300 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -447,15 +447,11 @@ public: /** Drawing params for which a deferred texture image data should be optimized. */ struct DeferredTextureImageUsageParams { DeferredTextureImageUsageParams(const SkMatrix matrix, const SkFilterQuality quality, - int preScaleMipLevel, - SkColorType colorType = kN32_SkColorType) - : fMatrix(matrix), fQuality(quality), fPreScaleMipLevel(preScaleMipLevel), - fColorType(colorType) {} + int preScaleMipLevel) + : fMatrix(matrix), fQuality(quality), fPreScaleMipLevel(preScaleMipLevel) {} SkMatrix fMatrix; SkFilterQuality fQuality; int fPreScaleMipLevel; - SkColorType fColorType; - }; /** diff --git a/src/core/SkAutoPixmapStorage.cpp b/src/core/SkAutoPixmapStorage.cpp index 5ad19390c6..865b3a6029 100644 --- a/src/core/SkAutoPixmapStorage.cpp +++ b/src/core/SkAutoPixmapStorage.cpp @@ -14,16 +14,6 @@ SkAutoPixmapStorage::~SkAutoPixmapStorage() { this->freeStorage(); } -SkAutoPixmapStorage& SkAutoPixmapStorage::operator=(SkAutoPixmapStorage&& other) { - this->fStorage = other.fStorage; - this->INHERITED::reset(other.info(), this->fStorage, other.rowBytes(), other.ctable()); - - other.fStorage = nullptr; - other.INHERITED::reset(); - - return *this; -} - size_t SkAutoPixmapStorage::AllocSize(const SkImageInfo& info, size_t* rowBytes) { size_t rb = info.minRowBytes(); if (rowBytes) { diff --git a/src/core/SkAutoPixmapStorage.h b/src/core/SkAutoPixmapStorage.h index 6342a41deb..66c5655e54 100644 --- a/src/core/SkAutoPixmapStorage.h +++ b/src/core/SkAutoPixmapStorage.h @@ -17,11 +17,6 @@ public: ~SkAutoPixmapStorage(); /** - * Leave the moved-from object in a free-but-valid state. - */ - SkAutoPixmapStorage& operator=(SkAutoPixmapStorage&& other); - - /** * Try to allocate memory for the pixels needed to match the specified Info. On success * return true and fill out the pixmap to point to that memory. The storage will be freed * when this object is destroyed, or if another call to tryAlloc() or alloc() is made. diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 4c89e8e0fc..55ceba06d2 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -657,8 +657,7 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox SkAutoPixmapStorage pixmap; SkImageInfo info; size_t pixelSize = 0; - if (!isScaled && this->peekPixels(&pixmap) && !pixmap.ctable() && - pixmap.info().colorType() == params[0].fColorType) { + if (!isScaled && this->peekPixels(&pixmap) && !pixmap.ctable()) { info = pixmap.info(); pixelSize = SkAlign8(pixmap.getSafeSize()); if (!dstColorSpace) { @@ -681,35 +680,24 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox info = info.makeColorSpace(nullptr); } } - // Force color type to be the requested type. - info = info.makeColorType(params->fColorType); + if (kIndex_8_SkColorType == info.colorType()) { + // Force Index8 to be N32 instead. Index8 is unsupported in Ganesh. + info = info.makeColorType(kN32_SkColorType); + } pixelSize = SkAlign8(SkAutoPixmapStorage::AllocSize(info, nullptr)); if (fillMode) { - // Always decode to N32 and convert to the requested type if necessary. - SkImageInfo decodeInfo = info.makeColorType(kN32_SkColorType); - SkAutoPixmapStorage decodePixmap; - decodePixmap.alloc(decodeInfo); - + pixmap.alloc(info); if (isScaled) { - if (!this->scalePixels(decodePixmap, scaleFilterQuality, + if (!this->scalePixels(pixmap, scaleFilterQuality, SkImage::kDisallow_CachingHint)) { return 0; } } else { - if (!this->readPixels(decodePixmap, 0, 0, SkImage::kDisallow_CachingHint)) { + if (!this->readPixels(pixmap, 0, 0, SkImage::kDisallow_CachingHint)) { return 0; } } - SkASSERT(!decodePixmap.ctable()); - - if (decodeInfo.colorType() != info.colorType()) { - pixmap.alloc(info); - // Convert and copy the decoded pixmap to the target pixmap. - decodePixmap.readPixels(pixmap.info(), pixmap.writable_addr(), pixmap.rowBytes(), 0, - 0); - } else { - pixmap = std::move(decodePixmap); - } + SkASSERT(!pixmap.ctable()); } } int mipMapLevelCount = 1; diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index a67756bca3..c747b8ea5b 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -1078,13 +1078,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) { { createLarge, {{SkMatrix::I(), kMedium_SkFilterQuality, 5}, {SkMatrix::I(), kMedium_SkFilterQuality, 4}}, kMedium_SkFilterQuality, 16, true}, - // Create a images which are decoded to a 4444 backing. - { create_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0,kARGB_4444_SkColorType}}, - kNone_SkFilterQuality, 1, true }, - { create_codec_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0, kARGB_4444_SkColorType}}, - kNone_SkFilterQuality, 1, true }, - { create_data_image, {{SkMatrix::I(), kNone_SkFilterQuality, 0, kARGB_4444_SkColorType}}, - kNone_SkFilterQuality, 1, true }, }; |