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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 return SkISize::Make(kWidth, kHeight); | 95 return SkISize::Make(kWidth, kHeight); |
96 } | 96 } |
97 | 97 |
98 void onDraw(SkCanvas* inputCanvas) override { | 98 void onDraw(SkCanvas* inputCanvas) override { |
99 SkCanvas* canvas = inputCanvas; | 99 SkCanvas* canvas = inputCanvas; |
100 sk_sp<SkSurface> surface; | 100 sk_sp<SkSurface> surface; |
101 if (fUseDFT) { | 101 if (fUseDFT) { |
102 #if SK_SUPPORT_GPU | 102 #if SK_SUPPORT_GPU |
103 // Create a new Canvas to enable DFT | 103 // Create a new Canvas to enable DFT |
104 GrContext* ctx = inputCanvas->getGrContext(); | 104 GrContext* ctx = inputCanvas->getGrContext(); |
105 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize(), | 105 SkISize size = onISize(); |
106 inputCanvas->imageInfo
().profileType()); | 106 sk_sp<SkColorSpace> colorSpace = sk_ref_sp(inputCanvas->imageInfo().
colorSpace()); |
| 107 SkImageInfo info = SkImageInfo::MakeN32(size.width(), size.height(), |
| 108 kPremul_SkAlphaType, colorSp
ace); |
107 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType)
; | 109 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType)
; |
108 uint32_t gammaCorrect = inputCanvas->getProps(&canvasProps) | 110 uint32_t gammaCorrect = inputCanvas->getProps(&canvasProps) |
109 ? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0; | 111 ? canvasProps.flags() & SkSurfaceProps::kGammaCorrect_Flag : 0; |
110 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag
| gammaCorrect, | 112 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag
| gammaCorrect, |
111 SkSurfaceProps::kLegacyFontHost_InitType); | 113 SkSurfaceProps::kLegacyFontHost_InitType); |
112 surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0,
&props); | 114 surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0,
&props); |
113 canvas = surface.get() ? surface->getCanvas() : inputCanvas; | 115 canvas = surface.get() ? surface->getCanvas() : inputCanvas; |
114 // init our new canvas with the old canvas's matrix | 116 // init our new canvas with the old canvas's matrix |
115 canvas->setMatrix(inputCanvas->getTotalMatrix()); | 117 canvas->setMatrix(inputCanvas->getTotalMatrix()); |
116 #endif | 118 #endif |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 typedef GM INHERITED; | 190 typedef GM INHERITED; |
189 }; | 191 }; |
190 | 192 |
191 ////////////////////////////////////////////////////////////////////////////// | 193 ////////////////////////////////////////////////////////////////////////////// |
192 | 194 |
193 DEF_GM( return new TextBlobMixedSizes(false); ) | 195 DEF_GM( return new TextBlobMixedSizes(false); ) |
194 #if SK_SUPPORT_GPU | 196 #if SK_SUPPORT_GPU |
195 DEF_GM( return new TextBlobMixedSizes(true); ) | 197 DEF_GM( return new TextBlobMixedSizes(true); ) |
196 #endif | 198 #endif |
197 } | 199 } |
OLD | NEW |