Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 67d0957

Browse files
author
Yuncong Zhang
authored
Merge pull request #338 from UnityTech/fix_raster_cache_assert
fix raster cache assert issue
2 parents d701d0f + 218b2ea commit 67d0957

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Runtime/ui/renderer/compositeCanvas/flow/raster_cache.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ public void draw(Canvas canvas) {
2929
D.assert(() => {
3030
var textureWidth = Mathf.CeilToInt(bounds.width * this.devicePixelRatio);
3131
var textureHeight = Mathf.CeilToInt(bounds.height * this.devicePixelRatio);
32-
33-
D.assert(this.image.width == textureWidth);
34-
D.assert(this.image.height == textureHeight);
32+
33+
//it is possible that there is a minor difference between the bound size and the image size (1 pixel at
34+
//most) due to the roundOut operation when calculating the bounds if the elements in the canvas transform
35+
//is not all integer
36+
D.assert(Mathf.Abs(this.image.width - textureWidth) <= 1);
37+
D.assert(Mathf.Abs(this.image.height - textureHeight) <= 1);
3538
return true;
3639
});
3740

0 commit comments

Comments
 (0)