diff options
author | 2017-05-30 09:19:59 -0400 | |
---|---|---|
committer | 2017-05-30 14:13:53 +0000 | |
commit | b474e2d826cf7d6ac232d1e39c61e02c472e43b6 (patch) | |
tree | 8c5ef54df58c7d0a545b90e235901197b5ab54a6 | |
parent | bb581ce30f55360fd3a12e7f5aa1fe324b16d085 (diff) |
bug fix in convert_with_pipeline()
What do you supppose happens if we put an SkColorSpaceTransferFn on the
stack, pass its address to SkRasterPipeline, then pop it off the stack?
BUG=skia:6671
Change-Id: I17c777d9dc55a67cca6196a01c076a6be8283d3d
Reviewed-on: https://skia-review.googlesource.com/18078
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
-rw-r--r-- | src/core/SkConvertPixels.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/core/SkConvertPixels.cpp b/src/core/SkConvertPixels.cpp index d557763927..933f7be4a9 100644 --- a/src/core/SkConvertPixels.cpp +++ b/src/core/SkConvertPixels.cpp @@ -309,14 +309,14 @@ static void convert_with_pipeline(const SkImageInfo& dstInfo, void* dstRow, size premulState = kUnpremul_SkAlphaType; } + SkColorSpaceTransferFn srcFn; if (isColorAware && srcInfo.gammaCloseToSRGB()) { pipeline.append_from_srgb(srcInfo.alphaType()); } else if (isColorAware && !srcInfo.colorSpace()->gammaIsLinear()) { - SkColorSpaceTransferFn fn; - SkAssertResult(srcInfo.colorSpace()->isNumericalTransferFn(&fn)); - pipeline.append(SkRasterPipeline::parametric_r, &fn); - pipeline.append(SkRasterPipeline::parametric_g, &fn); - pipeline.append(SkRasterPipeline::parametric_b, &fn); + SkAssertResult(srcInfo.colorSpace()->isNumericalTransferFn(&srcFn)); + pipeline.append(SkRasterPipeline::parametric_r, &srcFn); + pipeline.append(SkRasterPipeline::parametric_g, &srcFn); + pipeline.append(SkRasterPipeline::parametric_b, &srcFn); } float matrix[12]; @@ -336,15 +336,15 @@ static void convert_with_pipeline(const SkImageInfo& dstInfo, void* dstRow, size } } + SkColorSpaceTransferFn dstFn; if (isColorAware && dstInfo.gammaCloseToSRGB()) { pipeline.append(SkRasterPipeline::to_srgb); } else if (isColorAware && !dstInfo.colorSpace()->gammaIsLinear()) { - SkColorSpaceTransferFn fn; - SkAssertResult(dstInfo.colorSpace()->isNumericalTransferFn(&fn)); - fn = fn.invert(); - pipeline.append(SkRasterPipeline::parametric_r, &fn); - pipeline.append(SkRasterPipeline::parametric_g, &fn); - pipeline.append(SkRasterPipeline::parametric_b, &fn); + SkAssertResult(dstInfo.colorSpace()->isNumericalTransferFn(&dstFn)); + dstFn = dstFn.invert(); + pipeline.append(SkRasterPipeline::parametric_r, &dstFn); + pipeline.append(SkRasterPipeline::parametric_g, &dstFn); + pipeline.append(SkRasterPipeline::parametric_b, &dstFn); } if (kUnpremul_SkAlphaType == premulState && kPremul_SkAlphaType == dat && |