mirror of https://github.com/Genymobile/scrcpy
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.1 KiB
Java
58 lines
1.1 KiB
Java
package com.genymobile.scrcpy;
|
|
|
|
import android.graphics.Rect;
|
|
|
|
import java.util.Objects;
|
|
|
|
public final class Size {
|
|
private final int width;
|
|
private final int height;
|
|
|
|
public Size(int width, int height) {
|
|
this.width = width;
|
|
this.height = height;
|
|
}
|
|
|
|
public int getWidth() {
|
|
return width;
|
|
}
|
|
|
|
public int getHeight() {
|
|
return height;
|
|
}
|
|
|
|
public Size rotate() {
|
|
return new Size(height, width);
|
|
}
|
|
|
|
public Rect toRect() {
|
|
return new Rect(0, 0, width, height);
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) {
|
|
return true;
|
|
}
|
|
if (o == null || getClass() != o.getClass()) {
|
|
return false;
|
|
}
|
|
Size size = (Size) o;
|
|
return width == size.width
|
|
&& height == size.height;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(width, height);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Size{"
|
|
+ "width=" + width
|
|
+ ", height=" + height
|
|
+ '}';
|
|
}
|
|
}
|