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

Side by Side Diff: gm/convexpolyeffect.cpp

Issue 783763002: Initial CL to move color / coverage off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@no-static-gp
Patch Set: bug fix Created 6 years 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/rrects.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 /* 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 m.setTranslate(x, y); 126 m.setTranslate(x, y);
127 path->transform(m, &p); 127 path->transform(m, &p);
128 128
129 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; 129 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et;
130 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create( edgeType, p)); 130 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create( edgeType, p));
131 if (!fp) { 131 if (!fp) {
132 continue; 132 continue;
133 } 133 }
134 134
135 GrDrawState ds; 135 GrDrawState ds;
136 const GrGeometryProcessor* gp = GrDefaultGeoProcFactory::Create( ); 136 const GrGeometryProcessor* gp = GrDefaultGeoProcFactory::Create( 0xff000000);
137 ds.setGeometryProcessor(gp)->unref(); 137 ds.setGeometryProcessor(gp)->unref();
138 ds.addCoverageProcessor(fp); 138 ds.addCoverageProcessor(fp);
139 ds.setIdentityViewMatrix(); 139 ds.setIdentityViewMatrix();
140 ds.setRenderTarget(rt); 140 ds.setRenderTarget(rt);
141 ds.setColor(0xff000000);
142 141
143 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVer texStride(), 0); 142 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVer texStride(), 0);
144 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); 143 SkASSERT(gp->getVertexStride() == sizeof(SkPoint));
145 SkPoint* verts = reinterpret_cast<SkPoint*>(geo.vertices()); 144 SkPoint* verts = reinterpret_cast<SkPoint*>(geo.vertices());
146 145
147 SkRect bounds = p.getBounds(); 146 SkRect bounds = p.getBounds();
148 // Make sure any artifacts around the exterior of path are visib le by using overly 147 // Make sure any artifacts around the exterior of path are visib le by using overly
149 // conservative bounding geometry. 148 // conservative bounding geometry.
150 bounds.outset(5.f, 5.f); 149 bounds.outset(5.f, 5.f);
151 bounds.toQuad(verts); 150 bounds.toQuad(verts);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 183 }
185 SkRect rect = *iter.get(); 184 SkRect rect = *iter.get();
186 rect.offset(x, y); 185 rect.offset(x, y);
187 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; 186 GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et;
188 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create( edgeType, rect)); 187 SkAutoTUnref<GrFragmentProcessor> fp(GrConvexPolyEffect::Create( edgeType, rect));
189 if (!fp) { 188 if (!fp) {
190 continue; 189 continue;
191 } 190 }
192 191
193 GrDrawState ds; 192 GrDrawState ds;
194 const GrGeometryProcessor* gp = GrDefaultGeoProcFactory::Create( ); 193 const GrGeometryProcessor* gp = GrDefaultGeoProcFactory::Create( 0xff000000);
195 ds.setGeometryProcessor(gp)->unref(); 194 ds.setGeometryProcessor(gp)->unref();
196 ds.addCoverageProcessor(fp); 195 ds.addCoverageProcessor(fp);
197 ds.setIdentityViewMatrix(); 196 ds.setIdentityViewMatrix();
198 ds.setRenderTarget(rt); 197 ds.setRenderTarget(rt);
199 ds.setColor(0xff000000);
200 198
201 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVer texStride(), 0); 199 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVer texStride(), 0);
202 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); 200 SkASSERT(gp->getVertexStride() == sizeof(SkPoint));
203 SkPoint* verts = reinterpret_cast<SkPoint*>(geo.vertices()); 201 SkPoint* verts = reinterpret_cast<SkPoint*>(geo.vertices());
204 202
205 SkRect bounds = rect; 203 SkRect bounds = rect;
206 bounds.outset(5.f, 5.f); 204 bounds.outset(5.f, 5.f);
207 bounds.toQuad(verts); 205 bounds.toQuad(verts);
208 206
209 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer( )); 207 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer( ));
(...skipping 20 matching lines...) Expand all
230 SkTLList<SkPath> fPaths; 228 SkTLList<SkPath> fPaths;
231 SkTLList<SkRect> fRects; 229 SkTLList<SkRect> fRects;
232 230
233 typedef GM INHERITED; 231 typedef GM INHERITED;
234 }; 232 };
235 233
236 DEF_GM( return SkNEW(ConvexPolyEffect); ) 234 DEF_GM( return SkNEW(ConvexPolyEffect); )
237 } 235 }
238 236
239 #endif 237 #endif
OLDNEW
« no previous file with comments | « gm/beziereffects.cpp ('k') | gm/rrects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698