Bug in scaling for small bitmaps (with proposed fix)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35748
    wesson
    Participant

    Hello, I've registered not a long ago a version of Alphaskin.

    I think I may have found a bug in the resize kernel.

    Condition of occurence is when switching to some specific themes (blue glass, blue ice, fallout style, desert, neutral 3 or retro)

    There must be also a TsSpinEdit with a given size (for instance 79 * 21), in fact, it has to end up with one of the internal bitmap sized 3*3 that must be resized 3*2. So it is probably reproductible with other kind of controls.

    The problem: The resize kernel generate pixel offset that are outside the bitmap. In fact, it generates pixel offset that goes to line -1.

    Consequence: in debug, it crashes. in release, it may also crash, but silently. And in any case, there is memory corrupted.

    The solution(well, the one that I have implemented) : limit the kernel not only for positive B, but also for negative value

    And here is the source code (in sGraphUtils.pas, procedure CreateContributors(…))

    Line 4464:

    if B < 0 then begin if -B >= MaxSize then Pixel := 2 * MaxSize + B – 1 else Pixel := -B;

    end else begin

    if B >= MaxSize then Pixel := 2 * MaxSize – B – 1 else Pixel := B;

    end;

    I can provide a svn or git compatible diff file, if anyone is interested.

    I hope this help.

    #50558
    Support
    Keymaster

    Hello, thank you for this researching, I'll check it soon.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.