summaryrefslogtreecommitdiffstats
path: root/android/source/src/java/org/mozilla/gecko/gfx/DynamicTileLayer.java
blob: ea95c032e8f385d51417d3a90b4482786b759f54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package org.mozilla.gecko.gfx;

import android.content.Context;
import android.graphics.RectF;

public class DynamicTileLayer extends ComposedTileLayer {
    public DynamicTileLayer(Context context) {
        super(context);
    }

    @Override
    protected RectF getViewPort(ImmutableViewportMetrics viewportMetrics) {
        RectF rect = viewportMetrics.getViewport();
        return inflate(roundToTileSize(rect, tileSize), getInflateFactor());
    }

    @Override
    protected float getZoom(ImmutableViewportMetrics viewportMetrics) {
        return viewportMetrics.zoomFactor;
    }

    @Override
    protected int getTilePriority() {
        return 0;
    }

    private IntSize getInflateFactor() {
        return new IntSize(tileSize.width*2, tileSize.height*4);
    }
}