aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-06-03 08:23:40 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-03 08:23:40 -0700
commit577967c155fe3e2ce8251b053da60bd0d8fb32f4 (patch)
treec46ff2345f1e3d1d2cb67788d8b0cbec933a5315 /src
parent34604046cfad409937f508126914591109d3143a (diff)
Fix uses of SkImageInfo in BRD to preserve color space info
Diffstat (limited to 'src')
-rw-r--r--src/android/SkBitmapRegionCodec.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/android/SkBitmapRegionCodec.cpp b/src/android/SkBitmapRegionCodec.cpp
index b9c82d941a..a335432b31 100644
--- a/src/android/SkBitmapRegionCodec.cpp
+++ b/src/android/SkBitmapRegionCodec.cpp
@@ -52,8 +52,9 @@ bool SkBitmapRegionCodec::decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocat
// Create the image info for the decode
SkColorType dstColorType = fCodec->computeOutputColorType(prefColorType);
SkAlphaType dstAlphaType = fCodec->computeOutputAlphaType(requireUnpremul);
- SkImageInfo decodeInfo = SkImageInfo::Make(scaledSize.width(), scaledSize.height(),
- dstColorType, dstAlphaType);
+ SkImageInfo decodeInfo = fCodec->getInfo().makeWH(scaledSize.width(), scaledSize.height())
+ .makeColorType(dstColorType)
+ .makeAlphaType(dstAlphaType);
// Construct a color table for the decode if necessary
SkAutoTUnref<SkColorTable> colorTable(nullptr);
@@ -85,7 +86,7 @@ bool SkBitmapRegionCodec::decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocat
// used kAlpha8 for grayscale images (before kGray8 existed). While
// the codec recognizes kGray8, we need to decode into a kAlpha8
// bitmap in order to avoid a behavior change.
- outInfo = SkImageInfo::MakeA8(scaledOutWidth, scaledOutHeight);
+ outInfo = outInfo.makeColorType(kAlpha_8_SkColorType).makeAlphaType(kPremul_SkAlphaType);
}
bitmap->setInfo(outInfo);
if (!bitmap->tryAllocPixels(allocator, colorTable.get())) {
@@ -131,8 +132,5 @@ bool SkBitmapRegionCodec::decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocat
}
bool SkBitmapRegionCodec::conversionSupported(SkColorType colorType) {
- // FIXME: Call virtual function when it lands.
- SkImageInfo info = SkImageInfo::Make(0, 0, colorType, fCodec->getInfo().alphaType(),
- fCodec->getInfo().profileType());
- return conversion_possible(info, fCodec->getInfo());
+ return conversion_possible(fCodec->getInfo().makeColorType(colorType), fCodec->getInfo());
}