| 80 | } |
| 81 | |
| 82 | SVGImage::ImageInfo SVGImage::LoadImage(const SVGIRI& iri, const Rect& viewPort) { |
| 83 | std::shared_ptr<Image> image = ::tgfx::LoadImage(iri); |
| 84 | if (!image) { |
| 85 | return {}; |
| 86 | } |
| 87 | |
| 88 | // Per spec: raster content has implicit viewbox of '0 0 width height'. |
| 89 | const Rect viewBox = Rect::MakeWH(image->width(), image->height()); |
| 90 | |
| 91 | // Map and place at x, y specified by viewport |
| 92 | Rect dst = viewBox.makeOffset(viewPort.left, viewPort.top); |
| 93 | |
| 94 | return {std::move(image), dst}; |
| 95 | } |
| 96 | |
| 97 | void SVGImage::onRender(const SVGRenderContext& context) const { |
| 98 | // Per spec: x, w, width, height attributes establish the new viewport. |
nothing calls this directly
no test coverage detected