@@ -231,25 +231,6 @@ class GrTextBlob : public SkNVRefCnt<GrTextBlob>, public SkGlyphRunPainterInterf
231231 const SkSurfaceProps&, const GrDistanceFieldAdjustTable*,
232232 GrTextTarget*);
233233
234- private:
235- GrTextBlob (GrStrikeCache* strikeCache, GrColor color, bool forceWForDistanceFields)
236- : fColor {color}
237- , fStrikeCache {strikeCache}
238- , fForceWForDistanceFields {forceWForDistanceFields} { }
239-
240- // This function will only be called when we are generating a blob from scratch. We record the
241- // initial view matrix and initial offsets(x,y), because we record vertex bounds relative to
242- // these numbers. When blobs are reused with new matrices, we need to return to model space so
243- // we can update the vertex bounds appropriately.
244- void setupViewMatrix (const SkMatrix& viewMatrix, SkScalar x, SkScalar y) {
245- fInitialViewMatrix = viewMatrix;
246- if (!viewMatrix.invert (&fInitialViewMatrixInverse )) {
247- fInitialViewMatrixInverse = SkMatrix::I ();
248- }
249- fInitialX = x;
250- fInitialY = y;
251- }
252-
253234public:
254235 // Any glyphs that can't be rendered with the base or override descriptor
255236 // are rendered as paths
@@ -396,6 +377,33 @@ class GrTextBlob : public SkNVRefCnt<GrTextBlob>, public SkGlyphRunPainterInterf
396377 SkScalar maxScale);
397378
398379private:
380+ GrTextBlob (
381+ size_t size, GrStrikeCache* strikeCache, GrColor color, bool forceWForDistanceFields);
382+
383+ struct StrokeInfo {
384+ SkScalar fFrameWidth ;
385+ SkScalar fMiterLimit ;
386+ SkPaint::Join fJoin ;
387+ };
388+
389+ enum TextType {
390+ kHasDistanceField_TextType = 0x1 ,
391+ kHasBitmap_TextType = 0x2 ,
392+ };
393+
394+ // This function will only be called when we are generating a blob from scratch. We record the
395+ // initial view matrix and initial offsets(x,y), because we record vertex bounds relative to
396+ // these numbers. When blobs are reused with new matrices, we need to return to model space so
397+ // we can update the vertex bounds appropriately.
398+ void setupViewMatrix (const SkMatrix& viewMatrix, SkScalar x, SkScalar y) {
399+ fInitialViewMatrix = viewMatrix;
400+ if (!viewMatrix.invert (&fInitialViewMatrixInverse )) {
401+ fInitialViewMatrixInverse = SkMatrix::I ();
402+ }
403+ fInitialX = x;
404+ fInitialY = y;
405+ }
406+
399407 std::unique_ptr<GrAtlasTextOp> makeOp (
400408 SubRun& info, int glyphCount,
401409 const SkMatrix& viewMatrix, SkScalar x, SkScalar y, const SkIRect& clipRect,
@@ -418,7 +426,18 @@ class GrTextBlob : public SkNVRefCnt<GrTextBlob>, public SkGlyphRunPainterInterf
418426 void processSourceMasks (const SkZip<SkGlyphVariant, SkPoint>& drawables,
419427 const SkStrikeSpec& strikeSpec) override ;
420428
429+ // Overall size of this struct plus vertices and glyphs at the end.
430+ const size_t fSize ;
421431
432+ // Lifetime: The GrStrikeCache is owned by and has the same lifetime as the GrRecordingContext.
433+ // The GrRecordingContext also owns the GrTextBlob cache which owns this GrTextBlob.
434+ GrStrikeCache* const fStrikeCache ;
435+
436+ // From the distance field options to force distance fields to have a W coordinate.
437+ const bool fForceWForDistanceFields ;
438+
439+ // The color of the text to draw for solid colors.
440+ const GrColor fColor ;
422441
423442 // Pool of bytes for vertex data.
424443 char * fVertices ;
@@ -432,24 +451,11 @@ class GrTextBlob : public SkNVRefCnt<GrTextBlob>, public SkGlyphRunPainterInterf
432451 // Assume one run per text blob.
433452 SkSTArray<1 , SubRun> fSubRuns ;
434453
435- // The color of the text to draw for solid colors.
436- const GrColor fColor ;
437-
438- // Lifetime: The GrStrikeCache is owned by and has the same lifetime as the GrRecordingContext.
439- // The GrRecordingContext also owns the GrTextBlob cache which owns this GrTextBlob.
440- GrStrikeCache* const fStrikeCache ;
441454 SkMaskFilterBase::BlurRec fBlurRec ;
442-
443- struct StrokeInfo {
444- SkScalar fFrameWidth ;
445- SkScalar fMiterLimit ;
446- SkPaint::Join fJoin ;
447- };
448455 StrokeInfo fStrokeInfo ;
449456 Key fKey ;
450457 SkMatrix fInitialViewMatrix ;
451458 SkMatrix fInitialViewMatrixInverse ;
452- size_t fSize ;
453459 SkColor fLuminanceColor ;
454460 SkScalar fInitialX ;
455461 SkScalar fInitialY ;
@@ -460,13 +466,6 @@ class GrTextBlob : public SkNVRefCnt<GrTextBlob>, public SkGlyphRunPainterInterf
460466 SkScalar fMaxMinScale {-SK_ScalarMax};
461467 SkScalar fMinMaxScale {SK_ScalarMax};
462468
463- // From the distance field options to force distance fields to have a W coordinate.
464- const bool fForceWForDistanceFields ;
465-
466- enum TextType {
467- kHasDistanceField_TextType = 0x1 ,
468- kHasBitmap_TextType = 0x2 ,
469- };
470469 uint8_t fTextType {0 };
471470};
472471
0 commit comments