aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkConvertPixels.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2018-05-04 17:06:44 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-07 19:03:57 +0000
commit1f5cd6cc7fa2a1c8253e5d11626f2a73dc313c25 (patch)
tree76a04c8afd7ea87adcb9acf0b3f42c8f084b3034 /src/core/SkConvertPixels.cpp
parent382caaecdfb90ee9c042e9989c0b4c9a21e072cf (diff)
Handle failure to create SkColorSpaceXform in SkConvertPixels
For now, this will just fallback to the pipeline code. Eventually, we may need to support more color spaces in skcms, (or put in a simpler fallback that just does type conversion and ignores color space)? Bug: chromium:838115 Change-Id: Id71eec6a72202683957c884620ee3fe90df6c776 Reviewed-on: https://skia-review.googlesource.com/126201 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/core/SkConvertPixels.cpp')
-rw-r--r--src/core/SkConvertPixels.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/SkConvertPixels.cpp b/src/core/SkConvertPixels.cpp
index 8a8f2ba153..d984acaa1a 100644
--- a/src/core/SkConvertPixels.cpp
+++ b/src/core/SkConvertPixels.cpp
@@ -119,7 +119,7 @@ static inline bool optimized_color_xform(const SkImageInfo& dstInfo, const SkIma
return true;
}
-static inline void apply_color_xform(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
+static inline bool apply_color_xform(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
const SkImageInfo& srcInfo, const void* srcPixels,
size_t srcRB, SkTransferFunctionBehavior behavior) {
SkColorSpaceXform::ColorFormat dstFormat = select_xform_format(dstInfo.colorType());
@@ -150,7 +150,9 @@ static inline void apply_color_xform(const SkImageInfo& dstInfo, void* dstPixels
std::unique_ptr<SkColorSpaceXform> xform =
SkColorSpaceXform_Base::New(srcInfo.colorSpace(), dstInfo.colorSpace(), behavior);
- SkASSERT(xform);
+ if (!xform) {
+ return false;
+ }
for (int y = 0; y < dstInfo.height(); y++) {
SkAssertResult(xform->apply(dstFormat, dstPixels, srcFormat, srcPixels, dstInfo.width(),
@@ -158,6 +160,7 @@ static inline void apply_color_xform(const SkImageInfo& dstInfo, void* dstPixels
dstPixels = SkTAddOffset<void>(dstPixels, dstRB);
srcPixels = SkTAddOffset<const void>(srcPixels, srcRB);
}
+ return true;
}
// Fast Path 4: Alpha 8 dsts.
@@ -425,8 +428,9 @@ void SkConvertPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
// Fast Path 3: Color space xform.
if (isColorAware && optimized_color_xform(dstInfo, srcInfo, behavior)) {
- apply_color_xform(dstInfo, dstPixels, dstRB, srcInfo, srcPixels, srcRB, behavior);
- return;
+ if (apply_color_xform(dstInfo, dstPixels, dstRB, srcInfo, srcPixels, srcRB, behavior)) {
+ return;
+ }
}
// Fast Path 4: Alpha 8 dsts.