focus exported color apis

Change-Id: I97f9db61698b6fee783fa3d6bfbbdd023fd6fee5
Reviewed-on: https://skia-review.googlesource.com/156245
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2018-09-21 16:38:57 -04:00 committed by Skia Commit-Bot
parent 2f10afa432
commit c5de102ff4
2 changed files with 6 additions and 5 deletions

View File

@ -231,7 +231,7 @@ SK_API SkPMColor SkPreMultiplyColor(SkColor c);
struct SkPM4f;
template <SkAlphaType kAT>
struct SK_API SkRGBA4f {
struct SkRGBA4f {
float fR;
float fG;
float fB;
@ -280,5 +280,6 @@ struct SK_API SkRGBA4f {
};
using SkColor4f = SkRGBA4f<kUnpremul_SkAlphaType>;
template <> SK_API SkColor SkColor4f::toSkColor() const;
#endif

View File

@ -136,26 +136,26 @@ uint64_t SkPM4f::toF16() const {
///////////////////////////////////////////////////////////////////////////////////////////////////
template <>
SK_API SkColor4f SkColor4f::FromColor(SkColor bgra) {
SkColor4f SkColor4f::FromColor(SkColor bgra) {
SkColor4f rgba;
swizzle_rb(Sk4f_fromL32(bgra)).store(rgba.vec());
return rgba;
}
template <>
SK_API SkColor SkColor4f::toSkColor() const {
SkColor SkColor4f::toSkColor() const {
return Sk4f_toL32(swizzle_rb(Sk4f::Load(this->vec())));
}
template <>
SK_API SkColor4f SkColor4f::Pin(float r, float g, float b, float a) {
SkColor4f SkColor4f::Pin(float r, float g, float b, float a) {
SkColor4f c4;
Sk4f::Min(Sk4f::Max(Sk4f(r, g, b, a), Sk4f(0)), Sk4f(1)).store(c4.vec());
return c4;
}
template <>
SK_API SkPM4f SkColor4f::toPM4f() const {
SkPM4f SkColor4f::toPM4f() const {
auto rgba = Sk4f::Load(this->vec());
return SkPM4f::From4f(rgba * Sk4f(rgba[3], rgba[3], rgba[3], 1));
}