common paint: fix invalid memory access in unit test

casting the paint to shape is not allowed if the compositor target
is not shape, here it concretely checking the the type before casting....
This commit is contained in:
Hermet Park 2021-11-12 16:37:10 +09:00 committed by Hermet Park
parent d520da2db8
commit b1604e2ec7

View file

@ -206,7 +206,7 @@ void* Paint::Impl::update(RenderMethod& renderer, const RenderTransform* pTransf
we can avoid regular ClipPath / AlphaMasking sequence but use viewport for performance */ we can avoid regular ClipPath / AlphaMasking sequence but use viewport for performance */
auto tryFastTrack = false; auto tryFastTrack = false;
if (cmpMethod == CompositeMethod::ClipPath) tryFastTrack = true; if (cmpMethod == CompositeMethod::ClipPath) tryFastTrack = true;
else if (cmpMethod == CompositeMethod::AlphaMask) { else if (cmpMethod == CompositeMethod::AlphaMask && cmpTarget->identifier() == TVG_CLASS_ID_SHAPE) {
auto shape = static_cast<Shape*>(cmpTarget); auto shape = static_cast<Shape*>(cmpTarget);
uint8_t a; uint8_t a;
shape->fillColor(nullptr, nullptr, nullptr, &a); shape->fillColor(nullptr, nullptr, nullptr, &a);