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

Unified Diff: gm/gamma.cpp

Issue 2029373004: respect srgb gamma when building mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning 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 | « bench/MipMapBench.cpp ('k') | gm/mipmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gamma.cpp
diff --git a/gm/gamma.cpp b/gm/gamma.cpp
index 25608d26b3632c7b70b996265e31a0ded7cdfba8..c9fa28be104f87e1cf72c4710b03296893440101 100644
--- a/gm/gamma.cpp
+++ b/gm/gamma.cpp
@@ -9,6 +9,7 @@
#include "Resources.h"
#include "SkGradientShader.h"
+#include "SkPM4fPriv.h"
DEF_SIMPLE_GM(gamma, canvas, 560, 200) {
SkPaint p;
@@ -38,14 +39,14 @@ DEF_SIMPLE_GM(gamma, canvas, 560, 200) {
srgbGreyBmp.eraseARGB(0xFF, 0xBC, 0xBC, 0xBC);
SkBitmap mipmapBmp;
- SkImageInfo mipmapInfo = SkImageInfo::MakeN32(2, 2, kOpaque_SkAlphaType,
- kSRGB_SkColorProfileType);
+ SkImageInfo mipmapInfo = SkImageInfo::Make(2, 2, kN32_SkColorType, kOpaque_SkAlphaType,
+ SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named));
mipmapBmp.allocPixels(mipmapInfo);
SkPMColor* mipmapPixels = reinterpret_cast<SkPMColor*>(mipmapBmp.getPixels());
- // 0x89 = 255 * linear_to_srgb(0.25f)
- mipmapPixels[0] = mipmapPixels[3] = SkPackARGB32(0xFF, 0x89, 0x89, 0x89);
- // 0xE1 = 255 * linear_to_srgb(0.75f)
- mipmapPixels[1] = mipmapPixels[2] = SkPackARGB32(0xFF, 0xE1, 0xE1, 0xE1);
+ unsigned s25 = 0x89; // 255 * linear_to_srgb(0.25f)
+ unsigned s75 = 0xE1; // 255 * linear_to_srgb(0.75f)
+ mipmapPixels[0] = mipmapPixels[3] = SkPackARGB32(0xFF, s25, s25, s25);
+ mipmapPixels[1] = mipmapPixels[2] = SkPackARGB32(0xFF, s75, s75, s75);
SkPaint textPaint;
textPaint.setColor(SK_ColorWHITE);
« no previous file with comments | « bench/MipMapBench.cpp ('k') | gm/mipmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698