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

Commit aa9c4d15 authored by Alec Mouri's avatar Alec Mouri Committed by Android (Google) Code Review
Browse files

Merge "Revert^2 "Push atoms for decoding images"" into main

parents 25deabcc c477f9f9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -580,6 +580,7 @@ cc_defaults {
        "utils/Color.cpp",
        "utils/LinearAllocator.cpp",
        "utils/StringUtils.cpp",
        "utils/StatsUtils.cpp",
        "utils/TypefaceUtils.cpp",
        "utils/VectorDrawableUtils.cpp",
        "AnimationContext.cpp",
+3 −1
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@
#include <SkColorSpace.h>
#include <SkColorType.h>
#include <SkEncodedOrigin.h>
#include <SkImageInfo.h>
#include <SkGainmapInfo.h>
#include <SkImageInfo.h>
#include <SkMatrix.h>
#include <SkPaint.h>
#include <SkPngChunkReader.h>
@@ -43,6 +43,8 @@

#include <memory>

#include "modules/skcms/src/skcms_public.h"

using namespace android;

sk_sp<SkColorSpace> ImageDecoder::getDefaultColorSpace() const {
+4 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include <stdint.h>
#include <stdio.h>
#include <sys/stat.h>
#include <utils/StatsUtils.h>

#include <memory>

@@ -630,6 +631,7 @@ static jobject doDecode(JNIEnv* env, std::unique_ptr<SkStreamRewindable> stream,
        }
        bitmap::reinitBitmap(env, javaBitmap, outputBitmap.info(), isPremultiplied);
        outputBitmap.notifyPixelsChanged();
        uirenderer::logBitmapDecode(*reuseBitmap);
        // If a java bitmap was passed in for reuse, pass it back
        return javaBitmap;
    }
@@ -650,6 +652,7 @@ static jobject doDecode(JNIEnv* env, std::unique_ptr<SkStreamRewindable> stream,
            }
        }

        uirenderer::logBitmapDecode(*hardwareBitmap);
        return bitmap::createBitmap(env, hardwareBitmap.release(), bitmapCreateFlags,
                ninePatchChunk, ninePatchInsets, -1);
    }
@@ -659,6 +662,7 @@ static jobject doDecode(JNIEnv* env, std::unique_ptr<SkStreamRewindable> stream,
        heapBitmap->setGainmap(std::move(gainmap));
    }

    uirenderer::logBitmapDecode(*heapBitmap);
    // now create the java bitmap
    return bitmap::createBitmap(env, heapBitmap, bitmapCreateFlags, ninePatchChunk, ninePatchInsets,
                                -1);
+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <HardwareBitmapUploader.h>
#include <androidfw/Asset.h>
#include <sys/stat.h>
#include <utils/StatsUtils.h>

#include <memory>

@@ -376,6 +377,7 @@ static jobject nativeDecodeRegion(JNIEnv* env, jobject, jlong brdHandle, jint in
            recycledBitmap->setGainmap(std::move(gainmap));
        }
        bitmap::reinitBitmap(env, javaBitmap, recycledBitmap->info(), !requireUnpremul);
        uirenderer::logBitmapDecode(*recycledBitmap);
        return javaBitmap;
    }

@@ -392,12 +394,14 @@ static jobject nativeDecodeRegion(JNIEnv* env, jobject, jlong brdHandle, jint in
                hardwareBitmap->setGainmap(std::move(gm));
            }
        }
        uirenderer::logBitmapDecode(*hardwareBitmap);
        return bitmap::createBitmap(env, hardwareBitmap.release(), bitmapCreateFlags);
    }
    Bitmap* heapBitmap = heapAlloc.getStorageObjAndReset();
    if (hasGainmap && heapBitmap != nullptr) {
        heapBitmap->setGainmap(std::move(gainmap));
    }
    uirenderer::logBitmapDecode(*heapBitmap);
    return android::bitmap::createBitmap(env, heapBitmap, bitmapCreateFlags);
}

+4 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include <hwui/Bitmap.h>
#include <hwui/ImageDecoder.h>
#include <sys/stat.h>
#include <utils/StatsUtils.h>

#include "Bitmap.h"
#include "BitmapFactory.h"
@@ -485,6 +486,7 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong
                        hwBitmap->setGainmap(std::move(gm));
                    }
                }
                uirenderer::logBitmapDecode(*hwBitmap);
                return bitmap::createBitmap(env, hwBitmap.release(), bitmapCreateFlags,
                                            ninePatchChunk, ninePatchInsets);
            }
@@ -498,6 +500,8 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong

        nativeBitmap->setImmutable();
    }

    uirenderer::logBitmapDecode(*nativeBitmap);
    return bitmap::createBitmap(env, nativeBitmap.release(), bitmapCreateFlags, ninePatchChunk,
                                ninePatchInsets);
}
Loading