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

Unified Diff: src/gpu/gl/GrGLPath.cpp

Issue 522883002: Don't assert on empty GrGLPaths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLPath.cpp
diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp
index 972a7af39bd324195ca7f785c83e8ac673d56515..a6cf804c2f44196898f8d6e1a1c4ccf79c659e43 100644
--- a/src/gpu/gl/GrGLPath.cpp
+++ b/src/gpu/gl/GrGLPath.cpp
@@ -85,29 +85,32 @@ void GrGLPath::InitPathObject(GrGpuGL* gpu,
GrGLuint pathID,
const SkPath& skPath,
const SkStrokeRec& stroke) {
- SkSTArray<16, GrGLubyte, true> pathCommands;
- SkSTArray<16, SkPoint, true> pathPoints;
-
- int verbCnt = skPath.countVerbs();
- int pointCnt = skPath.countPoints();
- pathCommands.resize_back(verbCnt);
- pathPoints.resize_back(pointCnt);
-
- // TODO: Direct access to path points since we could pass them on directly.
- skPath.getPoints(&pathPoints[0], pointCnt);
- skPath.getVerbs(&pathCommands[0], verbCnt);
-
- SkDEBUGCODE(int numPts = 0);
- for (int i = 0; i < verbCnt; ++i) {
- SkPath::Verb v = static_cast<SkPath::Verb>(pathCommands[i]);
- pathCommands[i] = verb_to_gl_path_cmd(v);
- SkDEBUGCODE(numPts += num_pts(v));
+ if (!skPath.isEmpty()) {
+ SkSTArray<16, GrGLubyte, true> pathCommands;
+ SkSTArray<16, SkPoint, true> pathPoints;
+
+ int verbCnt = skPath.countVerbs();
+ int pointCnt = skPath.countPoints();
+ pathCommands.resize_back(verbCnt);
+ pathPoints.resize_back(pointCnt);
+
+ // TODO: Direct access to path points since we could pass them on directly.
+ skPath.getPoints(&pathPoints[0], pointCnt);
+ skPath.getVerbs(&pathCommands[0], verbCnt);
+
+ SkDEBUGCODE(int numPts = 0);
+ for (int i = 0; i < verbCnt; ++i) {
+ SkPath::Verb v = static_cast<SkPath::Verb>(pathCommands[i]);
+ pathCommands[i] = verb_to_gl_path_cmd(v);
+ SkDEBUGCODE(numPts += num_pts(v));
+ }
+ SkASSERT(pathPoints.count() == numPts);
+
+ GR_GL_CALL(gpu->glInterface(),
+ PathCommands(pathID, verbCnt, &pathCommands[0],
+ 2 * pointCnt, GR_GL_FLOAT, &pathPoints[0]));
}
- SkASSERT(pathPoints.count() == numPts);
- GR_GL_CALL(gpu->glInterface(),
- PathCommands(pathID, verbCnt, &pathCommands[0],
- 2 * pointCnt, GR_GL_FLOAT, &pathPoints[0]));
if (stroke.needToApply()) {
SkASSERT(!stroke.isHairlineStyle());
GR_GL_CALL(gpu->glInterface(),
@@ -128,7 +131,6 @@ void GrGLPath::InitPathObject(GrGpuGL* gpu,
GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path, const SkStrokeRec& stroke)
: INHERITED(gpu, kIsWrapped, path, stroke),
fPathID(gpu->glPathRendering()->genPaths(1)) {
- SkASSERT(!path.isEmpty());
InitPathObject(gpu, fPathID, fSkPath, stroke);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698