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>
This commit is contained in:
Mike Klein 2018-07-12 11:29:19 -04:00 committed by Skia Commit-Bot
parent 5551a94b9e
commit a4704078b9
2 changed files with 3 additions and 34 deletions

View File

@ -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();

View File

@ -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