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

Commit f1d1f002 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "switch to new API for compute image size"

parents 7472b72d 7569de0f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1051,7 +1051,7 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {
    }

    // Read the bitmap blob.
    size_t size = bitmap->getSize();
    size_t size = bitmap->computeByteSize();
    android::Parcel::ReadableBlob blob;
    android::status_t status = p->readBlob(size, &blob);
    if (status) {
@@ -1188,7 +1188,7 @@ static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
            p->allowFds() ? "allowed" : "forbidden");
#endif

    size_t size = bitmap.getSize();
    size_t size = bitmap.computeByteSize();
    android::Parcel::WritableBlob blob;
    status = p->writeBlob(size, mutableCopy, &blob);
    if (status) {
@@ -1411,7 +1411,7 @@ static void Bitmap_copyPixelsToBuffer(JNIEnv* env, jobject,
        android::AutoBufferPointer abp(env, jbuffer, JNI_TRUE);

        // the java side has already checked that buffer is large enough
        memcpy(abp.pointer(), src, bitmap.getSize());
        memcpy(abp.pointer(), src, bitmap.computeByteSize());
    }
}

@@ -1424,7 +1424,7 @@ static void Bitmap_copyPixelsFromBuffer(JNIEnv* env, jobject,
    if (NULL != dst) {
        android::AutoBufferPointer abp(env, jbuffer, JNI_FALSE);
        // the java side has already checked that buffer is large enough
        memcpy(dst, abp.pointer(), bitmap.getSize());
        memcpy(dst, abp.pointer(), bitmap.computeByteSize());
        bitmap.notifyPixelsChanged();
    }
}
+2 −3
Original line number Diff line number Diff line
@@ -174,13 +174,12 @@ public:
            return false;
        }

        const int64_t size64 = info.getSafeSize64(bitmap->rowBytes());
        if (!sk_64_isS32(size64)) {
        const size_t size = info.computeByteSize(bitmap->rowBytes());
        if (size > SK_MaxS32) {
            ALOGW("bitmap is too large");
            return false;
        }

        const size_t size = sk_64_asS32(size64);
        if (size > mSize) {
            ALOGW("bitmap marked for reuse (%u bytes) can't fit new bitmap "
                  "(%zu bytes)", mSize, size);
+1 −1
Original line number Diff line number Diff line
@@ -645,7 +645,7 @@ bool RecyclingClippingPixelAllocator::allocPixelRef(SkBitmap* bitmap) {
    const int maxHeight = SkTMax(bitmap->height(), mRecycledBitmap->info().height());
    const SkImageInfo maxInfo = bitmap->info().makeWH(maxWidth, maxHeight);
    const size_t rowBytes = maxInfo.minRowBytes();
    const size_t bytesNeeded = maxInfo.getSafeSize(rowBytes);
    const size_t bytesNeeded = maxInfo.computeByteSize(rowBytes);
    if (bytesNeeded <= mRecycledBytes) {
        // Here we take advantage of reconfigure() to reset the rowBytes
        // of mRecycledBitmap.  It is very important that we pass in
+4 −4
Original line number Diff line number Diff line
@@ -1328,7 +1328,7 @@ nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type,
    const void* ptr = bitmap.getPixels();
    jlong id = (jlong)(uintptr_t)rsAllocationCreateFromBitmap((RsContext)con,
                                                  (RsType)type, (RsAllocationMipmapControl)mip,
                                                  ptr, bitmap.getSize(), usage);
                                                  ptr, bitmap.computeByteSize(), usage);
    return id;
}

@@ -1356,7 +1356,7 @@ nAllocationCubeCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong ty
    const void* ptr = bitmap.getPixels();
    jlong id = (jlong)(uintptr_t)rsAllocationCubeCreateFromBitmap((RsContext)con,
                                                      (RsType)type, (RsAllocationMipmapControl)mip,
                                                      ptr, bitmap.getSize(), usage);
                                                      ptr, bitmap.computeByteSize(), usage);
    return id;
}

@@ -1371,7 +1371,7 @@ nAllocationCopyFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, j
    const void* ptr = bitmap.getPixels();
    rsAllocation2DData((RsContext)con, (RsAllocation)alloc, 0, 0,
                       0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X,
                       w, h, ptr, bitmap.getSize(), 0);
                       w, h, ptr, bitmap.computeByteSize(), 0);
}

static void
@@ -1381,7 +1381,7 @@ nAllocationCopyToBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, job
    GraphicsJNI::getSkBitmap(_env, jbitmap, &bitmap);

    void* ptr = bitmap.getPixels();
    rsAllocationCopyToBitmap((RsContext)con, (RsAllocation)alloc, ptr, bitmap.getSize());
    rsAllocationCopyToBitmap((RsContext)con, (RsAllocation)alloc, ptr, bitmap.computeByteSize());
    bitmap.notifyPixelsChanged();
}