Skip to content

Commit e6c13b8

Browse files
committed
Deprecate display rescale callbacks
1 parent 78c13b7 commit e6c13b8

9 files changed

Lines changed: 31 additions & 17 deletions

File tree

jme3-android/src/main/java/com/jme3/app/AndroidHarnessFragment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ public void reshape(int logicalWidth, int logicalHeight, int framebufferWidth, i
244244
}
245245

246246
@Override
247+
@Deprecated
247248
public void rescale(float x, float y) {
248249
app.rescale(x, y);
249250
}

jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ public void onSurfaceChanged(GL10 gl, int width, int height) {
465465
if (renderable.get()) {
466466
logger.log(Level.FINE, "App already initialized, calling reshape");
467467
listener.reshape(logicalWidth, logicalHeight, getRenderFramebufferWidth(), getRenderFramebufferHeight());
468-
listener.rescale(displayScale.x, displayScale.y);
469468
}
470469
}
471470

@@ -512,7 +511,6 @@ private void applyDisplayScaleModeIfNeeded() {
512511
updateDisplayScaleMetrics();
513512
if (renderable.get()) {
514513
listener.reshape(logicalWidth, logicalHeight, getRenderFramebufferWidth(), getRenderFramebufferHeight());
515-
listener.rescale(displayScale.x, displayScale.y);
516514
}
517515
}
518516

@@ -531,7 +529,6 @@ public void onDrawFrame(GL10 gl) {
531529
listener.initialize();
532530
if (framebufferWidth > 0 && framebufferHeight > 0) {
533531
listener.reshape(logicalWidth, logicalHeight, getRenderFramebufferWidth(), getRenderFramebufferHeight());
534-
listener.rescale(displayScale.x, displayScale.y);
535532
}
536533
renderable.set(true);
537534
}

jme3-core/src/main/java/com/jme3/app/LegacyApplication.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,13 @@ public void reshape(int logicalWidth, int logicalHeight, int framebufferWidth, i
603603
}
604604
}
605605

606+
/**
607+
* @deprecated Display scale changes are reported through
608+
* {@link #reshape(int, int, int, int)}. Built-in contexts no longer call
609+
* this method.
610+
*/
606611
@Override
612+
@Deprecated
607613
public void rescale(float x, float y) {
608614
if (renderManager != null) {
609615
renderManager.notifyRescale(x, y);

jme3-core/src/main/java/com/jme3/post/SceneProcessor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,15 @@ public interface SceneProcessor {
6565
/**
6666
* Called when the scale of the viewport has been changed.
6767
*
68+
* @deprecated Display scale changes are reported through
69+
* {@link #reshape(ViewPort, int, int)} using the viewport render target size.
70+
* Built-in contexts no longer call this method.
71+
*
6872
* @param vp the affected ViewPort
6973
* @param x the new horizontal scale
7074
* @param y the new vertical scale
7175
*/
76+
@Deprecated
7277
public default void rescale(ViewPort vp, float x, float y) {
7378

7479
}

jme3-core/src/main/java/com/jme3/renderer/RenderManager.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,8 @@ private void notifyReshape(ViewPort vp, int w, int h) {
486486
}
487487
}
488488

489-
private void notifyRescale(ViewPort vp, float x, float y) {
489+
@Deprecated
490+
private void notifyRescale(ViewPort vp, float x, float y) {
490491
List<SceneProcessor> processors = vp.getProcessors();
491492
for (SceneProcessor proc : processors) {
492493
if (!proc.isInitialized()) {
@@ -554,11 +555,16 @@ private int getFrameBufferHeight(FrameBuffer frameBuffer, int fallbackHeight) {
554555
/**
555556
* Internal use only.
556557
* Updates the scale of all on-screen ViewPorts
557-
*
558-
* @param x the new horizontal scale
559-
* @param y the new vertical scale
560-
*/
561-
public void notifyRescale(float x, float y) {
558+
*
559+
* @deprecated Display scale changes are handled by {@link #notifyReshape(int, int, int, int)}
560+
* using logical and framebuffer sizes. Built-in contexts no longer call
561+
* this method.
562+
*
563+
* @param x the new horizontal scale
564+
* @param y the new vertical scale
565+
*/
566+
@Deprecated
567+
public void notifyRescale(float x, float y) {
562568
for (ViewPort vp : preViewPorts) {
563569
notifyRescale(vp, x, y);
564570
}

jme3-core/src/main/java/com/jme3/system/SystemListener.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,15 @@ public default void reshape(int logicalWidth, int logicalHeight, int framebuffer
6666

6767
/**
6868
* Called to notify the application that the scale has changed.
69+
*
70+
* @deprecated Display scale changes are reported through
71+
* {@link #reshape(int, int, int, int)}. Built-in contexts no longer call
72+
* this method.
73+
*
6974
* @param x the new horizontal scale of the display
7075
* @param y the new vertical scale of the display
7176
*/
77+
@Deprecated
7278
public default void rescale(float x, float y){
7379

7480
}

jme3-desktop/src/main/java/com/jme3/system/awt/AwtPanelsContext.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public void reshape(int width, int height) {
7070
}
7171

7272
@Override
73+
@Deprecated
7374
public void rescale(float x, float y) {
7475
logger.severe("rescale is not supported.");
7576
}

jme3-ios/src/main/java/com/jme3/system/ios/IGLESContext.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ public void resizeFramebuffer(int width, int height) {
319319
logger.log(Level.FINE, "iOS framebuffer resized, width: {0} height: {1}",
320320
new Object[]{framebufferWidth, framebufferHeight});
321321
listener.reshape(logicalWidth, logicalHeight, getRenderFramebufferWidth(), getRenderFramebufferHeight());
322-
listener.rescale(displayScale.x, displayScale.y);
323322
}
324323
}
325324
}
@@ -365,7 +364,6 @@ private void applyDisplayScaleModeIfNeeded() {
365364
linearFrameBufferDirty = true;
366365
if (renderable.get() && listener != null) {
367366
listener.reshape(logicalWidth, logicalHeight, getRenderFramebufferWidth(), getRenderFramebufferHeight());
368-
listener.rescale(displayScale.x, displayScale.y);
369367
}
370368
}
371369

jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
229229
private int oldFramebufferHeight;
230230
private int oldLogicalWidth;
231231
private int oldLogicalHeight;
232-
private final Vector2f oldScale = new Vector2f(1, 1);
233232
private final Vector2f displayScale = new Vector2f(1, 1);
234233
private Material blitMaterial;
235234
private Picture blitGeometry;
@@ -586,10 +585,6 @@ private void updateSizes(boolean notifyListener) {
586585
oldFramebufferHeight = framebufferHeight;
587586
}
588587

589-
if (oldScale.x != displayScale.x || oldScale.y != displayScale.y) {
590-
listener.rescale(displayScale.x, displayScale.y);
591-
oldScale.set(displayScale);
592-
}
593588
}
594589
}
595590

@@ -681,7 +676,6 @@ protected void destroyContext() {
681676
oldFramebufferHeight = 0;
682677
oldLogicalWidth = 0;
683678
oldLogicalHeight = 0;
684-
oldScale.set(1, 1);
685679
} catch (Exception ex) {
686680
if (failure == null) {
687681
failure = ex;

0 commit comments

Comments
 (0)