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

Side by Side Diff: gm/dftext.cpp

Issue 2188463002: Remove SkSurfaceProps gamma-correctness flag entirely. (Closed) Base URL: https://skia.googlesource.com/skia.git@remove-is-gamma-correct
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « dm/DMGpuSupport.h ('k') | gm/surface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "gm.h" 7 #include "gm.h"
8 #include "Resources.h" 8 #include "Resources.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 25 matching lines...) Expand all
36 virtual void onDraw(SkCanvas* inputCanvas) override { 36 virtual void onDraw(SkCanvas* inputCanvas) override {
37 SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f }; 37 SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f };
38 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f }; 38 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f };
39 39
40 // set up offscreen rendering with distance field text 40 // set up offscreen rendering with distance field text
41 #if SK_SUPPORT_GPU 41 #if SK_SUPPORT_GPU
42 GrContext* ctx = inputCanvas->getGrContext(); 42 GrContext* ctx = inputCanvas->getGrContext();
43 SkISize size = onISize(); 43 SkISize size = onISize();
44 SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), kPr emul_SkAlphaType, 44 SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), kPr emul_SkAlphaType,
45 sk_ref_sp(inputCanvas->imageInfo ().colorSpace())); 45 sk_ref_sp(inputCanvas->imageInfo ().colorSpace()));
46 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); 46 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
47 uint32_t gammaCorrect = inputCanvas->getProps(&canvasProps)
48 ? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0;
49 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag | g ammaCorrect,
50 SkSurfaceProps::kLegacyFontHost_InitType); 47 SkSurfaceProps::kLegacyFontHost_InitType);
51 auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props)); 48 auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props));
52 SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas; 49 SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas;
53 // init our new canvas with the old canvas's matrix 50 // init our new canvas with the old canvas's matrix
54 canvas->setMatrix(inputCanvas->getTotalMatrix()); 51 canvas->setMatrix(inputCanvas->getTotalMatrix());
55 #else 52 #else
56 SkCanvas* canvas = inputCanvas; 53 SkCanvas* canvas = inputCanvas;
57 #endif 54 #endif
58 // apply global scale to test glyph positioning 55 // apply global scale to test glyph positioning
59 canvas->scale(1.05f, 1.05f); 56 canvas->scale(1.05f, 1.05f);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 200 }
204 201
205 private: 202 private:
206 sk_sp<SkTypeface> fEmojiTypeface; 203 sk_sp<SkTypeface> fEmojiTypeface;
207 const char* fEmojiText; 204 const char* fEmojiText;
208 205
209 typedef skiagm::GM INHERITED; 206 typedef skiagm::GM INHERITED;
210 }; 207 };
211 208
212 DEF_GM(return new DFTextGM;) 209 DEF_GM(return new DFTextGM;)
OLDNEW
« no previous file with comments | « dm/DMGpuSupport.h ('k') | gm/surface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698