diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkDraw_vertices.cpp | 4 | ||||
-rw-r--r-- | src/core/SkPM4fPriv.h | 33 |
2 files changed, 3 insertions, 34 deletions
diff --git a/src/core/SkDraw_vertices.cpp b/src/core/SkDraw_vertices.cpp index 544e84d6a6..4d1ccea496 100644 --- a/src/core/SkDraw_vertices.cpp +++ b/src/core/SkDraw_vertices.cpp @@ -141,7 +141,9 @@ static SkPM4f* convert_colors(const SkColor src[], int count, SkColorSpace* devi SkPM4f* dst = alloc->makeArray<SkPM4f>(count); if (!deviceCS) { for (int i = 0; i < count; ++i) { - dst[i] = SkPM4f_from_SkColor(src[i], nullptr); + SkColor4f color4f; + swizzle_rb(Sk4f_fromL32(src[i])).store(&color4f); + dst[i] = color4f.premul(); } } else { auto srcCS = SkColorSpace::MakeSRGB(); diff --git a/src/core/SkPM4fPriv.h b/src/core/SkPM4fPriv.h index 71a56cdc5e..f5e9aa02e6 100644 --- a/src/core/SkPM4fPriv.h +++ b/src/core/SkPM4fPriv.h @@ -112,38 +112,5 @@ static inline void append_gamut_transform(SkRasterPipeline* p, p->append(SkRasterPipeline::matrix_3x4, ptr-12); } -static inline SkColor4f to_colorspace(const SkColor4f& c, SkColorSpace* src, SkColorSpace* dst) { - SkColor4f color4f = c; - if (src && dst && !SkColorSpace::Equals(src, dst)) { - SkJumper_MemoryCtx color4f_ptr = { &color4f, 0 }; - - SkSTArenaAlloc<256> alloc; - SkRasterPipeline p(&alloc); - p.append_constant_color(&alloc, color4f); - append_gamut_transform(&p, &alloc, src, dst, kUnpremul_SkAlphaType); - p.append(SkRasterPipeline::store_f32, &color4f_ptr); - - p.run(0,0,1,1); - } - return color4f; -} - -static inline SkColor4f SkColor4f_from_SkColor(SkColor color, SkColorSpace* dst) { - SkColor4f color4f; - if (dst) { - // sRGB gamma, sRGB gamut. - color4f = to_colorspace(SkColor4f::FromColor(color), - SkColorSpace::MakeSRGB().get(), dst); - } else { - // Linear gamma, dst gamut. - swizzle_rb(SkNx_cast<float>(Sk4b::Load(&color)) * (1/255.0f)).store(&color4f); - } - return color4f; -} - -static inline SkPM4f SkPM4f_from_SkColor(SkColor color, SkColorSpace* dst) { - return SkColor4f_from_SkColor(color, dst).premul(); -} - #endif |