2012-02-04 07:31:05 +00:00
|
|
|
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
2012-05-21 11:12:37 +00:00
|
|
|
* 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/. */
|
2012-02-04 07:31:05 +00:00
|
|
|
|
|
|
|
package org.mozilla.gecko.gfx;
|
|
|
|
|
2012-07-18 00:54:54 +00:00
|
|
|
public class VirtualLayer extends Layer {
|
2012-02-26 15:47:47 +00:00
|
|
|
public VirtualLayer(IntSize size) {
|
|
|
|
super(size);
|
|
|
|
}
|
2012-02-04 07:31:05 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void draw(RenderContext context) {
|
|
|
|
// No-op.
|
|
|
|
}
|
|
|
|
|
2012-03-20 04:07:42 +00:00
|
|
|
void setPositionAndResolution(int left, int top, int right, int bottom, float newResolution) {
|
2012-02-23 21:29:22 +00:00
|
|
|
// This is an optimized version of the following code:
|
|
|
|
// beginTransaction();
|
|
|
|
// try {
|
2012-03-20 04:07:42 +00:00
|
|
|
// setPosition(new Rect(left, top, right, bottom));
|
2012-02-23 21:29:22 +00:00
|
|
|
// 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
|
2012-03-20 04:07:42 +00:00
|
|
|
// 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);
|
2012-02-23 21:29:22 +00:00
|
|
|
mResolution = newResolution;
|
|
|
|
}
|
2012-02-04 07:31:05 +00:00
|
|
|
}
|