Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: src/codec/SkPngCodec.cpp

Issue 2339233003: Support Float32 output from SkColorSpaceXform (Closed)
Patch Set: Some fixes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/codec/SkPngCodec.cpp
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 0002bc5a31b922eb1e869bc20f9eb6c2440f7886..d6366d3b396417f3026ec3e34b154b0d252e4113 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -149,11 +149,12 @@ bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo, int* ctableCount)
// If we are not decoding to F16, we can color xform now and store the results
// in the color table.
if (fColorXform && kRGBA_F16_SkColorType != dstInfo.colorType()) {
- SkColorType xformColorType = is_rgba(dstInfo.colorType()) ?
- kRGBA_8888_SkColorType : kBGRA_8888_SkColorType;
- SkAlphaType xformAlphaType = select_alpha_xform(dstInfo.alphaType(),
+ SkColorSpaceXform::ColorFormat xformColorFormat = is_rgba(dstInfo.colorType()) ?
+ SkColorSpaceXform::kRGBA_8888_ColorFormat :
+ SkColorSpaceXform::kBGRA_8888_ColorFormat;
+ SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
- fColorXform->apply(colorTable, colorTable, numColors, xformColorType, xformAlphaType);
+ fColorXform->apply(colorTable, colorTable, numColors, xformColorFormat, xformAlphaType);
}
// Pad the color table with the last color in the table (or black) in the case that
@@ -380,16 +381,17 @@ void SkPngCodec::allocateStorage(const SkImageInfo& dstInfo) {
void SkPngCodec::applyXformRow(void* dst, const void* src, SkColorType colorType,
SkAlphaType alphaType, int width) {
+ SkColorSpaceXform::ColorFormat colorFormat = select_xform_format(colorType);
msarett 2016/09/14 20:20:35 Leon, ideally your PNG change can land first? I t
scroggo 2016/09/14 20:35:01 That depends. How much of a hurry are you to get t
msarett 2016/09/14 21:09:43 I'll probably want to write some stuff based on th
switch (fXformMode) {
case kSwizzleOnly_XformMode:
fSwizzler->swizzle(dst, (const uint8_t*) src);
break;
case kColorOnly_XformMode:
- fColorXform->apply(dst, (const uint32_t*) src, width, colorType, alphaType);
+ fColorXform->apply(dst, (const uint32_t*) src, width, colorFormat, alphaType);
break;
case kSwizzleColor_XformMode:
fSwizzler->swizzle(fColorXformSrcRow, (const uint8_t*) src);
- fColorXform->apply(dst, fColorXformSrcRow, width, colorType, alphaType);
+ fColorXform->apply(dst, fColorXformSrcRow, width, colorFormat, alphaType);
break;
}
}
@@ -425,7 +427,7 @@ public:
return y;
}
- SkAlphaType xformAlphaType = select_alpha_xform(dstInfo.alphaType(),
+ SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
int width = fSwizzler ? fSwizzler->swizzleWidth() : dstInfo.width();
@@ -511,7 +513,7 @@ public:
}
}
- SkAlphaType xformAlphaType = select_alpha_xform(dstInfo.alphaType(),
+ SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
int width = fSwizzler ? fSwizzler->swizzleWidth() : dstInfo.width();
srcRow = storage.get();
@@ -902,7 +904,7 @@ SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
uint64_t SkPngCodec::onGetFillValue(const SkImageInfo& dstInfo) const {
const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
if (colorPtr) {
- SkAlphaType alphaType = select_alpha_xform(dstInfo.alphaType(),
+ SkAlphaType alphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
return get_color_table_fill_value(dstInfo.colorType(), alphaType, colorPtr, 0,
fColorXform.get());

Powered by Google App Engine
This is Rietveld 408576698