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

Method onDraw

snap_drawing/src/snap_drawing/cpp/Layers/SpinnerLayer.cpp:102–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void SpinnerLayer::onDraw(DrawingContext& drawingContext) {
103 Layer::onDraw(drawingContext);
104
105 auto pi2 = M_PI * 2.0f;
106
107 drawArc(drawingContext, drawingContext.drawBounds(), _outerCirclePaint, _outerCirclePath, pi2 * _rotationRatio);
108
109 auto innerCircleBounds = drawingContext.drawBounds();
110
111 innerCircleBounds.offset(kInnerCircleOffset, kInnerCircleOffset);
112 innerCircleBounds.right -= kInnerCircleOffset * 2;
113 innerCircleBounds.bottom -= kInnerCircleOffset * 2;
114
115 if (!innerCircleBounds.isEmpty()) {
116 drawArc(drawingContext,
117 innerCircleBounds,
118 _innerCirclePaint,
119 _innerCirclePath,
120 pi2 - fmod(pi2 * (_rotationRatio + kInnerCircleRotationOffset), pi2));
121 }
122}
123
124void SpinnerLayer::onRootChanged(ILayerRoot* root) {
125 Layer::onRootChanged(root);

Callers

nothing calls this directly

Calls 3

drawArcFunction · 0.85
offsetMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected