179 lines
5.5 KiB
Java
179 lines
5.5 KiB
Java
package o;
|
|
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.BitmapShader;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Color;
|
|
import android.graphics.Paint;
|
|
import android.graphics.Path;
|
|
import android.graphics.Rect;
|
|
import android.graphics.Shader;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.view.View;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
import o.GJa;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class xgo {
|
|
public static final int d = 2;
|
|
public Drawable a;
|
|
public final RVV b;
|
|
public final Paint c;
|
|
public final View e;
|
|
private boolean f;
|
|
private final Paint g;
|
|
private final Path h;
|
|
private boolean i;
|
|
private GJa.LWm j;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public interface RVV {
|
|
void IP_(Canvas canvas);
|
|
|
|
boolean d();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public xgo(RVV rvv) {
|
|
this.b = rvv;
|
|
View view = (View) rvv;
|
|
this.e = view;
|
|
view.setWillNotDraw(false);
|
|
this.h = new Path();
|
|
this.g = new Paint(7);
|
|
Paint paint = new Paint(1);
|
|
this.c = paint;
|
|
paint.setColor(0);
|
|
}
|
|
|
|
public final void e() {
|
|
if (d == 0) {
|
|
this.i = true;
|
|
this.f = false;
|
|
this.e.buildDrawingCache();
|
|
Bitmap drawingCache = this.e.getDrawingCache();
|
|
if (drawingCache == null && this.e.getWidth() != 0 && this.e.getHeight() != 0) {
|
|
drawingCache = Bitmap.createBitmap(this.e.getWidth(), this.e.getHeight(), Bitmap.Config.ARGB_8888);
|
|
this.e.draw(new Canvas(drawingCache));
|
|
}
|
|
if (drawingCache != null) {
|
|
Paint paint = this.g;
|
|
Shader.TileMode tileMode = Shader.TileMode.CLAMP;
|
|
paint.setShader(new BitmapShader(drawingCache, tileMode, tileMode));
|
|
}
|
|
this.i = false;
|
|
this.f = true;
|
|
}
|
|
}
|
|
|
|
public final void b() {
|
|
if (d == 0) {
|
|
this.f = false;
|
|
this.e.destroyDrawingCache();
|
|
this.g.setShader(null);
|
|
this.e.invalidate();
|
|
}
|
|
}
|
|
|
|
public final void c(GJa.LWm lWm) {
|
|
if (lWm == null) {
|
|
this.j = null;
|
|
} else {
|
|
GJa.LWm lWm2 = this.j;
|
|
if (lWm2 == null) {
|
|
this.j = new GJa.LWm(lWm);
|
|
} else {
|
|
float f = lWm.e;
|
|
float f2 = lWm.b;
|
|
float f3 = lWm.a;
|
|
lWm2.e = f;
|
|
lWm2.b = f2;
|
|
lWm2.a = f3;
|
|
}
|
|
if (lWm.a + 1.0E-4f >= a(lWm)) {
|
|
this.j.a = Float.MAX_VALUE;
|
|
}
|
|
}
|
|
d();
|
|
}
|
|
|
|
public final GJa.LWm a() {
|
|
GJa.LWm lWm = this.j;
|
|
if (lWm == null) {
|
|
return null;
|
|
}
|
|
GJa.LWm lWm2 = new GJa.LWm(lWm);
|
|
if (lWm2.a == Float.MAX_VALUE) {
|
|
lWm2.a = a(lWm2);
|
|
}
|
|
return lWm2;
|
|
}
|
|
|
|
private void d() {
|
|
if (d == 1) {
|
|
this.h.rewind();
|
|
GJa.LWm lWm = this.j;
|
|
if (lWm != null) {
|
|
this.h.addCircle(lWm.e, this.j.b, this.j.a, Path.Direction.CW);
|
|
}
|
|
}
|
|
this.e.invalidate();
|
|
}
|
|
|
|
private float a(GJa.LWm lWm) {
|
|
return qRE.e(lWm.e, lWm.b, this.e.getWidth(), this.e.getHeight());
|
|
}
|
|
|
|
public final void IN_(Canvas canvas) {
|
|
if (c()) {
|
|
int i = d;
|
|
if (i == 0) {
|
|
canvas.drawCircle(this.j.e, this.j.b, this.j.a, this.g);
|
|
if (!this.i && Color.alpha(this.c.getColor()) != 0) {
|
|
canvas.drawCircle(this.j.e, this.j.b, this.j.a, this.c);
|
|
}
|
|
} else if (i == 1) {
|
|
int save = canvas.save();
|
|
canvas.clipPath(this.h);
|
|
this.b.IP_(canvas);
|
|
if (!this.i && Color.alpha(this.c.getColor()) != 0) {
|
|
canvas.drawRect(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, this.e.getWidth(), this.e.getHeight(), this.c);
|
|
}
|
|
canvas.restoreToCount(save);
|
|
} else if (i == 2) {
|
|
this.b.IP_(canvas);
|
|
if (!this.i && Color.alpha(this.c.getColor()) != 0) {
|
|
canvas.drawRect(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, this.e.getWidth(), this.e.getHeight(), this.c);
|
|
}
|
|
} else {
|
|
throw new IllegalStateException("Unsupported strategy ".concat(String.valueOf(i)));
|
|
}
|
|
} else {
|
|
this.b.IP_(canvas);
|
|
if (!this.i && Color.alpha(this.c.getColor()) != 0) {
|
|
canvas.drawRect(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, this.e.getWidth(), this.e.getHeight(), this.c);
|
|
}
|
|
}
|
|
IM_(canvas);
|
|
}
|
|
|
|
private void IM_(Canvas canvas) {
|
|
Drawable drawable;
|
|
if (this.i || (drawable = this.a) == null || this.j == null) {
|
|
return;
|
|
}
|
|
Rect bounds = drawable.getBounds();
|
|
float width = this.j.e - (bounds.width() / 2.0f);
|
|
float height = this.j.b - (bounds.height() / 2.0f);
|
|
canvas.translate(width, height);
|
|
this.a.draw(canvas);
|
|
canvas.translate(-width, -height);
|
|
}
|
|
|
|
public final boolean c() {
|
|
GJa.LWm lWm = this.j;
|
|
boolean z = lWm == null || lWm.a == Float.MAX_VALUE;
|
|
return d == 0 ? !z && this.f : !z;
|
|
}
|
|
}
|