< prev index next >

src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java

Print this page




 158     }
 159 
 160     public static CGLGraphicsConfig getGC(CGLLayer layer) {
 161         return (CGLGraphicsConfig)layer.getGraphicsConfiguration();
 162     }
 163 
 164     public void validate() {
 165         // Overridden in CGLWindowSurfaceData below
 166     }
 167 
 168     @Override
 169     public double getDefaultScaleX() {
 170         return scale;
 171     }
 172 
 173     @Override
 174     public double getDefaultScaleY() {
 175         return scale;
 176     }
 177 
 178     @Override
 179     public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
 180                             int dx, int dy) {
 181         final int state = sg2d.transformState;
 182         if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
 183             || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
 184             return false;
 185         }
 186         if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
 187             x += sg2d.transX;
 188             y += sg2d.transY;
 189         } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
 190             final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
 191             sg2d.transform.transform(coords, 0, coords, 0, 3);
 192             x = (int) Math.ceil(coords[0] - 0.5);
 193             y = (int) Math.ceil(coords[1] - 0.5);
 194             w = ((int) Math.ceil(coords[2] - 0.5)) - x;
 195             h = ((int) Math.ceil(coords[3] - 0.5)) - y;
 196             dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
 197             dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
 198         }
 199         oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
 200         return true;
 201     }
 202 
 203     protected native void clearWindow();
 204 
 205     public static class CGLWindowSurfaceData extends CGLSurfaceData {
 206 
 207         public CGLWindowSurfaceData(CPlatformView pView,
 208                 CGLGraphicsConfig gc) {
 209             super(pView, gc, gc.getColorModel(), WINDOW, 0, 0);
 210         }
 211 
 212         @Override
 213         public SurfaceData getReplacement() {
 214             return pView.getSurfaceData();
 215         }
 216 
 217         @Override
 218         public Rectangle getBounds() {
 219             Rectangle r = pView.getBounds();
 220             return new Rectangle(0, 0, r.width, r.height);
 221         }
 222 




 158     }
 159 
 160     public static CGLGraphicsConfig getGC(CGLLayer layer) {
 161         return (CGLGraphicsConfig)layer.getGraphicsConfiguration();
 162     }
 163 
 164     public void validate() {
 165         // Overridden in CGLWindowSurfaceData below
 166     }
 167 
 168     @Override
 169     public double getDefaultScaleX() {
 170         return scale;
 171     }
 172 
 173     @Override
 174     public double getDefaultScaleY() {
 175         return scale;
 176     }
 177 

























 178     protected native void clearWindow();
 179 
 180     public static class CGLWindowSurfaceData extends CGLSurfaceData {
 181 
 182         public CGLWindowSurfaceData(CPlatformView pView,
 183                 CGLGraphicsConfig gc) {
 184             super(pView, gc, gc.getColorModel(), WINDOW, 0, 0);
 185         }
 186 
 187         @Override
 188         public SurfaceData getReplacement() {
 189             return pView.getSurfaceData();
 190         }
 191 
 192         @Override
 193         public Rectangle getBounds() {
 194             Rectangle r = pView.getBounds();
 195             return new Rectangle(0, 0, r.width, r.height);
 196         }
 197 


< prev index next >