Chromium Code Reviews| Index: src/gpu/text/GrAtlasTextBlob.h |
| diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h |
| index 1c5ea5e60ea73d6e8253794e46813d4f922665c8..85dba63663ff0e25006359c2d7b6743cf70f8575 100644 |
| --- a/src/gpu/text/GrAtlasTextBlob.h |
| +++ b/src/gpu/text/GrAtlasTextBlob.h |
| @@ -210,13 +210,11 @@ public: |
| // We use this color vs the SkPaint color because it has the colorfilter applied. |
| void initReusableBlob(GrColor color, const SkMatrix& viewMatrix, SkScalar x, SkScalar y) { |
| fPaintColor = color; |
| - fViewMatrix = viewMatrix; |
| - fX = x; |
| - fY = y; |
| + this->setupViewMatrix(viewMatrix, x, y); |
| } |
| - void initThrowawayBlob(const SkMatrix& viewMatrix) { |
| - fViewMatrix = viewMatrix; |
| + void initThrowawayBlob(const SkMatrix& viewMatrix, SkScalar x, SkScalar y) { |
| + this->setupViewMatrix(viewMatrix, x, y); |
| } |
| GrDrawBatch* test_createBatch(int glyphCount, int run, int subRun, |
| @@ -249,6 +247,16 @@ private: |
| SkDrawFilter* drawFilter, const SkMatrix& viewMatrix, |
| const SkIRect& clipBounds, SkScalar x, SkScalar y); |
| + void setupViewMatrix(const SkMatrix& viewMatrix, SkScalar x, SkScalar y) { |
|
bsalomon
2016/01/20 16:32:29
what are x and y here?
joshualitt
2016/01/20 16:43:50
I'm not 100% sure myself, but drawTextBlob(blob, x
bsalomon
2016/01/20 16:51:41
I see, that makes sense. Add a comment?
|
| + fViewMatrix = viewMatrix; |
| + if (!viewMatrix.invert(&fInitialViewMatrixInverse)) { |
| + fInitialViewMatrixInverse = SkMatrix::I(); |
|
bsalomon
2016/01/20 16:32:29
Is this really initial if we update it every time
joshualitt
2016/01/20 16:43:50
We only call setupViewMatrix when we fully regener
bsalomon
2016/01/20 16:51:41
Ok it'd be nice for that to be clearer. Maybe a co
|
| + SkDebugf("Could not invert viewmatrix\n"); |
| + } |
| + fX = fInitialX = x; |
| + fY = fInitialY = y; |
| + } |
| + |
| /* |
| * Each Run inside of the blob can have its texture coordinates regenerated if required. |
| * To determine if regeneration is necessary, fAtlasGeneration is used. If there have been |
| @@ -276,7 +284,6 @@ private: |
| Run() |
| : fInitialized(false) |
| , fDrawAsPaths(false) { |
| - fVertexBounds.setLargestInverted(); |
| // To ensure we always have one subrun, we push back a fresh run here |
| fSubRunInfo.push_back(); |
| } |
| @@ -290,10 +297,13 @@ private: |
| , fColor(GrColor_ILLEGAL) |
| , fMaskFormat(kA8_GrMaskFormat) |
| , fDrawAsDistanceFields(false) |
| - , fUseLCDText(false) {} |
| + , fUseLCDText(false) { |
| + fVertexBounds.setLargestInverted(); |
| + } |
| SubRunInfo(const SubRunInfo& that) |
| : fBulkUseToken(that.fBulkUseToken) |
| , fStrike(SkSafeRef(that.fStrike.get())) |
| + , fVertexBounds(that.fVertexBounds) |
| , fAtlasGeneration(that.fAtlasGeneration) |
| , fVertexStartIndex(that.fVertexStartIndex) |
| , fVertexEndIndex(that.fVertexEndIndex) |
| @@ -338,6 +348,11 @@ private: |
| fVertexEndIndex = prev.vertexEndIndex(); |
| } |
| + const SkRect& vertexBounds() const { return fVertexBounds; } |
| + void joinGlyphBounds(const SkRect& glyphBounds) { |
| + fVertexBounds.joinNonEmptyArg(glyphBounds); |
| + } |
| + |
| // df properties |
| void setUseLCDText(bool useLCDText) { fUseLCDText = useLCDText; } |
| bool hasUseLCDText() const { return fUseLCDText; } |
| @@ -347,6 +362,7 @@ private: |
| private: |
| GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken; |
| SkAutoTUnref<GrBatchTextStrike> fStrike; |
| + SkRect fVertexBounds; |
| uint64_t fAtlasGeneration; |
| size_t fVertexStartIndex; |
| size_t fVertexEndIndex; |
| @@ -368,7 +384,6 @@ private: |
| } |
| static const int kMinSubRuns = 1; |
| SkAutoTUnref<SkTypeface> fTypeface; |
| - SkRect fVertexBounds; |
| SkSTArray<kMinSubRuns, SubRunInfo> fSubRunInfo; |
| SkAutoDescriptor fDescriptor; |
| @@ -423,7 +438,10 @@ private: |
| SkTArray<BigGlyph> fBigGlyphs; |
| Key fKey; |
| SkMatrix fViewMatrix; |
| + SkMatrix fInitialViewMatrixInverse; |
| GrColor fPaintColor; |
| + SkScalar fInitialX; |
| + SkScalar fInitialY; |
| SkScalar fX; |
| SkScalar fY; |