Fix scissor test being enabled while no area is set
This commit is contained in:
@@ -92,7 +92,10 @@ public class OffsetGuiRenderer implements GuiRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDrawingArea(int x, int y, int width, int height) {
|
public void setDrawingArea(int x, int y, int width, int height) {
|
||||||
if (!strict) return;
|
if (!strict) {
|
||||||
|
renderer.setDrawingArea(x + position.getX(), y + position.getY(), width, height);
|
||||||
|
return;
|
||||||
|
}
|
||||||
int x2 = x + width;
|
int x2 = x + width;
|
||||||
int y2 = y + height;
|
int y2 = y + height;
|
||||||
// Convert and clamp top and left border
|
// Convert and clamp top and left border
|
||||||
@@ -111,7 +114,7 @@ public class OffsetGuiRenderer implements GuiRenderer {
|
|||||||
public void startUsing() {
|
public void startUsing() {
|
||||||
GL11.glPushAttrib(GL11.GL_SCISSOR_BIT);
|
GL11.glPushAttrib(GL11.GL_SCISSOR_BIT);
|
||||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||||
setDrawingArea(0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
setDrawingArea(0, 0, size.getWidth(), size.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopUsing() {
|
public void stopUsing() {
|
||||||
|
|||||||
@@ -112,7 +112,12 @@ public abstract class AbstractGuiDropdownMenu<V, T extends AbstractGuiDropdownMe
|
|||||||
ReadablePoint offsetPoint = new Point(0, size.getHeight());
|
ReadablePoint offsetPoint = new Point(0, size.getHeight());
|
||||||
ReadableDimension offsetSize = new Dimension(size.getWidth(), (fontRenderer.FONT_HEIGHT + 5) * values.length);
|
ReadableDimension offsetSize = new Dimension(size.getWidth(), (fontRenderer.FONT_HEIGHT + 5) * values.length);
|
||||||
OffsetGuiRenderer offsetRenderer = new OffsetGuiRenderer(renderer, offsetPoint, offsetSize);
|
OffsetGuiRenderer offsetRenderer = new OffsetGuiRenderer(renderer, offsetPoint, offsetSize);
|
||||||
dropdown.draw(offsetRenderer, offsetSize, renderInfo.offsetMouse(0, offsetPoint.getY()).layer(0));
|
offsetRenderer.startUsing();
|
||||||
|
try {
|
||||||
|
dropdown.draw(offsetRenderer, offsetSize, renderInfo.offsetMouse(0, offsetPoint.getY()).layer(0));
|
||||||
|
} finally {
|
||||||
|
offsetRenderer.stopUsing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user