mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 21:53:41 +00:00
common masking: optimize InvAlphaMask
try fast track if InvAlphaMask has 0 opacity + rectangle shape.
This commit is contained in:
parent
62963268cb
commit
28257ec807
1 changed files with 7 additions and 0 deletions
|
@ -209,11 +209,18 @@ RenderData Paint::Impl::update(RenderMethod& renderer, const RenderTransform* pT
|
||||||
auto tryFastTrack = false;
|
auto tryFastTrack = false;
|
||||||
if (target->identifier() == TVG_CLASS_ID_SHAPE) {
|
if (target->identifier() == TVG_CLASS_ID_SHAPE) {
|
||||||
if (method == CompositeMethod::ClipPath) tryFastTrack = true;
|
if (method == CompositeMethod::ClipPath) tryFastTrack = true;
|
||||||
|
//OPTIMIZE HERE: Actually, this condition AlphaMask is useless. We can skip it?
|
||||||
else if (method == CompositeMethod::AlphaMask) {
|
else if (method == CompositeMethod::AlphaMask) {
|
||||||
auto shape = static_cast<Shape*>(target);
|
auto shape = static_cast<Shape*>(target);
|
||||||
uint8_t a;
|
uint8_t a;
|
||||||
shape->fillColor(nullptr, nullptr, nullptr, &a);
|
shape->fillColor(nullptr, nullptr, nullptr, &a);
|
||||||
if (a == 255 && shape->opacity() == 255 && !shape->fill()) tryFastTrack = true;
|
if (a == 255 && shape->opacity() == 255 && !shape->fill()) tryFastTrack = true;
|
||||||
|
//OPTIMIZE HERE: Actually, this condition InvAlphaMask is useless. We can skip it?
|
||||||
|
} else if (method == CompositeMethod::InvAlphaMask) {
|
||||||
|
auto shape = static_cast<Shape*>(target);
|
||||||
|
uint8_t a;
|
||||||
|
shape->fillColor(nullptr, nullptr, nullptr, &a);
|
||||||
|
if ((a == 0 || shape->opacity() == 0) && !shape->fill()) tryFastTrack = true;
|
||||||
}
|
}
|
||||||
if (tryFastTrack) {
|
if (tryFastTrack) {
|
||||||
RenderRegion viewport2;
|
RenderRegion viewport2;
|
||||||
|
|
Loading…
Add table
Reference in a new issue