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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
92 GL_CALL_RET(fPathID, GenPaths(1)); | 92 fPathID = gpu->createGLPathObject(); |
93 | 93 |
94 SkSTArray<16, GrGLubyte, true> pathCommands; | 94 SkSTArray<16, GrGLubyte, true> pathCommands; |
95 SkSTArray<16, SkPoint, true> pathPoints; | 95 SkSTArray<16, SkPoint, true> pathPoints; |
96 | 96 |
97 int verbCnt = fSkPath.countVerbs(); | 97 int verbCnt = fSkPath.countVerbs(); |
98 int pointCnt = fSkPath.countPoints(); | 98 int pointCnt = fSkPath.countPoints(); |
99 pathCommands.resize_back(verbCnt); | 99 pathCommands.resize_back(verbCnt); |
100 pathPoints.resize_back(pointCnt); | 100 pathPoints.resize_back(pointCnt); |
101 | 101 |
102 // TODO: Direct access to path points since we could pass them on directly. | 102 // TODO: Direct access to path points since we could pass them on directly. |
(...skipping 25 matching lines...) Expand all Loading... |
128 fBounds.outset(SkScalarToFloat(stroke.getWidth()), SkScalarToFloat(strok
e.getWidth())); | 128 fBounds.outset(SkScalarToFloat(stroke.getWidth()), SkScalarToFloat(strok
e.getWidth())); |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 GrGLPath::~GrGLPath() { | 132 GrGLPath::~GrGLPath() { |
133 this->release(); | 133 this->release(); |
134 } | 134 } |
135 | 135 |
136 void GrGLPath::onRelease() { | 136 void GrGLPath::onRelease() { |
137 if (0 != fPathID && !this->isWrapped()) { | 137 if (0 != fPathID && !this->isWrapped()) { |
138 GL_CALL(DeletePaths(fPathID, 1)); | 138 static_cast<GrGpuGL*>(this->getGpu())->deleteGLPathObject(fPathID); |
139 fPathID = 0; | 139 fPathID = 0; |
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 |