mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28: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");
|
||||
|
||||
FrameBuffer frameBuffer = new FrameBuffer(Pixmap.Format.RGB888, drawingMap.getWidth(), drawingMap.getHeight(), false);
|
||||
SpriteBatch batch=new SpriteBatch();
|
||||
SpriteBatch batch = new SpriteBatch();
|
||||
|
||||
frameBuffer.begin();
|
||||
|
||||
@@ -46,16 +46,17 @@ public abstract class DrawOnPixmap {
|
||||
batch.begin();
|
||||
//Rendering ends here. Create a new Pixmap to Texture with mipmaps, otherwise will render as full black.
|
||||
Texture texture = new Texture(drawingMap);
|
||||
batch.draw(texture,0,0);
|
||||
batch.draw(texture, 0, 0);
|
||||
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();
|
||||
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();
|
||||
texture.dispose();
|
||||
batch.dispose();
|
||||
pixmap.dispose();
|
||||
if (bigText) //don't know why this is needed to circumvent bug getting default size for the same pixelfont
|
||||
Controls.getBitmapFont("default");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -484,10 +484,12 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
g.end();
|
||||
g.endClip();
|
||||
//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();
|
||||
g.dispose();
|
||||
frameBuffer.dispose();
|
||||
pixmap.dispose();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -519,7 +521,9 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
||||
}
|
||||
getGraphics().end();
|
||||
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) {
|
||||
//e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user