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

Side by Side Diff: gm/convexpolyeffect.cpp

Issue 511593004: Make setVertexAttribs in GrDrawState take a stride parameter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 // This test only works with the GPU backend. 9 // This test only works with the GPU backend.
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 SkScalar x = 0; 120 SkScalar x = 0;
121 121
122 for (int et = 0; et < kGrEffectEdgeTypeCnt; ++et) { 122 for (int et = 0; et < kGrEffectEdgeTypeCnt; ++et) {
123 GrTestTarget tt; 123 GrTestTarget tt;
124 context->getTestTarget(&tt); 124 context->getTestTarget(&tt);
125 if (NULL == tt.target()) { 125 if (NULL == tt.target()) {
126 SkDEBUGFAIL("Couldn't get Gr test target."); 126 SkDEBUGFAIL("Couldn't get Gr test target.");
127 return; 127 return;
128 } 128 }
129 GrDrawState* drawState = tt.target()->drawState(); 129 GrDrawState* drawState = tt.target()->drawState();
130 drawState->setVertexAttribs<kAttribs>(SK_ARRAY_COUNT(kAttribs)); 130 drawState->setVertexAttribs<kAttribs>(SK_ARRAY_COUNT(kAttribs), sizeof(SkPoint));
131 131
132 SkMatrix m; 132 SkMatrix m;
133 SkPath p; 133 SkPath p;
134 m.setTranslate(x, y); 134 m.setTranslate(x, y);
135 path->transform(m, &p); 135 path->transform(m, &p);
136 136
137 GrEffectEdgeType edgeType = (GrEffectEdgeType) et; 137 GrEffectEdgeType edgeType = (GrEffectEdgeType) et;
138 SkAutoTUnref<GrEffect> effect(GrConvexPolyEffect::Create(edgeTyp e, p)); 138 SkAutoTUnref<GrEffect> effect(GrConvexPolyEffect::Create(edgeTyp e, p));
139 if (!effect) { 139 if (!effect) {
140 continue; 140 continue;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 SkRect rect = *iter.get(); 187 SkRect rect = *iter.get();
188 rect.offset(x, y); 188 rect.offset(x, y);
189 GrEffectEdgeType edgeType = (GrEffectEdgeType) et; 189 GrEffectEdgeType edgeType = (GrEffectEdgeType) et;
190 SkAutoTUnref<GrEffect> effect(GrConvexPolyEffect::Create(edgeTyp e, rect)); 190 SkAutoTUnref<GrEffect> effect(GrConvexPolyEffect::Create(edgeTyp e, rect));
191 if (!effect) { 191 if (!effect) {
192 continue; 192 continue;
193 } 193 }
194 194
195 GrDrawState* drawState = tt.target()->drawState(); 195 GrDrawState* drawState = tt.target()->drawState();
196 drawState->setVertexAttribs<kAttribs>(SK_ARRAY_COUNT(kAttribs)); 196 drawState->setVertexAttribs<kAttribs>(SK_ARRAY_COUNT(kAttribs), sizeof(SkPoint));
197 drawState->addCoverageEffect(effect, 1); 197 drawState->addCoverageEffect(effect, 1);
198 drawState->setIdentityViewMatrix(); 198 drawState->setIdentityViewMatrix();
199 drawState->setRenderTarget(rt); 199 drawState->setRenderTarget(rt);
200 drawState->setColor(0xff000000); 200 drawState->setColor(0xff000000);
201 201
202 SkPoint verts[4]; 202 SkPoint verts[4];
203 SkRect bounds = rect; 203 SkRect bounds = rect;
204 bounds.outset(5.f, 5.f); 204 bounds.outset(5.f, 5.f);
205 bounds.toQuad(verts); 205 bounds.toQuad(verts);
206 206
(...skipping 22 matching lines...) Expand all
229 SkTLList<SkPath> fPaths; 229 SkTLList<SkPath> fPaths;
230 SkTLList<SkRect> fRects; 230 SkTLList<SkRect> fRects;
231 231
232 typedef GM INHERITED; 232 typedef GM INHERITED;
233 }; 233 };
234 234
235 DEF_GM( return SkNEW(ConvexPolyEffect); ) 235 DEF_GM( return SkNEW(ConvexPolyEffect); )
236 } 236 }
237 237
238 #endif 238 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698