Loading libs/hwui/hwui/ImageDecoder.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -498,7 +498,7 @@ SkCodec::Result ImageDecoder::decode(void* pixels, size_t rowBytes) { return result; } SkCodec::Result ImageDecoder::extractGainmap(Bitmap* destination) { SkCodec::Result ImageDecoder::extractGainmap(Bitmap* destination, bool isShared) { ATRACE_CALL(); SkGainmapInfo gainmapInfo; std::unique_ptr<SkStream> gainmapStream; Loading Loading @@ -553,9 +553,12 @@ SkCodec::Result ImageDecoder::extractGainmap(Bitmap* destination) { return SkCodec::kInternalError; } // TODO: We don't currently parcel the gainmap, but if we should then also support // the shared allocator sk_sp<Bitmap> nativeBitmap = Bitmap::allocateHeapBitmap(&bm); sk_sp<Bitmap> nativeBitmap; if (isShared) { nativeBitmap = Bitmap::allocateAshmemBitmap(&bm); } else { nativeBitmap = Bitmap::allocateHeapBitmap(&bm); } if (!nativeBitmap) { ALOGE("OOM allocating Bitmap with dimensions %i x %i", bitmapInfo.width(), bitmapInfo.height()); Loading libs/hwui/hwui/ImageDecoder.h +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ public: // Set whether the ImageDecoder should handle RestorePrevious frames. void setHandleRestorePrevious(bool handle); SkCodec::Result extractGainmap(Bitmap* destination); SkCodec::Result extractGainmap(Bitmap* destination, bool isShared); private: // State machine for keeping track of how to handle RestorePrevious (RP) Loading libs/hwui/jni/ImageDecoder.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -354,7 +354,8 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong // cost of RAM if (result == SkCodec::kSuccess && !jpostProcess && !preferRamOverQuality) { // The gainmap costs RAM to improve quality, so skip this if we're prioritizing RAM instead result = decoder->extractGainmap(nativeBitmap.get()); result = decoder->extractGainmap(nativeBitmap.get(), allocator == kSharedMemory_Allocator ? true : false); jexception = get_and_clear_exception(env); } Loading Loading
libs/hwui/hwui/ImageDecoder.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -498,7 +498,7 @@ SkCodec::Result ImageDecoder::decode(void* pixels, size_t rowBytes) { return result; } SkCodec::Result ImageDecoder::extractGainmap(Bitmap* destination) { SkCodec::Result ImageDecoder::extractGainmap(Bitmap* destination, bool isShared) { ATRACE_CALL(); SkGainmapInfo gainmapInfo; std::unique_ptr<SkStream> gainmapStream; Loading Loading @@ -553,9 +553,12 @@ SkCodec::Result ImageDecoder::extractGainmap(Bitmap* destination) { return SkCodec::kInternalError; } // TODO: We don't currently parcel the gainmap, but if we should then also support // the shared allocator sk_sp<Bitmap> nativeBitmap = Bitmap::allocateHeapBitmap(&bm); sk_sp<Bitmap> nativeBitmap; if (isShared) { nativeBitmap = Bitmap::allocateAshmemBitmap(&bm); } else { nativeBitmap = Bitmap::allocateHeapBitmap(&bm); } if (!nativeBitmap) { ALOGE("OOM allocating Bitmap with dimensions %i x %i", bitmapInfo.width(), bitmapInfo.height()); Loading
libs/hwui/hwui/ImageDecoder.h +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ public: // Set whether the ImageDecoder should handle RestorePrevious frames. void setHandleRestorePrevious(bool handle); SkCodec::Result extractGainmap(Bitmap* destination); SkCodec::Result extractGainmap(Bitmap* destination, bool isShared); private: // State machine for keeping track of how to handle RestorePrevious (RP) Loading
libs/hwui/jni/ImageDecoder.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -354,7 +354,8 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong // cost of RAM if (result == SkCodec::kSuccess && !jpostProcess && !preferRamOverQuality) { // The gainmap costs RAM to improve quality, so skip this if we're prioritizing RAM instead result = decoder->extractGainmap(nativeBitmap.get()); result = decoder->extractGainmap(nativeBitmap.get(), allocator == kSharedMemory_Allocator ? true : false); jexception = get_and_clear_exception(env); } Loading