mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
cleanup pixmap
This commit is contained in:
@@ -32,7 +32,7 @@ public abstract class DrawOnPixmap {
|
|||||||
BitmapFont font = bigText ? Controls.getBitmapFont("big") : Controls.getBitmapFont("default");
|
BitmapFont font = bigText ? Controls.getBitmapFont("big") : Controls.getBitmapFont("default");
|
||||||
|
|
||||||
FrameBuffer frameBuffer = new FrameBuffer(Pixmap.Format.RGB888, drawingMap.getWidth(), drawingMap.getHeight(), false);
|
FrameBuffer frameBuffer = new FrameBuffer(Pixmap.Format.RGB888, drawingMap.getWidth(), drawingMap.getHeight(), false);
|
||||||
SpriteBatch batch=new SpriteBatch();
|
SpriteBatch batch = new SpriteBatch();
|
||||||
|
|
||||||
frameBuffer.begin();
|
frameBuffer.begin();
|
||||||
|
|
||||||
@@ -46,16 +46,17 @@ public abstract class DrawOnPixmap {
|
|||||||
batch.begin();
|
batch.begin();
|
||||||
//Rendering ends here. Create a new Pixmap to Texture with mipmaps, otherwise will render as full black.
|
//Rendering ends here. Create a new Pixmap to Texture with mipmaps, otherwise will render as full black.
|
||||||
Texture texture = new Texture(drawingMap);
|
Texture texture = new Texture(drawingMap);
|
||||||
batch.draw(texture,0,0);
|
batch.draw(texture, 0, 0);
|
||||||
font.setColor(color);
|
font.setColor(color);
|
||||||
font.draw(batch,itemText,x,y,width, Align.center,true);
|
font.draw(batch, itemText, x, y, width, Align.center, true);
|
||||||
batch.end();
|
batch.end();
|
||||||
drawingMap.drawPixmap(Pixmap.createFromFrameBuffer(0, 0, drawingMap.getWidth(), drawingMap.getHeight()),0,0);
|
Pixmap pixmap = Pixmap.createFromFrameBuffer(0, 0, drawingMap.getWidth(), drawingMap.getHeight());
|
||||||
|
drawingMap.drawPixmap(pixmap, 0, 0);
|
||||||
frameBuffer.end();
|
frameBuffer.end();
|
||||||
texture.dispose();
|
texture.dispose();
|
||||||
batch.dispose();
|
batch.dispose();
|
||||||
|
pixmap.dispose();
|
||||||
if (bigText) //don't know why this is needed to circumvent bug getting default size for the same pixelfont
|
if (bigText) //don't know why this is needed to circumvent bug getting default size for the same pixelfont
|
||||||
Controls.getBitmapFont("default");
|
Controls.getBitmapFont("default");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -484,10 +484,12 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
g.end();
|
g.end();
|
||||||
g.endClip();
|
g.endClip();
|
||||||
//Rendering ends here. Create a new Pixmap to Texture with mipmaps, otherwise will render as full black.
|
//Rendering ends here. Create a new Pixmap to Texture with mipmaps, otherwise will render as full black.
|
||||||
Texture result = new Texture(Pixmap.createFromFrameBuffer(0, 0, preview_w, preview_h), Forge.isTextureFilteringEnabled());
|
Pixmap pixmap = Pixmap.createFromFrameBuffer(0, 0, preview_w, preview_h);
|
||||||
|
Texture result = new Texture(pixmap, Forge.isTextureFilteringEnabled());
|
||||||
frameBuffer.end();
|
frameBuffer.end();
|
||||||
g.dispose();
|
g.dispose();
|
||||||
frameBuffer.dispose();
|
frameBuffer.dispose();
|
||||||
|
pixmap.dispose();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,7 +521,9 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
}
|
}
|
||||||
getGraphics().end();
|
getGraphics().end();
|
||||||
getGraphics().endClip();
|
getGraphics().endClip();
|
||||||
generatedTooltip = new Texture(Pixmap.createFromFrameBuffer(0, 0, preview_w, preview_h), Forge.isTextureFilteringEnabled());
|
Pixmap pixmap = Pixmap.createFromFrameBuffer(0, 0, preview_w, preview_h);
|
||||||
|
generatedTooltip = new Texture(pixmap, Forge.isTextureFilteringEnabled());
|
||||||
|
pixmap.dispose();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user