Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: src/core/SkColor.cpp

Issue 2097003003: remove experimental treat-skcolor-as-srgb flag (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix toSkColor Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/core/SkPM4fPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColor.cpp
diff --git a/src/core/SkColor.cpp b/src/core/SkColor.cpp
index 985790dfe50bbca2464eeb3ad8ff040f3c37d909..a1404a27e360288ad930d45cc3c0a1c876593f85 100644
--- a/src/core/SkColor.cpp
+++ b/src/core/SkColor.cpp
@@ -9,8 +9,6 @@
#include "SkColorPriv.h"
#include "SkFixed.h"
-bool gTreatSkColorAsSRGB;
-
SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) {
return SkPremultiplyARGBInline(a, r, g, b);
}
@@ -158,17 +156,15 @@ SkColor4f SkColor4f::FromColor(SkColor c) {
Sk4f value = SkNx_shuffle<2,1,0,3>(SkNx_cast<float>(Sk4b::Load(&c)));
SkColor4f c4;
(value * Sk4f(1.0f / 255)).store(&c4);
- if (gTreatSkColorAsSRGB) {
- c4.fR = srgb_to_linear(c4.fR);
- c4.fG = srgb_to_linear(c4.fG);
- c4.fB = srgb_to_linear(c4.fB);
- }
+ c4.fR = srgb_to_linear(c4.fR);
+ c4.fG = srgb_to_linear(c4.fG);
+ c4.fB = srgb_to_linear(c4.fB);
return c4;
}
SkColor SkColor4f::toSkColor() const {
SkColor result;
- Sk4f value = SkNx_shuffle<2, 1, 0, 3>(Sk4f::Load(this->vec()));
+ Sk4f value = Sk4f(linear_to_srgb(fB), linear_to_srgb(fG), linear_to_srgb(fR), fA);
SkNx_cast<uint8_t>(value * Sk4f(255) + Sk4f(0.5f)).store(&result);
return result;
}
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/core/SkPM4fPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698