aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/gamma.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-06-10 11:41:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-10 11:41:47 -0700
commit6644d9353f3f0c09914385fd762e073f98d54205 (patch)
tree617f3b1d2ca2b06cc34decfb44c4c975ba903ca5 /gm/gamma.cpp
parent7049396b65660907af5292d899053280430d929a (diff)
respect srgb gamma when building mips
Proposed policy: - If the target is *legacy* (e.g. L32/PMColor) ignore gamma - If the target is S32/F16 respect gamma BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029373004 Review-Url: https://codereview.chromium.org/2029373004
Diffstat (limited to 'gm/gamma.cpp')
-rw-r--r--gm/gamma.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/gm/gamma.cpp b/gm/gamma.cpp
index 25608d26b3..c9fa28be10 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);