Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp

Issue 1709133003: Revert of Use unorm shorts for texture coordinates when rendering text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLVertexArray.cpp ('k') | src/gpu/text/GrBatchFontCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
diff --git a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
index 18eb23cdfe36f1846de547a1c3b059bd8ca6c192..14bf4a5d61ef8a6bb40929a916b9ede20c64409c 100644
--- a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
+++ b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
@@ -21,7 +21,6 @@
template <bool regenPos, bool regenCol, bool regenTexCoords>
inline void regen_vertices(intptr_t vertex, const GrGlyph* glyph, size_t vertexStride,
bool useDistanceFields, SkScalar transX, SkScalar transY,
- int32_t log2Width, int32_t log2Height,
GrColor color) {
int u0, v0, u1, v1;
if (regenTexCoords) {
@@ -40,20 +39,6 @@
u1 = u0 + width;
v1 = v0 + height;
}
-
- // normalize
- u0 *= 65535;
- u0 >>= log2Width;
- u1 *= 65535;
- u1 >>= log2Width;
- v0 *= 65535;
- v0 >>= log2Height;
- v1 *= 65535;
- v1 >>= log2Height;
- SkASSERT(u0 >= 0 && u0 <= 65535);
- SkASSERT(u1 >= 0 && u1 <= 65535);
- SkASSERT(v0 >= 0 && v0 <= 65535);
- SkASSERT(v1 >= 0 && v1 <= 65535);
}
// This is a bit wonky, but sometimes we have LCD text, in which case we won't have color
@@ -74,9 +59,8 @@
}
if (regenTexCoords) {
- uint16_t* textureCoords = reinterpret_cast<uint16_t*>(vertex + texCoordOffset);
- textureCoords[0] = (uint16_t) u0;
- textureCoords[1] = (uint16_t) v0;
+ SkIPoint16* textureCoords = reinterpret_cast<SkIPoint16*>(vertex + texCoordOffset);
+ textureCoords->set(u0, v0);
}
vertex += vertexStride;
@@ -93,9 +77,8 @@
}
if (regenTexCoords) {
- uint16_t* textureCoords = reinterpret_cast<uint16_t*>(vertex + texCoordOffset);
- textureCoords[0] = (uint16_t)u0;
- textureCoords[1] = (uint16_t)v1;
+ SkIPoint16* textureCoords = reinterpret_cast<SkIPoint16*>(vertex + texCoordOffset);
+ textureCoords->set(u0, v1);
}
vertex += vertexStride;
@@ -112,9 +95,8 @@
}
if (regenTexCoords) {
- uint16_t* textureCoords = reinterpret_cast<uint16_t*>(vertex + texCoordOffset);
- textureCoords[0] = (uint16_t)u1;
- textureCoords[1] = (uint16_t)v1;
+ SkIPoint16* textureCoords = reinterpret_cast<SkIPoint16*>(vertex + texCoordOffset);
+ textureCoords->set(u1, v1);
}
vertex += vertexStride;
@@ -131,9 +113,8 @@
}
if (regenTexCoords) {
- uint16_t* textureCoords = reinterpret_cast<uint16_t*>(vertex + texCoordOffset);
- textureCoords[0] = (uint16_t)u1;
- textureCoords[1] = (uint16_t)v0;
+ SkIPoint16* textureCoords = reinterpret_cast<SkIPoint16*>(vertex + texCoordOffset);
+ textureCoords->set(u1, v0);
}
}
@@ -180,7 +161,6 @@
bool brokenRun = false;
for (int glyphIdx = 0; glyphIdx < glyphCount; glyphIdx++) {
GrGlyph* glyph = nullptr;
- int log2Width = 0, log2Height = 0;
if (regenTexCoords) {
size_t glyphOffset = glyphIdx + info->glyphStartIndex();
@@ -207,8 +187,6 @@
}
fontCache->addGlyphToBulkAndSetUseToken(info->bulkUseToken(), glyph,
target->currentToken());
- log2Width = fontCache->log2Width(info->maskFormat());
- log2Height = fontCache->log2Height(info->maskFormat());
}
intptr_t vertex = reinterpret_cast<intptr_t>(fVertices);
@@ -216,7 +194,7 @@
vertex += vertexStride * glyphIdx * GrAtlasTextBatch::kVerticesPerGlyph;
regen_vertices<regenPos, regenCol, regenTexCoords>(vertex, glyph, vertexStride,
info->drawAsDistanceFields(), transX,
- transY, log2Width, log2Height, color);
+ transY, color);
helper->incGlyphCount();
}
« no previous file with comments | « src/gpu/gl/GrGLVertexArray.cpp ('k') | src/gpu/text/GrBatchFontCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698