Revert "DeferredTextureImageData low-bit-depth/dithering support"

This reverts commit 2c075e749d.

Reason for revert: Breaking tests. e.g.: https://chromium-swarm.appspot.com/task?id=369dc44f62ce9510&refresh=10

Original change's description:
> DeferredTextureImageData low-bit-depth/dithering support
> 
> Cause DeferredTextureImageData functionality to support low bit depth
> (4444, 565) image formats (with dithering).
> 
> Bug: 720105
> Change-Id: Ie3b5768ebc393d9b0a5322461c722bf37c80b791
> Reviewed-on: https://skia-review.googlesource.com/18945
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Eric Karl <ericrk@chromium.org>

TBR=bsalomon@google.com,ericrk@chromium.org
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 720105

Change-Id: I07aec722425efc62bc54f82cee9a19a9bf339f7b
Reviewed-on: https://skia-review.googlesource.com/19039
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2017-06-08 13:03:37 +00:00 committed by Skia Commit-Bot
parent cde9031a5a
commit d7c681d6a7
6 changed files with 11 additions and 56 deletions

View File

@ -154,13 +154,6 @@ DEF_SIMPLE_GM(deferred_texture_image_low, canvas, 512 + 512 + 30, 512 + 20) {
DrawDeferredTextureImageData(canvas, &params);
}
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, &params);
}
DEF_SIMPLE_GM(deferred_texture_image_medium_encoded, canvas, 512 + 512 + 30, 1110) {
sk_sp<SkImage> encodedImage = GetResourceAsImage("mandrill_512.png");
if (!encodedImage) {

View File

@ -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;
};
/**

View File

@ -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) {

View File

@ -16,11 +16,6 @@ public:
SkAutoPixmapStorage();
~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

View File

@ -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;

View File

@ -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 },
};