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

Unified Diff: src/core/SkLinearBitmapPipeline_sample.h

Issue 2163683002: Correct sRGB <-> linear everywhere. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: back to brute Created 4 years, 5 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/core/SkColorMatrixFilterRowMajor255.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/SkLinearBitmapPipeline_sample.h
diff --git a/src/core/SkLinearBitmapPipeline_sample.h b/src/core/SkLinearBitmapPipeline_sample.h
index 86ad6e146f0062ed779d493538f8f366ece46a00..759075b3e5ab3f2481e1f0af8d999448770bbd7d 100644
--- a/src/core/SkLinearBitmapPipeline_sample.h
+++ b/src/core/SkLinearBitmapPipeline_sample.h
@@ -170,11 +170,10 @@ public:
PixelConverter(const SkPixmap& srcPixmap) { }
Sk4f toSk4f(Element pixel) const {
- float gray = pixel * (1.0f/255.0f);
- Sk4f result = Sk4f{gray, gray, gray, 1.0f};
- return gammaType == kSRGB_SkGammaType
- ? srgb_to_linear(result)
- : result;
+ float gray = (gammaType == kSRGB_SkGammaType)
+ ? sk_linear_from_srgb[pixel]
+ : pixel * (1/255.0f);
+ return {gray, gray, gray, 1.0f};
}
};
« no previous file with comments | « src/core/SkColorMatrixFilterRowMajor255.cpp ('k') | src/core/SkPM4fPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698