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

Side by Side Diff: gm/rrects.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/dcshader.cpp ('k') | gm/texturedomaineffect.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 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 SkRect imageSpaceBounds = fRRects[curRRect].getBounds(); 96 SkRect imageSpaceBounds = fRRects[curRRect].getBounds();
97 imageSpaceBounds.offset(SkIntToScalar(x), SkIntToScalar(y)); 97 imageSpaceBounds.offset(SkIntToScalar(x), SkIntToScalar(y));
98 SkASSERT(kMaxImageBound.contains(imageSpaceBounds)); 98 SkASSERT(kMaxImageBound.contains(imageSpaceBounds));
99 #endif 99 #endif
100 canvas->save(); 100 canvas->save();
101 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); 101 canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
102 if (kEffect_Type == fType) { 102 if (kEffect_Type == fType) {
103 #if SK_SUPPORT_GPU 103 #if SK_SUPPORT_GPU
104 GrPipelineBuilder pipelineBuilder; 104 GrPipelineBuilder pipelineBuilder;
105 pipelineBuilder.setXPFactory( 105 pipelineBuilder.setXPFactory(
106 GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode) )->unref(); 106 GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
107 107
108 SkRRect rrect = fRRects[curRRect]; 108 SkRRect rrect = fRRects[curRRect];
109 rrect.offset(SkIntToScalar(x), SkIntToScalar(y)); 109 rrect.offset(SkIntToScalar(x), SkIntToScalar(y));
110 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; 110 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et;
111 SkAutoTUnref<GrFragmentProcessor> fp(GrRRectEffect::Crea te(edgeType, 111 sk_sp<GrFragmentProcessor> fp(GrRRectEffect::Make(edgeTy pe, rrect));
112 rrect));
113 if (fp) { 112 if (fp) {
114 pipelineBuilder.addCoverageFragmentProcessor(fp); 113 pipelineBuilder.addCoverageFragmentProcessor(std::mo ve(fp));
115 114
116 SkRect bounds = rrect.getBounds(); 115 SkRect bounds = rrect.getBounds();
117 bounds.outset(2.f, 2.f); 116 bounds.outset(2.f, 2.f);
118 117
119 SkAutoTUnref<GrDrawBatch> batch( 118 SkAutoTUnref<GrDrawBatch> batch(
120 GrRectBatchFactory::CreateNonAAFill(0xff0000 00, SkMatrix::I(), 119 GrRectBatchFactory::CreateNonAAFill(0xff0000 00, SkMatrix::I(),
121 bounds, nullptr, nullptr)); 120 bounds, nullptr, nullptr));
122 drawContext->drawContextPriv().testingOnly_drawBatch (pipelineBuilder, 121 drawContext->drawContextPriv().testingOnly_drawBatch (pipelineBuilder,
123 batch); 122 batch);
124 } else { 123 } else {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 253
255 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); ) 254 DEF_GM( return new RRectGM(RRectGM::kAA_Draw_Type); )
256 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); ) 255 DEF_GM( return new RRectGM(RRectGM::kBW_Draw_Type); )
257 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); ) 256 DEF_GM( return new RRectGM(RRectGM::kAA_Clip_Type); )
258 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); ) 257 DEF_GM( return new RRectGM(RRectGM::kBW_Clip_Type); )
259 #if SK_SUPPORT_GPU 258 #if SK_SUPPORT_GPU
260 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); ) 259 DEF_GM( return new RRectGM(RRectGM::kEffect_Type); )
261 #endif 260 #endif
262 261
263 } 262 }
OLDNEW
« no previous file with comments | « gm/dcshader.cpp ('k') | gm/texturedomaineffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698