MCPcopy Create free account
hub / github.com/Tencent/tgfx / computeVertices

Method computeVertices

test/src/CornerPinEffect.cpp:170–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170std::vector<float> CornerPinEffect::computeVertices(const BackendTexture& source,
171 const BackendRenderTarget& target,
172 const Point& offset) const {
173 std::vector<float> vertices = {};
174 auto textureWidth = static_cast<float>(source.width());
175 auto textureHeight = static_cast<float>(source.height());
176 Point texturePoints[4] = {{0.0f, textureHeight},
177 {textureWidth, textureHeight},
178 {0.0f, 0.0f},
179 {textureWidth, 0.0f}};
180 for (size_t i = 0; i < 4; i++) {
181 auto vertexPoint = ToGLVertexPoint(cornerPoints[i] + offset, target);
182 vertices.push_back(vertexPoint.x);
183 vertices.push_back(vertexPoint.y);
184 auto texturePoint = ToGLTexturePoint(texturePoints[i], source);
185 vertices.push_back(texturePoint.x * vertexQs[i]);
186 vertices.push_back(texturePoint.y * vertexQs[i]);
187 vertices.push_back(vertexQs[i]);
188 }
189 return vertices;
190}
191
192static float calculateDistance(const Point& intersection, const Point& vertexPoint) {
193 return std::sqrtf(std::powf(fabsf(intersection.x - vertexPoint.x), 2) +

Callers

nothing calls this directly

Calls 4

ToGLVertexPointFunction · 0.85
ToGLTexturePointFunction · 0.85
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected