Update git submodules
[LibreOffice.git] / android / source / src / java / org / mozilla / gecko / gfx / DisplayPortMetrics.java
blob6c16bcea3a022e61ac6f3d26d40471bfb241f6ee
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 file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 package org.mozilla.gecko.gfx;
8 import android.graphics.RectF;
10 import org.mozilla.gecko.util.FloatUtils;
13 * This class keeps track of the area we request Gecko to paint, as well
14 * as the resolution of the paint. The area may be different from the visible
15 * area of the page, and the resolution may be different from the resolution
16 * used in the compositor to render the page. This is so that we can ask Gecko
17 * to paint a much larger area without using extra memory, and then render some
18 * subsection of that with compositor scaling.
20 public final class DisplayPortMetrics {
21 private final RectF mPosition;
22 private final float mResolution;
24 public RectF getPosition() {
25 return mPosition;
28 public float getResolution() {
29 return mResolution;
32 public DisplayPortMetrics() {
33 this(0, 0, 0, 0, 1);
36 public DisplayPortMetrics(float left, float top, float right, float bottom, float resolution) {
37 mPosition = new RectF(left, top, right, bottom);
38 mResolution = resolution;
41 public boolean contains(RectF rect) {
42 return mPosition.contains(rect);
45 public boolean fuzzyEquals(DisplayPortMetrics metrics) {
46 return RectUtils.fuzzyEquals(mPosition, metrics.mPosition)
47 && FloatUtils.fuzzyEquals(mResolution, metrics.mResolution);
50 @Override
51 public String toString() {
52 return "DisplayPortMetrics v=(" + mPosition.left + ","
53 + mPosition.top + "," + mPosition.right + ","
54 + mPosition.bottom + ") z=" + mResolution;