[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    [OpenJDK 2D-Dev] [100303] Graphics: custom Composite + anti-aliasing = RasterFormatException
From:       Matthias Wienand <matthias.wienand () itemis ! de>
Date:       2013-03-05 13:29:04
Message-ID: 5135F320.1050000 () itemis ! de
[Download RAW message or body]


Hi,

when drawing outside of the client area while using a custom Composite when
anti-aliasing is enabled, then a RasterFormatException is thrown. When
anti-aliasing is disabled, the behavior is as expected, i.e. the drawing is
correctly clipped and the custom Composite is correctly applied. I opened a
bug ticket [1] where you can find a small program demonstrating the issue.

The exception is thrown when the Raster objects for the custom Composite are
constructed. (sun.java2d.pipe.GeneralCompositePipe#renderPathTile(...))

I opened a question at stackoverflow.com [2] to resolve the problem, but could
not find a way to get it working without changing AWT source code. I do not
have much knowledge of the AWT source code, nonetheless I have a guess where
to change it.

Fortunately, it seems to be an "off by one" error, considering that the
RasterFormatException is thrown because a Raster's bounds are exceeded by
exactly one. When you follow the execution flow to find out where the bounds
of the drawing are computed, then you end up at the
sun.java2d.pisces.PiscesCache#PiscesCache(...) constructor:

    PiscesCache(int minx, int miny, int maxx, int maxy) {
        assert maxy >= miny && maxx >= minx;
        bboxX0 = minx;
        bboxY0 = miny;
        bboxX1 = maxx + 1;
        bboxY1 = maxy + 1;

My guess is, that the bboxX1 and bboxY1 values are off by one. The passed-in
maxx and maxy values are inclusive, and my observation is, that the bboxX1 and
bboxY1 values shall be inclusive, too. At least, removing the addition solves
the problem for me.

best regards,
Matthias

[1] https://bugs.openjdk.java.net/show_bug.cgi?id=100303
[2] http://stackoverflow.com/questions/1462588/java-awt-custom-
    compositecontext-anti-aliasing-rasterformatexception-when-dra

-- 
Matthias Wienand
Auszubildender

Telefon: +49 231 98 60 210
Telefax: +49 231 98 60 211

http://www.itemis.de
matthias.wienand@itemis.de

itemis AG
Am Brambusch 15-24
44536 Lünen

Rechtlicher Hinweis:

Amtsgericht Dortmund, HRB 20621

Vorstand: Jens Wagener (Vors.), Wolfgang Neuhaus, Dr. Georg Pietrek, Jens Trompeter, Sebastian Neus
Aufsichtsrat: Dr. Burkhard Igel (Vors.), Stephan Grollmann, Michael Neuhaus



["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic