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

Unified Diff: src/gpu/text/GrAtlasTextBlob.h

Issue 1684253002: start to chip away at friending of GrAtlasTextBatch/GrAtlasTextBlob (Closed) Base URL: https://skia.googlesource.com/skia.git@tc-cleanup-6-lastmember
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/batches/GrAtlasTextBatch.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/text/GrAtlasTextBlob.h
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index 68cba3d50684de1fb02cdd4a839df0db7f5e6b1b..b4168e921ebf98ae691c7e991f850f8b06c805be 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -200,6 +200,40 @@ public:
const GrClip& clip,
const SkIRect& clipBounds);
+ void computeSubRunBounds(SkRect* outBounds, int runIndex, int subRunIndex) {
+ // We don't yet position distance field text on the cpu, so we have to map the vertex bounds
+ // into device space.
+ // We handle vertex bounds differently for distance field text and bitmap text because
+ // the vertex bounds of bitmap text are in device space. If we are flushing multiple runs
+ // from one blob then we are going to pay the price here of mapping the rect for each run.
+ const Run& run = fRuns[runIndex];
+ const Run::SubRunInfo& subRun = run.fSubRunInfo[subRunIndex];
+ *outBounds = subRun.vertexBounds();
+ if (subRun.drawAsDistanceFields()) {
+ // Distance field text is positioned with the (X,Y) as part of the glyph position,
+ // and currently the view matrix is applied on the GPU
+ outBounds->offset(fX - fInitialX, fY - fInitialY);
+ fViewMatrix.mapRect(outBounds);
+ } else {
+ // Bitmap text is fully positioned on the CPU, and offset by an (X,Y) translate in
+ // device space.
+ SkMatrix boundsMatrix = fInitialViewMatrixInverse;
+
+ boundsMatrix.postTranslate(-fInitialX, -fInitialY);
+
+ boundsMatrix.postTranslate(fX, fY);
+
+ boundsMatrix.postConcat(fViewMatrix);
+ boundsMatrix.mapRect(outBounds);
+
+ // Due to floating point numerical inaccuracies, we have to round out here
+ outBounds->roundOut(outBounds);
+ }
+ }
+
+ const SkMatrix& viewMatrix() const { return fViewMatrix; }
+
+
// position + local coord
static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16);
static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + sizeof(SkIPoint16);
@@ -221,12 +255,6 @@ public:
this->setupViewMatrix(viewMatrix, x, y);
}
- GrDrawBatch* test_createBatch(int glyphCount, int run, int subRun,
- GrColor color, SkScalar transX, SkScalar transY,
- const SkPaint& skPaint, const SkSurfaceProps& props,
- const GrDistanceFieldAdjustTable* distanceAdjustTable,
- GrBatchFontCache* cache);
-
const Key& key() const { return fKey; }
~GrAtlasTextBlob() {
@@ -235,6 +263,14 @@ public:
}
}
+ ////////////////////////////////////////////////////////////////////////////////////////////////
+ // Internal test methods
+ GrDrawBatch* test_createBatch(int glyphCount, int run, int subRun,
+ GrColor color, SkScalar transX, SkScalar transY,
+ const SkPaint& skPaint, const SkSurfaceProps& props,
+ const GrDistanceFieldAdjustTable* distanceAdjustTable,
+ GrBatchFontCache* cache);
+
private:
GrAtlasTextBlob()
: fMaxMinScale(-SK_ScalarMax)
« no previous file with comments | « src/gpu/batches/GrAtlasTextBatch.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698