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

Unified Diff: src/gpu/GrAtlasTextContext.cpp

Issue 1093083003: Some simple optimizations for improving GrAtlasTextContext perf (Closed) Base URL: https://skia.googlesource.com/skia.git@atdfregen
Patch Set: simple optimizations Created 5 years, 8 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 | « no previous file | src/gpu/GrBatchAtlas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAtlasTextContext.cpp
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 8c162220f9e2ec98d31e50e2a8c83cd6c57cc976..c1a46fea9c037a58e6138e76d33e042790e0966f 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -1201,7 +1201,7 @@ void GrAtlasTextContext::bmpAppendGlyph(BitmapTextBlob* blob, int runIndex,
}
GrGlyph* glyph = fCurrStrike->getGlyph(packed, scaler);
- if (!glyph || glyph->fBounds.isEmpty()) {
+ if (!glyph) {
return;
}
@@ -1225,7 +1225,7 @@ void GrAtlasTextContext::bmpAppendGlyph(BitmapTextBlob* blob, int runIndex,
#endif
// If the glyph is too large we fall back to paths
- if (fCurrStrike->glyphTooLargeForAtlas(glyph)) {
+ if (glyph->fTooLargeForAtlas) {
this->appendGlyphPath(blob, glyph, scaler, vx, vy);
return;
}
@@ -1264,7 +1264,7 @@ bool GrAtlasTextContext::dfAppendGlyph(BitmapTextBlob* blob, int runIndex,
}
GrGlyph* glyph = fCurrStrike->getGlyph(packed, scaler);
- if (!glyph || glyph->fBounds.isEmpty()) {
+ if (!glyph) {
return true;
}
@@ -1301,7 +1301,7 @@ bool GrAtlasTextContext::dfAppendGlyph(BitmapTextBlob* blob, int runIndex,
// TODO combine with the above
// If the glyph is too large we fall back to paths
- if (fCurrStrike->glyphTooLargeForAtlas(glyph)) {
+ if (glyph->fTooLargeForAtlas) {
this->appendGlyphPath(blob, glyph, scaler, SkScalarRoundToInt(sx - dx),
SkScalarRoundToInt(sy - dy));
return true;
@@ -1345,39 +1345,52 @@ inline void GrAtlasTextContext::appendGlyphCommon(BitmapTextBlob* blob, Run* run
intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVertices + subRun->fVertexEndIndex);
- // V0
- SkPoint* position = reinterpret_cast<SkPoint*>(vertex);
- position->set(positions.fLeft, positions.fTop);
if (useVertexColor) {
+ // V0
+ SkPoint* position = reinterpret_cast<SkPoint*>(vertex);
+ position->set(positions.fLeft, positions.fTop);
SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint));
*colorPtr = color;
- }
- vertex += vertexStride;
+ vertex += vertexStride;
- // V1
- position = reinterpret_cast<SkPoint*>(vertex);
- position->set(positions.fLeft, positions.fBottom);
- if (useVertexColor) {
- SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint));
+ // V1
+ position = reinterpret_cast<SkPoint*>(vertex);
+ position->set(positions.fLeft, positions.fBottom);
+ colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint));
*colorPtr = color;
- }
- vertex += vertexStride;
+ vertex += vertexStride;
- // V2
- position = reinterpret_cast<SkPoint*>(vertex);
- position->set(positions.fRight, positions.fBottom);
- if (useVertexColor) {
- SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint));
+ // V2
+ position = reinterpret_cast<SkPoint*>(vertex);
+ position->set(positions.fRight, positions.fBottom);
+ colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint));
*colorPtr = color;
- }
- vertex += vertexStride;
+ vertex += vertexStride;
- // V3
- position = reinterpret_cast<SkPoint*>(vertex);
- position->set(positions.fRight, positions.fTop);
- if (useVertexColor) {
- SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint));
+ // V3
+ position = reinterpret_cast<SkPoint*>(vertex);
+ position->set(positions.fRight, positions.fTop);
+ colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint));
*colorPtr = color;
+ } else {
+ // V0
+ SkPoint* position = reinterpret_cast<SkPoint*>(vertex);
+ position->set(positions.fLeft, positions.fTop);
+ vertex += vertexStride;
+
+ // V1
+ position = reinterpret_cast<SkPoint*>(vertex);
+ position->set(positions.fLeft, positions.fBottom);
+ vertex += vertexStride;
+
+ // V2
+ position = reinterpret_cast<SkPoint*>(vertex);
+ position->set(positions.fRight, positions.fBottom);
+ vertex += vertexStride;
+
+ // V3
+ position = reinterpret_cast<SkPoint*>(vertex);
+ position->set(positions.fRight, positions.fTop);
}
subRun->fGlyphEndIndex++;
« no previous file with comments | « no previous file | src/gpu/GrBatchAtlas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698