mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1054371 - Part 3: Ged rid of separate paint instance for private mode (r=mcomella)
This commit is contained in:
parent
35cf360008
commit
a62dbad7ef
@ -20,7 +20,6 @@ public class BackButton extends ShapedButton {
|
||||
private Path mPath;
|
||||
private Path mBorderPath;
|
||||
private Paint mBorderPaint;
|
||||
private Paint mBorderPrivatePaint;
|
||||
private final float mBorderWidth;
|
||||
|
||||
public BackButton(Context context, AttributeSet attrs) {
|
||||
@ -31,16 +30,20 @@ public class BackButton extends ShapedButton {
|
||||
// Paint to draw the border.
|
||||
mBorderPaint = new Paint();
|
||||
mBorderPaint.setAntiAlias(true);
|
||||
mBorderPaint.setColor(0xFFB5B5B5);
|
||||
mBorderPaint.setStrokeWidth(mBorderWidth);
|
||||
mBorderPaint.setStyle(Paint.Style.STROKE);
|
||||
|
||||
mBorderPrivatePaint = new Paint(mBorderPaint);
|
||||
mBorderPrivatePaint.setColor(0xFF363B40);
|
||||
|
||||
// Path is masked.
|
||||
mPath = new Path();
|
||||
mBorderPath = new Path();
|
||||
|
||||
setPrivateMode(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrivateMode(boolean isPrivate) {
|
||||
super.setPrivateMode(isPrivate);
|
||||
mBorderPaint.setColor(isPrivate ? 0xFF363B40 : 0xFFB5B5B5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -59,7 +62,7 @@ public class BackButton extends ShapedButton {
|
||||
mCanvasDelegate.draw(canvas, mPath, getWidth(), getHeight());
|
||||
|
||||
// Draw the border on top.
|
||||
canvas.drawPath(mBorderPath, isPrivateMode() ? mBorderPrivatePaint : mBorderPaint);
|
||||
canvas.drawPath(mBorderPath, mBorderPaint);
|
||||
}
|
||||
|
||||
// The drawable is constructed as per @drawable/url_bar_nav_button.
|
||||
|
@ -19,7 +19,6 @@ import android.util.AttributeSet;
|
||||
public class ForwardButton extends ShapedButton {
|
||||
private Path mBorderPath;
|
||||
private Paint mBorderPaint;
|
||||
private Paint mBorderPrivatePaint;
|
||||
private final float mBorderWidth;
|
||||
|
||||
public ForwardButton(Context context, AttributeSet attrs) {
|
||||
@ -30,14 +29,18 @@ public class ForwardButton extends ShapedButton {
|
||||
// Paint to draw the border.
|
||||
mBorderPaint = new Paint();
|
||||
mBorderPaint.setAntiAlias(true);
|
||||
mBorderPaint.setColor(0xFFB5B5B5);
|
||||
mBorderPaint.setStrokeWidth(mBorderWidth);
|
||||
mBorderPaint.setStyle(Paint.Style.STROKE);
|
||||
|
||||
mBorderPrivatePaint = new Paint(mBorderPaint);
|
||||
mBorderPrivatePaint.setColor(0xFF363B40);
|
||||
|
||||
mBorderPath = new Path();
|
||||
|
||||
setPrivateMode(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrivateMode(boolean isPrivate) {
|
||||
super.setPrivateMode(isPrivate);
|
||||
mBorderPaint.setColor(isPrivate ? 0xFF363B40 : 0xFFBFBFBF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,7 +57,7 @@ public class ForwardButton extends ShapedButton {
|
||||
super.draw(canvas);
|
||||
|
||||
// Draw the border on top.
|
||||
canvas.drawPath(mBorderPath, isPrivateMode() ? mBorderPrivatePaint : mBorderPaint);
|
||||
canvas.drawPath(mBorderPath, mBorderPaint);
|
||||
}
|
||||
|
||||
// The drawable is constructed as per @drawable/url_bar_nav_button.
|
||||
|
Loading…
Reference in New Issue
Block a user