Merge "LayoutLib: add native delegate for set/getHinting in Paint."
This commit is contained in:
committed by
Android (Google) Code Review
commit
cf508bd5c3
@@ -82,6 +82,7 @@ public class Paint_Delegate {
|
||||
private float mTextSize;
|
||||
private float mTextScaleX;
|
||||
private float mTextSkewX;
|
||||
private int mHintingMode = Paint.HINTING_ON;
|
||||
|
||||
private Xfermode_Delegate mXfermode;
|
||||
private ColorFilter_Delegate mColorFilter;
|
||||
@@ -269,6 +270,28 @@ public class Paint_Delegate {
|
||||
setFlag(thisPaint, Paint.FILTER_BITMAP_FLAG, filter);
|
||||
}
|
||||
|
||||
@LayoutlibDelegate
|
||||
/*package*/ static int getHinting(Paint thisPaint) {
|
||||
// get the delegate from the native int.
|
||||
Paint_Delegate delegate = sManager.getDelegate(thisPaint.mNativePaint);
|
||||
if (delegate == null) {
|
||||
return Paint.HINTING_ON;
|
||||
}
|
||||
|
||||
return delegate.mHintingMode;
|
||||
}
|
||||
|
||||
@LayoutlibDelegate
|
||||
/*package*/ static void setHinting(Paint thisPaint, int mode) {
|
||||
// get the delegate from the native int.
|
||||
Paint_Delegate delegate = sManager.getDelegate(thisPaint.mNativePaint);
|
||||
if (delegate == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
delegate.mHintingMode = mode;
|
||||
}
|
||||
|
||||
@LayoutlibDelegate
|
||||
/*package*/ static void setAntiAlias(Paint thisPaint, boolean aa) {
|
||||
setFlag(thisPaint, Paint.ANTI_ALIAS_FLAG, aa);
|
||||
@@ -1098,6 +1121,7 @@ public class Paint_Delegate {
|
||||
mPathEffect = paint.mPathEffect;
|
||||
mMaskFilter = paint.mMaskFilter;
|
||||
mRasterizer = paint.mRasterizer;
|
||||
mHintingMode = paint.mHintingMode;
|
||||
updateFontObject();
|
||||
}
|
||||
|
||||
@@ -1121,6 +1145,7 @@ public class Paint_Delegate {
|
||||
mMaskFilter = null;
|
||||
mRasterizer = null;
|
||||
updateFontObject();
|
||||
mHintingMode = Paint.HINTING_ON;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user