Merge "Move hasEqualAttribute from Paint with adding some accessors"

This commit is contained in:
Seigo Nonaka
2018-09-25 18:34:26 +00:00
committed by Android (Google) Code Review
4 changed files with 80 additions and 68 deletions

View File

@@ -592,49 +592,6 @@ public class Paint {
mShadowLayerColor = paint.mShadowLayerColor;
}
/**
* Returns true if all attributes are equal.
*
* The caller is expected to have checked the trivial cases, like the pointers being equal,
* the objects having different classes, or the parameter being null.
* @hide
*/
public boolean hasEqualAttributes(@NonNull Paint other) {
return mColorFilter == other.mColorFilter
&& mMaskFilter == other.mMaskFilter
&& mPathEffect == other.mPathEffect
&& mShader == other.mShader
&& mTypeface == other.mTypeface
&& mXfermode == other.mXfermode
&& mHasCompatScaling == other.mHasCompatScaling
&& mCompatScaling == other.mCompatScaling
&& mInvCompatScaling == other.mInvCompatScaling
&& mBidiFlags == other.mBidiFlags
&& mLocales.equals(other.mLocales)
&& TextUtils.equals(mFontFeatureSettings, other.mFontFeatureSettings)
&& TextUtils.equals(mFontVariationSettings, other.mFontVariationSettings)
&& mShadowLayerRadius == other.mShadowLayerRadius
&& mShadowLayerDx == other.mShadowLayerDx
&& mShadowLayerDy == other.mShadowLayerDy
&& mShadowLayerColor == other.mShadowLayerColor
&& getFlags() == other.getFlags()
&& getHinting() == other.getHinting()
&& getStyle() == other.getStyle()
&& getColor() == other.getColor()
&& getStrokeWidth() == other.getStrokeWidth()
&& getStrokeMiter() == other.getStrokeMiter()
&& getStrokeCap() == other.getStrokeCap()
&& getStrokeJoin() == other.getStrokeJoin()
&& getTextAlign() == other.getTextAlign()
&& isElegantTextHeight() == other.isElegantTextHeight()
&& getTextSize() == other.getTextSize()
&& getTextScaleX() == other.getTextScaleX()
&& getTextSkewX() == other.getTextSkewX()
&& getLetterSpacing() == other.getLetterSpacing()
&& getWordSpacing() == other.getWordSpacing()
&& getHyphenEdit() == other.getHyphenEdit();
}
/** @hide */
@UnsupportedAppUsage
public void setCompatibilityScaling(float factor) {
@@ -1394,6 +1351,38 @@ public class Paint {
return nHasShadowLayer(mNativePaint);
}
/**
* Returns the blur radius of the shadow layer.
* @see #setShadowLayer(float,float,float,int)
*/
public float getShadowLayerRadius() {
return mShadowLayerRadius;
}
/**
* Returns the x offset of the shadow layer.
* @see #setShadowLayer(float,float,float,int)
*/
public float getShadowLayerDx() {
return mShadowLayerDx;
}
/**
* Returns the y offset of the shadow layer.
* @see #setShadowLayer(float,float,float,int)
*/
public float getShadowLayerDy() {
return mShadowLayerDy;
}
/**
* Returns the color of the shadow layer.
* @see #setShadowLayer(float,float,float,int)
*/
public @ColorInt int getShadowLayerColor() {
return mShadowLayerColor;
}
/**
* Return the paint's Align value for drawing text. This controls how the
* text is positioned relative to its origin. LEFT align means that all of