| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dbecf68 commit 8eba035
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -353,12 +353,13 @@ public void endDraw() { | |||
| 353 | 353 | loadPixels(); | |
| 354 | 354 | } | |
| 355 | 355 | ||
| 356 | - // Marking as modified, and then calling updatePixels() in | ||
| 357 | - // the super class, which just sets the mx1, my1, mx2, my2 | ||
| 358 | - // coordinates of the modified area. This avoids doing the | ||
| 359 | - // full copy of the pixels to the surface in this.updatePixels(). | ||
| 360 | - setModified(); | ||
| 361 | - super.updatePixels(); | ||
| 356 | + // // Marking as modified, and then calling updatePixels() in | ||
| 357 | + // // the super class, which just sets the mx1, my1, mx2, my2 | ||
| 358 | + // // coordinates of the modified area. This avoids doing the | ||
| 359 | + // // full copy of the pixels to the surface in this.updatePixels(). | ||
| 360 | + // setModified(); | ||
| 361 | + // super.updatePixels(); | ||
| 362 | + setModified(); // marks pixels as modified so that the pixels will be updated | ||
| 362 | 363 | } | |
| 363 | 364 | ||
| 364 | 365 | ||
@@ -1253,7 +1254,7 @@ protected void imageImpl(PImage who, | |||
| 1253 | 1254 | if ((tint && !cash.tinted) || | |
| 1254 | 1255 | (tint && (cash.tintedColor != tintColor)) || | |
| 1255 | 1256 | (!tint && cash.tinted)) { | |
| 1256 | - // for tint change, mark all pixels as needing update | ||
| 1257 | + // For tint change, mark all pixels as needing update. | ||
| 1257 | 1258 | who.updatePixels(); | |
| 1258 | 1259 | } | |
| 1259 | 1260 | ||
@@ -1602,13 +1603,16 @@ protected float textWidthImpl(char buffer[], int start, int stop) { | |||
| 1602 | 1603 | return super.textWidthImpl(buffer, start, stop); | |
| 1603 | 1604 | } | |
| 1604 | 1605 | ||
| 1605 | - protected void beginTextScreenMode() { | ||
| 1606 | - loadPixels(); | ||
| 1607 | - } | ||
| 1608 | 1606 | ||
| 1609 | - protected void endTextScreenMode() { | ||
| 1610 | - updatePixels(); | ||
| 1611 | - } | ||
| 1607 | + // protected void beginTextScreenMode() { | ||
| 1608 | + // loadPixels(); | ||
| 1609 | + // } | ||
| 1610 | + | ||
| 1611 | + | ||
| 1612 | + // protected void endTextScreenMode() { | ||
| 1613 | + // updatePixels(); | ||
| 1614 | + // } | ||
| 1615 | + | ||
| 1612 | 1616 | ||
| 1613 | 1617 | ////////////////////////////////////////////////////////////// | |
| 1614 | 1618 | ||
@@ -2308,19 +2312,19 @@ public void loadPixels() { | |||
| 2308 | 2312 | } | |
| 2309 | 2313 | ||
| 2310 | 2314 | ||
| 2311 | - /** | ||
| 2312 | - * Update the pixels[] buffer to the PGraphics image. | ||
| 2313 | - * <P> | ||
| 2314 | - * Unlike in PImage, where updatePixels() only requests that the | ||
| 2315 | - * update happens, in PGraphicsJava2D, this will happen immediately. | ||
| 2316 | - */ | ||
| 2317 | - @Override | ||
| 2318 | - public void updatePixels() { | ||
| 2319 | - //updatePixels(0, 0, width, height); | ||
| 2320 | - // WritableRaster raster = ((BufferedImage) (useOffscreen && primarySurface ? offscreen : image)).getRaster(); | ||
| 2321 | - // WritableRaster raster = image.getRaster(); | ||
| 2322 | - getRaster().setDataElements(0, 0, width, height, pixels); | ||
| 2323 | - } | ||
| 2315 | + // /** | ||
| 2316 | + // * Update the pixels[] buffer to the PGraphics image. | ||
| 2317 | + // * <P> | ||
| 2318 | + // * Unlike in PImage, where updatePixels() only requests that the | ||
| 2319 | + // * update happens, in PGraphicsJava2D, this will happen immediately. | ||
| 2320 | + // */ | ||
| 2321 | + // @Override | ||
| 2322 | + // public void updatePixels() { | ||
| 2323 | + // //updatePixels(0, 0, width, height); | ||
| 2324 | + //// WritableRaster raster = ((BufferedImage) (useOffscreen && primarySurface ? offscreen : image)).getRaster(); | ||
| 2325 | + //// WritableRaster raster = image.getRaster(); | ||
| 2326 | + // updatePixels(0, 0, width, height); | ||
| 2327 | + // } | ||
| 2324 | 2328 | ||
| 2325 | 2329 | ||
| 2326 | 2330 | /** | |
@@ -2336,9 +2340,27 @@ public void updatePixels(int x, int y, int c, int d) { | |||
| 2336 | 2340 | // Show a warning message, but continue anyway. | |
| 2337 | 2341 | showVariationWarning("updatePixels(x, y, w, h)"); | |
| 2338 | 2342 | } | |
| 2339 | - updatePixels(); | ||
| 2343 | + // updatePixels(); | ||
| 2344 | + if (pixels != null) { | ||
| 2345 | + getRaster().setDataElements(0, 0, width, height, pixels); | ||
| 2346 | + } | ||
| 2347 | + modified = true; | ||
| 2340 | 2348 | } | |
| 2341 | 2349 | ||
| 2350 | + | ||
| 2351 | + // @Override | ||
| 2352 | + // protected void updatePixelsImpl(int x, int y, int w, int h) { | ||
| 2353 | + // super.updatePixelsImpl(x, y, w, h); | ||
| 2354 | + // | ||
| 2355 | + // if ((x != 0) || (y != 0) || (w != width) || (h != height)) { | ||
| 2356 | + // // Show a warning message, but continue anyway. | ||
| 2357 | + // showVariationWarning("updatePixels(x, y, w, h)"); | ||
| 2358 | + // } | ||
| 2359 | + // getRaster().setDataElements(0, 0, width, height, pixels); | ||
| 2360 | + // } | ||
| 2361 | + | ||
| 2362 | + | ||
| 2363 | + | ||
| 2342 | 2364 | ////////////////////////////////////////////////////////////// | |
| 2343 | 2365 | ||
| 2344 | 2366 | // GET/SET | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -263,14 +263,31 @@ public void loadPixels() { | |||
| 263 | 263 | } | |
| 264 | 264 | ||
| 265 | 265 | ||
| 266 | + @Override | ||
| 267 | + public void updatePixels() { | ||
| 268 | + if (hints[ENABLE_RETINA_PIXELS]) { | ||
| 269 | + updatePixels(0, 0, retina.width, retina.height); | ||
| 270 | + } else { | ||
| 271 | + updatePixels(0, 0, width, height); | ||
| 272 | + } | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + | ||
| 266 | 276 | /** | |
| 267 | 277 | * Update the pixels[] buffer to the PGraphics image. | |
| 268 | 278 | * <P> | |
| 269 | 279 | * Unlike in PImage, where updatePixels() only requests that the | |
| 270 | 280 | * update happens, in PGraphicsJava2D, this will happen immediately. | |
| 271 | 281 | */ | |
| 272 | 282 | @Override | |
| 273 | - public void updatePixels() { | ||
| 283 | + public void updatePixels(int ux, int uy, int uw, int uh) { | ||
| 284 | + int wide = hints[ENABLE_RETINA_PIXELS] ? retina.width : width; | ||
| 285 | + int high = hints[ENABLE_RETINA_PIXELS] ? retina.height : height; | ||
| 286 | + if ((ux != 0) || (uy != 0) || (uw != wide) || (uh != high)) { | ||
| 287 | + // Show a warning message, but continue anyway. | ||
| 288 | + showVariationWarning("updatePixels(x, y, w, h)"); | ||
| 289 | + } | ||
| 290 | + // If not using retina pixels, will need to first downsample | ||
| 274 | 291 | if (!hints[ENABLE_RETINA_PIXELS]) { | |
| 275 | 292 | int offset = 0; | |
| 276 | 293 | int roffset = 0; | |
@@ -286,13 +303,10 @@ public void updatePixels() { | |||
| 286 | 303 | } | |
| 287 | 304 | } | |
| 288 | 305 | getRaster().setDataElements(0, 0, retina.width, retina.height, retina.pixels); | |
| 306 | + modified = true; | ||
| 289 | 307 | } | |
| 290 | 308 | ||
| 291 | 309 | ||
| 292 | - // No override necessary, just prints a warning and calls updatePixels() | ||
| 293 | - //public void updatePixels(int x, int y, int c, int d); | ||
| 294 | - | ||
| 295 | - | ||
| 296 | 310 | static int rgetset[] = new int[4]; | |
| 297 | 311 | ||
| 298 | 312 | @Override | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -494,7 +494,8 @@ public void loadPixels() { // ignore | |||
| 494 | 494 | ||
| 495 | 495 | ||
| 496 | 496 | public void updatePixels() { // ignore | |
| 497 | - updatePixelsImpl(0, 0, width, height); | ||
| 497 | + // updatePixelsImpl(0, 0, width, height); | ||
| 498 | + updatePixels(0, 0, width, height); | ||
| 498 | 499 | } | |
| 499 | 500 | ||
| 500 | 501 | ||
@@ -530,11 +531,15 @@ public void updatePixels() { // ignore | |||
| 530 | 531 | * @param h height | |
| 531 | 532 | */ | |
| 532 | 533 | public void updatePixels(int x, int y, int w, int h) { // ignore | |
| 533 | - updatePixelsImpl(x, y, w, h); | ||
| 534 | - } | ||
| 535 | - | ||
| 536 | - | ||
| 537 | - protected void updatePixelsImpl(int x, int y, int w, int h) { | ||
| 534 | + // updatePixelsImpl(x, y, w, h); | ||
| 535 | + // } | ||
| 536 | + // | ||
| 537 | + // | ||
| 538 | + // /** | ||
| 539 | + // * Broken out as separate impl to signify that the w/y/w/h numbers have | ||
| 540 | + // * already been tested and their bounds set properly. | ||
| 541 | + // */ | ||
| 542 | + // protected void updatePixelsImpl(int x, int y, int w, int h) { | ||
| 538 | 543 | int x2 = x + w; | |
| 539 | 544 | int y2 = y + h; | |
| 540 | 545 | ||
@@ -896,7 +901,8 @@ protected void getImpl(int sourceX, int sourceY, | |||
| 896 | 901 | public void set(int x, int y, int c) { | |
| 897 | 902 | if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) return; | |
| 898 | 903 | pixels[y*width + x] = c; | |
| 899 | - updatePixelsImpl(x, y, 1, 1); // slow? | ||
| 904 | + //updatePixelsImpl(x, y, 1, 1); // slow? | ||
| 905 | + updatePixels(x, y, 1, 1); // slow? | ||
| 900 | 906 | } | |
| 901 | 907 | ||
| 902 | 908 | ||
@@ -955,7 +961,8 @@ protected void setImpl(PImage sourceImage, | |||
| 955 | 961 | targetOffset += width; | |
| 956 | 962 | } | |
| 957 | 963 | ||
| 958 | - updatePixelsImpl(targetX, targetY, sourceWidth, sourceHeight); | ||
| 964 | + //updatePixelsImpl(targetX, targetY, sourceWidth, sourceHeight); | ||
| 965 | + updatePixels(targetX, targetY, sourceWidth, sourceHeight); | ||
| 959 | 966 | } | |
| 960 | 967 | ||
| 961 | 968 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,10 @@ o JAI handles setting image size for png (check javax.imageio?) | |||
| 18 | 18 | o PNGEncodeParam png = PNGEncodeParam.getDefaultEncodeParam(bufImage); | |
| 19 | 19 | o png.setPhysicalDimension(round(dpi*39.370079), round(dpi*39.370079), 1); | |
| 20 | 20 | o JAI.create("filestore", bufImage, filename+".png", "PNG"); | |
| 21 | + X tint() with JAVA2D does not automatically refresh (with possible fix) | ||
| 22 | + X https://github.com/processing/processing/issues/1730 | ||
| 23 | + X change how updatePixels() is called in PGraphicsJava2D | ||
| 24 | + X only call setModified(), not updatePixels() in endDraw() | ||
| 21 | 25 | ||
| 22 | 26 | mouse wheel | |
| 23 | 27 | X add mouse wheel support to 2.0 event system | |
@@ -64,9 +68,6 @@ _ "deleted n framebuffer objects" | |||
| 64 | 68 | _ draw() called again before finishing on OS X (retina issue) | |
| 65 | 69 | _ https://github.com/processing/processing/issues/1709 | |
| 66 | 70 | ||
| 67 | - _ tint() with JAVA2D does not automatically refresh (with possible fix) | ||
| 68 | - _ https://github.com/processing/processing/issues/1730 | ||
| 69 | - | ||
| 70 | 71 | _ Linux sometimes not responding correctly w/ the size() command | |
| 71 | 72 | _ https://github.com/processing/processing/issues/1672 | |
| 72 | 73 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments