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

Commit 37028137 authored by Tom Hudson's avatar Tom Hudson Committed by Android (Google) Code Review
Browse files

Merge "Merge six commits from master-skia to master"

parents e29953c1 55078074
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -189,6 +189,7 @@ LOCAL_C_INCLUDES += \
    external/pdfium/core/include/fpdfdoc \
    external/pdfium/fpdfsdk/include \
    external/pdfium/public \
    external/skia/include/private \
    external/skia/src/core \
    external/skia/src/effects \
    external/skia/src/images \
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ public:

    virtual bool allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) {
        const SkImageInfo& info = bitmap->info();
        if (info.fColorType == kUnknown_SkColorType) {
        if (info.colorType() == kUnknown_SkColorType) {
            ALOGW("unable to reuse a bitmap as the target has an unknown bitmap configuration");
            return false;
        }
+4 −4
Original line number Diff line number Diff line
@@ -486,7 +486,7 @@ static bool computeAllocationSize(const SkBitmap& bitmap, size_t* size) {
android::Bitmap* GraphicsJNI::allocateJavaPixelRef(JNIEnv* env, SkBitmap* bitmap,
                                             SkColorTable* ctable) {
    const SkImageInfo& info = bitmap->info();
    if (info.fColorType == kUnknown_SkColorType) {
    if (info.colorType() == kUnknown_SkColorType) {
        doThrowIAE(env, "unknown bitmap configuration");
        return NULL;
    }
@@ -538,7 +538,7 @@ static void allocatePixelsReleaseProc(void* ptr, void* ctx) {

bool GraphicsJNI::allocatePixels(JNIEnv* env, SkBitmap* bitmap, SkColorTable* ctable) {
    const SkImageInfo& info = bitmap->info();
    if (info.fColorType == kUnknown_SkColorType) {
    if (info.colorType() == kUnknown_SkColorType) {
        doThrowIAE(env, "unknown bitmap configuration");
        return NULL;
    }
@@ -581,7 +581,7 @@ android::Bitmap* GraphicsJNI::allocateAshmemPixelRef(JNIEnv* env, SkBitmap* bitm
    int fd;

    const SkImageInfo& info = bitmap->info();
    if (info.fColorType == kUnknown_SkColorType) {
    if (info.colorType() == kUnknown_SkColorType) {
        doThrowIAE(env, "unknown bitmap configuration");
        return nullptr;
    }
@@ -625,7 +625,7 @@ android::Bitmap* GraphicsJNI::allocateAshmemPixelRef(JNIEnv* env, SkBitmap* bitm
android::Bitmap* GraphicsJNI::mapAshmemPixelRef(JNIEnv* env, SkBitmap* bitmap,
        SkColorTable* ctable, int fd, void* addr, bool readOnly) {
    const SkImageInfo& info = bitmap->info();
    if (info.fColorType == kUnknown_SkColorType) {
    if (info.colorType() == kUnknown_SkColorType) {
        doThrowIAE(env, "unknown bitmap configuration");
        return nullptr;
    }
+3 −4
Original line number Diff line number Diff line
@@ -313,12 +313,11 @@ static jlong nativeLockCanvas(JNIEnv* env, jclass clazz,
        return 0;
    }


    SkImageInfo info = SkImageInfo::Make(outBuffer.width, outBuffer.height,
                                         convertPixelFormat(outBuffer.format),
                                         kPremul_SkAlphaType);
    if (outBuffer.format == PIXEL_FORMAT_RGBX_8888) {
        info.fAlphaType = kOpaque_SkAlphaType;
    }
                                         outBuffer.format == PIXEL_FORMAT_RGBX_8888 ?
                                         kOpaque_SkAlphaType : kPremul_SkAlphaType);

    SkBitmap bitmap;
    ssize_t bpr = outBuffer.stride * bytesPerPixel(outBuffer.format);
+12 −11
Original line number Diff line number Diff line
@@ -138,35 +138,36 @@ static jobject nativeScreenshotBitmap(JNIEnv* env, jclass clazz,
        return NULL;
    }

    SkImageInfo screenshotInfo;
    screenshotInfo.fWidth = screenshot->getWidth();
    screenshotInfo.fHeight = screenshot->getHeight();

    SkColorType ct;
    SkAlphaType at;
    switch (screenshot->getFormat()) {
        case PIXEL_FORMAT_RGBX_8888: {
            screenshotInfo.fColorType = kRGBA_8888_SkColorType;
            screenshotInfo.fAlphaType = kOpaque_SkAlphaType;
            ct = kRGBA_8888_SkColorType;
            at = kOpaque_SkAlphaType;
            break;
        }
        case PIXEL_FORMAT_RGBA_8888: {
            screenshotInfo.fColorType = kRGBA_8888_SkColorType;
            screenshotInfo.fAlphaType = kPremul_SkAlphaType;
            ct = kRGBA_8888_SkColorType;
            at = kPremul_SkAlphaType;
            break;
        }
        case PIXEL_FORMAT_RGB_565: {
            screenshotInfo.fColorType = kRGB_565_SkColorType;
            screenshotInfo.fAlphaType = kOpaque_SkAlphaType;
            ct = kRGB_565_SkColorType;
            at = kOpaque_SkAlphaType;
            break;
        }
        default: {
            return NULL;
        }
    }
    SkImageInfo screenshotInfo = SkImageInfo::Make(screenshot->getWidth(),
                                                   screenshot->getHeight(),
                                                   ct, at);

    const size_t rowBytes =
            screenshot->getStride() * android::bytesPerPixel(screenshot->getFormat());

    if (!screenshotInfo.fWidth || !screenshotInfo.fHeight) {
    if (!screenshotInfo.width() || !screenshotInfo.height()) {
        return NULL;
    }

Loading