remove unnecessary code

This commit is contained in:
Horcrux
2016-07-27 14:55:58 +08:00
parent 7d09dcde29
commit b512d57c7a
16 changed files with 10 additions and 141 deletions
@@ -22,11 +22,6 @@ public class RNSVGClipPathShadowNode extends RNSVGGroupShadowNode {
getSvgShadowNode().defineClipPath(this, mName);
}
@Override
protected void removeDefinition() {
getSvgShadowNode().removeClipPath(mName);
}
@Override
public int hitTest(Point point, View view) {
return -1;
@@ -81,16 +81,6 @@ public class RNSVGGroupShadowNode extends RNSVGPathShadowNode {
}
}
protected void removeDefinition() {
if (mName != null) {
getSvgShadowNode().removeTemplate(mName);
}
for (int i = getChildCount() - 1; i >= 0; i--) {
((RNSVGVirtualNode) getChildAt(i)).removeDefinition();
}
}
@Override
public void mergeProperties(RNSVGVirtualNode target, ReadableArray mergeList) {
if (mergeList.size() != 0) {
@@ -19,12 +19,10 @@ import android.net.Uri;
import android.util.Log;
import com.facebook.common.executors.UiThreadImmediateExecutorService;
import com.facebook.common.logging.FLog;
import com.facebook.common.executors.CallerThreadExecutor;
import com.facebook.common.references.CloseableReference;
import com.facebook.datasource.DataSource;
import com.facebook.common.logging.FLog;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipeline;
import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber;
import com.facebook.imagepipeline.image.CloseableBitmap;
import com.facebook.imagepipeline.image.CloseableImage;
@@ -91,7 +89,6 @@ public class RNSVGImageShadowNode extends RNSVGPathShadowNode {
final ImageRequest request = ImageRequestBuilder.newBuilderWithSource(mUri).build();
final boolean inMemoryCache = Fresco.getImagePipeline().isInBitmapMemoryCache(request);
if (inMemoryCache) {
tryRender(request, canvas, paint, opacity * mOpacity);
} else if (!mLoading) {
@@ -135,11 +132,12 @@ public class RNSVGImageShadowNode extends RNSVGPathShadowNode {
float w = PropHelper.fromPercentageToFloat(mW, mCanvasWidth, 0, mScale);
float h = PropHelper.fromPercentageToFloat(mH, mCanvasHeight, 0, mScale);
Paint alphaPaint = new Paint();
alphaPaint.setAlpha((int) (opacity * 255));
canvas.drawBitmap(bitmap, null, new Rect((int) x, (int) y, (int) (x + w), (int) (y + h)), alphaPaint);
restoreCanvas(canvas, count);
markUpdateSeen();
}
private void tryRender(@Nonnull final ImageRequest request, @Nonnull final Canvas canvas, @Nonnull final Paint paint, final float opacity) {
@@ -70,12 +70,4 @@ public class RNSVGLinearGradientShadowNode extends RNSVGDefinitionShadowNode {
getSvgShadowNode().defineBrush(brush, mName);
}
}
@Override
protected void removeDefinition() {
if (mName != null) {
getSvgShadowNode().removeBrush(mName);
}
}
}
@@ -83,12 +83,4 @@ public class RNSVGRadialGradientShadowNode extends RNSVGDefinitionShadowNode {
getSvgShadowNode().defineBrush(brush, mName);
}
}
@Override
protected void removeDefinition() {
if (mName != null) {
getSvgShadowNode().removeBrush(mName);
}
}
}
@@ -47,7 +47,6 @@ public class RNSVGSvgViewShadowNode extends LayoutShadowNode {
Paint paint = new Paint();
drawChildren(canvas, paint);
return bitmap;
}
@@ -101,10 +100,6 @@ public class RNSVGSvgViewShadowNode extends LayoutShadowNode {
mDefinedClipPaths.put(clipPathRef, clipPath);
}
public void removeClipPath(String clipPathRef) {
mDefinedClipPaths.remove(clipPathRef);
}
public RNSVGVirtualNode getDefinedClipPath(String clipPathRef) {
return mDefinedClipPaths.get(clipPathRef);
}
@@ -113,10 +108,6 @@ public class RNSVGSvgViewShadowNode extends LayoutShadowNode {
mDefinedTemplates.put(templateRef, template);
}
public void removeTemplate(String templateRef) {
mDefinedTemplates.remove(templateRef);
}
public RNSVGVirtualNode getDefinedTemplate(String templateRef) {
return mDefinedTemplates.get(templateRef);
}
@@ -125,10 +116,6 @@ public class RNSVGSvgViewShadowNode extends LayoutShadowNode {
mDefinedBrushes.put(brushRef, brush);
}
public void removeBrush(String brushRef) {
mDefinedBrushes.remove(brushRef);
}
public PropHelper.RNSVGBrush getDefinedBrush(String brushRef) {
return mDefinedBrushes.get(brushRef);
}
@@ -167,7 +167,7 @@ public class RNSVGViewBoxShadowNode extends RNSVGGroupShadowNode {
@Override
public void mergeProperties(RNSVGVirtualNode target, ReadableArray mergeList) {
if (target.getClass() == RNSVGUseShadowNode.class) {
if (target instanceof RNSVGUseShadowNode) {
mFromSymbol = true;
mBoxWidth = ((RNSVGUseShadowNode)target).getWidth();
mBoxHeight = ((RNSVGUseShadowNode)target).getHeight();
@@ -299,16 +299,9 @@ public abstract class RNSVGVirtualNode extends LayoutShadowNode {
}
}
protected void removeDefinition() {
if (mName != null) {
getSvgShadowNode().removeTemplate(mName);
}
}
abstract public void mergeProperties(RNSVGVirtualNode target, ReadableArray mergeList, boolean inherited);
abstract public void mergeProperties(RNSVGVirtualNode target, ReadableArray mergeList);
abstract public void resetProperties();
}