michael@0: /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.gfx; michael@0: michael@0: public class VirtualLayer extends Layer { michael@0: public VirtualLayer(IntSize size) { michael@0: super(size); michael@0: } michael@0: michael@0: @Override michael@0: public void draw(RenderContext context) { michael@0: // No-op. michael@0: } michael@0: michael@0: void setPositionAndResolution(int left, int top, int right, int bottom, float newResolution) { michael@0: // This is an optimized version of the following code: michael@0: // beginTransaction(); michael@0: // try { michael@0: // setPosition(new Rect(left, top, right, bottom)); michael@0: // setResolution(newResolution); michael@0: // performUpdates(null); michael@0: // } finally { michael@0: // endTransaction(); michael@0: // } michael@0: michael@0: // it is safe to drop the transaction lock in this instance (i.e. for the michael@0: // VirtualLayer that is just a shadow of what gecko is painting) because michael@0: // the position and resolution of this layer are always touched on the compositor michael@0: // thread, and therefore do not require synchronization. michael@0: mPosition.set(left, top, right, bottom); michael@0: mResolution = newResolution; michael@0: } michael@0: }