mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 18:35:37 +01:00
get current pixel scale from GLWindow
This commit is contained in:
@@ -132,11 +132,6 @@ public abstract class PGL {
|
||||
* order to make sure the lines are always on top of the fill geometry */
|
||||
protected static float STROKE_DISPLACEMENT = 0.999f;
|
||||
|
||||
// ........................................................
|
||||
|
||||
// Retina support
|
||||
|
||||
int pixel_scale = 1;
|
||||
|
||||
// ........................................................
|
||||
|
||||
@@ -566,9 +561,10 @@ public abstract class PGL {
|
||||
x = (int)offsetX;
|
||||
y = (int)offsetY;
|
||||
}
|
||||
float scale = pg.getPixelScale();
|
||||
drawTexture(TEXTURE_2D, glColorTex.get(frontTex), fboWidth, fboHeight,
|
||||
x, y, pg.width, pg.height,
|
||||
0, 0, pixel_scale * pg.width, pixel_scale * pg.height,
|
||||
0, 0, (int)(scale * pg.width), (int)(scale * pg.height),
|
||||
0, 0, pg.width, pg.height);
|
||||
}
|
||||
|
||||
@@ -663,10 +659,11 @@ public abstract class PGL {
|
||||
x = (int)offsetX;
|
||||
y = (int)offsetY;
|
||||
}
|
||||
float scale = pg.getPixelScale();
|
||||
drawTexture(TEXTURE_2D, glColorTex.get(backTex),
|
||||
fboWidth, fboHeight,
|
||||
x, y, pg.width, pg.height,
|
||||
0, 0, pixel_scale * pg.width, pixel_scale * pg.height,
|
||||
0, 0, (int)(scale * pg.width), (int)(scale * pg.height),
|
||||
0, 0, pg.width, pg.height);
|
||||
|
||||
// Swapping front and back textures.
|
||||
@@ -720,12 +717,14 @@ public abstract class PGL {
|
||||
|
||||
private void createFBOLayer() {
|
||||
String ext = getString(EXTENSIONS);
|
||||
float scale = pg.getPixelScale();
|
||||
|
||||
if (-1 < ext.indexOf("texture_non_power_of_two")) {
|
||||
fboWidth = pixel_scale * pg.width;
|
||||
fboHeight = pixel_scale * pg.height;
|
||||
fboWidth = (int)(scale * pg.width);
|
||||
fboHeight = (int)(scale * pg.height);
|
||||
} else {
|
||||
fboWidth = nextPowerOfTwo(pixel_scale * pg.width);
|
||||
fboHeight = nextPowerOfTwo(pixel_scale * pg.height);
|
||||
fboWidth = nextPowerOfTwo((int)(scale * pg.width));
|
||||
fboHeight = nextPowerOfTwo((int)(scale * pg.height));
|
||||
}
|
||||
|
||||
int maxs = maxSamples();
|
||||
|
||||
Reference in New Issue
Block a user