|
34 | 34 | * glyph paths, measure their bounding boxes and draw them on a <code>Canvas</code> object. |
35 | 35 | */ |
36 | 36 | public class Renderer { |
37 | | - |
38 | 37 | private static final String TAG = Renderer.class.getSimpleName(); |
39 | 38 |
|
40 | | - private GlyphStrike mGlyphStrike; |
| 39 | + private GlyphStrike mGlyphStrike = new GlyphStrike(); |
41 | 40 | private int mGlyphLineRadius; |
42 | 41 | private int mGlyphLineCap; |
43 | 42 | private int mGlyphLineJoin; |
44 | 43 | private int mGlyphMiterLimit; |
45 | 44 |
|
46 | | - private Paint mPaint; |
47 | | - private boolean mShouldRender; |
48 | | - private boolean mShadowLayerSynced; |
49 | | - |
50 | | - private int mFillColor; |
51 | | - private RenderingStyle mRenderingStyle; |
52 | | - private WritingDirection mWritingDirection; |
53 | | - private Typeface mTypeface; |
54 | | - private float mTypeSize; |
55 | | - private float mSlantAngle; |
56 | | - private float mScaleX; |
57 | | - private float mScaleY; |
58 | | - private int mStrokeColor; |
| 45 | + private Paint mPaint = new Paint(); |
| 46 | + private boolean mShouldRender = false; |
| 47 | + private boolean mShadowLayerSynced = true; |
| 48 | + |
| 49 | + private int mFillColor = Color.BLACK; |
| 50 | + private RenderingStyle mRenderingStyle = RenderingStyle.FILL; |
| 51 | + private WritingDirection mWritingDirection = WritingDirection.LEFT_TO_RIGHT; |
| 52 | + private Typeface mTypeface = null; |
| 53 | + private float mTypeSize = 16.0f; |
| 54 | + private float mSlantAngle = 0.0f; |
| 55 | + private float mScaleX = 1.0f; |
| 56 | + private float mScaleY = 1.0f; |
| 57 | + private int mStrokeColor = Color.BLACK; |
59 | 58 | private float mStrokeWidth; |
60 | 59 | private StrokeCap mStrokeCap; |
61 | 60 | private StrokeJoin mStrokeJoin; |
62 | 61 | private float mStrokeMiter; |
63 | | - private float mShadowRadius; |
64 | | - private float mShadowDx; |
65 | | - private float mShadowDy; |
66 | | - private int mShadowColor; |
| 62 | + private float mShadowRadius = 0.0f; |
| 63 | + private float mShadowDx = 0.0f; |
| 64 | + private float mShadowDy = 0.0f; |
| 65 | + private int mShadowColor = Color.TRANSPARENT; |
67 | 66 |
|
68 | 67 | /** |
69 | 68 | * Constructs a renderer object. |
70 | 69 | */ |
71 | 70 | public Renderer() { |
72 | | - mGlyphStrike = new GlyphStrike(); |
73 | | - mPaint = new Paint(); |
74 | | - mShadowRadius = 0.0f; |
75 | | - mShadowDx = 0.0f; |
76 | | - mShadowDy = 0.0f; |
77 | | - mShadowColor = Color.TRANSPARENT; |
78 | | - |
79 | | - setFillColor(Color.BLACK); |
80 | | - setRenderingStyle(RenderingStyle.FILL); |
81 | | - setWritingDirection(WritingDirection.LEFT_TO_RIGHT); |
82 | | - setTypeSize(16.0f); |
83 | | - setSlantAngle(0.0f); |
84 | | - setScaleX(1.0f); |
85 | | - setScaleY(1.0f); |
86 | | - setStrokeColor(Color.BLACK); |
| 71 | + updatePixelSizes(); |
| 72 | + updateTransform(); |
| 73 | + |
87 | 74 | setStrokeWidth(1.0f); |
88 | 75 | setStrokeCap(StrokeCap.BUTT); |
89 | 76 | setStrokeJoin(StrokeJoin.ROUND); |
|
0 commit comments