| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 return name; | 92 return name; |
| 93 } | 93 } |
| 94 | 94 |
| 95 SkISize onISize() override { | 95 SkISize onISize() override { |
| 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 SkAutoTUnref<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 SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag
, |
| 108 SkSurfaceProps::kLegacyFontHost_InitType); | 108 SkSurfaceProps::kLegacyFontHost_InitType); |
| 109 surface.reset(SkSurface::NewRenderTarget(ctx, SkBudgeted::kNo, info,
0, | 109 surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0,
&props); |
| 110 &props)); | |
| 111 canvas = surface.get() ? surface->getCanvas() : inputCanvas; | 110 canvas = surface.get() ? surface->getCanvas() : inputCanvas; |
| 112 // init our new canvas with the old canvas's matrix | 111 // init our new canvas with the old canvas's matrix |
| 113 canvas->setMatrix(inputCanvas->getTotalMatrix()); | 112 canvas->setMatrix(inputCanvas->getTotalMatrix()); |
| 114 #endif | 113 #endif |
| 115 } | 114 } |
| 116 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE)); | 115 canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE)); |
| 117 | 116 |
| 118 SkRect bounds = fBlob->bounds(); | 117 SkRect bounds = fBlob->bounds(); |
| 119 | 118 |
| 120 static const int kPadX = SkScalarFloorToInt(bounds.width() / 3); | 119 static const int kPadX = SkScalarFloorToInt(bounds.width() / 3); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 typedef GM INHERITED; | 186 typedef GM INHERITED; |
| 188 }; | 187 }; |
| 189 | 188 |
| 190 ////////////////////////////////////////////////////////////////////////////// | 189 ////////////////////////////////////////////////////////////////////////////// |
| 191 | 190 |
| 192 DEF_GM( return new TextBlobMixedSizes(false); ) | 191 DEF_GM( return new TextBlobMixedSizes(false); ) |
| 193 #if SK_SUPPORT_GPU | 192 #if SK_SUPPORT_GPU |
| 194 DEF_GM( return new TextBlobMixedSizes(true); ) | 193 DEF_GM( return new TextBlobMixedSizes(true); ) |
| 195 #endif | 194 #endif |
| 196 } | 195 } |
| OLD | NEW |