| 42 | } |
| 43 | |
| 44 | void SVGAnimatedImage::doDraw(SkCanvas* canvas, |
| 45 | const Rect& drawBounds, |
| 46 | const Duration& time, |
| 47 | FittingSizeMode fittingSizeMode) { |
| 48 | std::lock_guard<Valdi::Mutex> lock(_mutex); |
| 49 | _currentTime = time; |
| 50 | |
| 51 | auto svgBounds = drawBounds.makeFittingSize(_size, fittingSizeMode); |
| 52 | auto saveCount = canvas->save(); |
| 53 | canvas->clipRect(drawBounds.getSkValue()); |
| 54 | canvas->translate(svgBounds.left, svgBounds.top); |
| 55 | |
| 56 | if (_size.width > 0 && _size.height > 0) { |
| 57 | canvas->scale(svgBounds.width() / _size.width, svgBounds.height() / _size.height); |
| 58 | _dom->setContainerSize(SkSize::Make(_size.width, _size.height)); |
| 59 | } else { |
| 60 | _dom->setContainerSize(SkSize::Make(svgBounds.width(), svgBounds.height())); |
| 61 | } |
| 62 | |
| 63 | _dom->render(canvas); |
| 64 | canvas->restoreToCount(saveCount); |
| 65 | } |
| 66 | |
| 67 | Valdi::Result<Ref<SVGAnimatedImage>> SVGAnimatedImage::make(const Valdi::Byte* data, size_t length) { |
| 68 | const Valdi::BytesView bytesView(nullptr, data, length); |
nothing calls this directly
no test coverage detected