LibreOffice Module android (master) 1
DisplayPortMetrics.java
Go to the documentation of this file.
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
6package org.mozilla.gecko.gfx;
7
8import android.graphics.RectF;
9
11
12/*
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.
19 */
20public final class DisplayPortMetrics {
21 private final RectF mPosition;
22 private final float mResolution;
23
24 public RectF getPosition() {
25 return mPosition;
26 }
27
28 public float getResolution() {
29 return mResolution;
30 }
31
33 this(0, 0, 0, 0, 1);
34 }
35
36 public DisplayPortMetrics(float left, float top, float right, float bottom, float resolution) {
37 mPosition = new RectF(left, top, right, bottom);
38 mResolution = resolution;
39 }
40
41 public boolean contains(RectF rect) {
42 return mPosition.contains(rect);
43 }
44
45 public boolean fuzzyEquals(DisplayPortMetrics metrics) {
48 }
49
50 public String toJSON() {
51 StringBuffer sb = new StringBuffer(256);
52 sb.append("{ \"left\": ").append(mPosition.left)
53 .append(", \"top\": ").append(mPosition.top)
54 .append(", \"right\": ").append(mPosition.right)
55 .append(", \"bottom\": ").append(mPosition.bottom)
56 .append(", \"resolution\": ").append(mResolution)
57 .append('}');
58 return sb.toString();
59 }
60
61 @Override
62 public String toString() {
63 return "DisplayPortMetrics v=(" + mPosition.left + ","
64 + mPosition.top + "," + mPosition.right + ","
65 + mPosition.bottom + ") z=" + mResolution;
66 }
67}
boolean fuzzyEquals(DisplayPortMetrics metrics)
DisplayPortMetrics(float left, float top, float right, float bottom, float resolution)
static boolean fuzzyEquals(RectF a, RectF b)
Definition: RectUtils.java:89
static boolean fuzzyEquals(float a, float b)
Definition: FloatUtils.java:13
OString right
OString top
OString bottom
sal_uInt64 left