Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "OpenGLRenderer" |
| 18 | |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 19 | #include <cmath> |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 20 | |
Romain Guy | 4bb9420 | 2010-10-12 15:59:26 -0700 | [diff] [blame] | 21 | #include <utils/Log.h> |
| 22 | |
Romain Guy | 03750a0 | 2010-10-18 14:06:08 -0700 | [diff] [blame] | 23 | #include "Caches.h" |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 24 | #include "Patch.h" |
Romain Guy | a5ef39a | 2010-12-03 16:48:20 -0800 | [diff] [blame] | 25 | #include "Properties.h" |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 26 | #include "UvMapper.h" |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 27 | |
| 28 | namespace android { |
| 29 | namespace uirenderer { |
| 30 | |
| 31 | /////////////////////////////////////////////////////////////////////////////// |
| 32 | // Constructors/destructor |
| 33 | /////////////////////////////////////////////////////////////////////////////// |
| 34 | |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 35 | Patch::Patch(): vertices(NULL), verticesCount(0), indexCount(0), hasEmptyQuads(false) { |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | Patch::~Patch() { |
Romain Guy | 6f72beb | 2010-11-30 12:04:14 -0800 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | /////////////////////////////////////////////////////////////////////////////// |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 42 | // Vertices management |
| 43 | /////////////////////////////////////////////////////////////////////////////// |
| 44 | |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 45 | uint32_t Patch::getSize() const { |
| 46 | return verticesCount * sizeof(TextureVertex); |
| 47 | } |
Romain Guy | a5ef39a | 2010-12-03 16:48:20 -0800 | [diff] [blame] | 48 | |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 49 | TextureVertex* Patch::createMesh(const float bitmapWidth, const float bitmapHeight, |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 50 | float width, float height, const Res_png_9patch* patch) { |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 51 | UvMapper mapper; |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 52 | return createMesh(bitmapWidth, bitmapHeight, width, height, mapper, patch); |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 53 | } |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 54 | |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 55 | TextureVertex* Patch::createMesh(const float bitmapWidth, const float bitmapHeight, |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 56 | float width, float height, const UvMapper& mapper, const Res_png_9patch* patch) { |
| 57 | if (vertices) return vertices; |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 58 | |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 59 | int8_t emptyQuads = 0; |
Romain Guy | 6cad757 | 2013-07-24 11:49:33 -0700 | [diff] [blame] | 60 | mColors = patch->colors; |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 61 | |
Romain Guy | 6cad757 | 2013-07-24 11:49:33 -0700 | [diff] [blame] | 62 | const int8_t numColors = patch->numColors; |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 63 | if (uint8_t(numColors) < sizeof(uint32_t) * 4) { |
| 64 | for (int8_t i = 0; i < numColors; i++) { |
Romain Guy | 6cad757 | 2013-07-24 11:49:33 -0700 | [diff] [blame] | 65 | if (mColors[i] == 0x0) { |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 66 | emptyQuads++; |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | hasEmptyQuads = emptyQuads > 0; |
| 72 | |
| 73 | uint32_t xCount = patch->numXDivs; |
| 74 | uint32_t yCount = patch->numYDivs; |
| 75 | |
| 76 | uint32_t maxVertices = ((xCount + 1) * (yCount + 1) - emptyQuads) * 4; |
| 77 | if (maxVertices == 0) return NULL; |
| 78 | |
Romain Guy | f296dca | 2013-06-24 14:33:37 -0700 | [diff] [blame] | 79 | TextureVertex* tempVertices = new TextureVertex[maxVertices]; |
| 80 | TextureVertex* vertex = tempVertices; |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 81 | |
| 82 | const int32_t* xDivs = patch->xDivs; |
| 83 | const int32_t* yDivs = patch->yDivs; |
| 84 | |
| 85 | const uint32_t xStretchCount = (xCount + 1) >> 1; |
| 86 | const uint32_t yStretchCount = (yCount + 1) >> 1; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 87 | |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 88 | float stretchX = 0.0f; |
Romain Guy | 41d35ae | 2012-10-10 16:06:04 -0700 | [diff] [blame] | 89 | float stretchY = 0.0f; |
| 90 | |
| 91 | float rescaleX = 1.0f; |
| 92 | float rescaleY = 1.0f; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 93 | |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 94 | if (xStretchCount > 0) { |
| 95 | uint32_t stretchSize = 0; |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 96 | for (uint32_t i = 1; i < xCount; i += 2) { |
| 97 | stretchSize += xDivs[i] - xDivs[i - 1]; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 98 | } |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 99 | const float xStretchTex = stretchSize; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 100 | const float fixed = bitmapWidth - stretchSize; |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 101 | const float xStretch = fmaxf(width - fixed, 0.0f); |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 102 | stretchX = xStretch / xStretchTex; |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 103 | rescaleX = fixed == 0.0f ? 0.0f : fminf(fmaxf(width, 0.0f) / fixed, 1.0f); |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | if (yStretchCount > 0) { |
| 107 | uint32_t stretchSize = 0; |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 108 | for (uint32_t i = 1; i < yCount; i += 2) { |
| 109 | stretchSize += yDivs[i] - yDivs[i - 1]; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 110 | } |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 111 | const float yStretchTex = stretchSize; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 112 | const float fixed = bitmapHeight - stretchSize; |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 113 | const float yStretch = fmaxf(height - fixed, 0.0f); |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 114 | stretchY = yStretch / yStretchTex; |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 115 | rescaleY = fixed == 0.0f ? 0.0f : fminf(fmaxf(height, 0.0f) / fixed, 1.0f); |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 116 | } |
| 117 | |
Romain Guy | 4bb9420 | 2010-10-12 15:59:26 -0700 | [diff] [blame] | 118 | uint32_t quadCount = 0; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 119 | |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 120 | float previousStepY = 0.0f; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 121 | |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 122 | float y1 = 0.0f; |
Romain Guy | f504a2f | 2011-05-26 16:40:55 -0700 | [diff] [blame] | 123 | float y2 = 0.0f; |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 124 | float v1 = 0.0f; |
| 125 | |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 126 | mUvMapper = mapper; |
| 127 | |
| 128 | for (uint32_t i = 0; i < yCount; i++) { |
| 129 | float stepY = yDivs[i]; |
Romain Guy | 5e7c469 | 2011-10-20 20:31:50 -0700 | [diff] [blame] | 130 | const float segment = stepY - previousStepY; |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 131 | |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 132 | if (i & 1) { |
Romain Guy | 8ab4079 | 2010-12-07 13:30:10 -0800 | [diff] [blame] | 133 | y2 = y1 + floorf(segment * stretchY + 0.5f); |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 134 | } else { |
Romain Guy | 41d35ae | 2012-10-10 16:06:04 -0700 | [diff] [blame] | 135 | y2 = y1 + segment * rescaleY; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 136 | } |
Romain Guy | 5e7c469 | 2011-10-20 20:31:50 -0700 | [diff] [blame] | 137 | |
| 138 | float vOffset = y1 == y2 ? 0.0f : 0.5 - (0.5 * segment / (y2 - y1)); |
| 139 | float v2 = fmax(0.0f, stepY - vOffset) / bitmapHeight; |
| 140 | v1 += vOffset / bitmapHeight; |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 141 | |
Romain Guy | eb6a4a1 | 2011-01-18 14:02:16 -0800 | [diff] [blame] | 142 | if (stepY > 0.0f) { |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 143 | generateRow(xDivs, xCount, vertex, y1, y2, v1, v2, stretchX, rescaleX, |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 144 | width, bitmapWidth, quadCount); |
Romain Guy | eb6a4a1 | 2011-01-18 14:02:16 -0800 | [diff] [blame] | 145 | } |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 146 | |
| 147 | y1 = y2; |
Romain Guy | 5e7c469 | 2011-10-20 20:31:50 -0700 | [diff] [blame] | 148 | v1 = stepY / bitmapHeight; |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 149 | |
| 150 | previousStepY = stepY; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 151 | } |
| 152 | |
Romain Guy | fdbec3e | 2011-01-19 10:37:35 -0800 | [diff] [blame] | 153 | if (previousStepY != bitmapHeight) { |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 154 | y2 = height; |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 155 | generateRow(xDivs, xCount, vertex, y1, y2, v1, 1.0f, stretchX, rescaleX, |
Romain Guy | 03c00b5 | 2013-06-20 18:30:28 -0700 | [diff] [blame] | 156 | width, bitmapWidth, quadCount); |
Romain Guy | fdbec3e | 2011-01-19 10:37:35 -0800 | [diff] [blame] | 157 | } |
Romain Guy | 03750a0 | 2010-10-18 14:06:08 -0700 | [diff] [blame] | 158 | |
Romain Guy | f296dca | 2013-06-24 14:33:37 -0700 | [diff] [blame] | 159 | if (verticesCount == maxVertices) { |
| 160 | vertices = tempVertices; |
| 161 | } else { |
| 162 | vertices = new TextureVertex[verticesCount]; |
| 163 | memcpy(vertices, tempVertices, verticesCount * sizeof(TextureVertex)); |
| 164 | delete[] tempVertices; |
| 165 | } |
| 166 | |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 167 | return vertices; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 168 | } |
| 169 | |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 170 | void Patch::generateRow(const int32_t* xDivs, uint32_t xCount, TextureVertex*& vertex, |
| 171 | float y1, float y2, float v1, float v2, float stretchX, float rescaleX, |
| 172 | float width, float bitmapWidth, uint32_t& quadCount) { |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 173 | float previousStepX = 0.0f; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 174 | |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 175 | float x1 = 0.0f; |
Romain Guy | f504a2f | 2011-05-26 16:40:55 -0700 | [diff] [blame] | 176 | float x2 = 0.0f; |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 177 | float u1 = 0.0f; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 178 | |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 179 | // Generate the row quad by quad |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 180 | for (uint32_t i = 0; i < xCount; i++) { |
| 181 | float stepX = xDivs[i]; |
Romain Guy | 5e7c469 | 2011-10-20 20:31:50 -0700 | [diff] [blame] | 182 | const float segment = stepX - previousStepX; |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 183 | |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 184 | if (i & 1) { |
Romain Guy | 8ab4079 | 2010-12-07 13:30:10 -0800 | [diff] [blame] | 185 | x2 = x1 + floorf(segment * stretchX + 0.5f); |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 186 | } else { |
Romain Guy | 41d35ae | 2012-10-10 16:06:04 -0700 | [diff] [blame] | 187 | x2 = x1 + segment * rescaleX; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 188 | } |
Romain Guy | 5e7c469 | 2011-10-20 20:31:50 -0700 | [diff] [blame] | 189 | |
| 190 | float uOffset = x1 == x2 ? 0.0f : 0.5 - (0.5 * segment / (x2 - x1)); |
| 191 | float u2 = fmax(0.0f, stepX - uOffset) / bitmapWidth; |
| 192 | u1 += uOffset / bitmapWidth; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 193 | |
Romain Guy | eb6a4a1 | 2011-01-18 14:02:16 -0800 | [diff] [blame] | 194 | if (stepX > 0.0f) { |
| 195 | generateQuad(vertex, x1, y1, x2, y2, u1, v1, u2, v2, quadCount); |
| 196 | } |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 197 | |
| 198 | x1 = x2; |
Romain Guy | 5e7c469 | 2011-10-20 20:31:50 -0700 | [diff] [blame] | 199 | u1 = stepX / bitmapWidth; |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 200 | |
| 201 | previousStepX = stepX; |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 202 | } |
| 203 | |
Romain Guy | fdbec3e | 2011-01-19 10:37:35 -0800 | [diff] [blame] | 204 | if (previousStepX != bitmapWidth) { |
Romain Guy | f504a2f | 2011-05-26 16:40:55 -0700 | [diff] [blame] | 205 | x2 = width; |
Romain Guy | f504a2f | 2011-05-26 16:40:55 -0700 | [diff] [blame] | 206 | generateQuad(vertex, x1, y1, x2, y2, u1, v1, 1.0f, v2, quadCount); |
Romain Guy | fdbec3e | 2011-01-19 10:37:35 -0800 | [diff] [blame] | 207 | } |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 208 | } |
| 209 | |
Romain Guy | 7444da5 | 2011-01-17 10:53:31 -0800 | [diff] [blame] | 210 | void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, float y2, |
Romain Guy | eb6a4a1 | 2011-01-18 14:02:16 -0800 | [diff] [blame] | 211 | float u1, float v1, float u2, float v2, uint32_t& quadCount) { |
Romain Guy | a5ef39a | 2010-12-03 16:48:20 -0800 | [diff] [blame] | 212 | const uint32_t oldQuadCount = quadCount; |
Romain Guy | eb6a4a1 | 2011-01-18 14:02:16 -0800 | [diff] [blame] | 213 | quadCount++; |
Romain Guy | bd41a11 | 2010-12-02 17:16:26 -0800 | [diff] [blame] | 214 | |
Romain Guy | 70561df | 2012-09-10 17:40:18 -0700 | [diff] [blame] | 215 | if (x1 < 0.0f) x1 = 0.0f; |
| 216 | if (x2 < 0.0f) x2 = 0.0f; |
| 217 | if (y1 < 0.0f) y1 = 0.0f; |
| 218 | if (y2 < 0.0f) y2 = 0.0f; |
| 219 | |
Romain Guy | a5ef39a | 2010-12-03 16:48:20 -0800 | [diff] [blame] | 220 | // Skip degenerate and transparent (empty) quads |
Romain Guy | 6cad757 | 2013-07-24 11:49:33 -0700 | [diff] [blame] | 221 | if ((mColors[oldQuadCount] == 0) || x1 >= x2 || y1 >= y2) { |
Romain Guy | fb13abd | 2011-01-16 15:16:38 -0800 | [diff] [blame] | 222 | #if DEBUG_PATCHES_EMPTY_VERTICES |
| 223 | PATCH_LOGD(" quad %d (empty)", oldQuadCount); |
Romain Guy | 6cad757 | 2013-07-24 11:49:33 -0700 | [diff] [blame] | 224 | PATCH_LOGD(" left, top = %.2f, %.2f\t\tu1, v1 = %.8f, %.8f", x1, y1, u1, v1); |
| 225 | PATCH_LOGD(" right, bottom = %.2f, %.2f\t\tu2, v2 = %.8f, %.8f", x2, y2, u2, v2); |
Romain Guy | fb13abd | 2011-01-16 15:16:38 -0800 | [diff] [blame] | 226 | #endif |
Romain Guy | 7444da5 | 2011-01-17 10:53:31 -0800 | [diff] [blame] | 227 | return; |
Romain Guy | 4bb9420 | 2010-10-12 15:59:26 -0700 | [diff] [blame] | 228 | } |
| 229 | |
Romain Guy | a5ef39a | 2010-12-03 16:48:20 -0800 | [diff] [blame] | 230 | // Record all non empty quads |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 231 | if (hasEmptyQuads) { |
| 232 | Rect bounds(x1, y1, x2, y2); |
| 233 | quads.add(bounds); |
| 234 | } |
| 235 | |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 236 | mUvMapper.map(u1, v1, u2, v2); |
| 237 | |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 238 | TextureVertex::set(vertex++, x1, y1, u1, v1); |
| 239 | TextureVertex::set(vertex++, x2, y1, u2, v1); |
| 240 | TextureVertex::set(vertex++, x1, y2, u1, v2); |
Romain Guy | 6820ac8 | 2010-09-15 18:11:50 -0700 | [diff] [blame] | 241 | TextureVertex::set(vertex++, x2, y2, u2, v2); |
Romain Guy | a5ef39a | 2010-12-03 16:48:20 -0800 | [diff] [blame] | 242 | |
Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 243 | verticesCount += 4; |
| 244 | indexCount += 6; |
Romain Guy | a5ef39a | 2010-12-03 16:48:20 -0800 | [diff] [blame] | 245 | |
| 246 | #if DEBUG_PATCHES_VERTICES |
| 247 | PATCH_LOGD(" quad %d", oldQuadCount); |
Romain Guy | 6cad757 | 2013-07-24 11:49:33 -0700 | [diff] [blame] | 248 | PATCH_LOGD(" left, top = %.2f, %.2f\t\tu1, v1 = %.8f, %.8f", x1, y1, u1, v1); |
| 249 | PATCH_LOGD(" right, bottom = %.2f, %.2f\t\tu2, v2 = %.8f, %.8f", x2, y2, u2, v2); |
Romain Guy | a5ef39a | 2010-12-03 16:48:20 -0800 | [diff] [blame] | 250 | #endif |
Romain Guy | fb5e23c | 2010-07-09 13:52:56 -0700 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | }; // namespace uirenderer |
| 254 | }; // namespace android |