blob: 41f66f55b01ea681bcb01ae15ab855aea57c6924 [file] [log] [blame]
Dan Gittik122df862018-03-28 16:59:22 +01001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.display;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/** @hide */
23public final class Curve implements Parcelable {
24 private final float[] mX;
25 private final float[] mY;
26
27 public Curve(float[] x, float[] y) {
28 mX = x;
29 mY = y;
30 }
31
32 public float[] getX() {
33 return mX;
34 }
35
36 public float[] getY() {
37 return mY;
38 }
39
40 public static final Creator<Curve> CREATOR = new Creator<Curve>() {
41 public Curve createFromParcel(Parcel in) {
42 float[] x = in.createFloatArray();
43 float[] y = in.createFloatArray();
44 return new Curve(x, y);
45 }
46
47 public Curve[] newArray(int size) {
48 return new Curve[size];
49 }
50 };
51
52 @Override
53 public void writeToParcel(Parcel out, int flags) {
54 out.writeFloatArray(mX);
55 out.writeFloatArray(mY);
56 }
57
58 @Override
59 public int describeContents() {
60 return 0;
61 }
Kenny Guy2047db92019-02-21 13:04:05 +000062
63 @Override
64 public String toString() {
65 StringBuilder sb = new StringBuilder("[");
66 final int size = mX.length;
67 for (int i = 0; i < size; i++) {
68 if (i != 0) {
69 sb.append(", ");
70 }
71 sb.append("(").append(mX[i]).append(", ").append(mY[i]).append(")");
72 }
73 sb.append("]");
74 return sb.toString();
75 }
Dan Gittik122df862018-03-28 16:59:22 +010076}