docstring_tokens
stringlengths
18
16.9k
code_tokens
stringlengths
75
1.81M
html_url
stringlengths
74
116
file_name
stringlengths
3
311
keep keep keep add keep keep keep keep keep keep
<mask> <mask> <mask> package versioned.host.exp.exponent.modules.api.components.svg; <mask> <mask> import com.facebook.react.bridge.Arguments; <mask> import com.facebook.react.bridge.ReadableArray; <mask> import com.facebook.react.bridge.WritableArray; <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> import com.facebook.react.common.ReactConstants; <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add import android.graphics.Matrix; import com.facebook.common.logging.FLog; </s> add import com.facebook.react.common.ReactConstants; </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> remove import android.graphics.Paint; import android.graphics.RadialGradient; import android.graphics.LinearGradient; import android.graphics.Shader; import android.graphics.Matrix; import javax.annotation.Nullable; </s> add </s> remove import android.graphics.Color; </s> add </s> remove import javax.annotation.Nullable; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RadialGradientShadowNode.java
keep keep keep add keep keep keep keep keep
<mask> import com.facebook.react.bridge.Arguments; <mask> import com.facebook.react.bridge.ReadableArray; <mask> import com.facebook.react.bridge.WritableArray; <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> <mask> /** <mask> * Shadow node for virtual RadialGradient definition view <mask> */ <mask> class RadialGradientShadowNode extends DefinitionShadowNode { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add import javax.annotation.Nullable; </s> add import com.facebook.react.bridge.ReadableArray; </s> remove public class RadialGradientShadowNode extends DefinitionShadowNode { </s> add class RadialGradientShadowNode extends DefinitionShadowNode { </s> remove import com.facebook.react.bridge.ReadableArray; </s> add </s> add import javax.annotation.Nullable; </s> add import static android.graphics.Matrix.MTRANS_X; import static android.graphics.Matrix.MTRANS_Y; import static android.graphics.PathMeasure.POSITION_MATRIX_FLAG; import static android.graphics.PathMeasure.TANGENT_MATRIX_FLAG;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RadialGradientShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> /** <mask> * Shadow node for virtual RadialGradient definition view <mask> */ <mask> public class RadialGradientShadowNode extends DefinitionShadowNode { <mask> private String mFx; <mask> private String mFy; <mask> private String mRx; <mask> private String mRy; <mask> private String mCx; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class LinearGradientShadowNode extends DefinitionShadowNode { </s> add class LinearGradientShadowNode extends DefinitionShadowNode { </s> remove public class ImageShadowNode extends RenderableShadowNode { </s> add class ImageShadowNode extends RenderableShadowNode { </s> remove public class LineShadowNode extends RenderableShadowNode { </s> add class LineShadowNode extends RenderableShadowNode { </s> remove public class RectShadowNode extends RenderableShadowNode { </s> add class RectShadowNode extends RenderableShadowNode { </s> remove public class UseShadowNode extends RenderableShadowNode { </s> add class UseShadowNode extends RenderableShadowNode { </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RadialGradientShadowNode.java
keep keep keep add keep keep keep keep keep keep
<mask> private String mCy; <mask> private ReadableArray mGradient; <mask> private Brush.BrushUnits mGradientUnits; <mask> <mask> @ReactProp(name = "fx") <mask> public void setFx(String fx) { <mask> mFx = fx; <mask> markUpdated(); <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; private Matrix mMatrix = null; </s> remove public void setPositionX(@Nullable String positionX) { </s> add public void setPositionX(@Nullable ReadableArray positionX) { </s> remove public void setPositionY(@Nullable String positionY) { </s> add public void setPositionY(@Nullable ReadableArray positionY) { </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate; </s> remove private GlyphContext mGlyphContext; private TextShadowNode mTextRoot; </s> add @ReactProp(name = "alignmentBaseline") public void setMethod(@Nullable String alignment) { mAlignmentBaseline = AlignmentBaseline.getEnum(alignment); markUpdated(); } </s> remove private int mTextAnchor = TEXT_ANCHOR_AUTO; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; private @Nullable String mPositionX; private @Nullable String mPositionY; private @Nullable ReadableMap mFont; </s> add @ReactProp(name = "lengthAdjust") public void setLengthAdjust(@Nullable String adjustment) { mLengthAdjust = TextLengthAdjust.valueOf(adjustment); markUpdated(); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RadialGradientShadowNode.java
keep add keep keep keep keep keep
<mask> Brush brush = new Brush(Brush.BrushType.RADIAL_GRADIENT, points, mGradientUnits); <mask> brush.setGradientColors(mGradient); <mask> <mask> SvgViewShadowNode svg = getSvgShadowNode(); <mask> if (mGradientUnits == Brush.BrushUnits.USER_SPACE_ON_USE) { <mask> brush.setUserSpaceBoundingBox(svg.getCanvasBounds()); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add if (mMatrix != null) { brush.setGradientTransform(mMatrix); } </s> remove public BezierTransformer getBezierTransformer() { </s> add public Path getPath() { </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove SvgViewShadowNode shadowNode = getSvgShadowNode(); shadowNode.markUpdated(); </s> add bitmapTryRender(bitmap, canvas, paint, opacity * mOpacity); </s> remove String text = mContent; if (text == null) { </s> add if (mContent == null) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RadialGradientShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RectShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> /** <mask> * Shadow node for virtual Rect view <mask> */ <mask> public class RectShadowNode extends RenderableShadowNode { <mask> <mask> private String mX; <mask> private String mY; <mask> private String mW; <mask> private String mH; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class ImageShadowNode extends RenderableShadowNode { </s> add class ImageShadowNode extends RenderableShadowNode { </s> remove public class UseShadowNode extends RenderableShadowNode { </s> add class UseShadowNode extends RenderableShadowNode { </s> remove public class LineShadowNode extends RenderableShadowNode { </s> add class LineShadowNode extends RenderableShadowNode { </s> remove public class LinearGradientShadowNode extends DefinitionShadowNode { </s> add class LinearGradientShadowNode extends DefinitionShadowNode { </s> remove public class RadialGradientShadowNode extends DefinitionShadowNode { </s> add class RadialGradientShadowNode extends DefinitionShadowNode { </s> remove public class TextPathShadowNode extends TextShadowNode { </s> add class TextPathShadowNode extends TextShadowNode {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RectShadowNode.java
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
<mask> <mask> @Override <mask> protected Path getPath(Canvas canvas, Paint paint) { <mask> Path path = new Path(); <mask> float x = relativeOnWidth(mX); <mask> float y = relativeOnHeight(mY); <mask> float w = relativeOnWidth(mW); <mask> float h = relativeOnHeight(mH); <mask> float rx = relativeOnWidth(mRx); <mask> float ry = relativeOnHeight(mRy); <mask> <mask> if (rx != 0 || ry != 0) { <mask> if (rx == 0) { <mask> rx = ry; <mask> } else if (ry == 0) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private Rect getRect() { float x = relativeOnWidth(mX); float y = relativeOnHeight(mY); float w = relativeOnWidth(mW); float h = relativeOnHeight(mH); </s> add private RectF getRect() { double x = relativeOnWidth(mX); double y = relativeOnHeight(mY); double w = relativeOnWidth(mW); double h = relativeOnHeight(mH); if (w == 0) { w = mImageWidth * mScale; } if (h == 0) { h = mImageHeight * mScale; } </s> remove private Path getLinePath(String line, Paint paint, Path path) { float[] widths = new float[line.length()]; paint.getTextWidths(line, widths); float glyphPosition = 0f; </s> add @SuppressWarnings("ConstantConditions") private Path getLinePath(String line, Paint paint, Canvas canvas) { final int length = line.length(); final Path path = new Path(); if (length == 0) { return path; } double pathLength = 0; PathMeasure pm = null; boolean isClosed = false; final boolean hasTextPath = textPath != null; if (hasTextPath) { pm = new PathMeasure(textPath.getPath(), false); pathLength = pm.getLength(); isClosed = pm.isClosed(); if (pathLength == 0) { return path; } } </s> remove float x1 = relativeOnWidth(mX1); float y1 = relativeOnHeight(mY1); float x2 = relativeOnWidth(mX2); float y2 = relativeOnHeight(mY2); </s> add double x1 = relativeOnWidth(mX1); double y1 = relativeOnHeight(mY1); double x2 = relativeOnWidth(mX2); double y2 = relativeOnHeight(mY2); </s> remove return new Rect((int) x, (int) y, (int) (x + w), (int) (y + h)); </s> add return new RectF((float)x, (float)y, (float)(x + w), (float)(y + h)); </s> remove // apply viewBox transform on Image render. Rect rect = getRect(); float rectWidth = (float)rect.width(); float rectHeight = (float)rect.height(); float rectX = (float)rect.left; float rectY = (float)rect.top; float rectRatio = rectWidth / rectHeight; RectF renderRect; if (mImageRatio == 0f || mImageRatio == rectRatio) { renderRect = new RectF(rect); } else if (mImageRatio < rectRatio) { renderRect = new RectF(0, 0, (int)(rectHeight * mImageRatio), (int)rectHeight); } else { renderRect = new RectF(0, 0, (int)rectWidth, (int)(rectWidth / mImageRatio)); </s> add if (mImageWidth == 0 || mImageHeight == 0) { mImageWidth = bitmap.getWidth(); mImageHeight = bitmap.getHeight(); </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RectShadowNode.java
keep keep keep replace keep replace keep
<mask> if (ry > h / 2) { <mask> ry = h / 2; <mask> } <mask> path.addRoundRect(new RectF(x, y, x + w, y + h), rx, ry, Path.Direction.CW); <mask> } else { <mask> path.addRect(x, y, x + w, y + h, Path.Direction.CW); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private Rect getRect() { float x = relativeOnWidth(mX); float y = relativeOnHeight(mY); float w = relativeOnWidth(mW); float h = relativeOnHeight(mH); </s> add private RectF getRect() { double x = relativeOnWidth(mX); double y = relativeOnHeight(mY); double w = relativeOnWidth(mW); double h = relativeOnHeight(mH); if (w == 0) { w = mImageWidth * mScale; } if (h == 0) { h = mImageHeight * mScale; } </s> remove float x = relativeOnWidth(mX); float y = relativeOnHeight(mY); float w = relativeOnWidth(mW); float h = relativeOnHeight(mH); float rx = relativeOnWidth(mRx); float ry = relativeOnHeight(mRy); </s> add double x = relativeOnWidth(mX); double y = relativeOnHeight(mY); double w = relativeOnWidth(mW); double h = relativeOnHeight(mH); double rx = relativeOnWidth(mRx); double ry = relativeOnHeight(mRy); </s> remove return new Rect((int) x, (int) y, (int) (x + w), (int) (y + h)); </s> add return new RectF((float)x, (float)y, (float)(x + w), (float)(y + h)); </s> remove // apply viewBox transform on Image render. Rect rect = getRect(); float rectWidth = (float)rect.width(); float rectHeight = (float)rect.height(); float rectX = (float)rect.left; float rectY = (float)rect.top; float rectRatio = rectWidth / rectHeight; RectF renderRect; if (mImageRatio == 0f || mImageRatio == rectRatio) { renderRect = new RectF(rect); } else if (mImageRatio < rectRatio) { renderRect = new RectF(0, 0, (int)(rectHeight * mImageRatio), (int)rectHeight); } else { renderRect = new RectF(0, 0, (int)rectWidth, (int)(rectWidth / mImageRatio)); </s> add if (mImageWidth == 0 || mImageHeight == 0) { mImageWidth = bitmap.getWidth(); mImageHeight = bitmap.getHeight(); </s> remove matrix.setTranslate(glyphPoint.x, glyphPoint.y); </s> add mid.setTranslate((float) startPoint, (float) (y + dy + baselineShift));
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RectShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RenderableShadowNode.java
keep keep keep add keep keep keep keep keep keep
<mask> <mask> /** <mask> * Renderable shadow node <mask> */ <mask> abstract public class RenderableShadowNode extends VirtualNode { <mask> <mask> // strokeLinecap <mask> private static final int CAP_BUTT = 0; <mask> private static final int CAP_ROUND = 1; <mask> private static final int CAP_SQUARE = 2; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class ViewBox extends GroupShadowNode { </s> add class ViewBox extends GroupShadowNode { </s> remove public class TextShadowNode extends GroupShadowNode { </s> add class TextShadowNode extends GroupShadowNode { String mTextLength = null; String mBaselineShift = null; TextLengthAdjust mLengthAdjust = TextLengthAdjust.spacing; private AlignmentBaseline mAlignmentBaseline; private @Nullable ReadableArray mPositionX; private @Nullable ReadableArray mPositionY; private @Nullable ReadableArray mRotate; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> remove private static final float[] sMatrixData = new float[9]; private static final float[] sRawMatrix = new float[9]; protected float mOpacity = 1f; protected Matrix mMatrix = new Matrix(); </s> add static final float MIN_OPACITY_FOR_DRAW = 0.01f; private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; float mOpacity = 1f; Matrix mMatrix = new Matrix(); </s> remove static public Matrix getTransform(RectF vbRect, RectF eRect, String align, int meetOrSlice, boolean fromSymbol) { </s> add static Matrix getTransform(RectF vbRect, RectF eRect, String align, int meetOrSlice) { </s> remove public abstract class VirtualNode extends LayoutShadowNode { </s> add import static versioned.host.exp.exponent.modules.api.components.svg.FontData.DEFAULT_FONT_SIZE;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RenderableShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> private static final int FILL_RULE_EVENODD = 0; <mask> private static final int FILL_RULE_NONZERO = 1; <mask> <mask> public @Nullable ReadableArray mStroke; <mask> public @Nullable float[] mStrokeDasharray; <mask> <mask> public float mStrokeWidth = 1; <mask> public float mStrokeOpacity = 1; <mask> public float mStrokeMiterlimit = 4; <mask> public float mStrokeDashoffset = 0; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public float mStrokeWidth = 1; </s> add public String mStrokeWidth = "1"; </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> remove protected @Nullable String mClipPath; </s> add private @Nullable String mClipPath; </s> remove public class TextShadowNode extends GroupShadowNode { </s> add class TextShadowNode extends GroupShadowNode { String mTextLength = null; String mBaselineShift = null; TextLengthAdjust mLengthAdjust = TextLengthAdjust.spacing; private AlignmentBaseline mAlignmentBaseline; private @Nullable ReadableArray mPositionX; private @Nullable ReadableArray mPositionY; private @Nullable ReadableArray mRotate; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; </s> remove private int mTextAnchor = TEXT_ANCHOR_AUTO; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; private @Nullable String mPositionX; private @Nullable String mPositionY; private @Nullable ReadableMap mFont; </s> add @ReactProp(name = "lengthAdjust") public void setLengthAdjust(@Nullable String adjustment) { mLengthAdjust = TextLengthAdjust.valueOf(adjustment); markUpdated(); } </s> remove protected final float mScale; protected boolean mResponsible; protected String mName; </s> add final float mScale; private boolean mResponsible; String mName;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RenderableShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> public @Nullable ReadableArray mStroke; <mask> public @Nullable float[] mStrokeDasharray; <mask> <mask> public float mStrokeWidth = 1; <mask> public float mStrokeOpacity = 1; <mask> public float mStrokeMiterlimit = 4; <mask> public float mStrokeDashoffset = 0; <mask> <mask> public Paint.Cap mStrokeLinecap = Paint.Cap.ROUND; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public @Nullable float[] mStrokeDasharray; </s> add public @Nullable String[] mStrokeDasharray; </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> remove public class TextShadowNode extends GroupShadowNode { </s> add class TextShadowNode extends GroupShadowNode { String mTextLength = null; String mBaselineShift = null; TextLengthAdjust mLengthAdjust = TextLengthAdjust.spacing; private AlignmentBaseline mAlignmentBaseline; private @Nullable ReadableArray mPositionX; private @Nullable ReadableArray mPositionY; private @Nullable ReadableArray mRotate; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; </s> remove private int mTextAnchor = TEXT_ANCHOR_AUTO; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; private @Nullable String mPositionX; private @Nullable String mPositionY; private @Nullable ReadableMap mFont; </s> add @ReactProp(name = "lengthAdjust") public void setLengthAdjust(@Nullable String adjustment) { mLengthAdjust = TextLengthAdjust.valueOf(adjustment); markUpdated(); } </s> remove protected @Nullable String mClipPath; </s> add private @Nullable String mClipPath; </s> remove private static final float[] sMatrixData = new float[9]; private static final float[] sRawMatrix = new float[9]; protected float mOpacity = 1f; protected Matrix mMatrix = new Matrix(); </s> add static final float MIN_OPACITY_FOR_DRAW = 0.01f; private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; float mOpacity = 1f; Matrix mMatrix = new Matrix();
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RenderableShadowNode.java
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
<mask> } <mask> <mask> @ReactProp(name = "strokeDasharray") <mask> public void setStrokeDasharray(@Nullable ReadableArray strokeDasharray) { <mask> <mask> mStrokeDasharray = PropHelper.toFloatArray(strokeDasharray); <mask> if (mStrokeDasharray != null && mStrokeDasharray.length > 0) { <mask> for (int i = 0; i < mStrokeDasharray.length; i++) { <mask> mStrokeDasharray[i] = mStrokeDasharray[i] * mScale; <mask> } <mask> } <mask> markUpdated(); <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add void traverseChildren(VirtualNode.NodeRunnable runner) { for (int i = 0; i < getChildCount(); i++) { ReactShadowNode child = getChildAt(i); if (!(child instanceof VirtualNode)) { continue; } runner.run((VirtualNode) child); } } </s> remove return value.size(); </s> add </s> remove private ArrayList<Float> getFloatArrayListFromReadableArray(ReadableArray readableArray) { ArrayList<Float> arrayList = new ArrayList<>(); </s> add double nextDeltaY() { incrementIndices(mDYIndices, mDYsIndex); </s> remove protected interface NodeRunnable { boolean run(VirtualNode node); </s> add interface NodeRunnable { void run(VirtualNode node); </s> remove protected void traverseChildren(NodeRunnable runner) { </s> add void traverseChildren(NodeRunnable runner) { </s> remove if (readableArray != null) { for (int i = 0; i < readableArray.size(); i++) { arrayList.add((float)readableArray.getDouble(i)); } </s> add int nextIndex = mDYIndex + 1; if (nextIndex < mDYs.length) { mDYIndex = nextIndex; String string = mDYs[nextIndex]; double val = PropHelper.fromRelative(string, mHeight, 0, mScale, mFontSize); mDY += val;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/RenderableShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> } <mask> } <mask> <mask> public String toDataURL() { <mask> Bitmap bitmap = Bitmap.createBitmap( <mask> (int) getLayoutWidth(), <mask> (int) getLayoutHeight(), <mask> Bitmap.Config.ARGB_8888); <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private Rect getRect() { float x = relativeOnWidth(mX); float y = relativeOnHeight(mY); float w = relativeOnWidth(mW); float h = relativeOnHeight(mH); </s> add private RectF getRect() { double x = relativeOnWidth(mX); double y = relativeOnHeight(mY); double w = relativeOnWidth(mW); double h = relativeOnHeight(mH); if (w == 0) { w = mImageWidth * mScale; } if (h == 0) { h = mImageHeight * mScale; } </s> remove return new Rect((int) x, (int) y, (int) (x + w), (int) (y + h)); </s> add return new RectF((float)x, (float)y, (float)(x + w), (float)(y + h)); </s> remove // apply viewBox transform on Image render. Rect rect = getRect(); float rectWidth = (float)rect.width(); float rectHeight = (float)rect.height(); float rectX = (float)rect.left; float rectY = (float)rect.top; float rectRatio = rectWidth / rectHeight; RectF renderRect; if (mImageRatio == 0f || mImageRatio == rectRatio) { renderRect = new RectF(rect); } else if (mImageRatio < rectRatio) { renderRect = new RectF(0, 0, (int)(rectHeight * mImageRatio), (int)rectHeight); } else { renderRect = new RectF(0, 0, (int)rectWidth, (int)(rectWidth / mImageRatio)); </s> add if (mImageWidth == 0 || mImageHeight == 0) { mImageWidth = bitmap.getWidth(); mImageHeight = bitmap.getHeight(); </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate; </s> remove public String getWidth() { return mWidth; } public String getHeight() { return mHeight; } </s> add </s> remove public void setPositionY(@Nullable String positionY) { </s> add public void setPositionY(@Nullable ReadableArray positionY) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/SvgViewShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> byte[] bitmapBytes = stream.toByteArray(); <mask> return Base64.encodeToString(bitmapBytes, Base64.DEFAULT); <mask> } <mask> <mask> public void enableTouchEvents() { <mask> if (!mResponsible) { <mask> mResponsible = true; <mask> } <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public int hitTest(Point point) { </s> add int hitTest(Point point) { </s> remove @ReactProp(name = "responsible", defaultBoolean = false) </s> add @ReactProp(name = "responsible") </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove private void setupGlyphContext() { mGlyphContext = new GlyphContext(mScale, getCanvasWidth(), getCanvasHeight()); } protected void releaseCachedPath() { </s> add void releaseCachedPath() { </s> remove if (!fontSizeSet && font.hasKey("fontSize")) { fontSize = (float)font.getDouble("fontSize"); fontSizeSet = true; } </s> add return mX; } </s> remove if (delta.size() != 0) { if (!valueSet) { value = delta.get(0); valueSet = true; } </s> add pushIndices(); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/SvgViewShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> mResponsible = true; <mask> } <mask> } <mask> <mask> public int hitTest(Point point) { <mask> if (!mResponsible) { <mask> return -1; <mask> } <mask> <mask> int count = getChildCount(); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public void enableTouchEvents() { </s> add void enableTouchEvents() { </s> remove delta.remove(0); } </s> add void popContext() { mFontContext.remove(mTop); mXsIndices.remove(mTop); mYsIndices.remove(mTop); mDXsIndices.remove(mTop); mDYsIndices.remove(mTop); mRsIndices.remove(mTop); mTop--; int x = mXsIndex; int y = mYsIndex; int dx = mDXsIndex; int dy = mDYsIndex; int r = mRsIndex; topFont = mFontContext.get(mTop); mXsIndex = mXsIndices.get(mTop); mYsIndex = mYsIndices.get(mTop); mDXsIndex = mDXsIndices.get(mTop); mDYsIndex = mDYsIndices.get(mTop); mRsIndex = mRsIndices.get(mTop); if (x != mXsIndex) { mXsContext.remove(x); mXs = mXsContext.get(mXsIndex); mXIndex = mXIndices.get(mXsIndex); } if (y != mYsIndex) { mYsContext.remove(y); mYs = mYsContext.get(mYsIndex); mYIndex = mYIndices.get(mYsIndex); } if (dx != mDXsIndex) { mDXsContext.remove(dx); mDXs = mDXsContext.get(mDXsIndex); mDXIndex = mDXIndices.get(mDXsIndex); </s> remove protected int saveAndSetupCanvas(Canvas canvas) { </s> add int saveAndSetupCanvas(Canvas canvas) { </s> remove boolean isBold = font.hasKey(PROP_FONT_WEIGHT) && "bold".equals(font.getString(PROP_FONT_WEIGHT)); boolean isItalic = font.hasKey(PROP_FONT_STYLE) && "italic".equals(font.getString(PROP_FONT_STYLE)); </s> add boolean underlineText = false; boolean strikeThruText = false; TextDecoration decoration = font.textDecoration; if (decoration == TextDecoration.Underline) { underlineText = true; } else if (decoration == TextDecoration.LineThrough) { strikeThruText = true; } </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove protected void drawGroup(Canvas canvas, Paint paint, float opacity) { pushGlyphContext(); super.drawGroup(canvas, paint, opacity); popGlyphContext(); } private int getTextAnchor() { return mTextAnchor; } private int getComputedTextAnchor() { int anchor = mTextAnchor; ReactShadowNode shadowNode = this; while (shadowNode.getChildCount() > 0 && anchor == TEXT_ANCHOR_AUTO) { shadowNode = shadowNode.getChildAt(0); if (shadowNode instanceof TextShadowNode) { anchor = ((TextShadowNode) shadowNode).getTextAnchor(); } else { break; </s> add AlignmentBaseline getAlignmentBaseline() { if (mAlignmentBaseline == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final AlignmentBaseline baseline = node.mAlignmentBaseline; if (baseline != null) { mAlignmentBaseline = baseline; return baseline; } } parent = parent.getParent();
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/SvgViewShadowNode.java
keep keep keep replace keep keep keep replace keep keep keep keep
<mask> return viewTag; <mask> } <mask> <mask> public void defineClipPath(VirtualNode clipPath, String clipPathRef) { <mask> mDefinedClipPaths.put(clipPathRef, clipPath); <mask> } <mask> <mask> public VirtualNode getDefinedClipPath(String clipPathRef) { <mask> return mDefinedClipPaths.get(clipPathRef); <mask> } <mask> <mask> public void defineTemplate(VirtualNode template, String templateRef) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public void defineTemplate(VirtualNode template, String templateRef) { </s> add void defineTemplate(VirtualNode template, String templateRef) { </s> remove public VirtualNode getDefinedTemplate(String templateRef) { </s> add VirtualNode getDefinedTemplate(String templateRef) { </s> remove public void defineBrush(Brush brush, String brushRef) { </s> add void defineBrush(Brush brush, String brushRef) { </s> remove public String getWidth() { return mWidth; } public String getHeight() { return mHeight; } </s> add </s> remove public Brush getDefinedBrush(String brushRef) { </s> add Brush getDefinedBrush(String brushRef) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/SvgViewShadowNode.java
keep replace keep keep keep replace keep
<mask> <mask> public void defineTemplate(VirtualNode template, String templateRef) { <mask> mDefinedTemplates.put(templateRef, template); <mask> } <mask> <mask> public VirtualNode getDefinedTemplate(String templateRef) { <mask> return mDefinedTemplates.get(templateRef); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public VirtualNode getDefinedClipPath(String clipPathRef) { </s> add VirtualNode getDefinedClipPath(String clipPathRef) { </s> remove public void defineBrush(Brush brush, String brushRef) { </s> add void defineBrush(Brush brush, String brushRef) { </s> remove public void defineClipPath(VirtualNode clipPath, String clipPathRef) { </s> add void defineClipPath(VirtualNode clipPath, String clipPathRef) { </s> remove public String getWidth() { return mWidth; } public String getHeight() { return mHeight; } </s> add </s> remove public Brush getDefinedBrush(String brushRef) { </s> add Brush getDefinedBrush(String brushRef) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/SvgViewShadowNode.java
keep keep keep keep replace keep keep keep replace keep
<mask> public VirtualNode getDefinedTemplate(String templateRef) { <mask> return mDefinedTemplates.get(templateRef); <mask> } <mask> <mask> public void defineBrush(Brush brush, String brushRef) { <mask> mDefinedBrushes.put(brushRef, brush); <mask> } <mask> <mask> public Brush getDefinedBrush(String brushRef) { <mask> return mDefinedBrushes.get(brushRef); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public VirtualNode getDefinedTemplate(String templateRef) { </s> add VirtualNode getDefinedTemplate(String templateRef) { </s> remove public void defineTemplate(VirtualNode template, String templateRef) { </s> add void defineTemplate(VirtualNode template, String templateRef) { </s> add void traverseChildren(VirtualNode.NodeRunnable runner) { for (int i = 0; i < getChildCount(); i++) { ReactShadowNode child = getChildAt(i); if (!(child instanceof VirtualNode)) { continue; } runner.run((VirtualNode) child); } } </s> remove public VirtualNode getDefinedClipPath(String clipPathRef) { </s> add VirtualNode getDefinedClipPath(String clipPathRef) { </s> remove public void defineClipPath(VirtualNode clipPath, String clipPathRef) { </s> add void defineClipPath(VirtualNode clipPath, String clipPathRef) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/SvgViewShadowNode.java
keep keep add keep
<mask> Brush getDefinedBrush(String brushRef) { <mask> return mDefinedBrushes.get(brushRef); <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public Brush getDefinedBrush(String brushRef) { </s> add Brush getDefinedBrush(String brushRef) { </s> remove public void defineBrush(Brush brush, String brushRef) { </s> add void defineBrush(Brush brush, String brushRef) { </s> remove public VirtualNode getDefinedTemplate(String templateRef) { </s> add VirtualNode getDefinedTemplate(String templateRef) { </s> add if (mMatrix != null) { brush.setGradientTransform(mMatrix); } </s> add if (mMatrix != null) { brush.setGradientTransform(mMatrix); } </s> remove private boolean textPathHasReachedEnd() { return mBezierTransformer.hasReachedEnd(); } private boolean textPathHasReachedStart() { return mBezierTransformer.hasReachedStart(); } </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/SvgViewShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/SymbolShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> import android.graphics.RectF; <mask> <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> <mask> public class SymbolShadowNode extends GroupShadowNode { <mask> <mask> private float mMinX; <mask> private float mMinY; <mask> private float mVbWidth; <mask> private float mVbHeight; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public abstract class VirtualNode extends LayoutShadowNode { </s> add import static versioned.host.exp.exponent.modules.api.components.svg.FontData.DEFAULT_FONT_SIZE; </s> add import javax.annotation.Nullable; </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> add import android.graphics.RectF; </s> add import com.facebook.react.bridge.ReadableMap; </s> remove import com.facebook.react.bridge.ReactMethod; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/SymbolShadowNode.java
keep keep keep keep replace keep keep keep replace keep keep keep keep
<mask> public void draw(Canvas canvas, Paint paint, float opacity) { <mask> saveDefinition(); <mask> } <mask> <mask> public void drawSymbol(Canvas canvas, Paint paint, float opacity, float width, float height) { <mask> if (mAlign != null) { <mask> RectF vbRect = new RectF(mMinX * mScale, mMinY * mScale, (mMinX + mVbWidth) * mScale, (mMinY + mVbHeight) * mScale); <mask> RectF eRect = new RectF(0, 0, width, height); <mask> Matrix viewBoxMatrix = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice, false); <mask> canvas.concat(viewBoxMatrix); <mask> super.draw(canvas, paint, opacity); <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove RectF vbRect = new RectF(0, 0, renderRect.width() / mScale, renderRect.height() / mScale); RectF eRect = new RectF(getCanvasLeft(), getCanvasTop(), rectWidth / mScale + getCanvasLeft(), rectHeight / mScale + getCanvasTop()); Matrix transform = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice, false); </s> add RectF renderRect = getRect(); RectF vbRect = new RectF(0, 0, mImageWidth, mImageHeight); Matrix transform = ViewBox.getTransform(vbRect, renderRect, mAlign, mMeetOrSlice); transform.mapRect(vbRect); </s> remove // apply viewBox transform on Image render. Rect rect = getRect(); float rectWidth = (float)rect.width(); float rectHeight = (float)rect.height(); float rectX = (float)rect.left; float rectY = (float)rect.top; float rectRatio = rectWidth / rectHeight; RectF renderRect; if (mImageRatio == 0f || mImageRatio == rectRatio) { renderRect = new RectF(rect); } else if (mImageRatio < rectRatio) { renderRect = new RectF(0, 0, (int)(rectHeight * mImageRatio), (int)rectHeight); } else { renderRect = new RectF(0, 0, (int)rectWidth, (int)(rectWidth / mImageRatio)); </s> add if (mImageWidth == 0 || mImageHeight == 0) { mImageWidth = bitmap.getWidth(); mImageHeight = bitmap.getHeight(); </s> remove transform.mapRect(renderRect); Matrix translation = new Matrix(); translation.postTranslate(rectX, rectY); translation.mapRect(renderRect); </s> add if (mMatrix != null) { mMatrix.mapRect(vbRect); } </s> remove protected void drawPath(Canvas canvas, Paint paint, float opacity) { </s> add void drawPath(Canvas canvas, Paint paint, float opacity) { </s> remove Path path = getGroupPath(canvas, paint); Matrix matrix = getAlignMatrix(path); canvas.concat(matrix); </s> add getGroupPath(canvas, paint);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/SymbolShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep replace keep keep keep keep replace keep keep
<mask> <mask> <mask> import android.annotation.TargetApi; <mask> import android.graphics.Canvas; <mask> import android.graphics.Matrix; <mask> import android.graphics.Paint; <mask> import android.graphics.Path; <mask> import android.graphics.PointF; <mask> import android.graphics.RectF; <mask> import android.graphics.Typeface; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; import android.util.Log; </s> add </s> remove import android.graphics.Matrix; </s> add </s> remove import android.graphics.Rect; </s> add </s> remove import javax.annotation.Nullable; </s> add </s> remove import android.graphics.Paint; import android.graphics.RadialGradient; import android.graphics.LinearGradient; import android.graphics.Shader; import android.graphics.Matrix; import javax.annotation.Nullable; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep add keep keep keep keep
<mask> import javax.annotation.Nullable; <mask> <mask> /** <mask> * Shadow node for virtual TSpan view <mask> */ <mask> class TSpanShadowNode extends TextShadowNode { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class TSpanShadowNode extends TextShadowNode { </s> add class TSpanShadowNode extends TextShadowNode { private static final double tau = 2 * Math.PI; private static final double radToDeg = 360 / tau; </s> add import com.facebook.react.bridge.ReadableArray; </s> add import javax.annotation.Nullable; </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> remove public class TextPathShadowNode extends TextShadowNode { </s> add class TextPathShadowNode extends TextShadowNode { </s> add import javax.annotation.Nullable;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep replace keep replace replace replace keep
<mask> * Shadow node for virtual TSpan view <mask> */ <mask> public class TSpanShadowNode extends TextShadowNode { <mask> <mask> private BezierTransformer mBezierTransformer; <mask> private Path mCache; <mask> private @Nullable String mContent; <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class TextPathShadowNode extends TextShadowNode { </s> add class TextPathShadowNode extends TextShadowNode { </s> add import static android.graphics.Matrix.MTRANS_X; import static android.graphics.Matrix.MTRANS_Y; import static android.graphics.PathMeasure.POSITION_MATRIX_FLAG; import static android.graphics.PathMeasure.TANGENT_MATRIX_FLAG; </s> remove public class UseShadowNode extends RenderableShadowNode { </s> add class UseShadowNode extends RenderableShadowNode { </s> remove public class PathShadowNode extends RenderableShadowNode { </s> add class PathShadowNode extends RenderableShadowNode { </s> remove public class ImageShadowNode extends RenderableShadowNode { </s> add class ImageShadowNode extends RenderableShadowNode {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> private BezierTransformer mBezierTransformer; <mask> private Path mCache; <mask> private @Nullable String mContent; <mask> <mask> private static final String PROP_FONT_FAMILY = "fontFamily"; <mask> private static final String PROP_FONT_SIZE = "fontSize"; <mask> private static final String PROP_FONT_STYLE = "fontStyle"; <mask> private static final String PROP_FONT_WEIGHT = "fontWeight"; <mask> <mask> @ReactProp(name = "content") <mask> public void setContent(@Nullable String content) { <mask> mContent = content; <mask> markUpdated(); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private BezierTransformer mBezierTransformer; private Path mCache; private @Nullable String mContent; </s> add private static final String FONTS = "fonts/"; private static final String OTF = ".otf"; private static final String TTF = ".ttf"; </s> remove public class TSpanShadowNode extends TextShadowNode { </s> add class TSpanShadowNode extends TextShadowNode { private static final double tau = 2 * Math.PI; private static final double radToDeg = 360 / tau; </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> remove private int mTextAnchor = TEXT_ANCHOR_AUTO; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; private @Nullable String mPositionX; private @Nullable String mPositionY; private @Nullable ReadableMap mFont; </s> add @ReactProp(name = "lengthAdjust") public void setLengthAdjust(@Nullable String adjustment) { mLengthAdjust = TextLengthAdjust.valueOf(adjustment); markUpdated(); } </s> remove protected @Nullable String mClipPath; </s> add private @Nullable String mClipPath; </s> remove public class TextShadowNode extends GroupShadowNode { </s> add class TextShadowNode extends GroupShadowNode { String mTextLength = null; String mBaselineShift = null; TextLengthAdjust mLengthAdjust = TextLengthAdjust.spacing; private AlignmentBaseline mAlignmentBaseline; private @Nullable ReadableArray mPositionX; private @Nullable ReadableArray mPositionY; private @Nullable ReadableArray mRotate; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep replace replace replace keep keep keep keep replace keep keep keep keep
<mask> } <mask> <mask> String text = mContent; <mask> <mask> if (text == null) { <mask> return getGroupPath(canvas, paint); <mask> } <mask> <mask> setupTextPath(); <mask> Path path = new Path(); <mask> <mask> pushGlyphContext(); <mask> applyTextPropertiesToPaint(paint); <mask> getLinePath(mContent + " ", paint, path); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove applyTextPropertiesToPaint(paint); getLinePath(mContent + " ", paint, path); mCache = path; </s> add mCache = getLinePath(mContent, paint, canvas); </s> remove Path path = getGroupPath(canvas, paint); Matrix matrix = getAlignMatrix(path); canvas.concat(matrix); </s> add getGroupPath(canvas, paint); </s> remove private Path getLinePath(String line, Paint paint, Path path) { float[] widths = new float[line.length()]; paint.getTextWidths(line, widths); float glyphPosition = 0f; </s> add @SuppressWarnings("ConstantConditions") private Path getLinePath(String line, Paint paint, Canvas canvas) { final int length = line.length(); final Path path = new Path(); if (length == 0) { return path; } double pathLength = 0; PathMeasure pm = null; boolean isClosed = false; final boolean hasTextPath = textPath != null; if (hasTextPath) { pm = new PathMeasure(textPath.getPath(), false); pathLength = pm.getLength(); isClosed = pm.isClosed(); if (pathLength == 0) { return path; } } </s> remove transform.mapRect(renderRect); Matrix translation = new Matrix(); translation.postTranslate(rectX, rectY); translation.mapRect(renderRect); </s> add if (mMatrix != null) { mMatrix.mapRect(vbRect); } </s> remove return new BezierTransformer(path.getBezierCurves(), relativeOnWidth(mStartOffset)); </s> add return path.getPath();
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep keep replace replace replace replace keep keep keep keep keep keep keep keep replace replace
<mask> setupTextPath(); <mask> Path path = new Path(); <mask> <mask> pushGlyphContext(); <mask> applyTextPropertiesToPaint(paint); <mask> getLinePath(mContent + " ", paint, path); <mask> <mask> mCache = path; <mask> popGlyphContext(); <mask> <mask> RectF box = new RectF(); <mask> path.computeBounds(box, true); <mask> <mask> mCache = path; <mask> popGlyphContext(); <mask> <mask> RectF box = new RectF(); <mask> path.computeBounds(box, true); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return path; </s> add return mCache; </s> remove Path path = new Path(); </s> add </s> remove protected GlyphContext getGlyphContext() { return mGlyphContext; } protected void pushGlyphContext() { getTextRoot().getGlyphContext().pushContext(mFont, mDeltaX, mDeltaY, mPositionX, mPositionY); } protected void popGlyphContext() { getTextRoot().getGlyphContext().popContext(); } protected ReadableMap getFontFromContext() { return getTextRoot().getGlyphContext().getGlyphFont(); } protected PointF getGlyphPointFromContext(float offset, float glyphWidth) { return getTextRoot().getGlyphContext().getNextGlyphPoint(offset, glyphWidth); } private Matrix getAlignMatrix(Path path) { RectF box = new RectF(); path.computeBounds(box, true); float width = box.width(); float x = 0; switch (getComputedTextAnchor()) { case TEXT_ANCHOR_MIDDLE: x = -width / 2; break; case TEXT_ANCHOR_END: x = -width; break; } Matrix matrix = new Matrix(); matrix.setTranslate(x, 0); return matrix; </s> add @Override void pushGlyphContext() { boolean isTextNode = !(this instanceof TextPathShadowNode) && !(this instanceof TSpanShadowNode); getTextRootGlyphContext().pushContext(isTextNode, this, mFont, mPositionX, mPositionY, mDeltaX, mDeltaY, mRotate); </s> remove transform.mapRect(renderRect); Matrix translation = new Matrix(); translation.postTranslate(rectX, rectY); translation.mapRect(renderRect); </s> add if (mMatrix != null) { mMatrix.mapRect(vbRect); } </s> remove private Path getLinePath(String line, Paint paint, Path path) { float[] widths = new float[line.length()]; paint.getTextWidths(line, widths); float glyphPosition = 0f; </s> add @SuppressWarnings("ConstantConditions") private Path getLinePath(String line, Paint paint, Canvas canvas) { final int length = line.length(); final Path path = new Path(); if (length == 0) { return path; } double pathLength = 0; PathMeasure pm = null; boolean isClosed = false; final boolean hasTextPath = textPath != null; if (hasTextPath) { pm = new PathMeasure(textPath.getPath(), false); pathLength = pm.getLength(); isClosed = pm.isClosed(); if (pathLength == 0) { return path; } }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> RectF box = new RectF(); <mask> path.computeBounds(box, true); <mask> <mask> return path; <mask> } <mask> <mask> private Path getLinePath(String line, Paint paint, Path path) { <mask> float[] widths = new float[line.length()]; <mask> paint.getTextWidths(line, widths); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove RectF box = new RectF(); path.computeBounds(box, true); </s> add mCache.computeBounds(new RectF(), true); </s> remove private Path getLinePath(String line, Paint paint, Path path) { float[] widths = new float[line.length()]; paint.getTextWidths(line, widths); float glyphPosition = 0f; </s> add @SuppressWarnings("ConstantConditions") private Path getLinePath(String line, Paint paint, Canvas canvas) { final int length = line.length(); final Path path = new Path(); if (length == 0) { return path; } double pathLength = 0; PathMeasure pm = null; boolean isClosed = false; final boolean hasTextPath = textPath != null; if (hasTextPath) { pm = new PathMeasure(textPath.getPath(), false); pathLength = pm.getLength(); isClosed = pm.isClosed(); if (pathLength == 0) { return path; } } </s> remove applyTextPropertiesToPaint(paint); getLinePath(mContent + " ", paint, path); mCache = path; </s> add mCache = getLinePath(mContent, paint, canvas); </s> remove protected GlyphContext getGlyphContext() { return mGlyphContext; } protected void pushGlyphContext() { getTextRoot().getGlyphContext().pushContext(mFont, mDeltaX, mDeltaY, mPositionX, mPositionY); } protected void popGlyphContext() { getTextRoot().getGlyphContext().popContext(); } protected ReadableMap getFontFromContext() { return getTextRoot().getGlyphContext().getGlyphFont(); } protected PointF getGlyphPointFromContext(float offset, float glyphWidth) { return getTextRoot().getGlyphContext().getNextGlyphPoint(offset, glyphWidth); } private Matrix getAlignMatrix(Path path) { RectF box = new RectF(); path.computeBounds(box, true); float width = box.width(); float x = 0; switch (getComputedTextAnchor()) { case TEXT_ANCHOR_MIDDLE: x = -width / 2; break; case TEXT_ANCHOR_END: x = -width; break; } Matrix matrix = new Matrix(); matrix.setTranslate(x, 0); return matrix; </s> add @Override void pushGlyphContext() { boolean isTextNode = !(this instanceof TextPathShadowNode) && !(this instanceof TSpanShadowNode); getTextRootGlyphContext().pushContext(isTextNode, this, mFont, mPositionX, mPositionY, mDeltaX, mDeltaY, mRotate); </s> remove path.addRect(new RectF(getRect()), Path.Direction.CW); </s> add path.addRect(getRect(), Path.Direction.CW); </s> remove transform.mapRect(renderRect); Matrix translation = new Matrix(); translation.postTranslate(rectX, rectY); translation.mapRect(renderRect); </s> add if (mMatrix != null) { mMatrix.mapRect(vbRect); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> <mask> return path; <mask> } <mask> <mask> private Path getLinePath(String line, Paint paint, Path path) { <mask> float[] widths = new float[line.length()]; <mask> paint.getTextWidths(line, widths); <mask> float glyphPosition = 0f; <mask> <mask> for (int index = 0; index < line.length(); index++) { <mask> String letter = line.substring(index, index + 1); <mask> Path glyph = new Path(); <mask> float width = widths[index]; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return path; </s> add return mCache; </s> remove RectF box = new RectF(); path.computeBounds(box, true); </s> add mCache.computeBounds(new RectF(), true); </s> remove return value; </s> add private static void incrementIndices(ArrayList<Integer> indices, int topIndex) { for (int index = topIndex; index >= 0; index--) { int xIndex = indices.get(index); indices.set(index, xIndex + 1); } </s> remove for (; index >= 0; index--) { ReadableMap font = mFontContext.get(index); </s> add int nextIndex = mXIndex + 1; if (nextIndex < mXs.length) { mDX = 0; mXIndex = nextIndex; String string = mXs[nextIndex]; mX = PropHelper.fromRelative(string, mWidth, 0, mScale, mFontSize); } </s> add if (dy != mDYsIndex) { mDYsContext.remove(dy); mDYs = mDYsContext.get(mDYsIndex); mDYIndex = mDYIndices.get(mDYsIndex); } if (r != mRsIndex) { mRsContext.remove(r); mRs = mRsContext.get(mRsIndex); mRIndex = mRIndices.get(mRsIndex); } } </s> remove if (mBezierTransformer != null) { Matrix matrix = new Matrix(); matrix.postTranslate(0, paint.ascent() * 1.1f); path.transform(matrix); </s> add Path glyph; if (hasLigature) { glyph = new Path(); paint.getTextPath(current, 0, current.length(), 0, 0, glyph); } else { glyph = bag.getOrCreateAndCache(currentChar, current); } glyph.transform(mid); path.addPath(glyph);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> if (mBezierTransformer != null) { <mask> matrix = mBezierTransformer.getTransformAtDistance(glyphPoint.x); <mask> <mask> if (textPathHasReachedEnd()) { <mask> break; <mask> } else if (!textPathHasReachedStart()) { <mask> continue; <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove if (mBezierTransformer != null) { Matrix matrix = new Matrix(); matrix.postTranslate(0, paint.ascent() * 1.1f); path.transform(matrix); </s> add Path glyph; if (hasLigature) { glyph = new Path(); paint.getTextPath(current, 0, current.length(), 0, 0, glyph); } else { glyph = bag.getOrCreateAndCache(currentChar, current); } glyph.transform(mid); path.addPath(glyph); </s> remove glyph.transform(matrix); path.addPath(glyph); } </s> add </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; } </s> remove TextPathShadowNode textPath = (TextPathShadowNode)parent; mBezierTransformer = textPath.getBezierTransformer(); </s> add textPath = (TextPathShadowNode) parent; </s> remove if (!runner.run((VirtualNode) child)) { break; } </s> add runner.run((VirtualNode) child); </s> remove if (fontWeight == null && font.hasKey("fontWeight")) { fontWeight = font.getString("fontWeight"); } if (fontStyle == null && font.hasKey("fontStyle")) { fontStyle = font.getString("fontStyle"); } </s> add double nextY() { incrementIndices(mYIndices, mYsIndex);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> matrix.postTranslate(0, glyphPoint.y); <mask> } else { <mask> matrix.setTranslate(glyphPoint.x, glyphPoint.y); <mask> } <mask> <mask> <mask> glyph.transform(matrix); <mask> path.addPath(glyph); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove glyph.transform(matrix); path.addPath(glyph); } </s> add </s> remove if (mBezierTransformer != null) { Matrix matrix = new Matrix(); matrix.postTranslate(0, paint.ascent() * 1.1f); path.transform(matrix); </s> add Path glyph; if (hasLigature) { glyph = new Path(); paint.getTextPath(current, 0, current.length(), 0, 0, glyph); } else { glyph = bag.getOrCreateAndCache(currentChar, current); } glyph.transform(mid); path.addPath(glyph); </s> remove loadBitmap(request); </s> add loadBitmap(request, canvas, paint, opacity * mOpacity); </s> remove mImageRatio = 0f; </s> add mImageWidth = 0; mImageHeight = 0; </s> remove mImageRatio = (float)src.getInt("width") / (float)src.getInt("height"); </s> add mImageWidth = src.getInt("width"); mImageHeight = src.getInt("height"); </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep add keep keep keep keep keep keep
<mask> } <mask> <mask> <mask> <mask> Path glyph; <mask> if (hasLigature) { <mask> glyph = new Path(); <mask> paint.getTextPath(current, 0, current.length(), 0, 0, glyph); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove if (mBezierTransformer != null) { Matrix matrix = new Matrix(); matrix.postTranslate(0, paint.ascent() * 1.1f); path.transform(matrix); </s> add Path glyph; if (hasLigature) { glyph = new Path(); paint.getTextPath(current, 0, current.length(), 0, 0, glyph); } else { glyph = bag.getOrCreateAndCache(currentChar, current); } glyph.transform(mid); path.addPath(glyph); </s> add private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; private Matrix mMatrix = null; </s> add private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; private Matrix mMatrix = null; </s> remove private AtomicBoolean mLoading = new AtomicBoolean(false); </s> add private final AtomicBoolean mLoading = new AtomicBoolean(false); private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; private Matrix mMatrix = null; </s> remove private static final float[] sMatrixData = new float[9]; private static final float[] sRawMatrix = new float[9]; protected float mOpacity = 1f; protected Matrix mMatrix = new Matrix(); </s> add static final float MIN_OPACITY_FOR_DRAW = 0.01f; private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; float mOpacity = 1f; Matrix mMatrix = new Matrix(); </s> remove transform.mapRect(renderRect); Matrix translation = new Matrix(); translation.postTranslate(rectX, rectY); translation.mapRect(renderRect); </s> add if (mMatrix != null) { mMatrix.mapRect(vbRect); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep replace replace replace keep replace replace replace replace keep
<mask> <mask> glyph.transform(matrix); <mask> path.addPath(glyph); <mask> } <mask> <mask> if (mBezierTransformer != null) { <mask> Matrix matrix = new Matrix(); <mask> matrix.postTranslate(0, paint.ascent() * 1.1f); <mask> path.transform(matrix); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove matrix.setTranslate(glyphPoint.x, glyphPoint.y); </s> add mid.setTranslate((float) startPoint, (float) (y + dy + baselineShift)); </s> remove if (textPathHasReachedEnd()) { </s> add case center: // Align the center of the aligned subtree with the center of the line box. baselineShift = totalHeight / 2; </s> remove sRawMatrix[0] = sMatrixData[0]; sRawMatrix[1] = sMatrixData[2]; sRawMatrix[2] = sMatrixData[4] * mScale; sRawMatrix[3] = sMatrixData[1]; sRawMatrix[4] = sMatrixData[3]; sRawMatrix[5] = sMatrixData[5] * mScale; sRawMatrix[6] = 0; sRawMatrix[7] = 0; sRawMatrix[8] = 1; </s> add if (mMatrix == null) { mMatrix = new Matrix(); } </s> remove transform.mapRect(renderRect); Matrix translation = new Matrix(); translation.postTranslate(rectX, rectY); translation.mapRect(renderRect); </s> add if (mMatrix != null) { mMatrix.mapRect(vbRect); } </s> remove Matrix viewBoxMatrix = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice, false); </s> add Matrix viewBoxMatrix = ViewBox.getTransform(vbRect, eRect, mAlign, mMeetOrSlice);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep replace replace keep keep keep keep keep keep keep keep replace keep
<mask> } <mask> <mask> private void applyTextPropertiesToPaint(Paint paint) { <mask> ReadableMap font = getFontFromContext(); <mask> <mask> paint.setTextAlign(Paint.Align.LEFT); <mask> <mask> float fontSize = (float)font.getDouble(PROP_FONT_SIZE); <mask> <mask> private void applyTextPropertiesToPaint(Paint paint) { <mask> ReadableMap font = getFontFromContext(); <mask> <mask> paint.setTextAlign(Paint.Align.LEFT); <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove float fontSize = (float)font.getDouble(PROP_FONT_SIZE); </s> add case middle: return -textMeasure / 2; </s> remove paint.setTextSize(fontSize * mScale); </s> add case end: return -textMeasure; } } private void applyTextPropertiesToPaint(Paint paint, FontData font) { AssetManager assetManager = getThemedContext().getResources().getAssets(); double fontSize = font.fontSize * mScale; </s> remove if (fontFamily == null && font.hasKey("fontFamily")) { fontFamily = font.getString("fontFamily"); } </s> add mX += advance; </s> remove return value; </s> add private static void incrementIndices(ArrayList<Integer> indices, int topIndex) { for (int index = topIndex; index >= 0; index--) { int xIndex = indices.get(index); indices.set(index, xIndex + 1); } </s> remove paint.setTypeface(Typeface.create(font.getString(PROP_FONT_FAMILY), fontStyle)); </s> add paint.setTypeface(typeface); paint.setTextSize((float) fontSize); paint.setTextAlign(Paint.Align.LEFT); // Do these have any effect for anyone? Not for me (@msand) at least. paint.setUnderlineText(underlineText); paint.setStrikeThruText(strikeThruText);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep replace keep replace keep
<mask> paint.setTextAlign(Paint.Align.LEFT); <mask> <mask> float fontSize = (float)font.getDouble(PROP_FONT_SIZE); <mask> <mask> paint.setTextSize(fontSize * mScale); <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove paint.setTextAlign(Paint.Align.LEFT); </s> add private double getTextAnchorOffset(TextAnchor textAnchor, double textMeasure) { switch (textAnchor) { default: case start: return 0; </s> remove private void applyTextPropertiesToPaint(Paint paint) { ReadableMap font = getFontFromContext(); </s> add private double getAbsoluteStartOffset(String startOffset, double distance, double fontSize) { return PropHelper.fromRelative(startOffset, distance, 0, mScale, fontSize); } </s> remove boolean isBold = font.hasKey(PROP_FONT_WEIGHT) && "bold".equals(font.getString(PROP_FONT_WEIGHT)); boolean isItalic = font.hasKey(PROP_FONT_STYLE) && "italic".equals(font.getString(PROP_FONT_STYLE)); </s> add boolean underlineText = false; boolean strikeThruText = false; TextDecoration decoration = font.textDecoration; if (decoration == TextDecoration.Underline) { underlineText = true; } else if (decoration == TextDecoration.LineThrough) { strikeThruText = true; } </s> add boolean isBold = font.fontWeight == FontWeight.Bold; boolean isItalic = font.fontStyle == FontStyle.italic; </s> remove mD = new PropHelper.PathParser(d, mScale); </s> add PropHelper.PathParser mD = new PropHelper.PathParser(d, mScale);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep add keep keep keep keep
<mask> AssetManager assetManager = getThemedContext().getResources().getAssets(); <mask> <mask> double fontSize = font.fontSize * mScale; <mask> <mask> <mask> boolean underlineText = false; <mask> boolean strikeThruText = false; <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove paint.setTextSize(fontSize * mScale); </s> add case end: return -textMeasure; } } private void applyTextPropertiesToPaint(Paint paint, FontData font) { AssetManager assetManager = getThemedContext().getResources().getAssets(); double fontSize = font.fontSize * mScale; </s> remove boolean isBold = font.hasKey(PROP_FONT_WEIGHT) && "bold".equals(font.getString(PROP_FONT_WEIGHT)); boolean isItalic = font.hasKey(PROP_FONT_STYLE) && "italic".equals(font.getString(PROP_FONT_STYLE)); </s> add boolean underlineText = false; boolean strikeThruText = false; TextDecoration decoration = font.textDecoration; if (decoration == TextDecoration.Underline) { underlineText = true; } else if (decoration == TextDecoration.LineThrough) { strikeThruText = true; } </s> remove int index = mContextLength - 1; </s> add double nextX(double advance) { incrementIndices(mXIndices, mXsIndex); </s> remove private Path getLinePath(String line, Paint paint, Path path) { float[] widths = new float[line.length()]; paint.getTextWidths(line, widths); float glyphPosition = 0f; </s> add @SuppressWarnings("ConstantConditions") private Path getLinePath(String line, Paint paint, Canvas canvas) { final int length = line.length(); final Path path = new Path(); if (length == 0) { return path; } double pathLength = 0; PathMeasure pm = null; boolean isClosed = false; final boolean hasTextPath = textPath != null; if (hasTextPath) { pm = new PathMeasure(textPath.getPath(), false); pathLength = pm.getLength(); isClosed = pm.isClosed(); if (pathLength == 0) { return path; } } </s> remove float fontSize = (float)font.getDouble(PROP_FONT_SIZE); </s> add case middle: return -textMeasure / 2; </s> remove protected final float mScale; protected boolean mResponsible; protected String mName; </s> add final float mScale; private boolean mResponsible; String mName;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep keep replace replace keep keep keep keep keep
<mask> <mask> paint.setTextSize(fontSize * mScale); <mask> <mask> <mask> boolean isBold = font.hasKey(PROP_FONT_WEIGHT) && "bold".equals(font.getString(PROP_FONT_WEIGHT)); <mask> boolean isItalic = font.hasKey(PROP_FONT_STYLE) && "italic".equals(font.getString(PROP_FONT_STYLE)); <mask> <mask> int fontStyle; <mask> if (isBold && isItalic) { <mask> fontStyle = Typeface.BOLD_ITALIC; <mask> } else if (isBold) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove paint.setTextSize(fontSize * mScale); </s> add case end: return -textMeasure; } } private void applyTextPropertiesToPaint(Paint paint, FontData font) { AssetManager assetManager = getThemedContext().getResources().getAssets(); double fontSize = font.fontSize * mScale; </s> remove float fontSize = (float)font.getDouble(PROP_FONT_SIZE); </s> add case middle: return -textMeasure / 2; </s> remove if (fontWeight == null && font.hasKey("fontWeight")) { fontWeight = font.getString("fontWeight"); } if (fontStyle == null && font.hasKey("fontStyle")) { fontStyle = font.getString("fontStyle"); } </s> add double nextY() { incrementIndices(mYIndices, mYsIndex); </s> remove if (fontFamily != null && fontSizeSet && fontWeight != null && fontStyle != null) { break; } </s> add int nextIndex = mYIndex + 1; if (nextIndex < mYs.length) { mDY = 0; mYIndex = nextIndex; String string = mYs[nextIndex]; mY = PropHelper.fromRelative(string, mHeight, 0, mScale, mFontSize); </s> remove int index = mContextLength - 1; </s> add double nextX(double advance) { incrementIndices(mXIndices, mXsIndex); </s> remove if (!fontSizeSet && font.hasKey("fontSize")) { fontSize = (float)font.getDouble("fontSize"); fontSizeSet = true; } </s> add return mX; }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> } else { <mask> fontStyle = Typeface.NORMAL; <mask> } <mask> // NB: if the font family is null / unsupported, the default one will be used <mask> paint.setTypeface(Typeface.create(font.getString(PROP_FONT_FAMILY), fontStyle)); <mask> } <mask> <mask> private void setupTextPath() { <mask> ReactShadowNode parent = getParent(); <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove TextPathShadowNode textPath = (TextPathShadowNode)parent; mBezierTransformer = textPath.getBezierTransformer(); </s> add textPath = (TextPathShadowNode) parent; </s> remove protected SvgViewShadowNode getSvgShadowNode() { </s> add SvgViewShadowNode getSvgShadowNode() { </s> remove if (textPathHasReachedEnd()) { </s> add case center: // Align the center of the aligned subtree with the center of the line box. baselineShift = totalHeight / 2; </s> remove if (fontWeight == null && font.hasKey("fontWeight")) { fontWeight = font.getString("fontWeight"); } if (fontStyle == null && font.hasKey("fontStyle")) { fontStyle = font.getString("fontStyle"); } </s> add double nextY() { incrementIndices(mYIndices, mYsIndex); </s> remove // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> add // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep keep replace replace keep keep keep keep keep
<mask> ReactShadowNode parent = getParent(); <mask> <mask> while (parent != null) { <mask> if (parent.getClass() == TextPathShadowNode.class) { <mask> TextPathShadowNode textPath = (TextPathShadowNode)parent; <mask> mBezierTransformer = textPath.getBezierTransformer(); <mask> break; <mask> } else if (!(parent instanceof TextShadowNode)) { <mask> break; <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; } </s> remove protected void drawGroup(Canvas canvas, Paint paint, float opacity) { pushGlyphContext(); super.drawGroup(canvas, paint, opacity); popGlyphContext(); } private int getTextAnchor() { return mTextAnchor; } private int getComputedTextAnchor() { int anchor = mTextAnchor; ReactShadowNode shadowNode = this; while (shadowNode.getChildCount() > 0 && anchor == TEXT_ANCHOR_AUTO) { shadowNode = shadowNode.getChildAt(0); if (shadowNode instanceof TextShadowNode) { anchor = ((TextShadowNode) shadowNode).getTextAnchor(); } else { break; </s> add AlignmentBaseline getAlignmentBaseline() { if (mAlignmentBaseline == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final AlignmentBaseline baseline = node.mAlignmentBaseline; if (baseline != null) { mAlignmentBaseline = baseline; return baseline; } } parent = parent.getParent(); </s> remove protected SvgViewShadowNode getSvgShadowNode() { </s> add SvgViewShadowNode getSvgShadowNode() { </s> remove if (fontWeight == null && font.hasKey("fontWeight")) { fontWeight = font.getString("fontWeight"); } if (fontStyle == null && font.hasKey("fontStyle")) { fontStyle = font.getString("fontStyle"); } </s> add double nextY() { incrementIndices(mYIndices, mYsIndex); </s> remove if (textPathHasReachedEnd()) { </s> add case center: // Align the center of the aligned subtree with the center of the line box. baselineShift = totalHeight / 2; </s> remove if (fontFamily != null && fontSizeSet && fontWeight != null && fontStyle != null) { break; } </s> add int nextIndex = mYIndex + 1; if (nextIndex < mYs.length) { mDY = 0; mYIndex = nextIndex; String string = mYs[nextIndex]; mY = PropHelper.fromRelative(string, mHeight, 0, mScale, mFontSize);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
keep keep keep keep replace replace replace replace replace replace replace replace keep
<mask> <mask> parent = parent.getParent(); <mask> } <mask> } <mask> <mask> private boolean textPathHasReachedEnd() { <mask> return mBezierTransformer.hasReachedEnd(); <mask> } <mask> <mask> private boolean textPathHasReachedStart() { <mask> return mBezierTransformer.hasReachedStart(); <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add parent = parent.getParent(); </s> remove protected void drawGroup(Canvas canvas, Paint paint, float opacity) { pushGlyphContext(); super.drawGroup(canvas, paint, opacity); popGlyphContext(); } private int getTextAnchor() { return mTextAnchor; } private int getComputedTextAnchor() { int anchor = mTextAnchor; ReactShadowNode shadowNode = this; while (shadowNode.getChildCount() > 0 && anchor == TEXT_ANCHOR_AUTO) { shadowNode = shadowNode.getChildAt(0); if (shadowNode instanceof TextShadowNode) { anchor = ((TextShadowNode) shadowNode).getTextAnchor(); } else { break; </s> add AlignmentBaseline getAlignmentBaseline() { if (mAlignmentBaseline == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final AlignmentBaseline baseline = node.mAlignmentBaseline; if (baseline != null) { mAlignmentBaseline = baseline; return baseline; } } parent = parent.getParent(); </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; } </s> remove return true; </s> add </s> remove private void setupGlyphContext() { mGlyphContext = new GlyphContext(mScale, getCanvasWidth(), getCanvasHeight()); } protected void releaseCachedPath() { </s> add void releaseCachedPath() { </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TSpanShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextPathShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> /** <mask> * Shadow node for virtual TextPath view <mask> */ <mask> public class TextPathShadowNode extends TextShadowNode { <mask> <mask> private String mHref; <mask> private @Nullable String mStartOffset; <mask> <mask> @ReactProp(name = "href") </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add private TextPathSide mSide; private TextPathMidLine mMidLine; </s> remove public class UseShadowNode extends RenderableShadowNode { </s> add class UseShadowNode extends RenderableShadowNode { </s> remove public class TSpanShadowNode extends TextShadowNode { </s> add class TSpanShadowNode extends TextShadowNode { private static final double tau = 2 * Math.PI; private static final double radToDeg = 360 / tau; </s> remove public class ImageShadowNode extends RenderableShadowNode { </s> add class ImageShadowNode extends RenderableShadowNode { </s> remove public class RectShadowNode extends RenderableShadowNode { </s> add class RectShadowNode extends RenderableShadowNode { </s> remove public class LineShadowNode extends RenderableShadowNode { </s> add class LineShadowNode extends RenderableShadowNode {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextPathShadowNode.java
keep keep keep add keep keep keep keep keep
<mask> */ <mask> class TextPathShadowNode extends TextShadowNode { <mask> <mask> private String mHref; <mask> private @Nullable String mStartOffset; <mask> private TextPathMethod mMethod = TextPathMethod.align; <mask> private TextPathSpacing mSpacing = TextPathSpacing.exact; <mask> <mask> @ReactProp(name = "href") </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add private TextPathMethod mMethod = TextPathMethod.align; private TextPathSpacing mSpacing = TextPathSpacing.exact; </s> remove public class TextPathShadowNode extends TextShadowNode { </s> add class TextPathShadowNode extends TextShadowNode { </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> remove public class TextShadowNode extends GroupShadowNode { </s> add class TextShadowNode extends GroupShadowNode { String mTextLength = null; String mBaselineShift = null; TextLengthAdjust mLengthAdjust = TextLengthAdjust.spacing; private AlignmentBaseline mAlignmentBaseline; private @Nullable ReadableArray mPositionX; private @Nullable ReadableArray mPositionY; private @Nullable ReadableArray mRotate; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; </s> remove public class TSpanShadowNode extends TextShadowNode { </s> add class TSpanShadowNode extends TextShadowNode { private static final double tau = 2 * Math.PI; private static final double radToDeg = 360 / tau; </s> remove private GlyphContext mGlyphContext; private TextShadowNode mTextRoot; </s> add @ReactProp(name = "alignmentBaseline") public void setMethod(@Nullable String alignment) { mAlignmentBaseline = AlignmentBaseline.getEnum(alignment); markUpdated(); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextPathShadowNode.java
keep add keep keep keep keep
<mask> private TextPathMidLine mMidLine; <mask> private @Nullable String mStartOffset; <mask> <mask> @ReactProp(name = "href") <mask> public void setHref(String href) { <mask> mHref = href; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add private TextPathSide mSide; private TextPathMidLine mMidLine; </s> remove public class TextPathShadowNode extends TextShadowNode { </s> add class TextPathShadowNode extends TextShadowNode { </s> remove private GlyphContext mGlyphContext; private TextShadowNode mTextRoot; </s> add @ReactProp(name = "alignmentBaseline") public void setMethod(@Nullable String alignment) { mAlignmentBaseline = AlignmentBaseline.getEnum(alignment); markUpdated(); } </s> remove private int mTextAnchor = TEXT_ANCHOR_AUTO; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; private @Nullable String mPositionX; private @Nullable String mPositionY; private @Nullable ReadableMap mFont; </s> add @ReactProp(name = "lengthAdjust") public void setLengthAdjust(@Nullable String adjustment) { mLengthAdjust = TextLengthAdjust.valueOf(adjustment); markUpdated(); } </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> remove private static final String PROP_FONT_FAMILY = "fontFamily"; private static final String PROP_FONT_SIZE = "fontSize"; private static final String PROP_FONT_STYLE = "fontStyle"; private static final String PROP_FONT_WEIGHT = "fontWeight"; </s> add private Path mCache; @Nullable String mContent; private TextPathShadowNode textPath;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextPathShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> public void draw(Canvas canvas, Paint paint, float opacity) { <mask> drawGroup(canvas, paint, opacity); <mask> } <mask> <mask> public BezierTransformer getBezierTransformer() { <mask> SvgViewShadowNode svg = getSvgShadowNode(); <mask> VirtualNode template = svg.getDefinedTemplate(mHref); <mask> <mask> if (template == null || template.getClass() != PathShadowNode.class) { <mask> // warning about this. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public String getWidth() { return mWidth; } public String getHeight() { return mHeight; } </s> add </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove Path path = getGroupPath(canvas, paint); Matrix matrix = getAlignMatrix(path); canvas.concat(matrix); </s> add getGroupPath(canvas, paint); </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas); </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> add setupGlyphContext(canvas);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextPathShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> return null; <mask> } <mask> <mask> PathShadowNode path = (PathShadowNode)template; <mask> return new BezierTransformer(path.getBezierCurves(), relativeOnWidth(mStartOffset)); <mask> } <mask> <mask> @Override <mask> protected Path getPath(Canvas canvas, Paint paint) { <mask> return getGroupPath(canvas, paint); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas); </s> remove path.addRect(new RectF(getRect()), Path.Direction.CW); </s> add path.addRect(getRect(), Path.Direction.CW); </s> remove protected Path getGroupPath(Canvas canvas, Paint paint) { </s> add Path getGroupPath(Canvas canvas, Paint paint) { </s> remove public ReadableArray getBezierCurves() { return mD.getBezierCurves(); </s> add public Path getPath() { return mPath; </s> remove protected void clip(Canvas canvas, Paint paint) { </s> add void clip(Canvas canvas, Paint paint) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextPathShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep keep replace replace keep keep keep keep keep
<mask> <mask> <mask> package versioned.host.exp.exponent.modules.api.components.svg; <mask> <mask> import javax.annotation.Nullable; <mask> <mask> import android.graphics.Canvas; <mask> import android.graphics.Matrix; <mask> import android.graphics.Paint; <mask> import android.graphics.Path; <mask> import android.graphics.Point; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove import android.annotation.TargetApi; </s> add import android.content.res.AssetManager; </s> remove import android.graphics.Matrix; </s> add </s> remove import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; import android.util.Log; </s> add </s> remove import android.graphics.Color; </s> add </s> remove import android.graphics.Rect; </s> add </s> remove import android.graphics.PointF; </s> add import android.graphics.PathMeasure; import android.graphics.Rect;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep replace keep keep replace replace replace replace replace
<mask> import javax.annotation.Nullable; <mask> <mask> import android.graphics.Canvas; <mask> import android.graphics.Matrix; <mask> import android.graphics.Paint; <mask> import android.graphics.Path; <mask> import android.graphics.Point; <mask> import android.graphics.PointF; <mask> import android.graphics.Rect; <mask> import android.graphics.RectF; <mask> import android.util.Log; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove import android.graphics.PointF; </s> add import android.graphics.PathMeasure; import android.graphics.Rect; </s> remove import android.graphics.Rect; </s> add </s> remove import javax.annotation.Nullable; </s> add </s> remove import android.annotation.TargetApi; </s> add import android.content.res.AssetManager; </s> remove import android.graphics.Paint; import android.graphics.RadialGradient; import android.graphics.LinearGradient; import android.graphics.Shader; import android.graphics.Matrix; import javax.annotation.Nullable; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> import android.graphics.Rect; <mask> import android.graphics.RectF; <mask> import android.util.Log; <mask> <mask> import com.facebook.react.bridge.ReactMethod; <mask> import com.facebook.react.bridge.ReadableArray; <mask> import com.facebook.react.bridge.ReadableMap; <mask> import com.facebook.react.uimanager.ReactShadowNode; <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; import android.util.Log; </s> add </s> add import android.graphics.RectF; </s> add import com.facebook.react.bridge.ReadableMap; </s> remove import android.graphics.PointF; </s> add import android.graphics.PathMeasure; import android.graphics.Rect; </s> remove import android.graphics.Rect; </s> add </s> remove import android.graphics.Paint; import android.graphics.RadialGradient; import android.graphics.LinearGradient; import android.graphics.Shader; import android.graphics.Matrix; import javax.annotation.Nullable; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep add keep keep keep keep
<mask> import com.facebook.react.uimanager.ReactShadowNode; <mask> import com.facebook.react.uimanager.annotations.ReactProp; <mask> <mask> /** <mask> * Shadow node for virtual Text view <mask> */ <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove </s> add import com.facebook.react.uimanager.annotations.ReactProp; </s> remove import com.facebook.react.bridge.ReadableArray; </s> add </s> add import javax.annotation.Nullable; </s> add import com.facebook.react.common.ReactConstants; import javax.annotation.Nullable; </s> add import com.facebook.react.bridge.ReadableArray; </s> add import static android.graphics.Matrix.MTRANS_X; import static android.graphics.Matrix.MTRANS_Y; import static android.graphics.PathMeasure.POSITION_MATRIX_FLAG; import static android.graphics.PathMeasure.TANGENT_MATRIX_FLAG;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep keep replace keep replace replace replace replace
<mask> /** <mask> * Shadow node for virtual Text view <mask> */ <mask> <mask> public class TextShadowNode extends GroupShadowNode { <mask> <mask> private static final int TEXT_ANCHOR_AUTO = 0; <mask> private static final int TEXT_ANCHOR_START = 1; <mask> private static final int TEXT_ANCHOR_MIDDLE = 2; <mask> private static final int TEXT_ANCHOR_END = 3; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class ViewBox extends GroupShadowNode { </s> add class ViewBox extends GroupShadowNode { </s> add @SuppressWarnings("WeakerAccess") </s> remove private int mTextAnchor = TEXT_ANCHOR_AUTO; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; private @Nullable String mPositionX; private @Nullable String mPositionY; private @Nullable ReadableMap mFont; </s> add @ReactProp(name = "lengthAdjust") public void setLengthAdjust(@Nullable String adjustment) { mLengthAdjust = TextLengthAdjust.valueOf(adjustment); markUpdated(); } </s> remove private BezierTransformer mBezierTransformer; private Path mCache; private @Nullable String mContent; </s> add private static final String FONTS = "fonts/"; private static final String OTF = ".otf"; private static final String TTF = ".ttf"; </s> remove public class TSpanShadowNode extends TextShadowNode { </s> add class TSpanShadowNode extends TextShadowNode { private static final double tau = 2 * Math.PI; private static final double radToDeg = 360 / tau;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep replace replace replace replace replace replace keep replace replace keep keep
<mask> <mask> private int mTextAnchor = TEXT_ANCHOR_AUTO; <mask> private @Nullable ReadableArray mDeltaX; <mask> private @Nullable ReadableArray mDeltaY; <mask> private @Nullable String mPositionX; <mask> private @Nullable String mPositionY; <mask> private @Nullable ReadableMap mFont; <mask> <mask> private GlyphContext mGlyphContext; <mask> private TextShadowNode mTextRoot; <mask> <mask> @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> remove public class TextShadowNode extends GroupShadowNode { </s> add class TextShadowNode extends GroupShadowNode { String mTextLength = null; String mBaselineShift = null; TextLengthAdjust mLengthAdjust = TextLengthAdjust.spacing; private AlignmentBaseline mAlignmentBaseline; private @Nullable ReadableArray mPositionX; private @Nullable ReadableArray mPositionY; private @Nullable ReadableArray mRotate; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; </s> remove public @Nullable float[] mStrokeDasharray; </s> add public @Nullable String[] mStrokeDasharray; </s> remove protected @Nullable String mClipPath; </s> add private @Nullable String mClipPath; </s> add private TextPathSide mSide; private TextPathMidLine mMidLine;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> <mask> private GlyphContext mGlyphContext; <mask> private TextShadowNode mTextRoot; <mask> <mask> @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) <mask> public void setTextAnchor(int textAnchor) { <mask> mTextAnchor = textAnchor; <mask> markUpdated(); <mask> } <mask> <mask> @ReactProp(name = "deltaX") <mask> public void setDeltaX(@Nullable ReadableArray deltaX) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private GlyphContext mGlyphContext; private TextShadowNode mTextRoot; </s> add @ReactProp(name = "alignmentBaseline") public void setMethod(@Nullable String alignment) { mAlignmentBaseline = AlignmentBaseline.getEnum(alignment); markUpdated(); } </s> remove private int mTextAnchor = TEXT_ANCHOR_AUTO; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; private @Nullable String mPositionX; private @Nullable String mPositionY; private @Nullable ReadableMap mFont; </s> add @ReactProp(name = "lengthAdjust") public void setLengthAdjust(@Nullable String adjustment) { mLengthAdjust = TextLengthAdjust.valueOf(adjustment); markUpdated(); } </s> remove public void setPositionX(@Nullable String positionX) { </s> add public void setPositionX(@Nullable ReadableArray positionX) { </s> remove public void setPositionY(@Nullable String positionY) { </s> add public void setPositionY(@Nullable ReadableArray positionY) { </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> remove public class GroupShadowNode extends RenderableShadowNode { </s> add class GroupShadowNode extends RenderableShadowNode { @Nullable ReadableMap mFont; private GlyphContext mGlyphContext; @ReactProp(name = "font") public void setFont(@Nullable ReadableMap font) { mFont = font; markUpdated(); } void setupGlyphContext(Canvas canvas) { RectF clipBounds = new RectF(canvas.getClipBounds()); mMatrix.mapRect(clipBounds); mGlyphContext = new GlyphContext(mScale, clipBounds.width(), clipBounds.height()); } GlyphContext getGlyphContext() { return mGlyphContext; } @SuppressWarnings("ConstantConditions") GlyphContext getTextRootGlyphContext() { return getTextRoot().getGlyphContext(); } void pushGlyphContext() { getTextRootGlyphContext().pushContext(this, mFont); } void popGlyphContext() { getTextRootGlyphContext().popContext(); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> markUpdated(); <mask> } <mask> <mask> @ReactProp(name = "positionX") <mask> public void setPositionX(@Nullable String positionX) { <mask> mPositionX = positionX; <mask> markUpdated(); <mask> } <mask> <mask> @ReactProp(name = "positionY") </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public void setPositionY(@Nullable String positionY) { </s> add public void setPositionY(@Nullable ReadableArray positionY) { </s> remove @ReactProp(name = "responsible", defaultBoolean = false) </s> add @ReactProp(name = "responsible") </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate; </s> remove private GlyphContext mGlyphContext; private TextShadowNode mTextRoot; </s> add @ReactProp(name = "alignmentBaseline") public void setMethod(@Nullable String alignment) { mAlignmentBaseline = AlignmentBaseline.getEnum(alignment); markUpdated(); } </s> remove mD = new PropHelper.PathParser(d, mScale); </s> add PropHelper.PathParser mD = new PropHelper.PathParser(d, mScale); </s> add private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; private Matrix mMatrix = null;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> markUpdated(); <mask> } <mask> <mask> @ReactProp(name = "positionY") <mask> public void setPositionY(@Nullable String positionY) { <mask> mPositionY = positionY; <mask> markUpdated(); <mask> } <mask> <mask> @ReactProp(name = "font") </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public void setPositionX(@Nullable String positionX) { </s> add public void setPositionX(@Nullable ReadableArray positionX) { </s> remove @ReactProp(name = "responsible", defaultBoolean = false) </s> add @ReactProp(name = "responsible") </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate; </s> remove private GlyphContext mGlyphContext; private TextShadowNode mTextRoot; </s> add @ReactProp(name = "alignmentBaseline") public void setMethod(@Nullable String alignment) { mAlignmentBaseline = AlignmentBaseline.getEnum(alignment); markUpdated(); } </s> remove mD = new PropHelper.PathParser(d, mScale); </s> add PropHelper.PathParser mD = new PropHelper.PathParser(d, mScale); </s> add private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; private Matrix mMatrix = null;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep replace keep replace replace replace keep keep keep
<mask> @Override <mask> public void draw(Canvas canvas, Paint paint, float opacity) { <mask> if (opacity > MIN_OPACITY_FOR_DRAW) { <mask> setupGlyphContext(); <mask> clip(canvas, paint); <mask> Path path = getGroupPath(canvas, paint); <mask> Matrix matrix = getAlignMatrix(path); <mask> canvas.concat(matrix); <mask> drawGroup(canvas, paint, opacity); <mask> releaseCachedPath(); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add setupGlyphContext(canvas); </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas); </s> remove public class GroupShadowNode extends RenderableShadowNode { </s> add class GroupShadowNode extends RenderableShadowNode { @Nullable ReadableMap mFont; private GlyphContext mGlyphContext; @ReactProp(name = "font") public void setFont(@Nullable ReadableMap font) { mFont = font; markUpdated(); } void setupGlyphContext(Canvas canvas) { RectF clipBounds = new RectF(canvas.getClipBounds()); mMatrix.mapRect(clipBounds); mGlyphContext = new GlyphContext(mScale, clipBounds.width(), clipBounds.height()); } GlyphContext getGlyphContext() { return mGlyphContext; } @SuppressWarnings("ConstantConditions") GlyphContext getTextRootGlyphContext() { return getTextRoot().getGlyphContext(); } void pushGlyphContext() { getTextRootGlyphContext().pushContext(this, mFont); } void popGlyphContext() { getTextRootGlyphContext().popContext(); } </s> remove public BezierTransformer getBezierTransformer() { </s> add public Path getPath() {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep replace keep replace replace replace keep keep
<mask> @Override <mask> protected Path getPath(Canvas canvas, Paint paint) { <mask> setupGlyphContext(); <mask> Path groupPath = getGroupPath(canvas, paint); <mask> Matrix matrix = getAlignMatrix(groupPath); <mask> groupPath.transform(matrix); <mask> <mask> releaseCachedPath(); <mask> return groupPath; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove Path path = getGroupPath(canvas, paint); Matrix matrix = getAlignMatrix(path); canvas.concat(matrix); </s> add getGroupPath(canvas, paint); </s> remove protected Path getGroupPath(Canvas canvas, Paint paint) { </s> add Path getGroupPath(Canvas canvas, Paint paint) { </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas); </s> remove return new BezierTransformer(path.getBezierCurves(), relativeOnWidth(mStartOffset)); </s> add return path.getPath(); </s> remove path.addRect(new RectF(getRect()), Path.Direction.CW); </s> add path.addRect(getRect(), Path.Direction.CW);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep
<mask> } <mask> <mask> protected void drawGroup(Canvas canvas, Paint paint, float opacity) { <mask> pushGlyphContext(); <mask> super.drawGroup(canvas, paint, opacity); <mask> popGlyphContext(); <mask> } <mask> <mask> private int getTextAnchor() { <mask> return mTextAnchor; <mask> } <mask> <mask> private int getComputedTextAnchor() { <mask> int anchor = mTextAnchor; <mask> ReactShadowNode shadowNode = this; <mask> <mask> while (shadowNode.getChildCount() > 0 && <mask> anchor == TEXT_ANCHOR_AUTO) { <mask> shadowNode = shadowNode.getChildAt(0); <mask> <mask> if (shadowNode instanceof TextShadowNode) { <mask> anchor = ((TextShadowNode) shadowNode).getTextAnchor(); <mask> } else { <mask> break; <mask> } <mask> } <mask> return anchor; <mask> } <mask> <mask> private TextShadowNode getTextRoot() { <mask> if (mTextRoot == null) { <mask> mTextRoot = this; <mask> <mask> while (mTextRoot != null) { <mask> if (mTextRoot.getClass() == TextShadowNode.class) { <mask> break; <mask> } <mask> <mask> ReactShadowNode parent = mTextRoot.getParent(); <mask> <mask> if (!(parent instanceof TextShadowNode)) { <mask> //todo: throw exception here <mask> mTextRoot = null; <mask> } else { <mask> mTextRoot = (TextShadowNode)parent; <mask> } <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove TextPathShadowNode textPath = (TextPathShadowNode)parent; mBezierTransformer = textPath.getBezierTransformer(); </s> add textPath = (TextPathShadowNode) parent; </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext(); </s> remove protected float getCanvasTop() { return getSvgShadowNode().getCanvasBounds().top; </s> add private float getCanvasHeight() { if (canvasHeight != -1) { return canvasHeight; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasHeight = getSvgShadowNode().getCanvasBounds().height(); } else { canvasHeight = root.getGlyphContext().getHeight(); } return canvasHeight; </s> remove protected float getCanvasHeight() { return getSvgShadowNode().getCanvasBounds().height(); } </s> add private float getCanvasWidth() { if (canvasWidth != -1) { return canvasWidth; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasWidth = getSvgShadowNode().getCanvasBounds().width(); } else { canvasWidth = root.getGlyphContext().getWidth(); } </s> remove if (fontWeight == null && font.hasKey("fontWeight")) { fontWeight = font.getString("fontWeight"); } if (fontStyle == null && font.hasKey("fontStyle")) { fontStyle = font.getString("fontStyle"); } </s> add double nextY() { incrementIndices(mYIndices, mYsIndex);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep add keep keep keep keep keep
<mask> mBaselineShift = baselineShift; <mask> return baselineShift; <mask> } <mask> } <mask> } <mask> } <mask> return mBaselineShift; <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; } </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate; </s> remove return mTextRoot; </s> add return mBaselineShift; </s> remove private boolean textPathHasReachedEnd() { return mBezierTransformer.hasReachedEnd(); } private boolean textPathHasReachedStart() { return mBezierTransformer.hasReachedStart(); } </s> add </s> remove return arrayList; </s> add return mDY; } double nextRotation() { incrementIndices(mRIndices, mRsIndex); mRIndex = Math.min(mRIndex + 1, mRs.length - 1); return mRs[mRIndex]; } float getWidth() { return mWidth; </s> remove protected float getCanvasHeight() { return getSvgShadowNode().getCanvasBounds().height(); } </s> add private float getCanvasWidth() { if (canvasWidth != -1) { return canvasWidth; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasWidth = getSvgShadowNode().getCanvasBounds().width(); } else { canvasWidth = root.getGlyphContext().getWidth(); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep keep replace replace keep keep keep keep keep
<mask> mTextRoot = (TextShadowNode)parent; <mask> } <mask> } <mask> } <mask> <mask> return mTextRoot; <mask> } <mask> <mask> private void setupGlyphContext() { <mask> mGlyphContext = new GlyphContext(mScale, getCanvasWidth(), getCanvasHeight()); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private void setupGlyphContext() { mGlyphContext = new GlyphContext(mScale, getCanvasWidth(), getCanvasHeight()); } protected void releaseCachedPath() { </s> add void releaseCachedPath() { </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; } </s> remove public class GroupShadowNode extends RenderableShadowNode { </s> add class GroupShadowNode extends RenderableShadowNode { @Nullable ReadableMap mFont; private GlyphContext mGlyphContext; @ReactProp(name = "font") public void setFont(@Nullable ReadableMap font) { mFont = font; markUpdated(); } void setupGlyphContext(Canvas canvas) { RectF clipBounds = new RectF(canvas.getClipBounds()); mMatrix.mapRect(clipBounds); mGlyphContext = new GlyphContext(mScale, clipBounds.width(), clipBounds.height()); } GlyphContext getGlyphContext() { return mGlyphContext; } @SuppressWarnings("ConstantConditions") GlyphContext getTextRootGlyphContext() { return getTextRoot().getGlyphContext(); } void pushGlyphContext() { getTextRootGlyphContext().pushContext(this, mFont); } void popGlyphContext() { getTextRootGlyphContext().popContext(); } </s> remove protected void drawGroup(Canvas canvas, Paint paint, float opacity) { pushGlyphContext(); super.drawGroup(canvas, paint, opacity); popGlyphContext(); } private int getTextAnchor() { return mTextAnchor; } private int getComputedTextAnchor() { int anchor = mTextAnchor; ReactShadowNode shadowNode = this; while (shadowNode.getChildCount() > 0 && anchor == TEXT_ANCHOR_AUTO) { shadowNode = shadowNode.getChildAt(0); if (shadowNode instanceof TextShadowNode) { anchor = ((TextShadowNode) shadowNode).getTextAnchor(); } else { break; </s> add AlignmentBaseline getAlignmentBaseline() { if (mAlignmentBaseline == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final AlignmentBaseline baseline = node.mAlignmentBaseline; if (baseline != null) { mAlignmentBaseline = baseline; return baseline; } } parent = parent.getParent(); </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate; </s> remove protected GlyphContext getGlyphContext() { return mGlyphContext; } protected void pushGlyphContext() { getTextRoot().getGlyphContext().pushContext(mFont, mDeltaX, mDeltaY, mPositionX, mPositionY); } protected void popGlyphContext() { getTextRoot().getGlyphContext().popContext(); } protected ReadableMap getFontFromContext() { return getTextRoot().getGlyphContext().getGlyphFont(); } protected PointF getGlyphPointFromContext(float offset, float glyphWidth) { return getTextRoot().getGlyphContext().getNextGlyphPoint(offset, glyphWidth); } private Matrix getAlignMatrix(Path path) { RectF box = new RectF(); path.computeBounds(box, true); float width = box.width(); float x = 0; switch (getComputedTextAnchor()) { case TEXT_ANCHOR_MIDDLE: x = -width / 2; break; case TEXT_ANCHOR_END: x = -width; break; } Matrix matrix = new Matrix(); matrix.setTranslate(x, 0); return matrix; </s> add @Override void pushGlyphContext() { boolean isTextNode = !(this instanceof TextPathShadowNode) && !(this instanceof TSpanShadowNode); getTextRootGlyphContext().pushContext(isTextNode, this, mFont, mPositionX, mPositionY, mDeltaX, mDeltaY, mRotate);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep replace replace replace replace replace keep replace keep
<mask> <mask> private void setupGlyphContext() { <mask> mGlyphContext = new GlyphContext(mScale, getCanvasWidth(), getCanvasHeight()); <mask> } <mask> <mask> protected void releaseCachedPath() { <mask> traverseChildren(new NodeRunnable() { <mask> public boolean run(VirtualNode node) { <mask> TextShadowNode text = (TextShadowNode)node; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove return true; </s> add </s> remove return mTextRoot; </s> add return mBaselineShift; </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep replace keep keep keep keep replace keep keep keep
<mask> TextShadowNode text = (TextShadowNode)node; <mask> text.releaseCachedPath(); <mask> return true; <mask> } <mask> }); <mask> } <mask> <mask> protected Path getGroupPath(Canvas canvas, Paint paint) { <mask> pushGlyphContext(); <mask> Path groupPath = super.getPath(canvas, paint); <mask> popGlyphContext(); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public boolean run(VirtualNode node) { </s> add public void run(VirtualNode node) { </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas); </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add </s> remove private void setupGlyphContext() { mGlyphContext = new GlyphContext(mScale, getCanvasWidth(), getCanvasHeight()); } protected void releaseCachedPath() { </s> add void releaseCachedPath() { </s> remove protected @Nullable Path getClipPath(Canvas canvas, Paint paint) { </s> add @Nullable Path getClipPath(Canvas canvas, Paint paint) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep
<mask> <mask> return groupPath; <mask> } <mask> <mask> protected GlyphContext getGlyphContext() { <mask> return mGlyphContext; <mask> } <mask> <mask> protected void pushGlyphContext() { <mask> getTextRoot().getGlyphContext().pushContext(mFont, mDeltaX, mDeltaY, mPositionX, mPositionY); <mask> } <mask> <mask> protected void popGlyphContext() { <mask> getTextRoot().getGlyphContext().popContext(); <mask> } <mask> <mask> protected ReadableMap getFontFromContext() { <mask> return getTextRoot().getGlyphContext().getGlyphFont(); <mask> } <mask> <mask> protected PointF getGlyphPointFromContext(float offset, float glyphWidth) { <mask> return getTextRoot().getGlyphContext().getNextGlyphPoint(offset, glyphWidth); <mask> } <mask> <mask> private Matrix getAlignMatrix(Path path) { <mask> RectF box = new RectF(); <mask> path.computeBounds(box, true); <mask> <mask> float width = box.width(); <mask> float x = 0; <mask> <mask> switch (getComputedTextAnchor()) { <mask> case TEXT_ANCHOR_MIDDLE: <mask> x = -width / 2; <mask> break; <mask> case TEXT_ANCHOR_END: <mask> x = -width; <mask> break; <mask> } <mask> <mask> Matrix matrix = new Matrix(); <mask> matrix.setTranslate(x, 0); <mask> return matrix; <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class GroupShadowNode extends RenderableShadowNode { </s> add class GroupShadowNode extends RenderableShadowNode { @Nullable ReadableMap mFont; private GlyphContext mGlyphContext; @ReactProp(name = "font") public void setFont(@Nullable ReadableMap font) { mFont = font; markUpdated(); } void setupGlyphContext(Canvas canvas) { RectF clipBounds = new RectF(canvas.getClipBounds()); mMatrix.mapRect(clipBounds); mGlyphContext = new GlyphContext(mScale, clipBounds.width(), clipBounds.height()); } GlyphContext getGlyphContext() { return mGlyphContext; } @SuppressWarnings("ConstantConditions") GlyphContext getTextRootGlyphContext() { return getTextRoot().getGlyphContext(); } void pushGlyphContext() { getTextRootGlyphContext().pushContext(this, mFont); } void popGlyphContext() { getTextRootGlyphContext().popContext(); } </s> remove RectF box = new RectF(); path.computeBounds(box, true); </s> add mCache.computeBounds(new RectF(), true); </s> remove protected float getCanvasHeight() { return getSvgShadowNode().getCanvasBounds().height(); } </s> add private float getCanvasWidth() { if (canvasWidth != -1) { return canvasWidth; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasWidth = getSvgShadowNode().getCanvasBounds().width(); } else { canvasWidth = root.getGlyphContext().getWidth(); } </s> remove return path; </s> add return mCache; </s> remove protected float getCanvasTop() { return getSvgShadowNode().getCanvasBounds().top; </s> add private float getCanvasHeight() { if (canvasHeight != -1) { return canvasHeight; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasHeight = getSvgShadowNode().getCanvasBounds().height(); } else { canvasHeight = root.getGlyphContext().getHeight(); } return canvasHeight; </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/TextShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/UseShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> /** <mask> * Shadow node for virtual Use view <mask> */ <mask> public class UseShadowNode extends RenderableShadowNode { <mask> <mask> private String mHref; <mask> private String mWidth; <mask> private String mHeight; <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class LineShadowNode extends RenderableShadowNode { </s> add class LineShadowNode extends RenderableShadowNode { </s> remove public class ImageShadowNode extends RenderableShadowNode { </s> add class ImageShadowNode extends RenderableShadowNode { </s> remove public class RectShadowNode extends RenderableShadowNode { </s> add class RectShadowNode extends RenderableShadowNode { </s> remove public class TextPathShadowNode extends TextShadowNode { </s> add class TextPathShadowNode extends TextShadowNode { </s> remove public class LinearGradientShadowNode extends DefinitionShadowNode { </s> add class LinearGradientShadowNode extends DefinitionShadowNode { </s> remove public class RadialGradientShadowNode extends DefinitionShadowNode { </s> add class RadialGradientShadowNode extends DefinitionShadowNode {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/UseShadowNode.java
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> mHeight = height; <mask> markUpdated(); <mask> } <mask> <mask> public String getWidth() { <mask> return mWidth; <mask> } <mask> <mask> public String getHeight() { <mask> return mHeight; <mask> } <mask> <mask> @Override <mask> public void draw(Canvas canvas, Paint paint, float opacity) { <mask> VirtualNode template = getSvgShadowNode().getDefinedTemplate(mHref); <mask> <mask> if (template != null) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public BezierTransformer getBezierTransformer() { </s> add public Path getPath() { </s> remove Path path = getGroupPath(canvas, paint); Matrix matrix = getAlignMatrix(path); canvas.concat(matrix); </s> add getGroupPath(canvas, paint); </s> remove public void drawSymbol(Canvas canvas, Paint paint, float opacity, float width, float height) { </s> add void drawSymbol(Canvas canvas, Paint paint, float opacity, float width, float height) { </s> remove protected void drawPath(Canvas canvas, Paint paint, float opacity) { </s> add void drawPath(Canvas canvas, Paint paint, float opacity) { </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas); </s> remove protected void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { </s> add void drawGroup(final Canvas canvas, final Paint paint, final float opacity) { pushGlyphContext();
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/UseShadowNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> clip(canvas, paint); <mask> <mask> if (template instanceof SymbolShadowNode) { <mask> SymbolShadowNode symbol = (SymbolShadowNode)template; <mask> symbol.drawSymbol(canvas, paint, opacity, relativeOnWidth(mWidth), relativeOnHeight(mHeight)); <mask> } else { <mask> template.draw(canvas, paint, opacity * mOpacity); <mask> } <mask> <mask> template.restoreCanvas(canvas, count); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove loadBitmap(request); </s> add loadBitmap(request, canvas, paint, opacity * mOpacity); </s> remove Path path = getGroupPath(canvas, paint); Matrix matrix = getAlignMatrix(path); canvas.concat(matrix); </s> add getGroupPath(canvas, paint); </s> add setupGlyphContext(canvas); </s> remove SvgViewShadowNode shadowNode = getSvgShadowNode(); shadowNode.markUpdated(); </s> add bitmapTryRender(bitmap, canvas, paint, opacity * mOpacity); </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas); </s> remove public String getWidth() { return mWidth; } public String getHeight() { return mHeight; } </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/UseShadowNode.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> /** <mask> * Shadow node for virtual ViewBox <mask> */ <mask> public class ViewBox extends GroupShadowNode { <mask> <mask> private static final int MOS_MEET = 0; <mask> private static final int MOS_SLICE = 1; <mask> private static final int MOS_NONE = 2; <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public class TextShadowNode extends GroupShadowNode { </s> add class TextShadowNode extends GroupShadowNode { String mTextLength = null; String mBaselineShift = null; TextLengthAdjust mLengthAdjust = TextLengthAdjust.spacing; private AlignmentBaseline mAlignmentBaseline; private @Nullable ReadableArray mPositionX; private @Nullable ReadableArray mPositionY; private @Nullable ReadableArray mRotate; private @Nullable ReadableArray mDeltaX; private @Nullable ReadableArray mDeltaY; </s> add @SuppressWarnings("WeakerAccess") </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> remove static public Matrix getTransform(RectF vbRect, RectF eRect, String align, int meetOrSlice, boolean fromSymbol) { </s> add static Matrix getTransform(RectF vbRect, RectF eRect, String align, int meetOrSlice) { </s> remove private BezierTransformer mBezierTransformer; private Path mCache; private @Nullable String mContent; </s> add private static final String FONTS = "fonts/"; private static final String OTF = ".otf"; private static final String TTF = ".ttf"; </s> remove public class TSpanShadowNode extends TextShadowNode { </s> add class TSpanShadowNode extends TextShadowNode { private static final double tau = 2 * Math.PI; private static final double radToDeg = 360 / tau;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace keep keep keep replace replace replace replace keep keep keep
<mask> private static final int MOS_MEET = 0; <mask> private static final int MOS_SLICE = 1; <mask> private static final int MOS_NONE = 2; <mask> <mask> static public Matrix getTransform(RectF vbRect, RectF eRect, String align, int meetOrSlice, boolean fromSymbol) { <mask> // based on https://svgwg.org/svg2-draft/coords.html#ComputingAViewportsTransform <mask> <mask> // Let vb-x, vb-y, vb-width, vb-height be the min-x, min-y, width and height values of the viewBox attribute respectively. <mask> float vbX = vbRect.left; <mask> float vbY = vbRect.top; <mask> float vbWidth = vbRect.width(); <mask> float vbHeight = vbRect.height(); <mask> <mask> // Let e-x, e-y, e-width, e-height be the position and size of the element respectively. <mask> float eX = eRect.left; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove float eX = eRect.left; float eY = eRect.top; float eWidth = eRect.width(); float eHeight = eRect.height(); </s> add double eX = eRect.left; double eY = eRect.top; double eWidth = eRect.width(); double eHeight = eRect.height(); </s> remove public class ViewBox extends GroupShadowNode { </s> add class ViewBox extends GroupShadowNode { </s> add @SuppressWarnings("WeakerAccess") </s> remove protected @Nullable String mClipPath; </s> add private @Nullable String mClipPath; </s> remove protected final float mScale; protected boolean mResponsible; protected String mName; </s> add final float mScale; private boolean mResponsible; String mName;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace replace replace replace keep keep keep replace
<mask> float vbWidth = vbRect.width(); <mask> float vbHeight = vbRect.height(); <mask> <mask> // Let e-x, e-y, e-width, e-height be the position and size of the element respectively. <mask> float eX = eRect.left; <mask> float eY = eRect.top; <mask> float eWidth = eRect.width(); <mask> float eHeight = eRect.height(); <mask> <mask> <mask> // Initialize scale-x to e-width/vb-width. <mask> float scaleX = eWidth / vbWidth; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove float vbX = vbRect.left; float vbY = vbRect.top; float vbWidth = vbRect.width(); float vbHeight = vbRect.height(); </s> add double vbX = vbRect.left; double vbY = vbRect.top; double vbWidth = vbRect.width(); double vbHeight = vbRect.height(); </s> remove float scaleY = eHeight / vbHeight; </s> add double scaleY = eHeight / vbHeight; </s> remove // Initialize translate-x to vb-x - e-x. // Initialize translate-y to vb-y - e-y. float translateX = vbX - eX; float translateY = vbY - eY; </s> add // Initialize translate-x to e-x - (vb-x * scale-x). // Initialize translate-y to e-y - (vb-y * scale-y). double translateX = eX - (vbX * scaleX); double translateY = eY - (vbY * scaleY); </s> remove float scale = scaleX = scaleY = Math.min(scaleX, scaleY); </s> add double scale = scaleX = scaleY = Math.min(scaleX, scaleY); </s> remove static public Matrix getTransform(RectF vbRect, RectF eRect, String align, int meetOrSlice, boolean fromSymbol) { </s> add static Matrix getTransform(RectF vbRect, RectF eRect, String align, int meetOrSlice) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace keep keep keep keep keep
<mask> // Initialize scale-x to e-width/vb-width. <mask> float scaleX = eWidth / vbWidth; <mask> <mask> // Initialize scale-y to e-height/vb-height. <mask> float scaleY = eHeight / vbHeight; <mask> <mask> // Initialize translate-x to vb-x - e-x. <mask> // Initialize translate-y to vb-y - e-y. <mask> float translateX = vbX - eX; <mask> float translateY = vbY - eY; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove float scaleX = eWidth / vbWidth; </s> add double scaleX = eWidth / vbWidth; </s> remove // Initialize translate-x to vb-x - e-x. // Initialize translate-y to vb-y - e-y. float translateX = vbX - eX; float translateY = vbY - eY; </s> add // Initialize translate-x to e-x - (vb-x * scale-x). // Initialize translate-y to e-y - (vb-y * scale-y). double translateX = eX - (vbX * scaleX); double translateY = eY - (vbY * scaleY); </s> remove float eX = eRect.left; float eY = eRect.top; float eWidth = eRect.width(); float eHeight = eRect.height(); </s> add double eX = eRect.left; double eY = eRect.top; double eWidth = eRect.width(); double eHeight = eRect.height(); </s> remove float scale = scaleX = scaleY = Math.min(scaleX, scaleY); </s> add double scale = scaleX = scaleY = Math.min(scaleX, scaleY); </s> remove // If align contains 'yMid', minus (e-height / scale-y - vb-height) / 2 from transform-y. </s> add // If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y. </s> remove // If align contains 'xMax', minus (e-width / scale-x - vb-width) from transform-x. </s> add // If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x.
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> <mask> // Initialize scale-y to e-height/vb-height. <mask> float scaleY = eHeight / vbHeight; <mask> <mask> // Initialize translate-x to vb-x - e-x. <mask> // Initialize translate-y to vb-y - e-y. <mask> float translateX = vbX - eX; <mask> float translateY = vbY - eY; <mask> <mask> // If align is 'none' <mask> if (meetOrSlice == MOS_NONE) { <mask> // Let scale be set the smaller value of scale-x and scale-y. <mask> // Assign scale-x and scale-y to scale. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove float scaleY = eHeight / vbHeight; </s> add double scaleY = eHeight / vbHeight; </s> remove float scale = scaleX = scaleY = Math.min(scaleX, scaleY); </s> add double scale = scaleX = scaleY = Math.min(scaleX, scaleY); </s> remove float scaleX = eWidth / vbWidth; </s> add double scaleX = eWidth / vbWidth; </s> remove // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> add // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> remove // If align contains 'yMax', minus (e-height / scale-y - vb-height) from transform-y. </s> add // If align contains 'yMax', add (e-height - vb-height * scale-y) to translate-y. </s> remove translateY -= eHeight / scaleY - vbHeight; </s> add translateY += (eHeight - vbHeight * scaleY);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace keep keep keep keep keep
<mask> // If align is 'none' <mask> if (meetOrSlice == MOS_NONE) { <mask> // Let scale be set the smaller value of scale-x and scale-y. <mask> // Assign scale-x and scale-y to scale. <mask> float scale = scaleX = scaleY = Math.min(scaleX, scaleY); <mask> <mask> // If scale is greater than 1 <mask> if (scale > 1) { <mask> // Minus translateX by (eWidth / scale - vbWidth) / 2 <mask> // Minus translateY by (eHeight / scale - vbHeight) / 2 </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove // Initialize translate-x to vb-x - e-x. // Initialize translate-y to vb-y - e-y. float translateX = vbX - eX; float translateY = vbY - eY; </s> add // Initialize translate-x to e-x - (vb-x * scale-x). // Initialize translate-y to e-y - (vb-y * scale-y). double translateX = eX - (vbX * scaleX); double translateY = eY - (vbY * scaleY); </s> remove // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> add // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> remove // If align contains 'xMid', minus (e-width / scale-x - vb-width) / 2 from transform-x. </s> add // If align contains 'xMid', add (e-width - vb-width * scale-x) / 2 to translate-x. </s> remove translateX -= eWidth / scaleX - vbWidth; </s> add translateX += (eWidth - vbWidth * scaleX); </s> remove // If align contains 'yMid', minus (e-height / scale-y - vb-height) / 2 from transform-y. </s> add // If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y. </s> remove // If align contains 'xMax', minus (e-width / scale-x - vb-width) from transform-x. </s> add // If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x.
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace keep keep keep keep keep
<mask> translateX -= (eWidth - vbWidth * scale) / 2; <mask> translateY -= (eHeight - vbHeight * scale) / 2; <mask> } <mask> } else { <mask> // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. <mask> // Otherwise, if align is not 'none' and meetOrSlice is 'slice', set the smaller of scale-x and scale-y to the larger. <mask> <mask> if (!align.equals("none") && meetOrSlice == MOS_MEET) { <mask> scaleX = scaleY = Math.min(scaleX, scaleY); <mask> } else if (!align.equals("none") && meetOrSlice == MOS_SLICE) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove float scale = scaleX = scaleY = Math.min(scaleX, scaleY); </s> add double scale = scaleX = scaleY = Math.min(scaleX, scaleY); </s> remove // If align contains 'xMid', minus (e-width / scale-x - vb-width) / 2 from transform-x. </s> add // If align contains 'xMid', add (e-width - vb-width * scale-x) / 2 to translate-x. </s> remove // Initialize translate-x to vb-x - e-x. // Initialize translate-y to vb-y - e-y. float translateX = vbX - eX; float translateY = vbY - eY; </s> add // Initialize translate-x to e-x - (vb-x * scale-x). // Initialize translate-y to e-y - (vb-y * scale-y). double translateX = eX - (vbX * scaleX); double translateY = eY - (vbY * scaleY); </s> remove translateY -= eHeight / scaleY - vbHeight; </s> add translateY += (eHeight - vbHeight * scaleY); </s> remove translateX -= eWidth / scaleX - vbWidth; </s> add translateX += (eWidth - vbWidth * scaleX); </s> remove // If align contains 'xMax', minus (e-width / scale-x - vb-width) from transform-x. </s> add // If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x.
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace keep keep keep keep keep
<mask> } else if (!align.equals("none") && meetOrSlice == MOS_SLICE) { <mask> scaleX = scaleY = Math.max(scaleX, scaleY); <mask> } <mask> <mask> // If align contains 'xMid', minus (e-width / scale-x - vb-width) / 2 from transform-x. <mask> if (align.contains("xMid")) { <mask> translateX -= (eWidth / scaleX - vbWidth) / 2; <mask> } <mask> <mask> // If align contains 'xMax', minus (e-width / scale-x - vb-width) from transform-x. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove translateX -= (eWidth / scaleX - vbWidth) / 2; </s> add translateX += (eWidth - vbWidth * scaleX) / 2.0d; </s> remove // If align contains 'xMax', minus (e-width / scale-x - vb-width) from transform-x. </s> add // If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x. </s> remove translateX -= eWidth / scaleX - vbWidth; </s> add translateX += (eWidth - vbWidth * scaleX); </s> remove // If align contains 'yMid', minus (e-height / scale-y - vb-height) / 2 from transform-y. </s> add // If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y. </s> remove translateY -= (eHeight / scaleY - vbHeight) / 2; </s> add translateY += (eHeight - vbHeight * scaleY) / 2.0d; </s> remove // If align contains 'yMax', minus (e-height / scale-y - vb-height) from transform-y. </s> add // If align contains 'yMax', add (e-height - vb-height * scale-y) to translate-y.
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep replace keep keep replace
<mask> if (align.contains("xMid")) { <mask> translateX -= (eWidth / scaleX - vbWidth) / 2; <mask> } <mask> <mask> // If align contains 'xMax', minus (e-width / scale-x - vb-width) from transform-x. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove // If align contains 'xMid', minus (e-width / scale-x - vb-width) / 2 from transform-x. </s> add // If align contains 'xMid', add (e-width - vb-width * scale-x) / 2 to translate-x. </s> remove translateX -= eWidth / scaleX - vbWidth; </s> add translateX += (eWidth - vbWidth * scaleX); </s> remove // If align contains 'yMid', minus (e-height / scale-y - vb-height) / 2 from transform-y. </s> add // If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y. </s> remove translateY -= (eHeight / scaleY - vbHeight) / 2; </s> add translateY += (eHeight - vbHeight * scaleY) / 2.0d; </s> remove // If align contains 'yMax', minus (e-height / scale-y - vb-height) from transform-y. </s> add // If align contains 'yMax', add (e-height - vb-height * scale-y) to translate-y.
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace keep keep replace
<mask> } <mask> <mask> // If align contains 'xMax', minus (e-width / scale-x - vb-width) from transform-x. <mask> if (align.contains("xMax")) { <mask> translateX -= eWidth / scaleX - vbWidth; <mask> } <mask> <mask> // If align contains 'yMid', minus (e-height / scale-y - vb-height) / 2 from transform-y. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove // If align contains 'xMax', minus (e-width / scale-x - vb-width) from transform-x. </s> add // If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x. </s> remove translateX -= (eWidth / scaleX - vbWidth) / 2; </s> add translateX += (eWidth - vbWidth * scaleX) / 2.0d; </s> remove // If align contains 'xMid', minus (e-width / scale-x - vb-width) / 2 from transform-x. </s> add // If align contains 'xMid', add (e-width - vb-width * scale-x) / 2 to translate-x. </s> remove translateY -= (eHeight / scaleY - vbHeight) / 2; </s> add translateY += (eHeight - vbHeight * scaleY) / 2.0d; </s> remove // If align contains 'yMax', minus (e-height / scale-y - vb-height) from transform-y. </s> add // If align contains 'yMax', add (e-height - vb-height * scale-y) to translate-y.
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep replace keep keep replace keep keep
<mask> <mask> // If align contains 'yMid', minus (e-height / scale-y - vb-height) / 2 from transform-y. <mask> if (align.contains("YMid")) { <mask> translateY -= (eHeight / scaleY - vbHeight) / 2; <mask> } <mask> <mask> // If align contains 'yMax', minus (e-height / scale-y - vb-height) from transform-y. <mask> if (align.contains("YMax")) { <mask> translateY -= eHeight / scaleY - vbHeight; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove // If align contains 'yMid', minus (e-height / scale-y - vb-height) / 2 from transform-y. </s> add // If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y. </s> remove translateX -= eWidth / scaleX - vbWidth; </s> add translateX += (eWidth - vbWidth * scaleX); </s> remove translateY -= eHeight / scaleY - vbHeight; </s> add translateY += (eHeight - vbHeight * scaleY); </s> remove // If align contains 'xMax', minus (e-width / scale-x - vb-width) from transform-x. </s> add // If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x. </s> remove // If align contains 'xMid', minus (e-width / scale-x - vb-width) / 2 from transform-x. </s> add // If align contains 'xMid', add (e-width - vb-width * scale-x) / 2 to translate-x.
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> // If align contains 'yMax', minus (e-height / scale-y - vb-height) from transform-y. <mask> if (align.contains("YMax")) { <mask> translateY -= eHeight / scaleY - vbHeight; <mask> } <mask> <mask> } <mask> <mask> // The transform applied to content contained by the element is given by </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove // If align contains 'yMax', minus (e-height / scale-y - vb-height) from transform-y. </s> add // If align contains 'yMax', add (e-height - vb-height * scale-y) to translate-y. </s> remove translateY -= (eHeight / scaleY - vbHeight) / 2; </s> add translateY += (eHeight - vbHeight * scaleY) / 2.0d; </s> remove // If align contains 'yMid', minus (e-height / scale-y - vb-height) / 2 from transform-y. </s> add // If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y. </s> remove translateX -= eWidth / scaleX - vbWidth; </s> add translateX += (eWidth - vbWidth * scaleX); </s> remove // If align contains 'xMax', minus (e-width / scale-x - vb-width) from transform-x. </s> add // If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x. </s> remove transform.postTranslate(-translateX * (fromSymbol ? scaleX : 1), -translateY * (fromSymbol ? scaleY : 1)); transform.postScale(scaleX, scaleY); </s> add transform.postTranslate((float) translateX, (float) translateY); transform.preScale((float) scaleX, (float) scaleY);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
keep keep keep keep replace replace keep keep keep
<mask> <mask> // The transform applied to content contained by the element is given by <mask> // translate(translate-x, translate-y) scale(scale-x, scale-y). <mask> Matrix transform = new Matrix(); <mask> transform.postTranslate(-translateX * (fromSymbol ? scaleX : 1), -translateY * (fromSymbol ? scaleY : 1)); <mask> transform.postScale(scaleX, scaleY); <mask> return transform; <mask> } <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove translateY -= eHeight / scaleY - vbHeight; </s> add translateY += (eHeight - vbHeight * scaleY); </s> remove float scale = scaleX = scaleY = Math.min(scaleX, scaleY); </s> add double scale = scaleX = scaleY = Math.min(scaleX, scaleY); </s> remove // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> add // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. </s> remove // Initialize translate-x to vb-x - e-x. // Initialize translate-y to vb-y - e-y. float translateX = vbX - eX; float translateY = vbY - eY; </s> add // Initialize translate-x to e-x - (vb-x * scale-x). // Initialize translate-y to e-y - (vb-y * scale-y). double translateX = eX - (vbX * scaleX); double translateY = eY - (vbY * scaleY); </s> remove return value.size(); </s> add </s> remove // If align contains 'xMid', minus (e-width / scale-x - vb-width) / 2 from transform-x. </s> add // If align contains 'xMid', add (e-width - vb-width * scale-x) / 2 to translate-x.
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/ViewBox.java
replace keep keep keep keep keep
<mask> /** <mask> * Copyright (c) 2015-present, Horcrux. <mask> * All rights reserved. <mask> * <mask> * This source code is licensed under the MIT-style license found in the <mask> * LICENSE file in the root directory of this source tree. </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep keep replace keep replace keep keep keep keep
<mask> <mask> import javax.annotation.Nullable; <mask> <mask> public abstract class VirtualNode extends LayoutShadowNode { <mask> <mask> protected static final float MIN_OPACITY_FOR_DRAW = 0.01f; <mask> <mask> private static final float[] sMatrixData = new float[9]; <mask> private static final float[] sRawMatrix = new float[9]; <mask> protected float mOpacity = 1f; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove private static final float[] sMatrixData = new float[9]; private static final float[] sRawMatrix = new float[9]; protected float mOpacity = 1f; protected Matrix mMatrix = new Matrix(); </s> add static final float MIN_OPACITY_FOR_DRAW = 0.01f; private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; float mOpacity = 1f; Matrix mMatrix = new Matrix(); </s> remove protected @Nullable String mClipPath; </s> add private @Nullable String mClipPath; </s> add @SuppressWarnings("WeakerAccess") </s> remove private AtomicBoolean mLoading = new AtomicBoolean(false); </s> add private final AtomicBoolean mLoading = new AtomicBoolean(false); private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; private Matrix mMatrix = null; </s> remove protected final float mScale; protected boolean mResponsible; protected String mName; </s> add final float mScale; private boolean mResponsible; String mName;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep keep keep replace replace replace replace keep keep replace keep keep keep
<mask> public abstract class VirtualNode extends LayoutShadowNode { <mask> <mask> protected static final float MIN_OPACITY_FOR_DRAW = 0.01f; <mask> <mask> private static final float[] sMatrixData = new float[9]; <mask> private static final float[] sRawMatrix = new float[9]; <mask> protected float mOpacity = 1f; <mask> protected Matrix mMatrix = new Matrix(); <mask> <mask> private int mClipRule; <mask> protected @Nullable String mClipPath; <mask> <mask> private static final int CLIP_RULE_EVENODD = 0; <mask> private static final int CLIP_RULE_NONZERO = 1; </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public abstract class VirtualNode extends LayoutShadowNode { </s> add import static versioned.host.exp.exponent.modules.api.components.svg.FontData.DEFAULT_FONT_SIZE; </s> remove protected static final float MIN_OPACITY_FOR_DRAW = 0.01f; </s> add abstract class VirtualNode extends LayoutShadowNode { /* N[1/Sqrt[2], 36] The inverse of the square root of 2. Provide enough digits for the 128-bit IEEE quad (36 significant digits). */ private static final double M_SQRT1_2l = 0.707106781186547524400844362104849039; </s> remove protected final float mScale; protected boolean mResponsible; protected String mName; </s> add final float mScale; private boolean mResponsible; String mName; </s> add @SuppressWarnings("WeakerAccess") </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); }
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> <mask> private static final int CLIP_RULE_EVENODD = 0; <mask> private static final int CLIP_RULE_NONZERO = 1; <mask> <mask> protected final float mScale; <mask> protected boolean mResponsible; <mask> protected String mName; <mask> <mask> private SvgViewShadowNode mSvgShadowNode; <mask> private Path mCachedClipPath; <mask> <mask> public VirtualNode() { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove protected @Nullable String mClipPath; </s> add private @Nullable String mClipPath; </s> remove private static final float[] sMatrixData = new float[9]; private static final float[] sRawMatrix = new float[9]; protected float mOpacity = 1f; protected Matrix mMatrix = new Matrix(); </s> add static final float MIN_OPACITY_FOR_DRAW = 0.01f; private static final float[] sRawMatrix = new float[]{ 1, 0, 0, 0, 1, 0, 0, 0, 1 }; float mOpacity = 1f; Matrix mMatrix = new Matrix(); </s> remove public VirtualNode() { </s> add VirtualNode() { </s> remove private static final int TEXT_ANCHOR_AUTO = 0; private static final int TEXT_ANCHOR_START = 1; private static final int TEXT_ANCHOR_MIDDLE = 2; private static final int TEXT_ANCHOR_END = 3; </s> add @ReactProp(name = "textLength") public void setmTextLength(@Nullable String length) { mTextLength = length; markUpdated(); } </s> add @SuppressWarnings("WeakerAccess") </s> remove public class ViewBox extends GroupShadowNode { </s> add class ViewBox extends GroupShadowNode {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep add keep keep keep keep keep
<mask> <mask> private SvgViewShadowNode mSvgShadowNode; <mask> private Path mCachedClipPath; <mask> <mask> VirtualNode() { <mask> mScale = DisplayMetricsHolder.getScreenDisplayMetrics().density; <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public VirtualNode() { </s> add VirtualNode() { </s> remove protected final float mScale; protected boolean mResponsible; protected String mName; </s> add final float mScale; private boolean mResponsible; String mName; </s> remove protected SvgViewShadowNode getSvgShadowNode() { </s> add SvgViewShadowNode getSvgShadowNode() { </s> remove protected @Nullable Path getClipPath() { </s> add @Nullable Path getClipPath() { </s> remove protected @Nullable Path getClipPath(Canvas canvas, Paint paint) { </s> add @Nullable Path getClipPath(Canvas canvas, Paint paint) { </s> remove public PathParser(String d, float scale) { </s> add PathParser(String d, float scale) {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> private SvgViewShadowNode mSvgShadowNode; <mask> private Path mCachedClipPath; <mask> <mask> public VirtualNode() { <mask> mScale = DisplayMetricsHolder.getScreenDisplayMetrics().density; <mask> } <mask> <mask> @Override <mask> public boolean isVirtual() { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add private GroupShadowNode mTextRoot; private float canvasHeight = -1; private float canvasWidth = -1; private GlyphContext glyphContext; </s> remove protected final float mScale; protected boolean mResponsible; protected String mName; </s> add final float mScale; private boolean mResponsible; String mName; </s> remove protected SvgViewShadowNode getSvgShadowNode() { </s> add SvgViewShadowNode getSvgShadowNode() { </s> remove SvgViewShadowNode shadowNode = getSvgShadowNode(); shadowNode.markUpdated(); </s> add bitmapTryRender(bitmap, canvas, paint, opacity * mOpacity); </s> remove public PathParser(String d, float scale) { </s> add PathParser(String d, float scale) { </s> remove return true; </s> add
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> * drawing code should apply opacity recursively. <mask> * <mask> * @param canvas the canvas to set up <mask> */ <mask> protected int saveAndSetupCanvas(Canvas canvas) { <mask> int count = canvas.save(); <mask> canvas.concat(mMatrix); <mask> return count; <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove protected void restoreCanvas(Canvas canvas, int count) { </s> add void restoreCanvas(Canvas canvas, int count) { </s> remove static int toFloatArray(ReadableArray value, float[] into) { int length = value.size() > into.length ? into.length : value.size(); for (int i = 0; i < length; i++) { into[i] = (float) value.getDouble(i); </s> add static int toMatrixData(ReadableArray value, float[] sRawMatrix, float mScale) { int fromSize = value.size(); if (fromSize != inputMatrixDataSize) { return fromSize; </s> remove * @param into output array * @return number of items copied from input to the output array </s> add * @param sRawMatrix output matrix * @param mScale current resolution scaling * @return size of input array </s> remove /** * Converts {@link ReadableArray} to an array of {@code float}. Returns newly created array. * * @return a {@code float[]} if converted successfully, or {@code null} if {@param value} was * {@code null}. */ static @Nullable float[] toFloatArray(@Nullable ReadableArray value) { if (value != null) { float[] result = new float[value.size()]; toFloatArray(value, result); return result; } return null; } </s> add private static final int inputMatrixDataSize = 6; </s> remove public int hitTest(Point point) { </s> add int hitTest(Point point) { </s> remove * Converts given {@link ReadableArray} to an array of {@code float}. Writes result to the array * passed in {@param into}. This method will write to the output array up to the number of items * from the input array. If the input array is longer than output the remaining part of the input * will not be converted. </s> add * Converts given {@link ReadableArray} to a matrix data array, {@code float[6]}. * Writes result to the array passed in {@param into}. * This method will write exactly six items to the output array from the input array. * * If the input array has a different size, then only the size is returned; * Does not check output array size. Ensure space for at least six elements.
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> * {@link #saveAndSetupCanvas}. <mask> * <mask> * @param canvas the canvas to restore <mask> */ <mask> protected void restoreCanvas(Canvas canvas, int count) { <mask> canvas.restoreToCount(count); <mask> } <mask> <mask> @ReactProp(name = "name") <mask> public void setName(String name) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove protected int saveAndSetupCanvas(Canvas canvas) { </s> add int saveAndSetupCanvas(Canvas canvas) { </s> remove static int toFloatArray(ReadableArray value, float[] into) { int length = value.size() > into.length ? into.length : value.size(); for (int i = 0; i < length; i++) { into[i] = (float) value.getDouble(i); </s> add static int toMatrixData(ReadableArray value, float[] sRawMatrix, float mScale) { int fromSize = value.size(); if (fromSize != inputMatrixDataSize) { return fromSize; </s> remove /** * Converts {@link ReadableArray} to an array of {@code float}. Returns newly created array. * * @return a {@code float[]} if converted successfully, or {@code null} if {@param value} was * {@code null}. */ static @Nullable float[] toFloatArray(@Nullable ReadableArray value) { if (value != null) { float[] result = new float[value.size()]; toFloatArray(value, result); return result; } return null; } </s> add private static final int inputMatrixDataSize = 6; </s> remove * @param into output array * @return number of items copied from input to the output array </s> add * @param sRawMatrix output matrix * @param mScale current resolution scaling * @return size of input array </s> remove * Converts given {@link ReadableArray} to an array of {@code float}. Writes result to the array * passed in {@param into}. This method will write to the output array up to the number of items * from the input array. If the input array is longer than output the remaining part of the input * will not be converted. </s> add * Converts given {@link ReadableArray} to a matrix data array, {@code float[6]}. * Writes result to the array passed in {@param into}. * This method will write exactly six items to the output array from the input array. * * If the input array has a different size, then only the size is returned; * Does not check output array size. Ensure space for at least six elements. </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep replace keep replace replace replace replace replace replace replace replace replace keep keep
<mask> public void setMatrix(@Nullable ReadableArray matrixArray) { <mask> if (matrixArray != null) { <mask> int matrixSize = PropHelper.toFloatArray(matrixArray, sMatrixData); <mask> if (matrixSize == 6) { <mask> sRawMatrix[0] = sMatrixData[0]; <mask> sRawMatrix[1] = sMatrixData[2]; <mask> sRawMatrix[2] = sMatrixData[4] * mScale; <mask> sRawMatrix[3] = sMatrixData[1]; <mask> sRawMatrix[4] = sMatrixData[3]; <mask> sRawMatrix[5] = sMatrixData[5] * mScale; <mask> sRawMatrix[6] = 0; <mask> sRawMatrix[7] = 0; <mask> sRawMatrix[8] = 1; <mask> mMatrix.setValues(sRawMatrix); <mask> } else if (matrixSize != -1) { </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> add sRawMatrix[0] = (float) value.getDouble(0); sRawMatrix[1] = (float) value.getDouble(2); sRawMatrix[2] = (float) value.getDouble(4) * mScale; sRawMatrix[3] = (float) value.getDouble(1); sRawMatrix[4] = (float) value.getDouble(3); sRawMatrix[5] = (float) value.getDouble(5) * mScale; return inputMatrixDataSize; </s> remove mStrokeDasharray = PropHelper.toFloatArray(strokeDasharray); if (mStrokeDasharray != null && mStrokeDasharray.length > 0) { for (int i = 0; i < mStrokeDasharray.length; i++) { mStrokeDasharray[i] = mStrokeDasharray[i] * mScale; </s> add if (strokeDasharray != null) { int fromSize = strokeDasharray.size(); mStrokeDasharray = new String[fromSize]; for (int i = 0; i < fromSize; i++) { mStrokeDasharray[i] = strokeDasharray.getString(i); </s> remove if (fontFamily != null && fontSizeSet && fontWeight != null && fontStyle != null) { break; } </s> add int nextIndex = mYIndex + 1; if (nextIndex < mYs.length) { mDY = 0; mYIndex = nextIndex; String string = mYs[nextIndex]; mY = PropHelper.fromRelative(string, mHeight, 0, mScale, mFontSize); </s> remove return anchor; } private TextShadowNode getTextRoot() { if (mTextRoot == null) { mTextRoot = this; while (mTextRoot != null) { if (mTextRoot.getClass() == TextShadowNode.class) { break; } ReactShadowNode parent = mTextRoot.getParent(); if (!(parent instanceof TextShadowNode)) { //todo: throw exception here mTextRoot = null; } else { mTextRoot = (TextShadowNode)parent; </s> add if (mAlignmentBaseline == null) { mAlignmentBaseline = AlignmentBaseline.baseline; } return mAlignmentBaseline; } String getBaselineShift() { if (mBaselineShift == null) { ReactShadowNode parent = this.getParent(); while (parent != null) { if (parent instanceof TextShadowNode) { TextShadowNode node = (TextShadowNode)parent; final String baselineShift = node.mBaselineShift; if (baselineShift != null) { mBaselineShift = baselineShift; return baselineShift; } </s> remove protected float getCanvasTop() { return getSvgShadowNode().getCanvasBounds().top; </s> add private float getCanvasHeight() { if (canvasHeight != -1) { return canvasHeight; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasHeight = getSvgShadowNode().getCanvasBounds().height(); } else { canvasHeight = root.getGlyphContext().getHeight(); } return canvasHeight;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> markUpdated(); <mask> } <mask> <mask> @ReactProp(name = "responsible", defaultBoolean = false) <mask> public void setResponsible(boolean responsible) { <mask> mResponsible = responsible; <mask> markUpdated(); <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove public void setPositionY(@Nullable String positionY) { </s> add public void setPositionY(@Nullable ReadableArray positionY) { </s> remove public void setPositionX(@Nullable String positionX) { </s> add public void setPositionX(@Nullable ReadableArray positionX) { </s> remove protected @Nullable Path getClipPath() { </s> add @Nullable Path getClipPath() { </s> remove @ReactProp(name = "textAnchor", defaultInt = TEXT_ANCHOR_AUTO) public void setTextAnchor(int textAnchor) { mTextAnchor = textAnchor; </s> add @ReactProp(name = "baselineShift") public void setBaselineShift(@Nullable String baselineShift) { mBaselineShift = baselineShift; markUpdated(); } @ReactProp(name = "verticalAlign") public void setVerticalAlign(@Nullable String verticalAlign) { if (verticalAlign != null) { verticalAlign = verticalAlign.trim(); int i = verticalAlign.lastIndexOf(' '); try { mAlignmentBaseline = AlignmentBaseline.getEnum(verticalAlign.substring(i)); } catch (IllegalArgumentException e) { mAlignmentBaseline = AlignmentBaseline.baseline; } try { mBaselineShift = verticalAlign.substring(0, i); } catch (IndexOutOfBoundsException e) { mBaselineShift = null; } } else { mAlignmentBaseline = AlignmentBaseline.baseline; mBaselineShift = null; } markUpdated(); } @ReactProp(name = "rotate") public void setRotate(@Nullable ReadableArray rotate) { mRotate = rotate; </s> remove private GlyphContext mGlyphContext; private TextShadowNode mTextRoot; </s> add @ReactProp(name = "alignmentBaseline") public void setMethod(@Nullable String alignment) { mAlignmentBaseline = AlignmentBaseline.getEnum(alignment); markUpdated(); } </s> remove mD = new PropHelper.PathParser(d, mScale); </s> add PropHelper.PathParser mD = new PropHelper.PathParser(d, mScale);
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep replace keep keep keep replace keep keep
<mask> <mask> protected @Nullable Path getClipPath() { <mask> return mCachedClipPath; <mask> } <mask> <mask> protected @Nullable Path getClipPath(Canvas canvas, Paint paint) { <mask> if (mClipPath != null) { <mask> VirtualNode node = getSvgShadowNode().getDefinedClipPath(mClipPath); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove protected void clip(Canvas canvas, Paint paint) { </s> add void clip(Canvas canvas, Paint paint) { </s> remove protected Path getGroupPath(Canvas canvas, Paint paint) { </s> add Path getGroupPath(Canvas canvas, Paint paint) { </s> remove protected SvgViewShadowNode getSvgShadowNode() { </s> add SvgViewShadowNode getSvgShadowNode() { </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add </s> remove public ReadableArray getBezierCurves() { return mD.getBezierCurves(); </s> add public Path getPath() { return mPath;
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return getClipPath(); <mask> } <mask> <mask> protected void clip(Canvas canvas, Paint paint) { <mask> Path clip = getClipPath(canvas, paint); <mask> <mask> if (clip != null) { <mask> canvas.clipPath(clip, Region.Op.REPLACE); <mask> } </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove protected @Nullable Path getClipPath(Canvas canvas, Paint paint) { </s> add @Nullable Path getClipPath(Canvas canvas, Paint paint) { </s> remove protected Path getGroupPath(Canvas canvas, Paint paint) { </s> add Path getGroupPath(Canvas canvas, Paint paint) { </s> remove protected @Nullable Path getClipPath() { </s> add @Nullable Path getClipPath() { </s> remove protected SvgViewShadowNode getSvgShadowNode() { </s> add SvgViewShadowNode getSvgShadowNode() { </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add </s> remove return new BezierTransformer(path.getBezierCurves(), relativeOnWidth(mStartOffset)); </s> add return path.getPath();
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> abstract protected Path getPath(Canvas canvas, Paint paint); <mask> <mask> protected SvgViewShadowNode getSvgShadowNode() { <mask> if (mSvgShadowNode != null) { <mask> return mSvgShadowNode; <mask> } <mask> <mask> ReactShadowNode parent = getParent(); </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove protected @Nullable Path getClipPath(Canvas canvas, Paint paint) { </s> add @Nullable Path getClipPath(Canvas canvas, Paint paint) { </s> remove protected void clip(Canvas canvas, Paint paint) { </s> add void clip(Canvas canvas, Paint paint) { </s> remove Matrix matrix = getAlignMatrix(groupPath); groupPath.transform(matrix); </s> add </s> remove setupGlyphContext(); </s> add setupGlyphContext(canvas); </s> remove return new BezierTransformer(path.getBezierCurves(), relativeOnWidth(mStartOffset)); </s> add return path.getPath(); </s> remove protected @Nullable Path getClipPath() { </s> add @Nullable Path getClipPath() {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java
keep keep keep replace replace keep keep replace replace keep keep
<mask> return mSvgShadowNode; <mask> } <mask> <mask> protected float relativeOnWidth(String length) { <mask> return PropHelper.fromPercentageToFloat(length, getCanvasWidth(), 0, mScale); <mask> } <mask> <mask> protected float relativeOnHeight(String length) { <mask> return PropHelper.fromPercentageToFloat(length, getCanvasHeight(), 0, mScale); <mask> } <mask> </s> Update RN SVG to 6.2.1 fbshipit-source-id: 4406670 </s> remove protected float getCanvasWidth() { return getSvgShadowNode().getCanvasBounds().width(); </s> add double relativeOnOther(String length) { double powX = Math.pow((getCanvasWidth()), 2); double powY = Math.pow((getCanvasHeight()), 2); double r = Math.sqrt(powX + powY) * M_SQRT1_2l; return PropHelper.fromRelative(length, r, 0, mScale, getFontSizeFromContext()); </s> remove protected float getCanvasLeft() { return getSvgShadowNode().getCanvasBounds().left; </s> add return canvasWidth; </s> remove protected float getCanvasHeight() { return getSvgShadowNode().getCanvasBounds().height(); } </s> add private float getCanvasWidth() { if (canvasWidth != -1) { return canvasWidth; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasWidth = getSvgShadowNode().getCanvasBounds().width(); } else { canvasWidth = root.getGlyphContext().getWidth(); } </s> remove protected float getCanvasTop() { return getSvgShadowNode().getCanvasBounds().top; </s> add private float getCanvasHeight() { if (canvasHeight != -1) { return canvasHeight; } GroupShadowNode root = getTextRoot(); if (root == null) { canvasHeight = getSvgShadowNode().getCanvasBounds().height(); } else { canvasHeight = root.getGlyphContext().getHeight(); } return canvasHeight; </s> remove protected SvgViewShadowNode getSvgShadowNode() { </s> add SvgViewShadowNode getSvgShadowNode() {
https://github.com/expo/expo/commit/3883eaa2c47978aa5e899da543ae5f308cacd090
android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/components/svg/VirtualNode.java