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