Skip to content

core/render: For BitmapData and related, refactor to clamp width and height to be non-negative for Rectangle argument. #11029

@iwannabethedev

Description

@iwannabethedev

Apparently, for a Rectangle ( https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/geom/Rectangle.html ), AVM2/AS3+ seems to allow negative values for width and height. Light testing indicates that when a Rectangle value is passed to the corresponding methods in BitmapData ( https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html ), the width and height is simply clamped to be non-negative.

Since negative width or height seems strange, it is assumed that such values will always be clamped for all the methods in BitmapData. But, the code currently passes around (i32, i32) for the corresponding Rectangle width and height in certain files, including 'core/src/bitmap/operations.rs'.

The task that this issue describes is to refactor the methods, such that (u32, u32) for width and height is passed around instead of (i32, i32), originating from the Rectangle argument. The clamping to non-negative should happen before the functions in 'core/src/bitmap/operations.rs' are called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-cleanupGeneral improvement of the code base

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions