Bug 721100 - After panning, tap area is offset at wrong place. r=pcwalton

When rendering with an offset for MultiTileLayer, the tile origin was moved
to compensate, but this lead to there being a mismatch between Gecko's
displayport origin and the one recorded on the Java side.

Instead of altering the origin, allow setting a render offset on MultiTileLayer
instead, so the origin remains correct.
This commit is contained in:
Chris Lord 2012-01-26 20:18:47 +00:00
Родитель f6b6e21869
Коммит ccf4980df5
2 изменённых файлов: 17 добавлений и 6 удалений

Просмотреть файл

@ -292,9 +292,7 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
LayerController controller = getLayerController();
PointF displayportOrigin = mGeckoViewport.getDisplayportOrigin();
Point tileOrigin = PointUtils.round(displayportOrigin);
tileOrigin.offset(-mRenderOffset.x, -mRenderOffset.y);
mTileLayer.setOrigin(tileOrigin);
mTileLayer.setOrigin(PointUtils.round(displayportOrigin));
mTileLayer.setResolution(mGeckoViewport.getZoomFactor());
if (onlyUpdatePageSize) {
@ -323,6 +321,7 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
Rect rect = new Rect(x, y, x + width, y + height);
rect.offset(mRenderOffset.x, mRenderOffset.y);
((MultiTileLayer)mTileLayer).invalidate(rect);
((MultiTileLayer)mTileLayer).setRenderOffset(mRenderOffset);
}
} finally {
endTransaction(mTileLayer);

Просмотреть файл

@ -67,6 +67,7 @@ public class MultiTileLayer extends Layer {
private IntSize mBufferSize;
private Region mDirtyRegion;
private Region mValidRegion;
private Point mRenderOffset;
private final LinkedList<SubTile> mTiles;
private final HashMap<Long, SubTile> mPositionHash;
@ -78,6 +79,7 @@ public class MultiTileLayer extends Layer {
mBufferSize = new IntSize(0, 0);
mDirtyRegion = new Region();
mValidRegion = new Region();
mRenderOffset = new Point();
mTiles = new LinkedList<SubTile>();
mPositionHash = new HashMap<Long, SubTile>();
}
@ -160,6 +162,12 @@ public class MultiTileLayer extends Layer {
return new Long((((long)point.x) << 32) | point.y);
}
private Point getOffsetOrigin() {
Point origin = new Point(getOrigin());
origin.offset(-mRenderOffset.x, -mRenderOffset.y);
return origin;
}
/**
* Performs the necessary functions to update the specified properties of
* a sub-tile.
@ -172,7 +180,7 @@ public class MultiTileLayer extends Layer {
// buffer. This is done as SingleTileLayer always updates the
// entire width, regardless of the dirty-rect's width, and so
// can override existing data.
Point origin = getOrigin();
Point origin = getOffsetOrigin();
Rect validRect = tile.getValidTextureArea();
validRect.offset(tileOrigin.x - origin.x, tileOrigin.y - origin.y);
Region validRegion = new Region(validRect);
@ -226,9 +234,9 @@ public class MultiTileLayer extends Layer {
}
// Check that we're capable of updating from this origin.
Point origin = getOrigin();
Point origin = getOffsetOrigin();
if ((origin.x % mTileSize.width) != 0 || (origin.y % mTileSize.height) != 0) {
Log.e(LOGTAG, "MultiTileLayer doesn't support non tile-aligned origins! (" +
Log.e(LOGTAG, "MultiTileLayer doesn't support non tile-aligned buffers! (" +
origin.x + ", " + origin.y + ")");
return true;
}
@ -395,6 +403,10 @@ public class MultiTileLayer extends Layer {
}
}
public void setRenderOffset(Point offset) {
mRenderOffset.set(offset.x, offset.y);
}
/**
* Invalidates all sub-tiles. This should be called if the source backing
* this layer has changed. This method is only valid inside a transaction.