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

Side by Side Diff: gm/rrects.cpp

Issue 1918003003: Bring sk_sp to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 return name; 59 return name;
60 } 60 }
61 61
62 SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight) ; } 62 SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight) ; }
63 63
64 void onDraw(SkCanvas* canvas) override { 64 void onDraw(SkCanvas* canvas) override {
65 GrContext* context = nullptr; 65 GrContext* context = nullptr;
66 #if SK_SUPPORT_GPU 66 #if SK_SUPPORT_GPU
67 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget (); 67 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget ();
68 context = rt ? rt->getContext() : nullptr; 68 context = rt ? rt->getContext() : nullptr;
69 SkAutoTUnref<GrDrawContext> drawContext; 69 sk_sp<GrDrawContext> drawContext;
70 if (kEffect_Type == fType) { 70 if (kEffect_Type == fType) {
71 if (!context) { 71 if (!context) {
72 skiagm::GM::DrawGpuOnlyMessage(canvas); 72 skiagm::GM::DrawGpuOnlyMessage(canvas);
73 return; 73 return;
74 } 74 }
75 75
76 drawContext.reset(context->drawContext(rt)); 76 drawContext = context->drawContext(sk_ref_sp(rt));
77 if (!drawContext) { 77 if (!drawContext) {
78 return; 78 return;
79 } 79 }
80 } 80 }
81 #endif 81 #endif
82 if (kEffect_Type == fType && nullptr == context) { 82 if (kEffect_Type == fType && nullptr == context) {
83 skiagm::GM::DrawGpuOnlyMessage(canvas); 83 skiagm::GM::DrawGpuOnlyMessage(canvas);
84 return; 84 return;
85 } 85 }
86 86
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) 272 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); )
273 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) 273 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); )
274 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) 274 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); )
275 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) 275 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); )
276 #if SK_SUPPORT_GPU 276 #if SK_SUPPORT_GPU
277 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) 277 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); )
278 #endif 278 #endif
279 279
280 } 280 }
OLDNEW
« gm/beziereffects.cpp ('K') | « gm/convexpolyeffect.cpp ('k') | gm/texdata.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698