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

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

Issue 1839743002: Fix GrConvexPolyEffect to deal with line paths. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix include to use "" instead of <> Created 4 years, 8 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/convexpolyeffect.cpp ('k') | no next file » | 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"
11 #include "effects/GrConstColorProcessor.h"
11 #include "glsl/GrGLSLFragmentProcessor.h" 12 #include "glsl/GrGLSLFragmentProcessor.h"
12 #include "glsl/GrGLSLFragmentShaderBuilder.h" 13 #include "glsl/GrGLSLFragmentShaderBuilder.h"
13 #include "glsl/GrGLSLProgramDataManager.h" 14 #include "glsl/GrGLSLProgramDataManager.h"
14 #include "glsl/GrGLSLUniformHandler.h" 15 #include "glsl/GrGLSLUniformHandler.h"
15 16
16 ////////////////////////////////////////////////////////////////////////////// 17 //////////////////////////////////////////////////////////////////////////////
17 class AARectEffect : public GrFragmentProcessor { 18 class AARectEffect : public GrFragmentProcessor {
18 public: 19 public:
19 const SkRect& getRect() const { return fRect; } 20 const SkRect& getRect() const { return fRect; }
20 21
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 248 }
248 249
249 if (path.countPoints() > kMaxEdges) { 250 if (path.countPoints() > kMaxEdges) {
250 return nullptr; 251 return nullptr;
251 } 252 }
252 253
253 SkPoint pts[kMaxEdges]; 254 SkPoint pts[kMaxEdges];
254 SkScalar edges[3 * kMaxEdges]; 255 SkScalar edges[3 * kMaxEdges];
255 256
256 SkPathPriv::FirstDirection dir; 257 SkPathPriv::FirstDirection dir;
257 SkAssertResult(SkPathPriv::CheapComputeFirstDirection(path, &dir)); 258 // The only way this should fail is if the clip is effectively a infinitely thin line. In that
259 // case nothing is inside the clip. It'd be nice to detect this at a higher level and either
260 // skip the draw or omit the clip element.
261 if (!SkPathPriv::CheapComputeFirstDirection(path, &dir)) {
262 if (GrProcessorEdgeTypeIsInverseFill(type)) {
263 return GrConstColorProcessor::Create(0xFFFFFFFF,
264 GrConstColorProcessor::kModulat eRGBA_InputMode);
265 }
266 return GrConstColorProcessor::Create(0, GrConstColorProcessor::kIgnore_I nputMode);
267 }
258 268
259 SkVector t; 269 SkVector t;
260 if (nullptr == offset) { 270 if (nullptr == offset) {
261 t.set(0, 0); 271 t.set(0, 0);
262 } else { 272 } else {
263 t = *offset; 273 t = *offset;
264 } 274 }
265 275
266 int count = path.getPoints(pts, kMaxEdges); 276 int count = path.getPoints(pts, kMaxEdges);
267 int n = 0; 277 int n = 0;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 353 }
344 354
345 GrFragmentProcessor* fp; 355 GrFragmentProcessor* fp;
346 do { 356 do {
347 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( 357 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
348 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); 358 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
349 fp = GrConvexPolyEffect::Create(edgeType, count, edges); 359 fp = GrConvexPolyEffect::Create(edgeType, count, edges);
350 } while (nullptr == fp); 360 } while (nullptr == fp);
351 return fp; 361 return fp;
352 } 362 }
OLDNEW
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698