OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrGLPath.h" | 9 #include "GrGLPath.h" |
10 #include "GrGpuGL.h" | 10 #include "GrGpuGL.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 0xFF, // conic | 23 0xFF, // conic |
24 GR_GL_CUBIC_CURVE_TO, | 24 GR_GL_CUBIC_CURVE_TO, |
25 GR_GL_CLOSE_PATH, | 25 GR_GL_CLOSE_PATH, |
26 }; | 26 }; |
27 GR_STATIC_ASSERT(0 == SkPath::kMove_Verb); | 27 GR_STATIC_ASSERT(0 == SkPath::kMove_Verb); |
28 GR_STATIC_ASSERT(1 == SkPath::kLine_Verb); | 28 GR_STATIC_ASSERT(1 == SkPath::kLine_Verb); |
29 GR_STATIC_ASSERT(2 == SkPath::kQuad_Verb); | 29 GR_STATIC_ASSERT(2 == SkPath::kQuad_Verb); |
30 GR_STATIC_ASSERT(4 == SkPath::kCubic_Verb); | 30 GR_STATIC_ASSERT(4 == SkPath::kCubic_Verb); |
31 GR_STATIC_ASSERT(5 == SkPath::kClose_Verb); | 31 GR_STATIC_ASSERT(5 == SkPath::kClose_Verb); |
32 | 32 |
33 SkASSERT(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable)); | 33 SkASSERT(verb >= 0 && (size_t)verb < SK_ARRAY_COUNT(gTable)); |
34 return gTable[verb]; | 34 return gTable[verb]; |
35 } | 35 } |
36 | 36 |
37 #ifdef SK_DEBUG | 37 #ifdef SK_DEBUG |
38 inline int num_pts(SkPath::Verb verb) { | 38 inline int num_pts(SkPath::Verb verb) { |
39 static const int gTable[] = { | 39 static const int gTable[] = { |
40 1, // move | 40 1, // move |
41 1, // line | 41 1, // line |
42 2, // quad | 42 2, // quad |
43 2, // conic | 43 2, // conic |
44 3, // cubic | 44 3, // cubic |
45 0, // close | 45 0, // close |
46 }; | 46 }; |
47 GR_STATIC_ASSERT(0 == SkPath::kMove_Verb); | 47 GR_STATIC_ASSERT(0 == SkPath::kMove_Verb); |
48 GR_STATIC_ASSERT(1 == SkPath::kLine_Verb); | 48 GR_STATIC_ASSERT(1 == SkPath::kLine_Verb); |
49 GR_STATIC_ASSERT(2 == SkPath::kQuad_Verb); | 49 GR_STATIC_ASSERT(2 == SkPath::kQuad_Verb); |
50 GR_STATIC_ASSERT(4 == SkPath::kCubic_Verb); | 50 GR_STATIC_ASSERT(4 == SkPath::kCubic_Verb); |
51 GR_STATIC_ASSERT(5 == SkPath::kClose_Verb); | 51 GR_STATIC_ASSERT(5 == SkPath::kClose_Verb); |
52 | 52 |
53 SkASSERT(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable)); | 53 SkASSERT(verb >= 0 && (size_t)verb < SK_ARRAY_COUNT(gTable)); |
54 return gTable[verb]; | 54 return gTable[verb]; |
55 } | 55 } |
56 #endif | 56 #endif |
57 | 57 |
58 inline GrGLenum join_to_gl_join(SkPaint::Join join) { | 58 inline GrGLenum join_to_gl_join(SkPaint::Join join) { |
59 static GrGLenum gSkJoinsToGrGLJoins[] = { | 59 static GrGLenum gSkJoinsToGrGLJoins[] = { |
60 GR_GL_MITER_REVERT, | 60 GR_GL_MITER_REVERT, |
61 GR_GL_ROUND, | 61 GR_GL_ROUND, |
62 GR_GL_BEVEL | 62 GR_GL_BEVEL |
63 }; | 63 }; |
64 return gSkJoinsToGrGLJoins[join]; | 64 return gSkJoinsToGrGLJoins[join]; |
65 GR_STATIC_ASSERT(0 == SkPaint::kMiter_Join); | 65 GR_STATIC_ASSERT(0 == SkPaint::kMiter_Join); |
66 GR_STATIC_ASSERT(1 == SkPaint::kRound_Join); | 66 GR_STATIC_ASSERT(1 == SkPaint::kRound_Join); |
67 GR_STATIC_ASSERT(2 == SkPaint::kBevel_Join); | 67 GR_STATIC_ASSERT(2 == SkPaint::kBevel_Join); |
68 GR_STATIC_ASSERT(GR_ARRAY_COUNT(gSkJoinsToGrGLJoins) == SkPaint::kJoinCount)
; | 68 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gSkJoinsToGrGLJoins) == SkPaint::kJoinCount)
; |
69 } | 69 } |
70 | 70 |
71 inline GrGLenum cap_to_gl_cap(SkPaint::Cap cap) { | 71 inline GrGLenum cap_to_gl_cap(SkPaint::Cap cap) { |
72 static GrGLenum gSkCapsToGrGLCaps[] = { | 72 static GrGLenum gSkCapsToGrGLCaps[] = { |
73 GR_GL_FLAT, | 73 GR_GL_FLAT, |
74 GR_GL_ROUND, | 74 GR_GL_ROUND, |
75 GR_GL_SQUARE | 75 GR_GL_SQUARE |
76 }; | 76 }; |
77 return gSkCapsToGrGLCaps[cap]; | 77 return gSkCapsToGrGLCaps[cap]; |
78 GR_STATIC_ASSERT(0 == SkPaint::kButt_Cap); | 78 GR_STATIC_ASSERT(0 == SkPaint::kButt_Cap); |
79 GR_STATIC_ASSERT(1 == SkPaint::kRound_Cap); | 79 GR_STATIC_ASSERT(1 == SkPaint::kRound_Cap); |
80 GR_STATIC_ASSERT(2 == SkPaint::kSquare_Cap); | 80 GR_STATIC_ASSERT(2 == SkPaint::kSquare_Cap); |
81 GR_STATIC_ASSERT(GR_ARRAY_COUNT(gSkCapsToGrGLCaps) == SkPaint::kCapCount); | 81 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gSkCapsToGrGLCaps) == SkPaint::kCapCount); |
82 } | 82 } |
83 | 83 |
84 } | 84 } |
85 | 85 |
86 static const bool kIsWrapped = false; // The constructor creates the GL path obj
ect. | 86 static const bool kIsWrapped = false; // The constructor creates the GL path obj
ect. |
87 | 87 |
88 GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path, const SkStrokeRec& stroke) | 88 GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path, const SkStrokeRec& stroke) |
89 : INHERITED(gpu, kIsWrapped, path, stroke) { | 89 : INHERITED(gpu, kIsWrapped, path, stroke) { |
90 SkASSERT(!path.isEmpty()); | 90 SkASSERT(!path.isEmpty()); |
91 | 91 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 | 141 |
142 INHERITED::onRelease(); | 142 INHERITED::onRelease(); |
143 } | 143 } |
144 | 144 |
145 void GrGLPath::onAbandon() { | 145 void GrGLPath::onAbandon() { |
146 fPathID = 0; | 146 fPathID = 0; |
147 | 147 |
148 INHERITED::onAbandon(); | 148 INHERITED::onAbandon(); |
149 } | 149 } |
OLD | NEW |