diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-12-09 14:05:58 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-12-11 23:10:42 +0100 |
commit | 7c42247d78f59f99c2616445cb667cbe80e7314b (patch) | |
tree | ba600d76c717262f45d8a10c29ee5456c9eb88bb /android | |
parent | 42070ee22821a34e0d64718f4ff813984bdcc409 (diff) |
android: add FixedZoomTileLayer as a low-res layer
Change-Id: I20d6fb3117ac46c8de63708a122253444bca1671
Diffstat (limited to 'android')
3 files changed, 36 insertions, 1 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/FixedZoomTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/FixedZoomTileLayer.java new file mode 100644 index 000000000000..a62586800c50 --- /dev/null +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/FixedZoomTileLayer.java @@ -0,0 +1,13 @@ +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) { + + } +} diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java index 9d25e45f13fc..6efd62df10b8 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java @@ -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 diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java index feb9c09e824a..64d3a5d84ab7 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/LayerRenderer.java @@ -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; |