@@ -267,6 +267,7 @@ export struct CpuCanvas : Canvas {
267267 _poly.clear ();
268268 createSolid (_poly, _path);
269269 _poly.transform (current ().trans );
270+ _poly.sortForAet ();
270271
271272 auto clipBound = _poly.bound ().ceil ().cast <isize>().clipTo (current ().clip );
272273
@@ -275,7 +276,7 @@ export struct CpuCanvas : Canvas {
275276 current ().clip = clipBound;
276277 _rast.fill (_poly, current ().clip , rule, [&](CpuRast::Frag frag) {
277278 u8 const parentPixel = current ().clipMask .has () ? current ().clipMask .unwrap ()->pixels ().load (frag.xy - current ().clipBound .xy ).red : 255 ;
278- newClipMask->mutPixels ().store (frag.xy - clipBound.xy , Color::fromRgb (parentPixel * frag.a , 0 , 0 ));
279+ newClipMask->mutPixels ().store (frag.xy - clipBound.xy , Color::fromRgb (Math::roundi ( parentPixel * frag.a ) , 0 , 0 ));
279280 });
280281
281282 current ().clipMask = newClipMask;
@@ -313,7 +314,9 @@ export struct CpuCanvas : Canvas {
313314 bool isSuitableForFastFill =
314315 radii.zero () and
315316 current ().fill .is <Color>() and
316- current ().trans .isAxisAligned ();
317+ current ().trans .isAxisAligned () and
318+ not current ().clipMask .has () and
319+ current ().opacity > 0.99 ;
317320
318321 if (isSuitableForFastFill) {
319322 _fillRect (r, current ().fill .unwrap <Color>());
@@ -346,13 +349,15 @@ export struct CpuCanvas : Canvas {
346349 _poly.clear ();
347350 createStroke (_poly, path, current ().stroke );
348351 _poly.transform (current ().trans );
352+ _poly.sortForAet ();
349353 _fill (current ().stroke .fill );
350354 }
351355
352356 void fill (Math::Path const & path, FillRule rule = FillRule::NONZERO) override {
353357 _poly.clear ();
354358 createSolid (_poly, path);
355359 _poly.transform (current ().trans );
360+ _poly.sortForAet ();
356361 _fill (current ().fill , rule);
357362 }
358363
0 commit comments