MCPcopy Create free account
hub / github.com/Snapchat/Valdi / onDraw

Method onDraw

snap_drawing/src/snap_drawing/cpp/Layers/TextLayer.cpp:43–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 if (customUnderlineStyle) {
42 paint.setStroke(true);
43 paint.setStrokeWidth(customUnderlineStyle->height);
44 paint.setStrokeCap(PaintStrokeCapButt);
45 if (customUnderlineStyle->isPatterned()) {
46 paint.setStrokeDashPattern(customUnderlineStyle->onWidth, customUnderlineStyle->offWidth);
47 }
48
49 auto path = makeTextDecorationPath(bounds);
50 drawingContext.drawPaint(paint, path);
51 } else if (style == TextLayoutDecorationStyleDashed) {
52 auto strokeWidth = std::max<Scalar>(bounds.height(), 1.0f);
53 paint.setStroke(true);
54 paint.setStrokeWidth(strokeWidth);
55 paint.setStrokeCap(PaintStrokeCapButt);
56 paint.setStrokeDashPattern(strokeWidth * 3.0f, strokeWidth * 2.0f);
57
58 auto path = makeTextDecorationPath(bounds);
59 drawingContext.drawPaint(paint, path);
60 } else if (style == TextLayoutDecorationStyleDotted) {
61 auto strokeWidth = std::max<Scalar>(bounds.height(), 1.0f);
62 paint.setStroke(false);
63 paint.setStrokeDotPattern(strokeWidth / 2.0f, strokeWidth * 2.0f);
64
65 auto path = makeTextDecorationPath(bounds);
66 drawingContext.drawPaint(paint, path);
67 } else {
68 drawingContext.drawPaint(paint, bounds);
69 }
70}
71
72TextLayer::TextLayer(const Ref<Resources>& resources) : Layer(resources) {
73 _textPaint.setAntiAlias(true);
74 _gradientWrapper = GradientWrapper();
75}
76

Callers

nothing calls this directly

Calls 7

getRespectDynamicTypeMethod · 0.80
getDynamicTypeScaleMethod · 0.80
getDisplayScaleMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
concatMethod · 0.45
getEntriesMethod · 0.45

Tested by

no test coverage detected