aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2018-07-12 11:29:19 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-12 17:30:18 +0000
commita4704078b9d7f6c86cdd29c80840bfc4f15bea1a (patch)
tree289452a9a708f1d8db667bdbc703b77617fd8357 /src
parent5551a94b9e0fc822cda36d3bb5b70a97d2be4c17 (diff)
clean up some old busted color routines
Change-Id: I6e1dcce0b1fd7e4a01dc44c07173e9742922d2c0 Reviewed-on: https://skia-review.googlesource.com/141044 Auto-Submit: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkDraw_vertices.cpp4
-rw-r--r--src/core/SkPM4fPriv.h33
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