Index: src/gpu/GrPath.cpp |
diff --git a/src/gpu/GrPath.cpp b/src/gpu/GrPath.cpp |
index 71c13af30656e21ed3181549b08a43c7987dd2e3..ef906a755a6d51c74b6385c17f10c550e7dfa605 100644 |
--- a/src/gpu/GrPath.cpp |
+++ b/src/gpu/GrPath.cpp |
@@ -58,8 +58,8 @@ inline static bool compute_key_for_oval_path(const SkPath& path, const GrStrokeI |
// Encodes the full path data to the unique key for very small, volatile paths. This is typically |
// hit when clipping stencils the clip stack. Intention is that this handles rects too, since |
// SkPath::isRect seems to do non-trivial amount of work. |
-inline static bool compute_key_for_simple_path(const SkPath& path, const GrStrokeInfo& stroke, |
- GrUniqueKey* key) { |
+inline static bool compute_key_for_simple_path(const SkPath& path, const SkPathRef* pathRef, |
+ const GrStrokeInfo& stroke, GrUniqueKey* key) { |
if (!path.isVolatile()) { |
return false; |
} |
@@ -78,19 +78,12 @@ inline static bool compute_key_for_simple_path(const SkPath& path, const GrStrok |
SkASSERT(false); |
return false; |
} |
- SkSTArray<16, SkScalar, true> conicWeights(16); |
- if ((path.getSegmentMasks() & SkPath::kConic_SegmentMask) != 0) { |
- SkPath::RawIter iter(path); |
- SkPath::Verb verb; |
- SkPoint points[4]; |
- while ((verb = iter.next(points)) != SkPath::kDone_Verb) { |
- if (verb == SkPath::kConic_Verb) { |
- conicWeights.push_back(iter.conicWeight()); |
- } |
- } |
- } |
- const int conicWeightCnt = conicWeights.count(); |
+ const int conicWeightCnt = pathRef ? pathRef->countWeights() : 0; |
+ if (conicWeightCnt < 0) { |
reed1
2015/11/30 15:36:39
Why this check?
Kimmo Kinnunen
2015/12/01 06:35:14
Because it's an int and used as a thing below that
reed1
2015/12/01 14:37:21
Yes, but can it ever be negative? This is an inter
|
+ SkASSERT(false); |
+ return false; |
+ } |
// Construct counts that align as uint32_t counts. |
#define ARRAY_DATA32_COUNT(array_type, count) \ |
@@ -149,7 +142,7 @@ inline static bool compute_key_for_simple_path(const SkPath& path, const GrStrok |
(conicWeightCnt * sizeof(SkScalar) / sizeof(uint32_t)))) { |
builder[i + conicWeightData32Cnt - 1] = 0; |
} |
- memcpy(&builder[i], conicWeights.begin(), conicWeightCnt * sizeof(SkScalar)); |
+ memcpy(&builder[i], pathRef->conicWeights(), conicWeightCnt * sizeof(SkScalar)); |
SkDEBUGCODE(i += conicWeightData32Cnt); |
} |
SkASSERT(i == baseData32Cnt); |
@@ -186,7 +179,7 @@ void GrPath::ComputeKey(const SkPath& path, const GrStrokeInfo& stroke, GrUnique |
return; |
} |
- if (compute_key_for_simple_path(path, stroke, key)) { |
+ if (compute_key_for_simple_path(path, path.fPathRef, stroke, key)) { |
*outIsVolatile = false; |
return; |
} |