treat SkPMColor as sRGB in SkPM4f::FromPMColor()
We made the wrong call in SkPM4f::FromPMColor(). SkPM4f::FromPMColor() is only used by the color correct drawing pipeline, not legacy. That means it makes a lot more sense to treat SkPMColors as premul sRGB than premul linear. You can see the effect very clearly in any code path using the fallback SkShader::Context::shadeSpan4f(). We shade legacy 8888, then "linearize" to float by calling SkPM4f::FromPMColor(). At head we're not really linearizing, which means everything ends up too bright in the end. Things get double sRGB-encoded, etc. It is expected that this CL will make many color correct images look darker and a lot more like legacy mode. It may be jarring... we've gotten used to seeing this bug and thinking brighter == fixed. The only GM that changes in actual legacy 8888 is gamut, which explicitly creates non-legacy 8888 images... the diff there is expected. Change-Id: I77ac6cfe8f7ffb15e90f4aad798dbe8f9d3aafbd Reviewed-on: https://skia-review.googlesource.com/15227 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
parent
0f35332796
commit
a4f3e14d89
@ -108,7 +108,11 @@ SkColor SkHSVToColor(U8CPU a, const SkScalar hsv[3]) {
|
||||
#include "SkHalf.h"
|
||||
|
||||
SkPM4f SkPM4f::FromPMColor(SkPMColor c) {
|
||||
return From4f(swizzle_rb_if_bgra(Sk4f_fromL32(c)));
|
||||
return From4f(swizzle_rb_if_bgra(Sk4f_fromS32(c)));
|
||||
}
|
||||
|
||||
SkPMColor SkPM4f::toPMColor() const {
|
||||
return Sk4f_toS32(swizzle_rb_if_bgra(this->to4f()));
|
||||
}
|
||||
|
||||
SkColor4f SkPM4f::unpremul() const {
|
||||
|
@ -50,12 +50,7 @@ struct SkPM4f {
|
||||
Sk4f to4f_bgra() const { return swizzle_rb(this->to4f()); }
|
||||
Sk4f to4f_pmorder() const { return swizzle_rb_if_bgra(this->to4f()); }
|
||||
|
||||
SkPMColor toPMColor() const {
|
||||
Sk4f value = swizzle_rb_if_bgra(this->to4f());
|
||||
SkPMColor result;
|
||||
SkNx_cast<uint8_t>(value * Sk4f(255) + Sk4f(0.5f)).store(&result);
|
||||
return result;
|
||||
}
|
||||
SkPMColor toPMColor() const;
|
||||
|
||||
void toF16(uint16_t[4]) const;
|
||||
uint64_t toF16() const; // 4 float16 values packed into uint64_t
|
||||
|
Loading…
Reference in New Issue
Block a user