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

Side by Side Diff: gm/dftext.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 unified diff | Download patch
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 30 matching lines...) Expand all
41 canvas->translate(-px, -py); 41 canvas->translate(-px, -py);
42 } 42 }
43 43
44 virtual void onDraw(SkCanvas* inputCanvas) override { 44 virtual void onDraw(SkCanvas* inputCanvas) override {
45 SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f }; 45 SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f };
46 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f }; 46 SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f };
47 47
48 // set up offscreen rendering with distance field text 48 // set up offscreen rendering with distance field text
49 #if SK_SUPPORT_GPU 49 #if SK_SUPPORT_GPU
50 GrContext* ctx = inputCanvas->getGrContext(); 50 GrContext* ctx = inputCanvas->getGrContext();
51 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize()); 51 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize(),
52 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag, 52 inputCanvas->imageInfo().p rofileType());
53 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
54 uint32_t allowSRGBInputs = inputCanvas->getProps(&canvasProps)
55 ? canvasProps.flags() & SkSurfaceProps::kAllowSRGBInputs_Flag : 0;
56 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag | a llowSRGBInputs,
53 SkSurfaceProps::kLegacyFontHost_InitType); 57 SkSurfaceProps::kLegacyFontHost_InitType);
54 auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props)); 58 auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props));
55 SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas; 59 SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas;
56 // init our new canvas with the old canvas's matrix 60 // init our new canvas with the old canvas's matrix
57 canvas->setMatrix(inputCanvas->getTotalMatrix()); 61 canvas->setMatrix(inputCanvas->getTotalMatrix());
58 #else 62 #else
59 SkCanvas* canvas = inputCanvas; 63 SkCanvas* canvas = inputCanvas;
60 #endif 64 #endif
61 // apply global scale to test glyph positioning 65 // apply global scale to test glyph positioning
62 canvas->scale(1.05f, 1.05f); 66 canvas->scale(1.05f, 1.05f);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 210 }
207 211
208 private: 212 private:
209 SkAutoTUnref<SkTypeface> fEmojiTypeface; 213 SkAutoTUnref<SkTypeface> fEmojiTypeface;
210 const char* fEmojiText; 214 const char* fEmojiText;
211 215
212 typedef skiagm::GM INHERITED; 216 typedef skiagm::GM INHERITED;
213 }; 217 };
214 218
215 DEF_GM(return new DFTextGM;) 219 DEF_GM(return new DFTextGM;)
OLDNEW
« no previous file with comments | « gm/constcolorprocessor.cpp ('k') | gm/surface.cpp » ('j') | src/effects/SkImageSource.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698