MCPcopy Create free account
hub / github.com/antvis/F2Native / DrawInner

Method DrawInner

core/graphics/shape/Shape.cpp:5–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3xg::shape::Shape::Shape() : Element() { isShape_ = true; }
4
5void xg::shape::Shape::DrawInner(canvas::CanvasContext &context) const {
6 float originOpacity = context.GlobalAlpha();
7 //coregraphics context path和fill必须配对 path和stroke必须配对
8 //在既有fill又有stroke的case 会浪费一点性能
9
10 // fill case
11 if(HasFill()) {
12 CreatePath(context);
13 if(!std::isnan(fillOpacity_)) {
14 context.SetGlobalAlpha(fillOpacity_);
15 context.Fill();
16 context.SetGlobalAlpha(originOpacity);
17 } else {
18 context.Fill();
19 }
20 }
21
22 // stroke case
23 if(HasStroke() && lineWidth_ > 0) {
24 CreatePath(context);
25 if(!std::isnan(strokeOpacity_)) {
26 context.SetGlobalAlpha(strokeOpacity_);
27 context.Stroke();
28 context.SetGlobalAlpha(originOpacity);
29 } else {
30 context.Stroke();
31 }
32 }
33}
34
35const BBox &xg::shape::Shape::GetBBox(canvas::CanvasContext &context) {
36 if(std::isnan(bbox_.minX)) {

Callers

nothing calls this directly

Calls 4

GlobalAlphaMethod · 0.45
SetGlobalAlphaMethod · 0.45
FillMethod · 0.45
StrokeMethod · 0.45

Tested by

no test coverage detected