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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 void onDraw(SkCanvas* inputCanvas) override { | 92 void onDraw(SkCanvas* inputCanvas) override { |
93 SkCanvas* canvas = inputCanvas; | 93 SkCanvas* canvas = inputCanvas; |
94 SkAutoTUnref<SkSurface> surface; | 94 SkAutoTUnref<SkSurface> surface; |
95 if (fUseDFT) { | 95 if (fUseDFT) { |
96 #if SK_SUPPORT_GPU | 96 #if SK_SUPPORT_GPU |
97 // Create a new Canvas to enable DFT | 97 // Create a new Canvas to enable DFT |
98 GrContext* ctx = inputCanvas->getGrContext(); | 98 GrContext* ctx = inputCanvas->getGrContext(); |
99 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize()); | 99 SkImageInfo info = SkImageInfo::MakeN32Premul(onISize()); |
100 SkSurfaceProps props(SkSurfaceProps::kUseDistanceFieldFonts_Flag, | 100 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag
, |
101 SkSurfaceProps::kLegacyFontHost_InitType); | 101 SkSurfaceProps::kLegacyFontHost_InitType); |
102 surface.reset(SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgete
d, info, 0, | 102 surface.reset(SkSurface::NewRenderTarget(ctx, SkSurface::kNo_Budgete
d, info, 0, |
103 &props)); | 103 &props)); |
104 canvas = surface.get() ? surface->getCanvas() : inputCanvas; | 104 canvas = surface.get() ? surface->getCanvas() : inputCanvas; |
105 // init our new canvas with the old canvas's matrix | 105 // init our new canvas with the old canvas's matrix |
106 canvas->setMatrix(inputCanvas->getTotalMatrix()); | 106 canvas->setMatrix(inputCanvas->getTotalMatrix()); |
107 #endif | 107 #endif |
108 } | 108 } |
109 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE)); | 109 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE)); |
110 | 110 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 typedef GM INHERITED; | 182 typedef GM INHERITED; |
183 }; | 183 }; |
184 | 184 |
185 ////////////////////////////////////////////////////////////////////////////// | 185 ////////////////////////////////////////////////////////////////////////////// |
186 | 186 |
187 DEF_GM( return new TextBlobMixedSizes(false); ) | 187 DEF_GM( return new TextBlobMixedSizes(false); ) |
188 #if SK_SUPPORT_GPU | 188 #if SK_SUPPORT_GPU |
189 DEF_GM( return new TextBlobMixedSizes(true); ) | 189 DEF_GM( return new TextBlobMixedSizes(true); ) |
190 #endif | 190 #endif |
191 } | 191 } |
OLD | NEW |