149 return (CGLGraphicsConfig)pView.getGraphicsConfiguration();
150 } else {
151 // REMIND: this should rarely (never?) happen, but what if
152 // default config is not CGL?
153 GraphicsEnvironment env = GraphicsEnvironment
154 .getLocalGraphicsEnvironment();
155 GraphicsDevice gd = env.getDefaultScreenDevice();
156 return (CGLGraphicsConfig) gd.getDefaultConfiguration();
157 }
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 int getDefaultScale() {
170 return scale;
171 }
172
173 @Override
174 public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
175 int dx, int dy) {
176 final int state = sg2d.transformState;
177 if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
178 || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
179 return false;
180 }
181 if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
182 x += sg2d.transX;
183 y += sg2d.transY;
184 } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
185 final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
186 sg2d.transform.transform(coords, 0, coords, 0, 3);
187 x = (int) Math.ceil(coords[0] - 0.5);
188 y = (int) Math.ceil(coords[1] - 0.5);
189 w = ((int) Math.ceil(coords[2] - 0.5)) - x;
|
149 return (CGLGraphicsConfig)pView.getGraphicsConfiguration();
150 } else {
151 // REMIND: this should rarely (never?) happen, but what if
152 // default config is not CGL?
153 GraphicsEnvironment env = GraphicsEnvironment
154 .getLocalGraphicsEnvironment();
155 GraphicsDevice gd = env.getDefaultScreenDevice();
156 return (CGLGraphicsConfig) gd.getDefaultConfiguration();
157 }
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;
|