Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: gm/textblobmixedsizes.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/textblobgeometrychange.cpp ('k') | gm/textblobrandomfont.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « gm/textblobgeometrychange.cpp ('k') | gm/textblobrandomfont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698