mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 21:59:20 +01:00
deal with offscreen buffer issues
This commit is contained in:
@@ -1701,7 +1701,7 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
|
||||
pixels = new int[width * height];
|
||||
}
|
||||
//((BufferedImage) image).getRGB(0, 0, width, height, pixels, 0, width);
|
||||
WritableRaster raster = ((BufferedImage) image).getRaster();
|
||||
WritableRaster raster = ((BufferedImage) (primarySurface ? offscreen : image)).getRaster();
|
||||
raster.getDataElements(0, 0, width, height, pixels);
|
||||
}
|
||||
|
||||
@@ -1714,7 +1714,7 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
|
||||
*/
|
||||
public void updatePixels() {
|
||||
//updatePixels(0, 0, width, height);
|
||||
WritableRaster raster = ((BufferedImage) image).getRaster();
|
||||
WritableRaster raster = ((BufferedImage) (primarySurface ? offscreen : image)).getRaster();
|
||||
raster.setDataElements(0, 0, width, height, pixels);
|
||||
}
|
||||
|
||||
@@ -1745,7 +1745,7 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
|
||||
public int get(int x, int y) {
|
||||
if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return 0;
|
||||
//return ((BufferedImage) image).getRGB(x, y);
|
||||
WritableRaster raster = ((BufferedImage) image).getRaster();
|
||||
WritableRaster raster = ((BufferedImage) (primarySurface ? offscreen : image)).getRaster();
|
||||
raster.getDataElements(x, y, getset);
|
||||
return getset[0];
|
||||
}
|
||||
@@ -1760,7 +1760,7 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
|
||||
|
||||
// oops, the last parameter is the scan size of the *target* buffer
|
||||
//((BufferedImage) image).getRGB(x, y, w, h, output.pixels, 0, w);
|
||||
WritableRaster raster = ((BufferedImage) image).getRaster();
|
||||
WritableRaster raster = ((BufferedImage) (primarySurface ? offscreen : image)).getRaster();
|
||||
raster.getDataElements(x, y, w, h, output.pixels);
|
||||
|
||||
return output;
|
||||
@@ -1776,14 +1776,14 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
|
||||
if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return;
|
||||
// ((BufferedImage) image).setRGB(x, y, argb);
|
||||
getset[0] = argb;
|
||||
WritableRaster raster = ((BufferedImage) image).getRaster();
|
||||
WritableRaster raster = ((BufferedImage) (primarySurface ? offscreen : image)).getRaster();
|
||||
raster.setDataElements(x, y, getset);
|
||||
}
|
||||
|
||||
|
||||
protected void setImpl(int dx, int dy, int sx, int sy, int sw, int sh,
|
||||
PImage src) {
|
||||
WritableRaster raster = ((BufferedImage) image).getRaster();
|
||||
WritableRaster raster = ((BufferedImage) (primarySurface ? offscreen : image)).getRaster();
|
||||
if ((sx == 0) && (sy == 0) && (sw == src.width) && (sh == src.height)) {
|
||||
raster.setDataElements(dx, dy, src.width, src.height, src.pixels);
|
||||
} else {
|
||||
|
||||
@@ -4,6 +4,14 @@ X had to add an additional offscreen buffer, which is more memory
|
||||
X however hopefully not a problem on modern machines
|
||||
X and probably no worse than what MemoryImageSource does
|
||||
X removed large synchronized block
|
||||
A OPENGL2 record only saves one line in a LINES shape
|
||||
A http://code.google.com/p/processing/issues/detail?id=579
|
||||
|
||||
_ save() no longer works at bottom of draw with JAVA2D
|
||||
X neither does loadPixels it seems
|
||||
X http://code.google.com/p/processing/issues/detail?id=594
|
||||
X made an edit so that loadPixels will apply to the offscreen image, but...
|
||||
X ironing out more issues with set() and the latest release
|
||||
|
||||
|
||||
_ bug: textAlign(RIGHT) is shutting off native fonts
|
||||
|
||||
Reference in New Issue
Block a user