MCPcopy Create free account
hub / github.com/VitalAudio/visage / parseRectShape

Function parseRectShape

visage_graphics/svg.cpp:365–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363 }
364
365 Path::CommandList parseRectShape(std::vector<std::string>& tokens, const Bounds& bounding_box) {
366 static constexpr int kNumInsets = 4;
367 float insets[kNumInsets] {};
368 for (int i = 0; i < tokens.size() - 1 && i < kNumInsets; ++i) {
369 float dim = (i % 2) ? bounding_box.width() : bounding_box.height();
370 insets[i] = parseNumber(tokens[i + 1], dim);
371 }
372
373 Path::CommandList path;
374 float rs[8] {};
375 float x = bounding_box.x() + insets[3];
376 float y = bounding_box.y() + insets[0];
377 float width = bounding_box.width() - insets[1] - insets[3];
378 float height = bounding_box.height() - insets[2] - insets[0];
379 if (parseBorderRadius(rs, tokens, bounding_box)) {
380 path.addRoundedRectangle(x, y, width, height, rs[0], rs[4], rs[1], rs[5], rs[2], rs[6], rs[3],
381 rs[7]);
382 }
383 else
384 path.addRectangle(x, y, width, height);
385 return path;
386 }
387
388 void SvgDrawable::checkPathClipping(const Matrix& scale_matrix, const Bounds& view_box,
389 std::map<std::string, SvgDrawable*>& clip_paths) {

Callers 1

checkPathClippingMethod · 0.85

Calls 9

parseBorderRadiusFunction · 0.85
addRectangleMethod · 0.80
parseNumberFunction · 0.70
sizeMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
xMethod · 0.45
yMethod · 0.45
addRoundedRectangleMethod · 0.45

Tested by

no test coverage detected