summaryrefslogtreecommitdiffstats
path: root/android/experimental/LOAndroid/app/src/main/java/org/mozilla/gecko/gfx/VirtualLayer.java
blob: 83d012876176615817d68e7f7922d23a39a9e7bb (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
31
32
33
34
35
36
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.gecko.gfx;

public class VirtualLayer extends Layer {
    public VirtualLayer(IntSize size) {
        super(size);
    }

    @Override
    public void draw(RenderContext context) {
        // No-op.
    }

    void setPositionAndResolution(int left, int top, int right, int bottom, float newResolution) {
        // This is an optimized version of the following code:
        // beginTransaction();
        // try {
        //     setPosition(new Rect(left, top, right, bottom));
        //     setResolution(newResolution);
        //     performUpdates(null);
        // } finally {
        //     endTransaction();
        // }

        // it is safe to drop the transaction lock in this instance (i.e. for the
        // VirtualLayer that is just a shadow of what gecko is painting) because
        // the position and resolution of this layer are always touched on the compositor
        // thread, and therefore do not require synchronization.
        mPosition.set(left, top, right, bottom);
        mResolution = newResolution;
    }
}