Shape transform/points edit protection against large rects

This commit is contained in:
Jindra Petřík
2023-10-16 09:36:06 +02:00
parent 19c114c185
commit 82535c8942
5 changed files with 130 additions and 26 deletions
@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.annotations.Calculated;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
import java.awt.Point;
@@ -93,4 +94,13 @@ public class RECT implements Serializable {
public Point getBottomRight() {
return new Point(Xmax, Ymax);
}
public void calculateBits() {
nbits = SWFOutputStream.getNeededBitsS(Xmin, Xmax, Ymin, Ymax);
}
public boolean isTooLarge() {
calculateBits();
return !SWFOutputStream.fitsInUB(5, nbits);
}
}