|
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- |
|
2 * This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 package org.mozilla.gecko.gfx; |
|
7 |
|
8 public class VirtualLayer extends Layer { |
|
9 public VirtualLayer(IntSize size) { |
|
10 super(size); |
|
11 } |
|
12 |
|
13 @Override |
|
14 public void draw(RenderContext context) { |
|
15 // No-op. |
|
16 } |
|
17 |
|
18 void setPositionAndResolution(int left, int top, int right, int bottom, float newResolution) { |
|
19 // This is an optimized version of the following code: |
|
20 // beginTransaction(); |
|
21 // try { |
|
22 // setPosition(new Rect(left, top, right, bottom)); |
|
23 // setResolution(newResolution); |
|
24 // performUpdates(null); |
|
25 // } finally { |
|
26 // endTransaction(); |
|
27 // } |
|
28 |
|
29 // it is safe to drop the transaction lock in this instance (i.e. for the |
|
30 // VirtualLayer that is just a shadow of what gecko is painting) because |
|
31 // the position and resolution of this layer are always touched on the compositor |
|
32 // thread, and therefore do not require synchronization. |
|
33 mPosition.set(left, top, right, bottom); |
|
34 mResolution = newResolution; |
|
35 } |
|
36 } |