Loading core/jni/android/graphics/AnimatedImageDrawable.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <SkPicture.h> #include <SkPictureRecorder.h> #include <hwui/AnimatedImageDrawable.h> #include <hwui/ImageDecoder.h> #include <hwui/Canvas.h> #include <utils/Looper.h> Loading core/jni/android/graphics/ImageDecoder.cpp +95 −130 File changed.Preview size limit exceeded, changes collapsed. Show changes core/jni/android/graphics/ImageDecoder.h +2 −38 Original line number Diff line number Diff line Loading @@ -14,48 +14,12 @@ * limitations under the License. */ #include "NinePatchPeeker.h" #include <hwui/Canvas.h> #include <jni.h> class SkAndroidCodec; using namespace android; struct ImageDecoder { // These need to stay in sync with ImageDecoder.java's Allocator constants. enum Allocator { kDefault_Allocator = 0, kSoftware_Allocator = 1, kSharedMemory_Allocator = 2, kHardware_Allocator = 3, }; // These need to stay in sync with ImageDecoder.java's Error constants. enum Error { kSourceException = 1, kSourceIncomplete = 2, kSourceMalformedData = 3, }; // These need to stay in sync with PixelFormat.java's Format constants. enum PixelFormat { kUnknown = 0, kTranslucent = -3, kOpaque = -1, }; std::unique_ptr<SkAndroidCodec> mCodec; sk_sp<NinePatchPeeker> mPeeker; ImageDecoder() :mPeeker(new NinePatchPeeker) {} }; // Creates a Java Canvas object from canvas, calls jimageDecoder's PostProcess on it, and then // releases the Canvas. // Caller needs to check for exceptions. jint postProcessAndRelease(JNIEnv* env, jobject jimageDecoder, std::unique_ptr<Canvas> canvas); jint postProcessAndRelease(JNIEnv* env, jobject jimageDecoder, std::unique_ptr<android::Canvas> canvas); libs/hwui/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ cc_defaults { "hwui/AnimatedImageThread.cpp", "hwui/Bitmap.cpp", "hwui/Canvas.cpp", "hwui/ImageDecoder.cpp", "hwui/MinikinSkia.cpp", "hwui/MinikinUtils.cpp", "hwui/PaintImpl.cpp", Loading libs/hwui/hwui/Bitmap.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -44,9 +44,7 @@ namespace android { // returns true if rowBytes * height can be represented by a positive int32_t value // and places that value in size. static bool computeAllocationSize(size_t rowBytes, int height, size_t* size) { bool Bitmap::computeAllocationSize(size_t rowBytes, int height, size_t* size) { return 0 <= height && height <= std::numeric_limits<size_t>::max() && !__builtin_mul_overflow(rowBytes, (size_t)height, size) && *size <= std::numeric_limits<int32_t>::max(); Loading @@ -66,7 +64,7 @@ static sk_sp<Bitmap> allocateBitmap(SkBitmap* bitmap, AllocPixelRef alloc) { // we must respect the rowBytes value already set on the bitmap instead of // attempting to compute our own. const size_t rowBytes = bitmap->rowBytes(); if (!computeAllocationSize(rowBytes, bitmap->height(), &size)) { if (!Bitmap::computeAllocationSize(rowBytes, bitmap->height(), &size)) { return nullptr; } Loading Loading
core/jni/android/graphics/AnimatedImageDrawable.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <SkPicture.h> #include <SkPictureRecorder.h> #include <hwui/AnimatedImageDrawable.h> #include <hwui/ImageDecoder.h> #include <hwui/Canvas.h> #include <utils/Looper.h> Loading
core/jni/android/graphics/ImageDecoder.cpp +95 −130 File changed.Preview size limit exceeded, changes collapsed. Show changes
core/jni/android/graphics/ImageDecoder.h +2 −38 Original line number Diff line number Diff line Loading @@ -14,48 +14,12 @@ * limitations under the License. */ #include "NinePatchPeeker.h" #include <hwui/Canvas.h> #include <jni.h> class SkAndroidCodec; using namespace android; struct ImageDecoder { // These need to stay in sync with ImageDecoder.java's Allocator constants. enum Allocator { kDefault_Allocator = 0, kSoftware_Allocator = 1, kSharedMemory_Allocator = 2, kHardware_Allocator = 3, }; // These need to stay in sync with ImageDecoder.java's Error constants. enum Error { kSourceException = 1, kSourceIncomplete = 2, kSourceMalformedData = 3, }; // These need to stay in sync with PixelFormat.java's Format constants. enum PixelFormat { kUnknown = 0, kTranslucent = -3, kOpaque = -1, }; std::unique_ptr<SkAndroidCodec> mCodec; sk_sp<NinePatchPeeker> mPeeker; ImageDecoder() :mPeeker(new NinePatchPeeker) {} }; // Creates a Java Canvas object from canvas, calls jimageDecoder's PostProcess on it, and then // releases the Canvas. // Caller needs to check for exceptions. jint postProcessAndRelease(JNIEnv* env, jobject jimageDecoder, std::unique_ptr<Canvas> canvas); jint postProcessAndRelease(JNIEnv* env, jobject jimageDecoder, std::unique_ptr<android::Canvas> canvas);
libs/hwui/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ cc_defaults { "hwui/AnimatedImageThread.cpp", "hwui/Bitmap.cpp", "hwui/Canvas.cpp", "hwui/ImageDecoder.cpp", "hwui/MinikinSkia.cpp", "hwui/MinikinUtils.cpp", "hwui/PaintImpl.cpp", Loading
libs/hwui/hwui/Bitmap.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -44,9 +44,7 @@ namespace android { // returns true if rowBytes * height can be represented by a positive int32_t value // and places that value in size. static bool computeAllocationSize(size_t rowBytes, int height, size_t* size) { bool Bitmap::computeAllocationSize(size_t rowBytes, int height, size_t* size) { return 0 <= height && height <= std::numeric_limits<size_t>::max() && !__builtin_mul_overflow(rowBytes, (size_t)height, size) && *size <= std::numeric_limits<int32_t>::max(); Loading @@ -66,7 +64,7 @@ static sk_sp<Bitmap> allocateBitmap(SkBitmap* bitmap, AllocPixelRef alloc) { // we must respect the rowBytes value already set on the bitmap instead of // attempting to compute our own. const size_t rowBytes = bitmap->rowBytes(); if (!computeAllocationSize(rowBytes, bitmap->height(), &size)) { if (!Bitmap::computeAllocationSize(rowBytes, bitmap->height(), &size)) { return nullptr; } Loading