Changeset 281


Ignore:
Timestamp:
08/26/08 17:43:55 (16 years ago)
Author:
bjn8
Message:

Yes! found out how to get over clipping issues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameGraphics.java

    r278 r281  
    769769        // Damaged areas pending to render. Accessessed by multiple threads
    770770        private static HashSet<Rectangle> damagedAreas = new HashSet<Rectangle>();
     771       
     772        /** The clip used while paiting */
     773        private static Area currentClip;
     774       
     775        /**
     776         * The current clip that is used for painting at this instant.
     777         *
     778         * Intention: for extra clipping within an items paint method - the clip is
     779         * lost in the graphics object for which can be regained via this method.
     780         *
     781         * @return
     782         *              The current clip. Null if no clip (e.g. full screen render).
     783         */
     784        public static Area getCurrentClip() {
     785                return (currentClip != null) ? (Area)currentClip.clone() : null;
     786        }
    771787
    772788        /**
     
    832848                        return;
    833849
    834                 Area clip = null;
     850                currentClip = null;
    835851                if (useInvalidation) { // build clip
    836852
     
    839855
    840856                                        for (Rectangle r : damagedAreas) {
    841                                                 if (clip == null)
    842                                                         clip = new Area(r);
     857                                                if (currentClip == null)
     858                                                        currentClip = new Area(r);
    843859                                                else
    844                                                         clip.add(new Area(r));
     860                                                        currentClip.add(new Area(r));
    845861                                        }
    846862                                        damagedAreas.clear();
     
    863879
    864880                Frame[] toPaint = DisplayIO.getFrames();
    865                 Image left = Paint(toPaint[0], clip);
    866                 Image right = Paint(toPaint[1], clip);
     881                Image left = Paint(toPaint[0], currentClip);
     882                Image right = Paint(toPaint[1], currentClip);
    867883
    868884                Graphics dg = _DisplayGraphics.create();
Note: See TracChangeset for help on using the changeset viewer.