Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f003414 authored by John Hoford's avatar John Hoford
Browse files

remove clone

Change-Id: Ia9f4c1778e06416018eeb07be657bcdd0af1496b
parent 5138b285
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ public abstract class BaseFiltersManager implements FiltersManagerInterface {

    public FilterRepresentation createFilterFromName(String name) {
        try {
            return mRepresentationLookup.get(name).clone();
            return mRepresentationLookup.get(name).copy();
        } catch (Exception e) {
            Log.v(LOGTAG, "unable to generate a filter representation for \"" + name + "\"");
            e.printStackTrace();
+9 −8
Original line number Diff line number Diff line
@@ -48,17 +48,18 @@ public class FilterBasicRepresentation extends FilterRepresentation implements P
    }

    @Override
    public FilterRepresentation clone() throws CloneNotSupportedException {
        FilterBasicRepresentation representation = (FilterBasicRepresentation) super.clone();
        representation.setMinimum(getMinimum());
        representation.setMaximum(getMaximum());
        representation.setValue(getValue());
        if (mLogVerbose) {
            Log.v(LOGTAG, "cloning from <" + this + "> to <" + representation + ">");
        }
    public FilterRepresentation copy() {
        FilterBasicRepresentation representation = new FilterBasicRepresentation(getName(),0,0,0);
        copyAllParameters(representation);
        return representation;
    }

    @Override
    protected void copyAllParameters(FilterRepresentation representation) {
        super.copyAllParameters(representation);
        representation.useParametersFrom(this);
    }

    @Override
    public void useParametersFrom(FilterRepresentation a) {
        if (a instanceof FilterBasicRepresentation) {
+9 −7
Original line number Diff line number Diff line
@@ -40,16 +40,18 @@ public class FilterColorBorderRepresentation extends FilterRepresentation {
    }

    @Override
    public FilterRepresentation clone() throws CloneNotSupportedException {
        setFilterClass(ImageFilterParametricBorder.class);
        FilterColorBorderRepresentation representation = (FilterColorBorderRepresentation) super.clone();
        representation.setName(getName());
        representation.setColor(getColor());
        representation.setBorderSize(getBorderSize());
        representation.setBorderRadius(getBorderRadius());
    public FilterRepresentation copy() {
        FilterColorBorderRepresentation representation = new FilterColorBorderRepresentation(0,0,0);
        copyAllParameters(representation);
        return representation;
    }

    @Override
    protected void copyAllParameters(FilterRepresentation representation) {
        super.copyAllParameters(representation);
        representation.useParametersFrom(this);
    }

    public void useParametersFrom(FilterRepresentation a) {
        if (a instanceof FilterColorBorderRepresentation) {
            FilterColorBorderRepresentation representation = (FilterColorBorderRepresentation) a;
+10 −4
Original line number Diff line number Diff line
@@ -33,10 +33,16 @@ public class FilterCurvesRepresentation extends FilterRepresentation {
    }

    @Override
    public FilterRepresentation clone() throws CloneNotSupportedException {
        FilterCurvesRepresentation rep = new FilterCurvesRepresentation();
        rep.useParametersFrom(this);
        return rep;
    public FilterRepresentation copy() {
        FilterCurvesRepresentation representation = new FilterCurvesRepresentation();
        copyAllParameters(representation);
        return representation;
    }

    @Override
    protected void copyAllParameters(FilterRepresentation representation) {
        super.copyAllParameters(representation);
        representation.useParametersFrom(this);
    }

    @Override
+13 −0
Original line number Diff line number Diff line
@@ -18,6 +18,19 @@ package com.android.gallery3d.filtershow.filters;

public class FilterDirectRepresentation extends FilterRepresentation {

    @Override
    public FilterRepresentation copy() {
        FilterDirectRepresentation representation = new FilterDirectRepresentation(getName());
        copyAllParameters(representation);
        return representation;
    }

    @Override
    protected void copyAllParameters(FilterRepresentation representation) {
        super.copyAllParameters(representation);
        representation.useParametersFrom(this);
    }

    public FilterDirectRepresentation(String name) {
        super(name);
    }
Loading