Skip to content

Commit 978991d

Browse files
committed
removed deprecated methods
1 parent 6631f9d commit 978991d

File tree

2 files changed

+30
-49
lines changed

2 files changed

+30
-49
lines changed

core/src/processing/core/PApplet.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,8 +3093,6 @@ public void focusLost() { }
30933093
// getting the time
30943094

30953095

3096-
// static protected Time time = new Time();
3097-
30983096
/**
30993097
* Get the number of milliseconds since the applet started.
31003098
* <P>
@@ -3108,15 +3106,11 @@ public int millis() {
31083106
/** Seconds position of the current time. */
31093107
static public int second() {
31103108
return Calendar.getInstance().get(Calendar.SECOND);
3111-
// time.setToNow();
3112-
// return time.second;
31133109
}
31143110

31153111
/** Minutes position of the current time. */
31163112
static public int minute() {
31173113
return Calendar.getInstance().get(Calendar.MINUTE);
3118-
// time.setToNow();
3119-
// return time.minute;
31203114
}
31213115

31223116
/**
@@ -3128,8 +3122,6 @@ static public int minute() {
31283122
*/
31293123
static public int hour() {
31303124
return Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
3131-
// time.setToNow();
3132-
// return time.hour;
31333125
}
31343126

31353127
/**
@@ -3140,8 +3132,6 @@ static public int hour() {
31403132
*/
31413133
static public int day() {
31423134
return Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
3143-
// time.setToNow();
3144-
// return time.monthDay;
31453135
}
31463136

31473137
/**
@@ -3150,17 +3140,13 @@ static public int day() {
31503140
static public int month() {
31513141
// months are number 0..11 so change to colloquial 1..12
31523142
return Calendar.getInstance().get(Calendar.MONTH) + 1;
3153-
// time.setToNow();
3154-
// return time.month + 1;
31553143
}
31563144

31573145
/**
31583146
* Get the current year.
31593147
*/
31603148
static public int year() {
31613149
return Calendar.getInstance().get(Calendar.YEAR);
3162-
// time.setToNow();
3163-
// return time.year;
31643150
}
31653151

31663152

core/src/processing/core/PGraphicsAndroid2D.java

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ protected void allocate() {
143143
if (bitmap != null) bitmap.recycle();
144144
bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
145145
canvas = new Canvas(bitmap);
146-
// image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
147-
// canvas = (Graphics2D) image.getGraphics();
148146
}
149147

150148

@@ -448,7 +446,7 @@ public void breakShape() {
448446
@Override
449447
public void endShape(int mode) {
450448
if (shape == POINTS && stroke && vertexCount > 0) {
451-
Matrix m = canvas.getMatrix();
449+
Matrix m = getMatrixImp();
452450
if (strokeWeight == 1 && m.isIdentity()) {
453451
if (screenPoint == null) {
454452
screenPoint = new float[2];
@@ -1516,12 +1514,8 @@ public PMatrix2D getMatrix(PMatrix2D target) {
15161514
if (target == null) {
15171515
target = new PMatrix2D();
15181516
}
1519-
// canvas.getTransform().getMatrix(transform);
1520-
Matrix m = new Matrix();
1521-
canvas.getMatrix(m);
1517+
Matrix m = getMatrixImp();
15221518
m.getValues(transform);
1523-
// target.set((float) transform[0], (float) transform[2], (float) transform[4],
1524-
// (float) transform[1], (float) transform[3], (float) transform[5]);
15251519
target.set((float) transform[0], (float) transform[1], (float) transform[2],
15261520
(float) transform[3], (float) transform[4], (float) transform[5]);
15271521
return target;
@@ -1565,6 +1559,11 @@ public void printMatrix() {
15651559
}
15661560

15671561

1562+
protected Matrix getMatrixImp() {
1563+
return parent.getSurfaceView().getMatrix();
1564+
// return canvas.getMatrix();
1565+
}
1566+
15681567

15691568
//////////////////////////////////////////////////////////////
15701569

@@ -1609,7 +1608,7 @@ public float screenX(float x, float y) {
16091608
}
16101609
screenPoint[0] = x;
16111610
screenPoint[1] = y;
1612-
canvas.getMatrix().mapPoints(screenPoint);
1611+
getMatrixImp().mapPoints(screenPoint);
16131612
return screenPoint[0];
16141613
}
16151614

@@ -1623,7 +1622,7 @@ public float screenY(float x, float y) {
16231622
}
16241623
screenPoint[0] = x;
16251624
screenPoint[1] = y;
1626-
canvas.getMatrix().mapPoints(screenPoint);
1625+
getMatrixImp().mapPoints(screenPoint);
16271626
return screenPoint[1];
16281627
}
16291628

@@ -2046,35 +2045,31 @@ public void set(int x, int y, PImage src) {
20462045
}
20472046

20482047
if (src.bitmap == null) {
2049-
// hopefully this will do the work to figure out what's on/offscreen
2050-
// in spite of the offset and stride that's been provided
2051-
canvas.drawBitmap(src.pixels, 0, src.width,
2052-
x, y, src.width, src.height, false, null);
2053-
// hasAlpha is set to false since we don't want blending.
2054-
// however that may be incorrect if it winds up copying only the RGB
2055-
// (without the A) portion of the pixels.
2056-
2057-
} else { // src.bitmap != null
2058-
if (src.width != src.bitmap.getWidth() ||
2059-
src.height != src.bitmap.getHeight()) {
2048+
src.bitmap = Bitmap.createBitmap(src.width, src.height, Config.ARGB_8888);
2049+
src.modified = true;
2050+
}
2051+
2052+
if (src.width != src.bitmap.getWidth() ||
2053+
src.height != src.bitmap.getHeight()) {
2054+
src.bitmap.recycle();
2055+
src.bitmap = Bitmap.createBitmap(src.width, src.height, Config.ARGB_8888);
2056+
src.modified = true;
2057+
}
2058+
if (src.modified) {
2059+
if (!src.bitmap.isMutable()) {
20602060
src.bitmap.recycle();
20612061
src.bitmap = Bitmap.createBitmap(src.width, src.height, Config.ARGB_8888);
2062-
src.modified = true;
2063-
}
2064-
if (src.modified) {
2065-
if (!src.bitmap.isMutable()) {
2066-
src.bitmap.recycle();
2067-
src.bitmap = Bitmap.createBitmap(src.width, src.height, Config.ARGB_8888);
2068-
}
2069-
src.bitmap.setPixels(src.pixels, 0, src.width, 0, 0, src.width, src.height);
2070-
src.modified = false;
20712062
}
2072-
// set() happens in screen coordinates, so need to clear the ctm
2073-
canvas.save(Canvas.MATRIX_SAVE_FLAG);
2074-
canvas.setMatrix(null); // set to identity
2075-
canvas.drawBitmap(src.bitmap, x, y, null);
2076-
canvas.restore();
2063+
src.bitmap.setPixels(src.pixels, 0, src.width, 0, 0, src.width, src.height);
2064+
src.modified = false;
20772065
}
2066+
2067+
// set() happens in screen coordinates, so need to clear the ctm
2068+
canvas.save(Canvas.MATRIX_SAVE_FLAG);
2069+
canvas.setMatrix(null); // set to identity
2070+
canvas.drawBitmap(src.bitmap, x, y, null);
2071+
canvas.restore();
2072+
20782073
}
20792074

20802075

0 commit comments

Comments
 (0)