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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return SkISize::Make(kWidth, kHeight); | 96 return SkISize::Make(kWidth, kHeight); |
97 } | 97 } |
98 | 98 |
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 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag
, | 107 inputCanvas->imageInfo
().profileType()); |
| 108 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType)
; |
| 109 uint32_t allowSRGBInputs = inputCanvas->getProps(&canvasProps) |
| 110 ? canvasProps.flags() & SkSurfaceProps::kAllowSRGBInputs_Flag :
0; |
| 111 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag
| allowSRGBInputs, |
108 SkSurfaceProps::kLegacyFontHost_InitType); | 112 SkSurfaceProps::kLegacyFontHost_InitType); |
109 surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0,
&props); | 113 surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0,
&props); |
110 canvas = surface.get() ? surface->getCanvas() : inputCanvas; | 114 canvas = surface.get() ? surface->getCanvas() : inputCanvas; |
111 // init our new canvas with the old canvas's matrix | 115 // init our new canvas with the old canvas's matrix |
112 canvas->setMatrix(inputCanvas->getTotalMatrix()); | 116 canvas->setMatrix(inputCanvas->getTotalMatrix()); |
113 #endif | 117 #endif |
114 } | 118 } |
115 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE)); | 119 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE)); |
116 | 120 |
117 SkRect bounds = fBlob->bounds(); | 121 SkRect bounds = fBlob->bounds(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 typedef GM INHERITED; | 189 typedef GM INHERITED; |
186 }; | 190 }; |
187 | 191 |
188 ////////////////////////////////////////////////////////////////////////////// | 192 ////////////////////////////////////////////////////////////////////////////// |
189 | 193 |
190 DEF_GM( return new TextBlobMixedSizes(false); ) | 194 DEF_GM( return new TextBlobMixedSizes(false); ) |
191 #if SK_SUPPORT_GPU | 195 #if SK_SUPPORT_GPU |
192 DEF_GM( return new TextBlobMixedSizes(true); ) | 196 DEF_GM( return new TextBlobMixedSizes(true); ) |
193 #endif | 197 #endif |
194 } | 198 } |
OLD | NEW |