From 8672f4dffa4b298d4cabee6151590ae885d47263 Mon Sep 17 00:00:00 2001 From: joshualitt Date: Tue, 21 Apr 2015 08:03:04 -0700 Subject: Pack BitmapTextBlob a bit tighter BUG=skia: Review URL: https://codereview.chromium.org/1092973004 --- src/gpu/GrAtlasTextContext.h | 96 ++++++++++++++++++++++---------------------- src/gpu/GrBatchAtlas.h | 2 +- 2 files changed, 49 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h index ec39ef5023..d5fa0d7849 100644 --- a/src/gpu/GrAtlasTextContext.h +++ b/src/gpu/GrAtlasTextContext.h @@ -98,22 +98,11 @@ private: struct SubRunInfo { SubRunInfo() : fAtlasGeneration(GrBatchAtlas::kInvalidAtlasGeneration) - , fGlyphStartIndex(0) - , fGlyphEndIndex(0) , fVertexStartIndex(0) , fVertexEndIndex(0) + , fGlyphStartIndex(0) + , fGlyphEndIndex(0) , fDrawAsDistanceFields(false) {} - GrMaskFormat fMaskFormat; - uint64_t fAtlasGeneration; - uint32_t fGlyphStartIndex; - uint32_t fGlyphEndIndex; - size_t fVertexStartIndex; - size_t fVertexEndIndex; - GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken; - - // distance field properties - bool fDrawAsDistanceFields; - bool fUseLCDText; // Distance field text cannot draw coloremoji, and so has to fall back. However, // though the distance field text and the coloremoji may share the same run, they // will have different descriptors. If fOverrideDescriptor is non-NULL, then it @@ -121,7 +110,17 @@ private: // TODO we could have a descriptor cache, it would reduce the size of these blobs // significantly, and then the subrun could just have a refed pointer to the // correct descriptor. - SkAutoTDelete fOverrideDescriptor; + SkAutoTDelete fOverrideDescriptor; // df properties + GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken; + uint64_t fAtlasGeneration; + size_t fVertexStartIndex; + size_t fVertexEndIndex; + uint32_t fGlyphStartIndex; + uint32_t fGlyphEndIndex; + SkScalar fTextRatio; // df property + GrMaskFormat fMaskFormat; + bool fDrawAsDistanceFields; // df property + bool fUseLCDText; // df property }; class SubRunInfoArray { @@ -171,15 +170,15 @@ private: private: static const int kMinSubRuns = 1; static const int kMinSubRunStorage = kMinSubRuns * sizeof(SubRunInfo); + SubRunInfo* fPtr; SkAutoSTMalloc fSubRunStorage; int fSubRunCount; int fSubRunAllocation; - SubRunInfo* fPtr; }; - SubRunInfoArray fSubRunInfo; - SkAutoDescriptor fDescriptor; SkAutoTUnref fTypeface; SkRect fVertexBounds; + SubRunInfoArray fSubRunInfo; + SkAutoDescriptor fDescriptor; GrColor fColor; bool fInitialized; bool fDrawAsPaths; @@ -191,37 +190,6 @@ private: int fVx; int fVy; }; -#ifdef SK_DEBUG - mutable SkScalar fTotalXError; - mutable SkScalar fTotalYError; -#endif - SkColor fPaintColor; - SkTArray fBigGlyphs; - SkMatrix fViewMatrix; - SkScalar fX; - SkScalar fY; - int fRunCount; - SkMaskFilter::BlurRec fBlurRec; - struct StrokeInfo { - SkScalar fFrameWidth; - SkScalar fMiterLimit; - SkPaint::Join fJoin; - }; - StrokeInfo fStrokeInfo; - GrMemoryPool* fPool; - - enum TextType { - kHasDistanceField_TextType = 0x1, - kHasBitmap_TextType = 0x2, - }; - uint8_t fTextType; - - BitmapTextBlob() : fTextType(0) {} - - // all glyph / vertex offsets are into these pools. - unsigned char* fVertices; - GrGlyph::PackedID* fGlyphIDs; - Run* fRuns; struct Key { Key() { @@ -240,7 +208,39 @@ private: return 0 == memcmp(this, &other, sizeof(Key)); } }; + + struct StrokeInfo { + SkScalar fFrameWidth; + SkScalar fMiterLimit; + SkPaint::Join fJoin; + }; + + enum TextType { + kHasDistanceField_TextType = 0x1, + kHasBitmap_TextType = 0x2, + }; + + // all glyph / vertex offsets are into these pools. + unsigned char* fVertices; + GrGlyph::PackedID* fGlyphIDs; + Run* fRuns; + GrMemoryPool* fPool; + SkMaskFilter::BlurRec fBlurRec; + StrokeInfo fStrokeInfo; + SkTArray fBigGlyphs; Key fKey; + SkMatrix fViewMatrix; +#ifdef SK_DEBUG + mutable SkScalar fTotalXError; + mutable SkScalar fTotalYError; +#endif + SkScalar fX; + SkScalar fY; + SkColor fPaintColor; + int fRunCount; + uint8_t fTextType; + + BitmapTextBlob() : fTextType(0) {} static const Key& GetKey(const BitmapTextBlob& blob) { return blob.fKey; diff --git a/src/gpu/GrBatchAtlas.h b/src/gpu/GrBatchAtlas.h index 889d260a18..77a49ce699 100644 --- a/src/gpu/GrBatchAtlas.h +++ b/src/gpu/GrBatchAtlas.h @@ -102,8 +102,8 @@ public: static const int kMinItems = 4; static const int kMaxPlots = 32; - uint32_t fPlotAlreadyUpdated; SkAutoSTMalloc fPlotsToUpdate; + uint32_t fPlotAlreadyUpdated; int fCount; int fAllocated; -- cgit v1.2.3