Loading core/jni/android/graphics/BitmapFactory.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -261,7 +261,7 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding SkBitmap* outputBitmap = NULL; unsigned int existingBufferSize = 0; if (javaBitmap != NULL) { outputBitmap = GraphicsJNI::getSkBitmap(env, javaBitmap); outputBitmap = GraphicsJNI::getSkBitmapDeprecated(env, javaBitmap); if (outputBitmap->isImmutable()) { ALOGW("Unable to reuse an immutable bitmap as an image decoder target."); javaBitmap = NULL; Loading core/jni/android/graphics/BitmapRegionDecoder.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -217,7 +217,7 @@ static jobject nativeDecodeRegion(JNIEnv* env, jobject, jlong brdHandle, if (tileBitmap != NULL) { // Re-use bitmap. bitmap = GraphicsJNI::getSkBitmap(env, tileBitmap); bitmap = GraphicsJNI::getSkBitmapDeprecated(env, tileBitmap); } if (bitmap == NULL) { bitmap = new SkBitmap; Loading core/jni/android/graphics/Graphics.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -338,7 +338,7 @@ SkColorType GraphicsJNI::legacyBitmapConfigToColorType(jint legacyConfig) { return static_cast<SkColorType>(gConfig2ColorType[legacyConfig]); } SkBitmap* GraphicsJNI::getSkBitmap(JNIEnv* env, jobject bitmap) { SkBitmap* GraphicsJNI::getSkBitmapDeprecated(JNIEnv* env, jobject bitmap) { SkASSERT(env); SkASSERT(bitmap); SkASSERT(env->IsInstanceOf(bitmap, gBitmap_class)); Loading @@ -348,6 +348,19 @@ SkBitmap* GraphicsJNI::getSkBitmap(JNIEnv* env, jobject bitmap) { return b; } void GraphicsJNI::getSkBitmap(JNIEnv* env, jobject bitmap, SkBitmap* outBitmap) { // TODO: We have to copy from the existing bitmap due to rowBytes not // being updated on the SkPixelRef at reconfigure time. This is a short term // problem that will be fixed with the specialized wrapper *outBitmap = *getSkBitmapDeprecated(env, bitmap); } SkPixelRef* GraphicsJNI::getSkPixelRef(JNIEnv* env, jobject bitmap) { jlong bitmapHandle = env->GetLongField(bitmap, gBitmap_skBitmapPtr); SkBitmap* b = reinterpret_cast<SkBitmap*>(bitmapHandle); return b->pixelRef(); } SkColorType GraphicsJNI::getNativeBitmapColorType(JNIEnv* env, jobject jconfig) { SkASSERT(env); if (NULL == jconfig) { Loading core/jni/android/graphics/GraphicsJNI.h +3 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,9 @@ public: static void point_to_jpointf(const SkPoint& point, JNIEnv*, jobject jpointf); static android::Canvas* getNativeCanvas(JNIEnv*, jobject canvas); static SkBitmap* getSkBitmap(JNIEnv*, jobject bitmap); static SkBitmap* getSkBitmapDeprecated(JNIEnv*, jobject bitmap); static void getSkBitmap(JNIEnv*, jobject bitmap, SkBitmap* outBitmap); static SkPixelRef* getSkPixelRef(JNIEnv*, jobject bitmap); static SkRegion* getNativeRegion(JNIEnv*, jobject region); // Given the 'native' long held by the Rasterizer.java object, return a Loading core/jni/android/graphics/pdf/PdfRenderer.cpp +10 −9 Original line number Diff line number Diff line Loading @@ -243,19 +243,21 @@ static void renderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int destLeft, i } static void nativeRenderPage(JNIEnv* env, jclass thiz, jlong documentPtr, jlong pagePtr, jlong bitmapPtr, jint destLeft, jint destTop, jint destRight, jint destBottom, jobject jbitmap, jint destLeft, jint destTop, jint destRight, jint destBottom, jlong matrixPtr, jint renderMode) { FPDF_PAGE page = reinterpret_cast<FPDF_PAGE>(pagePtr); SkBitmap* skBitmap = reinterpret_cast<SkBitmap*>(bitmapPtr); SkMatrix* skMatrix = reinterpret_cast<SkMatrix*>(matrixPtr); skBitmap->lockPixels(); SkBitmap skBitmap; GraphicsJNI::getSkBitmap(env, jbitmap, &skBitmap); const int stride = skBitmap->width() * 4; SkAutoLockPixels alp(skBitmap); FPDF_BITMAP bitmap = FPDFBitmap_CreateEx(skBitmap->width(), skBitmap->height(), FPDFBitmap_BGRA, skBitmap->getPixels(), stride); const int stride = skBitmap.width() * 4; FPDF_BITMAP bitmap = FPDFBitmap_CreateEx(skBitmap.width(), skBitmap.height(), FPDFBitmap_BGRA, skBitmap.getPixels(), stride); if (!bitmap) { ALOGE("Erorr creating bitmap"); Loading @@ -278,8 +280,7 @@ static void nativeRenderPage(JNIEnv* env, jclass thiz, jlong documentPtr, jlong renderPageBitmap(bitmap, page, destLeft, destTop, destRight, destBottom, skMatrix, renderFlags); skBitmap->notifyPixelsChanged(); skBitmap->unlockPixels(); skBitmap.notifyPixelsChanged(); } static JNINativeMethod gPdfRenderer_Methods[] = { Loading @@ -287,7 +288,7 @@ static JNINativeMethod gPdfRenderer_Methods[] = { {"nativeClose", "(J)V", (void*) nativeClose}, {"nativeGetPageCount", "(J)I", (void*) nativeGetPageCount}, {"nativeScaleForPrinting", "(J)Z", (void*) nativeScaleForPrinting}, {"nativeRenderPage", "(JJJIIIIJI)V", (void*) nativeRenderPage}, {"nativeRenderPage", "(JJLandroid/graphics/Bitmap;IIIIJI)V", (void*) nativeRenderPage}, {"nativeOpenPageAndGetSize", "(JILandroid/graphics/Point;)J", (void*) nativeOpenPageAndGetSize}, {"nativeClosePage", "(J)V", (void*) nativeClosePage} }; Loading Loading
core/jni/android/graphics/BitmapFactory.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -261,7 +261,7 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding SkBitmap* outputBitmap = NULL; unsigned int existingBufferSize = 0; if (javaBitmap != NULL) { outputBitmap = GraphicsJNI::getSkBitmap(env, javaBitmap); outputBitmap = GraphicsJNI::getSkBitmapDeprecated(env, javaBitmap); if (outputBitmap->isImmutable()) { ALOGW("Unable to reuse an immutable bitmap as an image decoder target."); javaBitmap = NULL; Loading
core/jni/android/graphics/BitmapRegionDecoder.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -217,7 +217,7 @@ static jobject nativeDecodeRegion(JNIEnv* env, jobject, jlong brdHandle, if (tileBitmap != NULL) { // Re-use bitmap. bitmap = GraphicsJNI::getSkBitmap(env, tileBitmap); bitmap = GraphicsJNI::getSkBitmapDeprecated(env, tileBitmap); } if (bitmap == NULL) { bitmap = new SkBitmap; Loading
core/jni/android/graphics/Graphics.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -338,7 +338,7 @@ SkColorType GraphicsJNI::legacyBitmapConfigToColorType(jint legacyConfig) { return static_cast<SkColorType>(gConfig2ColorType[legacyConfig]); } SkBitmap* GraphicsJNI::getSkBitmap(JNIEnv* env, jobject bitmap) { SkBitmap* GraphicsJNI::getSkBitmapDeprecated(JNIEnv* env, jobject bitmap) { SkASSERT(env); SkASSERT(bitmap); SkASSERT(env->IsInstanceOf(bitmap, gBitmap_class)); Loading @@ -348,6 +348,19 @@ SkBitmap* GraphicsJNI::getSkBitmap(JNIEnv* env, jobject bitmap) { return b; } void GraphicsJNI::getSkBitmap(JNIEnv* env, jobject bitmap, SkBitmap* outBitmap) { // TODO: We have to copy from the existing bitmap due to rowBytes not // being updated on the SkPixelRef at reconfigure time. This is a short term // problem that will be fixed with the specialized wrapper *outBitmap = *getSkBitmapDeprecated(env, bitmap); } SkPixelRef* GraphicsJNI::getSkPixelRef(JNIEnv* env, jobject bitmap) { jlong bitmapHandle = env->GetLongField(bitmap, gBitmap_skBitmapPtr); SkBitmap* b = reinterpret_cast<SkBitmap*>(bitmapHandle); return b->pixelRef(); } SkColorType GraphicsJNI::getNativeBitmapColorType(JNIEnv* env, jobject jconfig) { SkASSERT(env); if (NULL == jconfig) { Loading
core/jni/android/graphics/GraphicsJNI.h +3 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,9 @@ public: static void point_to_jpointf(const SkPoint& point, JNIEnv*, jobject jpointf); static android::Canvas* getNativeCanvas(JNIEnv*, jobject canvas); static SkBitmap* getSkBitmap(JNIEnv*, jobject bitmap); static SkBitmap* getSkBitmapDeprecated(JNIEnv*, jobject bitmap); static void getSkBitmap(JNIEnv*, jobject bitmap, SkBitmap* outBitmap); static SkPixelRef* getSkPixelRef(JNIEnv*, jobject bitmap); static SkRegion* getNativeRegion(JNIEnv*, jobject region); // Given the 'native' long held by the Rasterizer.java object, return a Loading
core/jni/android/graphics/pdf/PdfRenderer.cpp +10 −9 Original line number Diff line number Diff line Loading @@ -243,19 +243,21 @@ static void renderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int destLeft, i } static void nativeRenderPage(JNIEnv* env, jclass thiz, jlong documentPtr, jlong pagePtr, jlong bitmapPtr, jint destLeft, jint destTop, jint destRight, jint destBottom, jobject jbitmap, jint destLeft, jint destTop, jint destRight, jint destBottom, jlong matrixPtr, jint renderMode) { FPDF_PAGE page = reinterpret_cast<FPDF_PAGE>(pagePtr); SkBitmap* skBitmap = reinterpret_cast<SkBitmap*>(bitmapPtr); SkMatrix* skMatrix = reinterpret_cast<SkMatrix*>(matrixPtr); skBitmap->lockPixels(); SkBitmap skBitmap; GraphicsJNI::getSkBitmap(env, jbitmap, &skBitmap); const int stride = skBitmap->width() * 4; SkAutoLockPixels alp(skBitmap); FPDF_BITMAP bitmap = FPDFBitmap_CreateEx(skBitmap->width(), skBitmap->height(), FPDFBitmap_BGRA, skBitmap->getPixels(), stride); const int stride = skBitmap.width() * 4; FPDF_BITMAP bitmap = FPDFBitmap_CreateEx(skBitmap.width(), skBitmap.height(), FPDFBitmap_BGRA, skBitmap.getPixels(), stride); if (!bitmap) { ALOGE("Erorr creating bitmap"); Loading @@ -278,8 +280,7 @@ static void nativeRenderPage(JNIEnv* env, jclass thiz, jlong documentPtr, jlong renderPageBitmap(bitmap, page, destLeft, destTop, destRight, destBottom, skMatrix, renderFlags); skBitmap->notifyPixelsChanged(); skBitmap->unlockPixels(); skBitmap.notifyPixelsChanged(); } static JNINativeMethod gPdfRenderer_Methods[] = { Loading @@ -287,7 +288,7 @@ static JNINativeMethod gPdfRenderer_Methods[] = { {"nativeClose", "(J)V", (void*) nativeClose}, {"nativeGetPageCount", "(J)I", (void*) nativeGetPageCount}, {"nativeScaleForPrinting", "(J)Z", (void*) nativeScaleForPrinting}, {"nativeRenderPage", "(JJJIIIIJI)V", (void*) nativeRenderPage}, {"nativeRenderPage", "(JJLandroid/graphics/Bitmap;IIIIJI)V", (void*) nativeRenderPage}, {"nativeOpenPageAndGetSize", "(JILandroid/graphics/Point;)J", (void*) nativeOpenPageAndGetSize}, {"nativeClosePage", "(J)V", (void*) nativeClosePage} }; Loading