mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1166309 - Move gfx mozglue dependency to after Gecko starts; r=snorp
This commit is contained in:
parent
fff18a12b9
commit
e44c4f499f
@ -15,6 +15,7 @@ import java.nio.ByteBuffer;
|
||||
/** A buffered image that simply saves a buffer of pixel data. */
|
||||
public class BufferedImage {
|
||||
private ByteBuffer mBuffer;
|
||||
private Bitmap mBitmap;
|
||||
private IntSize mSize;
|
||||
private int mFormat;
|
||||
|
||||
@ -29,14 +30,13 @@ public class BufferedImage {
|
||||
public BufferedImage(Bitmap bitmap) {
|
||||
mFormat = bitmapConfigToFormat(bitmap.getConfig());
|
||||
mSize = new IntSize(bitmap.getWidth(), bitmap.getHeight());
|
||||
|
||||
int bpp = bitsPerPixelForFormat(mFormat);
|
||||
mBuffer = DirectBufferAllocator.allocate(mSize.getArea() * bpp);
|
||||
bitmap.copyPixelsToBuffer(mBuffer.asIntBuffer());
|
||||
mBitmap = bitmap;
|
||||
}
|
||||
|
||||
private synchronized void freeBuffer() {
|
||||
mBuffer = DirectBufferAllocator.free(mBuffer);
|
||||
if (mBuffer != null) {
|
||||
mBuffer = DirectBufferAllocator.free(mBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
@ -47,7 +47,16 @@ public class BufferedImage {
|
||||
}
|
||||
}
|
||||
|
||||
public ByteBuffer getBuffer() { return mBuffer; }
|
||||
public ByteBuffer getBuffer() {
|
||||
if (mBuffer == null) {
|
||||
int bpp = bitsPerPixelForFormat(mFormat);
|
||||
mBuffer = DirectBufferAllocator.allocate(mSize.getArea() * bpp);
|
||||
mBitmap.copyPixelsToBuffer(mBuffer.asIntBuffer());
|
||||
mBitmap = null;
|
||||
}
|
||||
return mBuffer;
|
||||
}
|
||||
|
||||
public IntSize getSize() { return mSize; }
|
||||
public int getFormat() { return mFormat; }
|
||||
|
||||
|
@ -161,12 +161,6 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
|
||||
mFrameTimings = new int[60];
|
||||
mCurrentFrame = mFrameTimingsSum = mDroppedFrames = 0;
|
||||
|
||||
// Initialize the FloatBuffer that will be used to store all vertices and texture
|
||||
// coordinates in draw() commands.
|
||||
mCoordByteBuffer = DirectBufferAllocator.allocate(COORD_BUFFER_SIZE * 4);
|
||||
mCoordByteBuffer.order(ByteOrder.nativeOrder());
|
||||
mCoordBuffer = mCoordByteBuffer.asFloatBuffer();
|
||||
|
||||
Tabs.registerOnTabsChangedListener(this);
|
||||
mZoomedViewListeners = new ArrayList<LayerView.ZoomedViewListener>();
|
||||
}
|
||||
@ -190,9 +184,11 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
DirectBufferAllocator.free(mCoordByteBuffer);
|
||||
mCoordByteBuffer = null;
|
||||
mCoordBuffer = null;
|
||||
if (mCoordByteBuffer != null) {
|
||||
DirectBufferAllocator.free(mCoordByteBuffer);
|
||||
mCoordByteBuffer = null;
|
||||
mCoordBuffer = null;
|
||||
}
|
||||
mHorizScrollLayer.destroy();
|
||||
mVertScrollLayer.destroy();
|
||||
Tabs.unregisterOnTabsChangedListener(this);
|
||||
@ -348,10 +344,17 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
|
||||
|
||||
private RenderContext createContext(RectF viewport, RectF pageRect, float zoomFactor, PointF offset) {
|
||||
if (mCoordBuffer == null) {
|
||||
throw new IllegalStateException();
|
||||
// Initialize the FloatBuffer that will be used to store all vertices and texture
|
||||
// coordinates in draw() commands.
|
||||
mCoordByteBuffer = DirectBufferAllocator.allocate(COORD_BUFFER_SIZE * 4);
|
||||
mCoordByteBuffer.order(ByteOrder.nativeOrder());
|
||||
mCoordBuffer = mCoordByteBuffer.asFloatBuffer();
|
||||
if (mCoordBuffer == null) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
return new RenderContext(viewport, pageRect, zoomFactor, offset, mPositionHandle, mTextureHandle,
|
||||
mCoordBuffer);
|
||||
return new RenderContext(viewport, pageRect, zoomFactor, offset,
|
||||
mPositionHandle, mTextureHandle, mCoordBuffer);
|
||||
}
|
||||
|
||||
private void updateDroppedFrames(long frameStartTime) {
|
||||
|
Loading…
Reference in New Issue
Block a user