aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-10-11 12:15:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-11 12:15:03 -0700
commit31d097e865f266c8398f45114e4c75c0dfdef058 (patch)
tree474aa98958055b0d7e85483c014fccb4235ef7ef /src/codec
parent7a1c53d0f67dcc98937ee5f06c6ba3f3b24882c6 (diff)
Add SkColorSpaceXform to the public API
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/SkCodecPriv.h4
-rw-r--r--src/codec/SkJpegCodec.cpp5
-rw-r--r--src/codec/SkPngCodec.cpp13
-rw-r--r--src/codec/SkWebpCodec.cpp5
4 files changed, 15 insertions, 12 deletions
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h
index b93def8790..f210303598 100644
--- a/src/codec/SkCodecPriv.h
+++ b/src/codec/SkCodecPriv.h
@@ -176,8 +176,8 @@ static inline uint64_t get_color_table_fill_value(SkColorType dstColorType, SkAl
SkASSERT(colorXform);
uint64_t dstColor;
uint32_t srcColor = colorPtr[fillIndex];
- colorXform->apply(&dstColor, &srcColor, 1, select_xform_format(dstColorType),
- SkColorSpaceXform::kRGBA_8888_ColorFormat, alphaType);
+ SkAssertResult(colorXform->apply(select_xform_format(dstColorType), &dstColor,
+ SkColorSpaceXform::kRGBA_8888_ColorFormat, &srcColor, 1, alphaType));
return dstColor;
}
default:
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index f6c856ee1d..92ab2bc182 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -517,8 +517,9 @@ int SkJpegCodec::readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes
}
if (fColorXform) {
- fColorXform->apply(dst, swizzleDst, dstWidth, select_xform_format(dstInfo.colorType()),
- SkColorSpaceXform::kRGBA_8888_ColorFormat, kOpaque_SkAlphaType);
+ SkAssertResult(fColorXform->apply(select_xform_format(dstInfo.colorType()), dst,
+ SkColorSpaceXform::kRGBA_8888_ColorFormat, swizzleDst,
+ dstWidth, kOpaque_SkAlphaType));
dst = SkTAddOffset<void>(dst, rowBytes);
}
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 55a29604a9..83032e6c18 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -272,8 +272,9 @@ bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo, int* ctableCount)
SkColorSpaceXform::kBGRA_8888_ColorFormat;
SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
- fColorXform->apply(colorTable, colorTable, numColors, xformColorFormat,
- SkColorSpaceXform::kRGBA_8888_ColorFormat, xformAlphaType);
+ SkAssertResult(fColorXform->apply(xformColorFormat, colorTable,
+ SkColorSpaceXform::kRGBA_8888_ColorFormat, colorTable,
+ numColors, xformAlphaType));
}
// Pad the color table with the last color in the table (or black) in the case that
@@ -441,13 +442,13 @@ void SkPngCodec::applyXformRow(void* dst, const void* src) {
fSwizzler->swizzle(dst, (const uint8_t*) src);
break;
case kColorOnly_XformMode:
- fColorXform->apply(dst, (const uint32_t*) src, fXformWidth, fXformColorFormat,
- srcColorFormat, fXformAlphaType);
+ SkAssertResult(fColorXform->apply(fXformColorFormat, dst, srcColorFormat, src,
+ fXformWidth, fXformAlphaType));
break;
case kSwizzleColor_XformMode:
fSwizzler->swizzle(fColorXformSrcRow, (const uint8_t*) src);
- fColorXform->apply(dst, fColorXformSrcRow, fXformWidth, fXformColorFormat,
- srcColorFormat, fXformAlphaType);
+ SkAssertResult(fColorXform->apply(fXformColorFormat, dst, srcColorFormat, fColorXformSrcRow,
+ fXformWidth, fXformAlphaType));
break;
}
}
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index 3e5ef2aecf..443a4a0732 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -315,8 +315,9 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
uint32_t* src = (uint32_t*) config.output.u.RGBA.rgba;
size_t srcRowBytes = config.output.u.RGBA.stride;
for (int y = 0; y < rowsDecoded; y++) {
- colorXform->apply(dst, src, dstInfo.width(), dstColorFormat,
- SkColorSpaceXform::kBGRA_8888_ColorFormat, xformAlphaType);
+ SkAssertResult(colorXform->apply(dstColorFormat, dst,
+ SkColorSpaceXform::kBGRA_8888_ColorFormat, src,
+ dstInfo.width(), xformAlphaType));
dst = SkTAddOffset<void>(dst, rowBytes);
src = SkTAddOffset<uint32_t>(src, srcRowBytes);
}