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