From 45c16fa82cd2fec010d4cb7763b654a413cabd0c Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 18 Jul 2017 18:15:13 -0400 Subject: convert over to 2d-mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [√] convert all stages to use SkJumper_MemoryCtx / be 2d-compatible [√] convert compile to 2d also, remove 1d run/compile [√] convert all call sites [√] no diffs Change-Id: I3b806eb8fe0c3ec043359616409f7cd1211a1e43 Reviewed-on: https://skia-review.googlesource.com/24263 Commit-Queue: Mike Klein Reviewed-by: Florin Malita --- src/images/SkImageEncoderFns.h | 59 ++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 22 deletions(-) (limited to 'src/images') diff --git a/src/images/SkImageEncoderFns.h b/src/images/SkImageEncoderFns.h index 4e73e4ff75..eb6ce8ba02 100644 --- a/src/images/SkImageEncoderFns.h +++ b/src/images/SkImageEncoderFns.h @@ -22,6 +22,7 @@ #include "SkRasterPipeline.h" #include "SkUnPreMultiply.h" #include "SkUnPreMultiplyPriv.h" +#include "../jumper/SkJumper.h" /** * Function template for transforming scanlines. @@ -153,18 +154,20 @@ static inline void transform_scanline_bgrA(char* SK_RESTRICT dst, const char* SK template static inline void transform_scanline_unpremultiply_sRGB(void* dst, const void* src, int width) { + SkJumper_MemoryCtx src_ctx = { (void*)src, 0 }, + dst_ctx = { (void*)dst, 0 }; SkRasterPipeline_<256> p; if (kIsRGBA) { - p.append(SkRasterPipeline::load_8888, &src); + p.append(SkRasterPipeline::load_8888, &src_ctx); } else { - p.append(SkRasterPipeline::load_bgra, &src); + p.append(SkRasterPipeline::load_bgra, &src_ctx); } p.append_from_srgb(kPremul_SkAlphaType); p.append(SkRasterPipeline::unpremul); p.append(SkRasterPipeline::to_srgb); - p.append(SkRasterPipeline::store_8888, &dst); - p.run(0,0, width); + p.append(SkRasterPipeline::store_8888, &dst_ctx); + p.run(0,0, width,1); } /** @@ -182,13 +185,15 @@ static inline void transform_scanline_to_premul_legacy(char* SK_RESTRICT dst, static inline void transform_scanline_to_premul_linear(char* SK_RESTRICT dst, const char* SK_RESTRICT src, int width, int, const SkPMColor*) { + SkJumper_MemoryCtx src_ctx = { (void*)src, 0 }, + dst_ctx = { (void*)dst, 0 }; SkRasterPipeline_<256> p; - p.append(SkRasterPipeline::load_8888, (const void**) &src); + p.append(SkRasterPipeline::load_8888, &src_ctx); p.append_from_srgb(kUnpremul_SkAlphaType); p.append(SkRasterPipeline::premul); p.append(SkRasterPipeline::to_srgb); - p.append(SkRasterPipeline::store_8888, (void**) &dst); - p.run(0,0, width); + p.append(SkRasterPipeline::store_8888, &dst_ctx); + p.run(0,0, width,1); } /** @@ -256,11 +261,13 @@ static inline void transform_scanline_4444(char* SK_RESTRICT dst, const char* SK */ static inline void transform_scanline_F16(char* SK_RESTRICT dst, const char* SK_RESTRICT src, int width, int, const SkPMColor*) { + SkJumper_MemoryCtx src_ctx = { (void*)src, 0 }, + dst_ctx = { (void*)dst, 0 }; SkRasterPipeline_<256> p; - p.append(SkRasterPipeline::load_f16, (const void**) &src); + p.append(SkRasterPipeline::load_f16, &src_ctx); p.append(SkRasterPipeline::to_srgb); - p.append(SkRasterPipeline::store_u16_be, (void**) &dst); - p.run(0,0, width); + p.append(SkRasterPipeline::store_u16_be, &dst_ctx); + p.run(0,0, width,1); } /** @@ -268,12 +275,14 @@ static inline void transform_scanline_F16(char* SK_RESTRICT dst, const char* SK_ */ static inline void transform_scanline_F16_premul(char* SK_RESTRICT dst, const char* SK_RESTRICT src, int width, int, const SkPMColor*) { + SkJumper_MemoryCtx src_ctx = { (void*)src, 0 }, + dst_ctx = { (void*)dst, 0 }; SkRasterPipeline_<256> p; - p.append(SkRasterPipeline::load_f16, (const void**) &src); + p.append(SkRasterPipeline::load_f16, &src_ctx); p.append(SkRasterPipeline::unpremul); p.append(SkRasterPipeline::to_srgb); - p.append(SkRasterPipeline::store_u16_be, (void**) &dst); - p.run(0,0, width); + p.append(SkRasterPipeline::store_u16_be, &dst_ctx); + p.run(0,0, width,1); } /** @@ -282,11 +291,13 @@ static inline void transform_scanline_F16_premul(char* SK_RESTRICT dst, const ch static inline void transform_scanline_F16_to_8888(char* SK_RESTRICT dst, const char* SK_RESTRICT src, int width, int, const SkPMColor*) { + SkJumper_MemoryCtx src_ctx = { (void*)src, 0 }, + dst_ctx = { (void*)dst, 0 }; SkRasterPipeline_<256> p; - p.append(SkRasterPipeline::load_f16, (const void**) &src); + p.append(SkRasterPipeline::load_f16, &src_ctx); p.append(SkRasterPipeline::to_srgb); - p.append(SkRasterPipeline::store_8888, (void**) &dst); - p.run(0,0, width); + p.append(SkRasterPipeline::store_8888, &dst_ctx); + p.run(0,0, width,1); } /** @@ -295,12 +306,14 @@ static inline void transform_scanline_F16_to_8888(char* SK_RESTRICT dst, static inline void transform_scanline_F16_premul_to_8888(char* SK_RESTRICT dst, const char* SK_RESTRICT src, int width, int, const SkPMColor*) { + SkJumper_MemoryCtx src_ctx = { (void*)src, 0 }, + dst_ctx = { (void*)dst, 0 }; SkRasterPipeline_<256> p; - p.append(SkRasterPipeline::load_f16, (const void**) &src); + p.append(SkRasterPipeline::load_f16, &src_ctx); p.append(SkRasterPipeline::unpremul); p.append(SkRasterPipeline::to_srgb); - p.append(SkRasterPipeline::store_8888, (void**) &dst); - p.run(0,0, width); + p.append(SkRasterPipeline::store_8888, &dst_ctx); + p.run(0,0, width,1); } /** @@ -308,12 +321,14 @@ static inline void transform_scanline_F16_premul_to_8888(char* SK_RESTRICT dst, */ static inline void transform_scanline_F16_to_premul_8888(char* SK_RESTRICT dst, const char* SK_RESTRICT src, int width, int, const SkPMColor*) { + SkJumper_MemoryCtx src_ctx = { (void*)src, 0 }, + dst_ctx = { (void*)dst, 0 }; SkRasterPipeline_<256> p; - p.append(SkRasterPipeline::load_f16, (const void**) &src); + p.append(SkRasterPipeline::load_f16, &src_ctx); p.append(SkRasterPipeline::premul); p.append(SkRasterPipeline::to_srgb); - p.append(SkRasterPipeline::store_8888, (void**) &dst); - p.run(0,0, width); + p.append(SkRasterPipeline::store_8888, &dst_ctx); + p.run(0,0, width,1); } static inline sk_sp icc_from_color_space(const SkImageInfo& info) { -- cgit v1.2.3