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

Side by Side Diff: gm/bigrrectaaeffect.cpp

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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/beziereffects.cpp ('k') | gm/constcolorprocessor.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 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 GrPrimitiveEdgeType edgeType = kEdgeTypes[et]; 68 GrPrimitiveEdgeType edgeType = kEdgeTypes[et];
69 canvas->save(); 69 canvas->save();
70 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); 70 canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
71 71
72 // Draw a background for the test case 72 // Draw a background for the test case
73 SkPaint paint; 73 SkPaint paint;
74 paint.setColor(SK_ColorWHITE); 74 paint.setColor(SK_ColorWHITE);
75 canvas->drawRect(testBounds, paint); 75 canvas->drawRect(testBounds, paint);
76 76
77 GrPipelineBuilder pipelineBuilder; 77 GrPipelineBuilder pipelineBuilder;
78 pipelineBuilder.setXPFactory( 78 pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXferm ode::kSrc_Mode));
79 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref ();
80 79
81 SkRRect rrect = fRRect; 80 SkRRect rrect = fRRect;
82 rrect.offset(SkIntToScalar(x + kGap), SkIntToScalar(y + kGap)); 81 rrect.offset(SkIntToScalar(x + kGap), SkIntToScalar(y + kGap));
83 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectEffect::Create(edgeT ype, rrect)); 82 sk_sp<GrFragmentProcessor> fp(GrRRectEffect::Make(edgeType, rrec t));
84 SkASSERT(fp); 83 SkASSERT(fp);
85 if (fp) { 84 if (fp) {
86 pipelineBuilder.addCoverageFragmentProcessor(fp); 85 pipelineBuilder.addCoverageFragmentProcessor(std::move(fp));
87 86
88 SkRect bounds = testBounds; 87 SkRect bounds = testBounds;
89 bounds.offset(SkIntToScalar(x), SkIntToScalar(y)); 88 bounds.offset(SkIntToScalar(x), SkIntToScalar(y));
90 89
91 SkAutoTUnref<GrDrawBatch> batch( 90 SkAutoTUnref<GrDrawBatch> batch(
92 GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMa trix::I(), bounds, 91 GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMa trix::I(), bounds,
93 nullptr, nullptr )); 92 nullptr, nullptr ));
94 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin eBuilder, batch); 93 drawContext->drawContextPriv().testingOnly_drawBatch(pipelin eBuilder, batch);
95 } 94 }
96 canvas->restore(); 95 canvas->restore();
(...skipping 25 matching lines...) Expand all
122 121
123 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRect(SkRect::MakeIWH(kSize, kSize)), "rect"); ) 122 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRect(SkRect::MakeIWH(kSize, kSize)), "rect"); )
124 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeOval(SkRect::MakeIWH(kSize, kSize)), "circle"); ) 123 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeOval(SkRect::MakeIWH(kSize, kSize)), "circle"); )
125 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeOval(SkRect::MakeIWH(kSize - 1, kSize - 10)), "ellipse"); ) 124 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeOval(SkRect::MakeIWH(kSize - 1, kSize - 10)), "ellipse"); )
126 // The next two have small linear segments between the corners 125 // The next two have small linear segments between the corners
127 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRectXY(SkRect::MakeIWH(kSize - 1, kSize - 10), kSize/2.f - 10.f, kSize/2.f - 10.f), "circular_corner"); ) 126 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRectXY(SkRect::MakeIWH(kSize - 1, kSize - 10), kSize/2.f - 10.f, kSize/2.f - 10.f), "circular_corner"); )
128 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRectXY(SkRect::MakeIWH(kSize - 1, kSize - 10), kSize/2.f - 10.f, kSize/2.f - 15.f), "elliptical_corner"); ) 127 DEF_GM( return new BigRRectAAEffectGM (SkRRect::MakeRectXY(SkRect::MakeIWH(kSize - 1, kSize - 10), kSize/2.f - 10.f, kSize/2.f - 15.f), "elliptical_corner"); )
129 128
130 } 129 }
131 #endif 130 #endif
OLDNEW
« no previous file with comments | « gm/beziereffects.cpp ('k') | gm/constcolorprocessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698