mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
Bug 724042 - back out 663892ff23e0 as we have a better solution.
This commit is contained in:
parent
b84511ce96
commit
244e89d4f2
@ -43,7 +43,7 @@ import org.mozilla.gecko.gfx.IntSize;
|
|||||||
import org.mozilla.gecko.gfx.LayerClient;
|
import org.mozilla.gecko.gfx.LayerClient;
|
||||||
import org.mozilla.gecko.gfx.LayerController;
|
import org.mozilla.gecko.gfx.LayerController;
|
||||||
import org.mozilla.gecko.gfx.LayerRenderer;
|
import org.mozilla.gecko.gfx.LayerRenderer;
|
||||||
import org.mozilla.gecko.gfx.SingleTileLayer;
|
import org.mozilla.gecko.gfx.MultiTileLayer;
|
||||||
import org.mozilla.gecko.gfx.PointUtils;
|
import org.mozilla.gecko.gfx.PointUtils;
|
||||||
import org.mozilla.gecko.gfx.WidgetTileLayer;
|
import org.mozilla.gecko.gfx.WidgetTileLayer;
|
||||||
import org.mozilla.gecko.FloatUtils;
|
import org.mozilla.gecko.FloatUtils;
|
||||||
@ -182,7 +182,7 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
|||||||
mRenderOffset.set(0, 0);
|
mRenderOffset.set(0, 0);
|
||||||
} else {
|
} else {
|
||||||
Log.i(LOGTAG, "Creating MultiTileLayer");
|
Log.i(LOGTAG, "Creating MultiTileLayer");
|
||||||
mTileLayer = new SingleTileLayer(mCairoImage);
|
mTileLayer = new MultiTileLayer(mCairoImage, TILE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
getLayerController().setRoot(mTileLayer);
|
getLayerController().setRoot(mTileLayer);
|
||||||
@ -197,13 +197,12 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
|||||||
public boolean beginDrawing(int width, int height, int tileWidth, int tileHeight, String metadata, boolean hasDirectTexture) {
|
public boolean beginDrawing(int width, int height, int tileWidth, int tileHeight, String metadata, boolean hasDirectTexture) {
|
||||||
// If we've changed surface types, cancel this draw
|
// If we've changed surface types, cancel this draw
|
||||||
if (setHasDirectTexture(hasDirectTexture)) {
|
if (setHasDirectTexture(hasDirectTexture)) {
|
||||||
Log.i(LOGTAG, "we've changed surface types, cancel this draw");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the tile-size matches. If it doesn't, we could crash trying
|
// Make sure the tile-size matches. If it doesn't, we could crash trying
|
||||||
// to access invalid memory.
|
// to access invalid memory.
|
||||||
if (mHasDirectTexture || mTileLayer instanceof SingleTileLayer) {
|
if (mHasDirectTexture) {
|
||||||
if (tileWidth != 0 || tileHeight != 0) {
|
if (tileWidth != 0 || tileHeight != 0) {
|
||||||
Log.e(LOGTAG, "Aborting draw, incorrect tile size of " + tileWidth + "x" + tileHeight);
|
Log.e(LOGTAG, "Aborting draw, incorrect tile size of " + tileWidth + "x" + tileHeight);
|
||||||
return false;
|
return false;
|
||||||
@ -236,24 +235,8 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
|||||||
// we're using MultiTileLayer. Otherwise, just synchronise the
|
// we're using MultiTileLayer. Otherwise, just synchronise the
|
||||||
// buffer size and return.
|
// buffer size and return.
|
||||||
if (!(mTileLayer instanceof MultiTileLayer)) {
|
if (!(mTileLayer instanceof MultiTileLayer)) {
|
||||||
if (mBufferSize.width != width || mBufferSize.height != height) {
|
if (mBufferSize.width != width || mBufferSize.height != height)
|
||||||
mBufferSize = new IntSize(width, height);
|
mBufferSize = new IntSize(width, height);
|
||||||
if (mTileLayer instanceof SingleTileLayer) {
|
|
||||||
int size = mBufferSize.getArea() * 2;
|
|
||||||
if (mBuffer == null || mBuffer.capacity() != size) {
|
|
||||||
// Free the old buffer
|
|
||||||
if (mBuffer != null) {
|
|
||||||
GeckoAppShell.freeDirectBuffer(mBuffer);
|
|
||||||
mBuffer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
mBuffer = GeckoAppShell.allocateDirectBuffer(size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!(mTileLayer instanceof SingleTileLayer)){
|
|
||||||
Log.i(LOGTAG, "returning early from beginDraw");
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +265,7 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
|||||||
IntSize realBufferSize = new IntSize(width + TILE_SIZE.width,
|
IntSize realBufferSize = new IntSize(width + TILE_SIZE.width,
|
||||||
height + TILE_SIZE.height);
|
height + TILE_SIZE.height);
|
||||||
|
|
||||||
|
// Reallocate the buffer if necessary
|
||||||
int bpp = CairoUtils.bitsPerPixelForCairoFormat(mFormat) / 8;
|
int bpp = CairoUtils.bitsPerPixelForCairoFormat(mFormat) / 8;
|
||||||
int size = realBufferSize.getArea() * bpp;
|
int size = realBufferSize.getArea() * bpp;
|
||||||
if (mBuffer == null || mBuffer.capacity() != size) {
|
if (mBuffer == null || mBuffer.capacity() != size) {
|
||||||
@ -296,8 +279,6 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(LOGTAG, "beginDraw finishing");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,13 +317,10 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
|||||||
try {
|
try {
|
||||||
updateViewport(!mUpdateViewportOnEndDraw);
|
updateViewport(!mUpdateViewportOnEndDraw);
|
||||||
mUpdateViewportOnEndDraw = false;
|
mUpdateViewportOnEndDraw = false;
|
||||||
Rect rect = new Rect(x, y, x + width, y + height);
|
|
||||||
rect.offset(mRenderOffset.x, mRenderOffset.y);
|
|
||||||
|
|
||||||
if (mTileLayer instanceof SingleTileLayer)
|
|
||||||
((SingleTileLayer)mTileLayer).invalidate(rect);
|
|
||||||
|
|
||||||
if (mTileLayer instanceof MultiTileLayer) {
|
if (mTileLayer instanceof MultiTileLayer) {
|
||||||
|
Rect rect = new Rect(x, y, x + width, y + height);
|
||||||
|
rect.offset(mRenderOffset.x, mRenderOffset.y);
|
||||||
((MultiTileLayer)mTileLayer).invalidate(rect);
|
((MultiTileLayer)mTileLayer).invalidate(rect);
|
||||||
((MultiTileLayer)mTileLayer).setRenderOffset(mRenderOffset);
|
((MultiTileLayer)mTileLayer).setRenderOffset(mRenderOffset);
|
||||||
}
|
}
|
||||||
@ -469,16 +447,10 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
|||||||
|
|
||||||
// Round up depending on layer implementation to remove texture wastage
|
// Round up depending on layer implementation to remove texture wastage
|
||||||
if (!mHasDirectTexture) {
|
if (!mHasDirectTexture) {
|
||||||
if (mTileLayer instanceof MultiTileLayer) {
|
// Round to the next multiple of the tile size
|
||||||
// Round to the next multiple of the tile size
|
bufferSize = new IntSize(((mScreenSize.width + LayerController.MIN_BUFFER.width - 1) / TILE_SIZE.width + 1) * TILE_SIZE.width,
|
||||||
bufferSize = new IntSize(((mScreenSize.width + LayerController.MIN_BUFFER.width - 1) / TILE_SIZE.width + 1) * TILE_SIZE.width,
|
((mScreenSize.height + LayerController.MIN_BUFFER.height - 1) / TILE_SIZE.height + 1) * TILE_SIZE.height);
|
||||||
((mScreenSize.height + LayerController.MIN_BUFFER.height - 1) / TILE_SIZE.height + 1) * TILE_SIZE.height);
|
tileSize = TILE_SIZE;
|
||||||
tileSize = TILE_SIZE;
|
|
||||||
} else {
|
|
||||||
bufferSize = new IntSize(IntSize.nextPowerOfTwo(mScreenSize.width + LayerController.MIN_BUFFER.width),
|
|
||||||
IntSize.nextPowerOfTwo(mScreenSize.height + LayerController.MIN_BUFFER.height));
|
|
||||||
tileSize = new IntSize(0, 0);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
int maxSize = getLayerController().getView().getMaxTextureSize();
|
int maxSize = getLayerController().getView().getMaxTextureSize();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user