OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrPath.h" | 8 #include "GrPath.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 // Encodes the full path data to the unique key for very small, volatile paths.
This is typically | 57 // Encodes the full path data to the unique key for very small, volatile paths.
This is typically |
58 // hit when clipping stencils the clip stack. Intention is that this handles rec
ts too, since | 58 // hit when clipping stencils the clip stack. Intention is that this handles rec
ts too, since |
59 // SkPath::isRect seems to do non-trivial amount of work. | 59 // SkPath::isRect seems to do non-trivial amount of work. |
60 inline static bool compute_key_for_simple_path(const SkPath& path, const GrStrok
eInfo& stroke, | 60 inline static bool compute_key_for_simple_path(const SkPath& path, const GrStrok
eInfo& stroke, |
61 GrUniqueKey* key) { | 61 GrUniqueKey* key) { |
62 if (!path.isVolatile()) { | 62 if (!path.isVolatile()) { |
63 return false; | 63 return false; |
64 } | 64 } |
65 | |
66 // The check below should take care of negative values casted positive. | 65 // The check below should take care of negative values casted positive. |
67 const int verbCnt = path.countVerbs(); | 66 const int verbCnt = path.countVerbs(); |
68 if (verbCnt > kSimpleVolatilePathVerbLimit) { | 67 if (verbCnt > kSimpleVolatilePathVerbLimit) { |
69 return false; | 68 return false; |
70 } | 69 } |
71 | 70 |
72 // If somebody goes wild with the constant, it might cause an overflow. | 71 // If somebody goes wild with the constant, it might cause an overflow. |
73 SK_COMPILE_ASSERT(kSimpleVolatilePathVerbLimit <= 100, | 72 SK_COMPILE_ASSERT(kSimpleVolatilePathVerbLimit <= 100, |
74 big_simple_volatile_path_verb_limit_may_cause_overflow); | 73 big_simple_volatile_path_verb_limit_may_cause_overflow); |
75 | 74 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 164 |
166 if (compute_key_for_simple_path(path, stroke, key)) { | 165 if (compute_key_for_simple_path(path, stroke, key)) { |
167 *outIsVolatile = false; | 166 *outIsVolatile = false; |
168 return; | 167 return; |
169 } | 168 } |
170 | 169 |
171 compute_key_for_general_path(path, stroke, key); | 170 compute_key_for_general_path(path, stroke, key); |
172 *outIsVolatile = path.isVolatile(); | 171 *outIsVolatile = path.isVolatile(); |
173 } | 172 } |
174 | 173 |
OLD | NEW |