| 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/. */ |
| 5 |
|
| 6 |
package org.mozilla.gecko.gfx; |
| 7 |
|
| 8 |
import android.graphics.RectF; |
| 9 |
|
| 10 |
import org.mozilla.gecko.util.FloatUtils; |
| 11 |
|
| 12 |
/* |
| 13 |
* This class keeps track of the area we request Gecko to paint. |
| 14 |
* The area may be different from the visible |
| 15 |
* area of the page. This is so that we can ask Gecko |
| 16 |
* to paint a much larger area without using extra memory, and then render some |
| 17 |
* subsection of that. |
| 18 |
*/ |
| 19 |
public final class DisplayPortMetrics { |
| 20 |
private final RectF mPosition; |
| 21 |
|
| 22 |
public RectF getPosition() { |
| 23 |
return mPosition; |
| 24 |
} |
| 25 |
|
| 26 |
public DisplayPortMetrics() { |
| 27 |
this(0, 0, 0, 0); |
| 28 |
} |
| 29 |
|
| 30 |
public DisplayPortMetrics(float left, float top, float right, float bottom) { |
| 31 |
mPosition = new RectF(left, top, right, bottom); |
| 32 |
} |
| 33 |
|
| 34 |
public boolean contains(RectF rect) { |
| 35 |
return mPosition.contains(rect); |
| 36 |
} |
| 37 |
|
| 38 |
@Override |
| 39 |
public String toString() { |
| 40 |
return "DisplayPortMetrics v=(" + mPosition.left + "," |
| 41 |
+ mPosition.top + "," + mPosition.right + "," |
| 42 |
+ mPosition.bottom + ")"; |
| 43 |
} |
| 44 |
} |