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

Side by Side Diff: src/gpu/batches/GrTessellatingPathRenderer.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 | « src/gpu/batches/GrTInstanceBatch.h ('k') | src/gpu/effects/GrBezierEffect.h » ('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 "GrTessellatingPathRenderer.h" 8 #include "GrTessellatingPathRenderer.h"
9 9
10 #include "GrAuditTrail.h" 10 #include "GrAuditTrail.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 info.fTolerance = isLinear ? 0 : tol; 204 info.fTolerance = isLinear ? 0 : tol;
205 info.fCount = count; 205 info.fCount = count;
206 SkAutoTUnref<SkData> data(SkData::NewWithCopy(&info, sizeof(info))); 206 SkAutoTUnref<SkData> data(SkData::NewWithCopy(&info, sizeof(info)));
207 key.setCustomData(data.get()); 207 key.setCustomData(data.get());
208 rp->assignUniqueKeyToResource(key, allocator.vertexBuffer()); 208 rp->assignUniqueKeyToResource(key, allocator.vertexBuffer());
209 SkPathPriv::AddGenIDChangeListener(fPath, new PathInvalidator(key)); 209 SkPathPriv::AddGenIDChangeListener(fPath, new PathInvalidator(key));
210 } 210 }
211 } 211 }
212 212
213 void onPrepareDraws(Target* target) const override { 213 void onPrepareDraws(Target* target) const override {
214 SkAutoTUnref<const GrGeometryProcessor> gp; 214 sk_sp<GrGeometryProcessor> gp;
215 { 215 {
216 using namespace GrDefaultGeoProcFactory; 216 using namespace GrDefaultGeoProcFactory;
217 217
218 Color color(fColor); 218 Color color(fColor);
219 LocalCoords localCoords(fPipelineInfo.readsLocalCoords() ? 219 LocalCoords localCoords(fPipelineInfo.readsLocalCoords() ?
220 LocalCoords::kUsePosition_Type : 220 LocalCoords::kUsePosition_Type :
221 LocalCoords::kUnused_Type); 221 LocalCoords::kUnused_Type);
222 Coverage::Type coverageType; 222 Coverage::Type coverageType;
223 if (fPipelineInfo.readsCoverage()) { 223 if (fPipelineInfo.readsCoverage()) {
224 coverageType = Coverage::kSolid_Type; 224 coverageType = Coverage::kSolid_Type;
225 } else { 225 } else {
226 coverageType = Coverage::kNone_Type; 226 coverageType = Coverage::kNone_Type;
227 } 227 }
228 Coverage coverage(coverageType); 228 Coverage coverage(coverageType);
229 gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoord s, 229 gp = GrDefaultGeoProcFactory::Make(color, coverage, localCoords, fVi ewMatrix);
230 fViewMatrix));
231 } 230 }
232 this->draw(target, gp.get()); 231 this->draw(target, gp.get());
233 } 232 }
234 233
235 void drawVertices(Target* target, const GrGeometryProcessor* gp, const GrBuf fer* vb, 234 void drawVertices(Target* target, const GrGeometryProcessor* gp, const GrBuf fer* vb,
236 int firstVertex, int count) const { 235 int firstVertex, int count) const {
237 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); 236 SkASSERT(gp->getVertexStride() == sizeof(SkPoint));
238 237
239 GrPrimitiveType primitiveType = TESSELLATOR_WIREFRAME ? kLines_GrPrimiti veType 238 GrPrimitiveType primitiveType = TESSELLATOR_WIREFRAME ? kLines_GrPrimiti veType
240 : kTriangles_GrPri mitiveType; 239 : kTriangles_GrPri mitiveType;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } 320 }
322 vmi.mapRect(&clipBounds); 321 vmi.mapRect(&clipBounds);
323 GrStyle style; 322 GrStyle style;
324 do { 323 do {
325 GrTest::TestStyle(random, &style); 324 GrTest::TestStyle(random, &style);
326 } while (style.strokeRec().isHairlineStyle()); 325 } while (style.strokeRec().isHairlineStyle());
327 return TessellatingPathBatch::Create(color, path, style, viewMatrix, clipBou nds); 326 return TessellatingPathBatch::Create(color, path, style, viewMatrix, clipBou nds);
328 } 327 }
329 328
330 #endif 329 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrTInstanceBatch.h ('k') | src/gpu/effects/GrBezierEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698