OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 #include "Resources.h" | 10 #include "Resources.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 void onDraw(SkCanvas* inputCanvas) override { | 99 void onDraw(SkCanvas* inputCanvas) override { |
100 SkCanvas* canvas = inputCanvas; | 100 SkCanvas* canvas = inputCanvas; |
101 sk_sp<SkSurface> surface; | 101 sk_sp<SkSurface> surface; |
102 if (fUseDFT) { | 102 if (fUseDFT) { |
103 #if SK_SUPPORT_GPU | 103 #if SK_SUPPORT_GPU |
104 // Create a new Canvas to enable DFT | 104 // Create a new Canvas to enable DFT |
105 GrContext* ctx = inputCanvas->getGrContext(); | 105 GrContext* ctx = inputCanvas->getGrContext(); |
106 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize(), | 106 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize(), |
107 inputCanvas->imageInfo
().profileType()); | 107 inputCanvas->imageInfo
().profileType()); |
108 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType)
; | 108 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType)
; |
109 uint32_t allowSRGBInputs = inputCanvas->getProps(&canvasProps) | 109 uint32_t gammaCorrect = inputCanvas->getProps(&canvasProps) |
110 ? canvasProps.flags() & SkSurfaceProps::kAllowSRGBInputs_Flag :
0; | 110 ? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0; |
111 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag
| allowSRGBInputs, | 111 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag
| gammaCorrect, |
112 SkSurfaceProps::kLegacyFontHost_InitType); | 112 SkSurfaceProps::kLegacyFontHost_InitType); |
113 surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0,
&props); | 113 surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0,
&props); |
114 canvas = surface.get() ? surface->getCanvas() : inputCanvas; | 114 canvas = surface.get() ? surface->getCanvas() : inputCanvas; |
115 // init our new canvas with the old canvas's matrix | 115 // init our new canvas with the old canvas's matrix |
116 canvas->setMatrix(inputCanvas->getTotalMatrix()); | 116 canvas->setMatrix(inputCanvas->getTotalMatrix()); |
117 #endif | 117 #endif |
118 } | 118 } |
119 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE)); | 119 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE)); |
120 | 120 |
121 SkRect bounds = fBlob->bounds(); | 121 SkRect bounds = fBlob->bounds(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 typedef GM INHERITED; | 189 typedef GM INHERITED; |
190 }; | 190 }; |
191 | 191 |
192 ////////////////////////////////////////////////////////////////////////////// | 192 ////////////////////////////////////////////////////////////////////////////// |
193 | 193 |
194 DEF_GM( return new TextBlobMixedSizes(false); ) | 194 DEF_GM( return new TextBlobMixedSizes(false); ) |
195 #if SK_SUPPORT_GPU | 195 #if SK_SUPPORT_GPU |
196 DEF_GM( return new TextBlobMixedSizes(true); ) | 196 DEF_GM( return new TextBlobMixedSizes(true); ) |
197 #endif | 197 #endif |
198 } | 198 } |
OLD | NEW |