Kaydet (Commit) 7c42247d authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

android: add FixedZoomTileLayer as a low-res layer

Change-Id: I20d6fb3117ac46c8de63708a122253444bca1671
üst 42070ee2
package org.mozilla.gecko.gfx;
public class FixedZoomTileLayer extends ComposedTileLayer {
@Override
protected float getZoom(ImmutableViewportMetrics viewportMetrics) {
return 0.5f;
}
@Override
public void addTile(SubTile tile) {
}
}
......@@ -33,6 +33,7 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
private boolean mRecordDrawTimes;
private final DrawTimingQueue mDrawTimingQueue;
private ComposedTileLayer mLowResLayer;
private ComposedTileLayer mRootLayer;
/* The Gecko viewport as per the UI thread. Must be touched only on the UI thread.
......@@ -111,6 +112,8 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
mGeckoIsReady = true;
mRootLayer = new DynamicTileLayer();
mLowResLayer = new FixedZoomTileLayer();
mLayerRenderer = new LayerRenderer(mView);
mView.setListener(this);
......@@ -139,6 +142,10 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
return mGeckoIsReady ? mRootLayer : null;
}
Layer getLowResLayer() {
return mGeckoIsReady ? mLowResLayer : null;
}
public LayerView getView() {
return mView;
}
......@@ -281,8 +288,8 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
}
public void beginDrawing() {
mLowResLayer.beginTransaction();
mRootLayer.beginTransaction();
}
public void endDrawing(ImmutableViewportMetrics viewportMetrics) {
......@@ -290,8 +297,10 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
try {
mNewGeckoViewport = viewportMetrics;
updateViewport(true);
mLowResLayer.invalidate();
mRootLayer.invalidate();
} finally {
mLowResLayer.endTransaction();
mRootLayer.endTransaction();
}
}
......@@ -309,6 +318,9 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
mRootLayer.setPosition(RectUtils.round(position));
mRootLayer.setResolution(mGeckoViewport.zoomFactor);
mLowResLayer.setPosition(RectUtils.round(position));
mLowResLayer.setResolution(mGeckoViewport.zoomFactor);
if (onlyUpdatePageSize) {
// Don't adjust page size when zooming unless zoom levels are
// approximately equal.
......@@ -471,10 +483,12 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
/* Root Layer Access */
public void reevaluateTiles() {
mLowResLayer.reevaluateTiles(getViewportMetrics());
mRootLayer.reevaluateTiles(getViewportMetrics());
}
public void clearAndResetlayers() {
mLowResLayer.clearAndReset();
mRootLayer.clearAndReset();
}
}
\ No newline at end of file
......@@ -497,6 +497,7 @@ public class LayerRenderer implements GLSurfaceView.Renderer {
mUpdated = true;
Layer rootLayer = mView.getLayerClient().getRoot();
Layer lowResLayer = mView.getLayerClient().getLowResLayer();
if (!mPageContext.fuzzyEquals(mLastPageContext)) {
// the viewport or page changed, so show the scrollbars again
......@@ -514,6 +515,7 @@ public class LayerRenderer implements GLSurfaceView.Renderer {
/* Update layers. */
if (rootLayer != null) mUpdated &= rootLayer.update(mPageContext); // called on compositor thread
if (lowResLayer != null) mUpdated &= lowResLayer.update(mPageContext); // called on compositor thread
mUpdated &= mBackgroundLayer.update(mScreenContext); // called on compositor thread
mUpdated &= mShadowLayer.update(mPageContext); // called on compositor thread
mUpdated &= mScreenshotLayer.update(mPageContext); // called on compositor thread
......@@ -609,6 +611,12 @@ public class LayerRenderer implements GLSurfaceView.Renderer {
// Draws the layer the client added to us.
void drawRootLayer() {
Layer lowResLayer = mView.getLayerClient().getLowResLayer();
if (lowResLayer == null) {
return;
}
lowResLayer.draw(mPageContext);
Layer rootLayer = mView.getLayerClient().getRoot();
if (rootLayer == null) {
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment