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

Commit d9b53a09 authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

Remove chaining from ImageDecoder setters

Bug: 76448408
Test: Infeasible
Change-Id: Ib0ef0a9a9b0f36481ed1bbb16ecaccd180df8915
parent 1e0a9b0b
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -13650,17 +13650,17 @@ package android.graphics {
    method public boolean isDecodeAsAlphaMaskEnabled();
    method public boolean isMutableRequired();
    method public boolean isUnpremultipliedRequired();
    method public android.graphics.ImageDecoder setAllocator(int);
    method public android.graphics.ImageDecoder setConserveMemory(boolean);
    method public android.graphics.ImageDecoder setCrop(android.graphics.Rect);
    method public android.graphics.ImageDecoder setDecodeAsAlphaMaskEnabled(boolean);
    method public android.graphics.ImageDecoder setMutableRequired(boolean);
    method public android.graphics.ImageDecoder setOnPartialImageListener(android.graphics.ImageDecoder.OnPartialImageListener);
    method public android.graphics.ImageDecoder setPostProcessor(android.graphics.PostProcessor);
    method public android.graphics.ImageDecoder setTargetColorSpace(android.graphics.ColorSpace);
    method public android.graphics.ImageDecoder setTargetSampleSize(int);
    method public android.graphics.ImageDecoder setTargetSize(int, int);
    method public android.graphics.ImageDecoder setUnpremultipliedRequired(boolean);
    method public void setAllocator(int);
    method public void setConserveMemory(boolean);
    method public void setCrop(android.graphics.Rect);
    method public void setDecodeAsAlphaMaskEnabled(boolean);
    method public void setMutableRequired(boolean);
    method public void setOnPartialImageListener(android.graphics.ImageDecoder.OnPartialImageListener);
    method public void setPostProcessor(android.graphics.PostProcessor);
    method public void setTargetColorSpace(android.graphics.ColorSpace);
    method public void setTargetSampleSize(int);
    method public void setTargetSize(int, int);
    method public void setUnpremultipliedRequired(boolean);
    field public static final int ALLOCATOR_DEFAULT = 0; // 0x0
    field public static final int ALLOCATOR_HARDWARE = 3; // 0x3
    field public static final int ALLOCATOR_SHARED_MEMORY = 2; // 0x2
+25 −46
Original line number Diff line number Diff line
@@ -855,7 +855,8 @@ public final class ImageDecoder implements AutoCloseable {
     */
    @java.lang.Deprecated
    public ImageDecoder setResize(int width, int height) {
        return this.setTargetSize(width, height);
        this.setTargetSize(width, height);
        return this;
    }

    /**
@@ -873,9 +874,8 @@ public final class ImageDecoder implements AutoCloseable {
     *
     *  @param width must be greater than 0.
     *  @param height must be greater than 0.
     *  @return this object for chaining.
     */
    public ImageDecoder setTargetSize(int width, int height) {
    public void setTargetSize(int width, int height) {
        if (width <= 0 || height <= 0) {
            throw new IllegalArgumentException("Dimensions must be positive! "
                    + "provided (" + width + ", " + height + ")");
@@ -883,7 +883,6 @@ public final class ImageDecoder implements AutoCloseable {

        mDesiredWidth = width;
        mDesiredHeight = height;
        return this;
    }

    /** @removed
@@ -891,7 +890,8 @@ public final class ImageDecoder implements AutoCloseable {
     */
    @java.lang.Deprecated
    public ImageDecoder setResize(int sampleSize) {
        return this.setTargetSampleSize(sampleSize);
        this.setTargetSampleSize(sampleSize);
        return this;
    }

    private int getTargetDimension(int original, int sampleSize, int computed) {
@@ -941,13 +941,12 @@ public final class ImageDecoder implements AutoCloseable {
     *  {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     *
     *  @param sampleSize Sampling rate of the encoded image.
     *  @return this object for chaining.
     */
    public ImageDecoder setTargetSampleSize(int sampleSize) {
    public void setTargetSampleSize(int sampleSize) {
        Size size = this.getSampledSize(sampleSize);
        int targetWidth = getTargetDimension(mWidth, sampleSize, size.getWidth());
        int targetHeight = getTargetDimension(mHeight, sampleSize, size.getHeight());
        return this.setTargetSize(targetWidth, targetHeight);
        this.setTargetSize(targetWidth, targetHeight);
    }

    private boolean requestedResize() {
@@ -1006,14 +1005,12 @@ public final class ImageDecoder implements AutoCloseable {
     *  {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     *
     *  @param allocator Type of allocator to use.
     *  @return this object for chaining.
     */
    public ImageDecoder setAllocator(@Allocator int allocator) {
    public void setAllocator(@Allocator int allocator) {
        if (allocator < ALLOCATOR_DEFAULT || allocator > ALLOCATOR_HARDWARE) {
            throw new IllegalArgumentException("invalid allocator " + allocator);
        }
        mAllocator = allocator;
        return this;
    }

    /**
@@ -1039,12 +1036,9 @@ public final class ImageDecoder implements AutoCloseable {
     *
     *  <p>Like all setters on ImageDecoder, this must be called inside
     *  {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     *
     *  @return this object for chaining.
     */
    public ImageDecoder setUnpremultipliedRequired(boolean unpremultipliedRequired) {
    public void setUnpremultipliedRequired(boolean unpremultipliedRequired) {
        mUnpremultipliedRequired = unpremultipliedRequired;
        return this;
    }

    /** @removed
@@ -1052,7 +1046,8 @@ public final class ImageDecoder implements AutoCloseable {
     */
    @java.lang.Deprecated
    public ImageDecoder setRequireUnpremultiplied(boolean unpremultipliedRequired) {
        return this.setUnpremultipliedRequired(unpremultipliedRequired);
        this.setUnpremultipliedRequired(unpremultipliedRequired);
        return this;
    }

    /**
@@ -1086,11 +1081,9 @@ public final class ImageDecoder implements AutoCloseable {
     *  <p>Like all setters on ImageDecoder, this must be called inside
     *  {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     *
     *  @return this object for chaining.
     */
    public ImageDecoder setPostProcessor(@Nullable PostProcessor p) {
    public void setPostProcessor(@Nullable PostProcessor p) {
        mPostProcessor = p;
        return this;
    }

    /**
@@ -1110,11 +1103,9 @@ public final class ImageDecoder implements AutoCloseable {
     *  <p>Like all setters on ImageDecoder, this must be called inside
     *  {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     *
     *  @return this object for chaining.
     */
    public ImageDecoder setOnPartialImageListener(@Nullable OnPartialImageListener l) {
    public void setOnPartialImageListener(@Nullable OnPartialImageListener l) {
        mOnPartialImageListener = l;
        return this;
    }

    /**
@@ -1140,11 +1131,9 @@ public final class ImageDecoder implements AutoCloseable {
     *  <p>Like all setters on ImageDecoder, this must be called inside
     *  {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     *
     *  @return this object for chaining.
     */
    public ImageDecoder setCrop(@Nullable Rect subset) {
    public void setCrop(@Nullable Rect subset) {
        mCropRect = subset;
        return this;
    }

    /**
@@ -1164,13 +1153,10 @@ public final class ImageDecoder implements AutoCloseable {
     *  <p>Like all setters on ImageDecoder, this must be called inside
     *  {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     *
     *  @return this object for chaining.
     *
     *  @hide
     */
    public ImageDecoder setOutPaddingRect(@NonNull Rect outPadding) {
    public void setOutPaddingRect(@NonNull Rect outPadding) {
        mOutPaddingRect = outPadding;
        return this;
    }

    /**
@@ -1191,12 +1177,9 @@ public final class ImageDecoder implements AutoCloseable {
     *
     *  <p>Like all setters on ImageDecoder, this must be called inside
     *  {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     *
     *  @return this object for chaining.
     */
    public ImageDecoder setMutableRequired(boolean mutable) {
    public void setMutableRequired(boolean mutable) {
        mMutable = mutable;
        return this;
    }

    /** @removed
@@ -1204,7 +1187,8 @@ public final class ImageDecoder implements AutoCloseable {
     */
    @java.lang.Deprecated
    public ImageDecoder setMutable(boolean mutable) {
        return this.setMutableRequired(mutable);
        this.setMutableRequired(mutable);
        return this;
    }

    /**
@@ -1236,12 +1220,9 @@ public final class ImageDecoder implements AutoCloseable {
     *
     *  <p>Like all setters on ImageDecoder, this must be called inside
     *  {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     *
     *  @return this object for chaining.
     */
    public ImageDecoder setConserveMemory(boolean conserveMemory) {
    public void setConserveMemory(boolean conserveMemory) {
        mConserveMemory = conserveMemory;
        return this;
    }

    /**
@@ -1269,12 +1250,9 @@ public final class ImageDecoder implements AutoCloseable {
     *
     *  <p>Like all setters on ImageDecoder, this must be called inside
     *  {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     *
     *  @return this object for chaining.
     */
    public ImageDecoder setDecodeAsAlphaMaskEnabled(boolean enabled) {
    public void setDecodeAsAlphaMaskEnabled(boolean enabled) {
        mDecodeAsAlphaMask = enabled;
        return this;
    }

    /** @removed
@@ -1282,7 +1260,8 @@ public final class ImageDecoder implements AutoCloseable {
     */
    @java.lang.Deprecated
    public ImageDecoder setDecodeAsAlphaMask(boolean enabled) {
        return this.setDecodeAsAlphaMaskEnabled(enabled);
        this.setDecodeAsAlphaMaskEnabled(enabled);
        return this;
    }

    /** @removed
@@ -1290,7 +1269,8 @@ public final class ImageDecoder implements AutoCloseable {
     */
    @java.lang.Deprecated
    public ImageDecoder setAsAlphaMask(boolean asAlphaMask) {
        return this.setDecodeAsAlphaMask(asAlphaMask);
        this.setDecodeAsAlphaMask(asAlphaMask);
        return this;
    }

    /**
@@ -1350,9 +1330,8 @@ public final class ImageDecoder implements AutoCloseable {
     * <p>Like all setters on ImageDecoder, this must be called inside
     * {@link OnHeaderDecodedListener#onHeaderDecoded}.</p>
     */
    public ImageDecoder setTargetColorSpace(ColorSpace colorSpace) {
    public void setTargetColorSpace(ColorSpace colorSpace) {
        mDesiredColorSpace = colorSpace;
        return this;
    }

    @Override