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

Unified Diff: gm/surface.cpp

Issue 1845283003: Gamma-correctness pushed into Skia, top-down. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 8 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
Index: gm/surface.cpp
diff --git a/gm/surface.cpp b/gm/surface.cpp
index 901e324397ef2af08a3618efcad01a453e6bb075..e104cb5ecf619040a463766310bbef75ae8eefd0 100644
--- a/gm/surface.cpp
+++ b/gm/surface.cpp
@@ -22,7 +22,7 @@ static sk_sp<SkShader> make_shader() {
}
static sk_sp<SkSurface> make_surface(GrContext* ctx, const SkImageInfo& info, SkPixelGeometry geo,
- int disallowAA, int disallowDither) {
+ int disallowAA, int disallowDither, bool allowSRGBInputs) {
uint32_t flags = 0;
if (disallowAA) {
flags |= SkSurfaceProps::kDisallowAntiAlias_Flag;
@@ -30,6 +30,9 @@ static sk_sp<SkSurface> make_surface(GrContext* ctx, const SkImageInfo& info, Sk
if (disallowDither) {
flags |= SkSurfaceProps::kDisallowDither_Flag;
}
+ if (allowSRGBInputs) {
+ flags |= SkSurfaceProps::kAllowSRGBInputs_Flag;
+ }
SkSurfaceProps props(flags, geo);
if (ctx) {
@@ -74,7 +77,10 @@ protected:
GrContext* ctx = canvas->getGrContext();
// must be opaque to have a hope of testing LCD text
- const SkImageInfo info = SkImageInfo::MakeN32(W, H, kOpaque_SkAlphaType);
+ const SkImageInfo info = SkImageInfo::MakeN32(W, H, kOpaque_SkAlphaType,
+ canvas->imageInfo().profileType());
+ SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
+ bool allowSRGBInputs = canvas->getProps(&canvasProps) && canvasProps.allowSRGBInputs();
const struct {
SkPixelGeometry fGeo;
@@ -92,7 +98,8 @@ protected:
for (int disallowDither = 0; disallowDither <= 1; ++disallowDither) {
SkScalar y = 0;
for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) {
- auto surface(make_surface(ctx, info, rec[i].fGeo, disallowAA, disallowDither));
+ auto surface(make_surface(ctx, info, rec[i].fGeo, disallowAA, disallowDither,
+ allowSRGBInputs));
test_draw(surface->getCanvas(), rec[i].fLabel);
surface->draw(canvas, x, y, nullptr);
y += H;
« no previous file with comments | « gm/dftext.cpp ('k') | gm/textblobgeometrychange.cpp » ('j') | src/effects/SkImageSource.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698