aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkBmpStandardCodec.cpp
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2016-11-03 17:27:12 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-03 17:27:27 +0000
commit6193568fed3983e406544a46a5e1fd292729ca84 (patch)
tree58df1e720fe02886bff42acb52f19d8d6997bfec /src/codec/SkBmpStandardCodec.cpp
parent668661700127e8e340c1d731d2b9fc5ea443163f (diff)
Revert "Add F16, SkColorSpaceXform support to SkBmpCodec"
This reverts commit d851795e7992565c1eb2b9474ee5ad01d1a01fad. Reason for revert: <INSERT REASONING HERE> Original change's description: > Add F16, SkColorSpaceXform support to SkBmpCodec > > BUG=skia:4895 > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4300 > > Change-Id: I2f2b8d3854ea3a8c5904dd3c5bea0342e2be9789 > Reviewed-on: https://skia-review.googlesource.com/4300 > Reviewed-by: Leon Scroggins <scroggo@google.com> > Commit-Queue: Matt Sarett <msarett@google.com> > Speculative revert for MSAN TBR=borenet@google.com,msarett@google.com,scroggo@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ie48c03c0c3156267763fbcf96818477567c5069d Reviewed-on: https://skia-review.googlesource.com/4378 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Matt Sarett <msarett@google.com>
Diffstat (limited to 'src/codec/SkBmpStandardCodec.cpp')
-rw-r--r--src/codec/SkBmpStandardCodec.cpp43
1 files changed, 12 insertions, 31 deletions
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index 2a703fdff9..2dbb338a07 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -48,6 +48,10 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo,
SkCodecPrintf("Error: scaling not supported.\n");
return kInvalidScale;
}
+ if (!conversion_possible_ignore_color_space(dstInfo, this->getInfo())) {
+ SkCodecPrintf("Error: cannot convert input type to output type.\n");
+ return kInvalidConversion;
+ }
Result result = this->prepareToDecode(dstInfo, opts, inputColorPtr, inputColorCount);
if (kSuccess != result) {
@@ -149,13 +153,13 @@ void SkBmpStandardCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Op
// In the case of bmp-in-icos, we will report BGRA to the client,
// since we may be required to apply an alpha mask after the decode.
// However, the swizzler needs to know the actual format of the bmp.
- SkEncodedInfo encodedInfo = this->getEncodedInfo();
+ SkEncodedInfo swizzlerInfo = this->getEncodedInfo();
if (fInIco) {
if (this->bitsPerPixel() <= 8) {
- encodedInfo = SkEncodedInfo::Make(SkEncodedInfo::kPalette_Color,
- encodedInfo.alpha(), this->bitsPerPixel());
+ swizzlerInfo = SkEncodedInfo::Make(SkEncodedInfo::kPalette_Color,
+ swizzlerInfo.alpha(), this->bitsPerPixel());
} else if (this->bitsPerPixel() == 24) {
- encodedInfo = SkEncodedInfo::Make(SkEncodedInfo::kBGR_Color,
+ swizzlerInfo = SkEncodedInfo::Make(SkEncodedInfo::kBGR_Color,
SkEncodedInfo::kOpaque_Alpha, 8);
}
}
@@ -163,29 +167,13 @@ void SkBmpStandardCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Op
// Get a pointer to the color table if it exists
const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
- SkImageInfo swizzlerInfo = dstInfo;
- SkCodec::Options swizzlerOptions = opts;
- if (this->colorXform()) {
- swizzlerInfo = swizzlerInfo.makeColorType(kBGRA_8888_SkColorType);
- if (kPremul_SkAlphaType == dstInfo.alphaType()) {
- swizzlerInfo = swizzlerInfo.makeAlphaType(kUnpremul_SkAlphaType);
- }
-
- swizzlerOptions.fZeroInitialized = kNo_ZeroInitialized;
- }
-
-
- fSwizzler.reset(SkSwizzler::CreateSwizzler(encodedInfo, colorPtr, swizzlerInfo,
- swizzlerOptions));
+ // Create swizzler
+ fSwizzler.reset(SkSwizzler::CreateSwizzler(swizzlerInfo, colorPtr, dstInfo, opts));
SkASSERT(fSwizzler);
}
-SkCodec::Result SkBmpStandardCodec::onPrepareToDecode(const SkImageInfo& dstInfo,
+SkCodec::Result SkBmpStandardCodec::prepareToDecode(const SkImageInfo& dstInfo,
const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputColorCount) {
- if (this->colorXform()) {
- this->resetXformBuffer(dstInfo.width());
- }
-
// Create the color table if necessary and prepare the stream for decode
// Note that if it is non-NULL, inputColorCount will be modified
if (!this->createColorTable(dstInfo.colorType(), dstInfo.alphaType(), inputColorCount)) {
@@ -219,14 +207,7 @@ int SkBmpStandardCodec::decodeRows(const SkImageInfo& dstInfo, void* dst, size_t
uint32_t row = this->getDstRow(y, dstInfo.height());
void* dstRow = SkTAddOffset<void>(dst, row * dstRowBytes);
-
- if (this->colorXform()) {
- SkImageInfo xformInfo = dstInfo.makeWH(fSwizzler->swizzleWidth(), dstInfo.height());
- fSwizzler->swizzle(this->xformBuffer(), fSrcBuffer.get());
- this->applyColorXform(xformInfo, dstRow, this->xformBuffer());
- } else {
- fSwizzler->swizzle(dstRow, fSrcBuffer.get());
- }
+ fSwizzler->swizzle(dstRow, fSrcBuffer.get());
}
if (fInIco && fIsOpaque) {