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

Unified Diff: src/gpu/SkGr.cpp

Issue 2347473007: Revert of Support Float32 output from SkColorSpaceXform (Closed)
Patch Set: Created 4 years, 3 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 | « src/gpu/GrDrawContext.cpp ('k') | src/opts/SkNx_neon.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGr.cpp
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 86b1007ba52eab2bf057b75acd90d703995a71ce..c8839f3f1a49b0863df897e6f60de1a421ea0c54 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -23,7 +23,6 @@
#include "SkColorFilter.h"
#include "SkConfig8888.h"
#include "SkCanvas.h"
-#include "SkColorSpaceXform.h"
#include "SkData.h"
#include "SkErrorInternals.h"
#include "SkMessageBus.h"
@@ -530,20 +529,18 @@
grPaint->setAntiAlias(skPaint.isAntiAlias());
grPaint->setAllowSRGBInputs(dc->isGammaCorrect());
- GrColor4f origColor;
+ // Raw translation of the SkPaint color to our 4f format:
+ GrColor4f origColor = GrColor4f::FromGrColor(SkColorToUnpremulGrColor(skPaint.getColor()));
// Linearize, if the color is meant to be in sRGB gamma:
if (dc->isGammaCorrect()) {
- SkColorSpaceXform* xform = dc->getColorXformFromSRGB();
- SkASSERT(xform);
-
- // FIXME (msarett): Support BGRA inputs to SkColorSpaceXform?
- uint32_t rgba = SkSwizzle_RB(skPaint.getColor());
- xform->apply(&origColor, &rgba, 1, SkColorSpaceXform::kRGBA_F32_ColorFormat,
- kUnpremul_SkAlphaType);
- } else {
- // Raw translation of the SkPaint color to our 4f format:
- origColor = GrColor4f::FromGrColor(SkColorToUnpremulGrColor(skPaint.getColor()));
+ origColor.fRGBA[0] = exact_srgb_to_linear(origColor.fRGBA[0]);
+ origColor.fRGBA[1] = exact_srgb_to_linear(origColor.fRGBA[1]);
+ origColor.fRGBA[2] = exact_srgb_to_linear(origColor.fRGBA[2]);
+
+ if (dc->getColorXformFromSRGB()) {
+ origColor = dc->getColorXformFromSRGB()->apply(origColor);
+ }
}
// Setup the initial color considering the shader, the SkPaint color, and the presence or not
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/opts/SkNx_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698