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

Side by Side Diff: src/gpu/effects/GrConvexPolyEffect.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 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
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.h ('k') | src/gpu/effects/GrCoverageSetOpXP.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 2014 Google Inc. 2 * Copyright 2014 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 "GrConvexPolyEffect.h" 8 #include "GrConvexPolyEffect.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "SkPathPriv.h" 10 #include "SkPathPriv.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 SkRect rect = SkRect::MakeLTRB(d->fRandom->nextSScalar1(), 64 SkRect rect = SkRect::MakeLTRB(d->fRandom->nextSScalar1(),
65 d->fRandom->nextSScalar1(), 65 d->fRandom->nextSScalar1(),
66 d->fRandom->nextSScalar1(), 66 d->fRandom->nextSScalar1(),
67 d->fRandom->nextSScalar1()); 67 d->fRandom->nextSScalar1());
68 GrFragmentProcessor* fp; 68 GrFragmentProcessor* fp;
69 do { 69 do {
70 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 70 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
71 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); 71 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
72 72
73 fp = AARectEffect::Create(edgeType, rect); 73 fp = AARectEffect::Create(edgeType, rect);
74 } while (NULL == fp); 74 } while (nullptr == fp);
75 return fp; 75 return fp;
76 } 76 }
77 77
78 ////////////////////////////////////////////////////////////////////////////// 78 //////////////////////////////////////////////////////////////////////////////
79 79
80 class GLAARectEffect : public GrGLFragmentProcessor { 80 class GLAARectEffect : public GrGLFragmentProcessor {
81 public: 81 public:
82 GLAARectEffect(const GrProcessor&); 82 GLAARectEffect(const GrProcessor&);
83 83
84 virtual void emitCode(EmitArgs&) override; 84 virtual void emitCode(EmitArgs&) override;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 GR_STATIC_ASSERT(kGrProcessorEdgeTypeCnt <= 8); 236 GR_STATIC_ASSERT(kGrProcessorEdgeTypeCnt <= 8);
237 uint32_t key = (cpe.getEdgeCount() << 3) | cpe.getEdgeType(); 237 uint32_t key = (cpe.getEdgeCount() << 3) | cpe.getEdgeType();
238 b->add32(key); 238 b->add32(key);
239 } 239 }
240 240
241 ////////////////////////////////////////////////////////////////////////////// 241 //////////////////////////////////////////////////////////////////////////////
242 242
243 GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType type, const SkPath& path, 243 GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType type, const SkPath& path,
244 const SkVector* offset) { 244 const SkVector* offset) {
245 if (kHairlineAA_GrProcessorEdgeType == type) { 245 if (kHairlineAA_GrProcessorEdgeType == type) {
246 return NULL; 246 return nullptr;
247 } 247 }
248 if (path.getSegmentMasks() != SkPath::kLine_SegmentMask || 248 if (path.getSegmentMasks() != SkPath::kLine_SegmentMask ||
249 !path.isConvex()) { 249 !path.isConvex()) {
250 return NULL; 250 return nullptr;
251 } 251 }
252 252
253 if (path.countPoints() > kMaxEdges) { 253 if (path.countPoints() > kMaxEdges) {
254 return NULL; 254 return nullptr;
255 } 255 }
256 256
257 SkPoint pts[kMaxEdges]; 257 SkPoint pts[kMaxEdges];
258 SkScalar edges[3 * kMaxEdges]; 258 SkScalar edges[3 * kMaxEdges];
259 259
260 SkPathPriv::FirstDirection dir; 260 SkPathPriv::FirstDirection dir;
261 SkAssertResult(SkPathPriv::CheapComputeFirstDirection(path, &dir)); 261 SkAssertResult(SkPathPriv::CheapComputeFirstDirection(path, &dir));
262 262
263 SkVector t; 263 SkVector t;
264 if (NULL == offset) { 264 if (nullptr == offset) {
265 t.set(0, 0); 265 t.set(0, 0);
266 } else { 266 } else {
267 t = *offset; 267 t = *offset;
268 } 268 }
269 269
270 int count = path.getPoints(pts, kMaxEdges); 270 int count = path.getPoints(pts, kMaxEdges);
271 int n = 0; 271 int n = 0;
272 for (int lastPt = count - 1, i = 0; i < count; lastPt = i++) { 272 for (int lastPt = count - 1, i = 0; i < count; lastPt = i++) {
273 if (pts[lastPt] != pts[i]) { 273 if (pts[lastPt] != pts[i]) {
274 SkVector v = pts[i] - pts[lastPt]; 274 SkVector v = pts[i] - pts[lastPt];
(...skipping 11 matching lines...) Expand all
286 } 286 }
287 } 287 }
288 if (path.isInverseFillType()) { 288 if (path.isInverseFillType()) {
289 type = GrInvertProcessorEdgeType(type); 289 type = GrInvertProcessorEdgeType(type);
290 } 290 }
291 return Create(type, n, edges); 291 return Create(type, n, edges);
292 } 292 }
293 293
294 GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, co nst SkRect& rect) { 294 GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, co nst SkRect& rect) {
295 if (kHairlineAA_GrProcessorEdgeType == edgeType){ 295 if (kHairlineAA_GrProcessorEdgeType == edgeType){
296 return NULL; 296 return nullptr;
297 } 297 }
298 return AARectEffect::Create(edgeType, rect); 298 return AARectEffect::Create(edgeType, rect);
299 } 299 }
300 300
301 GrConvexPolyEffect::~GrConvexPolyEffect() {} 301 GrConvexPolyEffect::~GrConvexPolyEffect() {}
302 302
303 void GrConvexPolyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons t { 303 void GrConvexPolyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons t {
304 inout->mulByUnknownSingleComponent(); 304 inout->mulByUnknownSingleComponent();
305 } 305 }
306 306
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 SkScalar edges[kMaxEdges * 3]; 344 SkScalar edges[kMaxEdges * 3];
345 for (int i = 0; i < 3 * count; ++i) { 345 for (int i = 0; i < 3 * count; ++i) {
346 edges[i] = d->fRandom->nextSScalar1(); 346 edges[i] = d->fRandom->nextSScalar1();
347 } 347 }
348 348
349 GrFragmentProcessor* fp; 349 GrFragmentProcessor* fp;
350 do { 350 do {
351 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 351 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
352 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); 352 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
353 fp = GrConvexPolyEffect::Create(edgeType, count, edges); 353 fp = GrConvexPolyEffect::Create(edgeType, count, edges);
354 } while (NULL == fp); 354 } while (nullptr == fp);
355 return fp; 355 return fp;
356 } 356 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.h ('k') | src/gpu/effects/GrCoverageSetOpXP.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698