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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 int verbCnt = path.countVerbs(); | 72 int verbCnt = path.countVerbs(); |
73 int pointCnt = path.countPoints(); | 73 int pointCnt = path.countPoints(); |
74 pathCommands.resize_back(verbCnt); | 74 pathCommands.resize_back(verbCnt); |
75 pathPoints.resize_back(pointCnt); | 75 pathPoints.resize_back(pointCnt); |
76 | 76 |
77 // 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. |
78 path.getPoints(&pathPoints[0], pointCnt); | 78 path.getPoints(&pathPoints[0], pointCnt); |
79 path.getVerbs(&pathCommands[0], verbCnt); | 79 path.getVerbs(&pathCommands[0], verbCnt); |
80 | 80 |
81 GR_DEBUGCODE(int numPts = 0); | 81 SkDEBUGCODE(int numPts = 0); |
82 for (int i = 0; i < verbCnt; ++i) { | 82 for (int i = 0; i < verbCnt; ++i) { |
83 SkPath::Verb v = static_cast<SkPath::Verb>(pathCommands[i]); | 83 SkPath::Verb v = static_cast<SkPath::Verb>(pathCommands[i]); |
84 pathCommands[i] = verb_to_gl_path_cmd(v); | 84 pathCommands[i] = verb_to_gl_path_cmd(v); |
85 GR_DEBUGCODE(numPts += num_pts(v)); | 85 SkDEBUGCODE(numPts += num_pts(v)); |
86 } | 86 } |
87 SkASSERT(pathPoints.count() == numPts); | 87 SkASSERT(pathPoints.count() == numPts); |
88 | 88 |
89 GL_CALL(PathCommands(fPathID, | 89 GL_CALL(PathCommands(fPathID, |
90 verbCnt, &pathCommands[0], | 90 verbCnt, &pathCommands[0], |
91 2 * pointCnt, GR_GL_FLOAT, &pathPoints[0])); | 91 2 * pointCnt, GR_GL_FLOAT, &pathPoints[0])); |
92 fBounds = path.getBounds(); | 92 fBounds = path.getBounds(); |
93 } | 93 } |
94 | 94 |
95 GrGLPath::~GrGLPath() { | 95 GrGLPath::~GrGLPath() { |
96 this->release(); | 96 this->release(); |
97 } | 97 } |
98 | 98 |
99 void GrGLPath::onRelease() { | 99 void GrGLPath::onRelease() { |
100 if (0 != fPathID && !this->isWrapped()) { | 100 if (0 != fPathID && !this->isWrapped()) { |
101 GL_CALL(DeletePaths(fPathID, 1)); | 101 GL_CALL(DeletePaths(fPathID, 1)); |
102 fPathID = 0; | 102 fPathID = 0; |
103 } | 103 } |
104 | 104 |
105 INHERITED::onRelease(); | 105 INHERITED::onRelease(); |
106 } | 106 } |
107 | 107 |
108 void GrGLPath::onAbandon() { | 108 void GrGLPath::onAbandon() { |
109 fPathID = 0; | 109 fPathID = 0; |
110 | 110 |
111 INHERITED::onAbandon(); | 111 INHERITED::onAbandon(); |
112 } | 112 } |
OLD | NEW |