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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 GrAssert(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable)); | 53 GrAssert(verb >= 0 && (size_t)verb < GR_ARRAY_COUNT(gTable)); |
54 return gTable[verb]; | 54 return gTable[verb]; |
55 } | 55 } |
56 #endif | 56 #endif |
57 } | 57 } |
58 | 58 |
59 static const bool kIsWrapped = false; // The constructor creates the GL path obj
ect. | 59 static const bool kIsWrapped = false; // The constructor creates the GL path obj
ect. |
60 | 60 |
61 GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path) : INHERITED(gpu, kIsWrapped
) { | 61 GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path) : INHERITED(gpu, kIsWrapped
) { |
62 GL_CALL_RET(fPathID, GenPaths(1)); | |
63 SkPath::Iter iter(path, true); | |
64 | |
65 SkSTArray<16, GrGLubyte, true> pathCommands; | |
66 #ifndef SK_SCALAR_IS_FLOAT | 62 #ifndef SK_SCALAR_IS_FLOAT |
67 GrCrash("Assumes scalar is float."); | 63 GrCrash("Assumes scalar is float."); |
68 #endif | 64 #endif |
| 65 SkASSERT(!path.isEmpty()); |
| 66 |
| 67 GL_CALL_RET(fPathID, GenPaths(1)); |
| 68 |
| 69 SkSTArray<16, GrGLubyte, true> pathCommands; |
69 SkSTArray<16, SkPoint, true> pathPoints; | 70 SkSTArray<16, SkPoint, true> pathPoints; |
70 | 71 |
71 int verbCnt = path.countVerbs(); | 72 int verbCnt = path.countVerbs(); |
72 int pointCnt = path.countPoints(); | 73 int pointCnt = path.countPoints(); |
73 pathCommands.resize_back(verbCnt); | 74 pathCommands.resize_back(verbCnt); |
74 pathPoints.resize_back(pointCnt); | 75 pathPoints.resize_back(pointCnt); |
75 | 76 |
76 // TODO: Direct access to path points since we could pass them on directly. | 77 // TODO: Direct access to path points since we could pass them on directly. |
77 path.getPoints(&pathPoints[0], pointCnt); | 78 path.getPoints(&pathPoints[0], pointCnt); |
78 path.getVerbs(&pathCommands[0], verbCnt); | 79 path.getVerbs(&pathCommands[0], verbCnt); |
(...skipping 23 matching lines...) Expand all Loading... |
102 } | 103 } |
103 | 104 |
104 INHERITED::onRelease(); | 105 INHERITED::onRelease(); |
105 } | 106 } |
106 | 107 |
107 void GrGLPath::onAbandon() { | 108 void GrGLPath::onAbandon() { |
108 fPathID = 0; | 109 fPathID = 0; |
109 | 110 |
110 INHERITED::onAbandon(); | 111 INHERITED::onAbandon(); |
111 } | 112 } |
OLD | NEW |