Lines Matching defs:bitmap

345 android::Bitmap* GraphicsJNI::getBitmap(JNIEnv* env, jobject bitmap) {
347 SkASSERT(bitmap);
348 SkASSERT(env->IsInstanceOf(bitmap, gBitmap_class));
349 jlong bitmapHandle = env->GetLongField(bitmap, gBitmap_nativePtr);
355 void GraphicsJNI::getSkBitmap(JNIEnv* env, jobject bitmap, SkBitmap* outBitmap) {
356 getBitmap(env, bitmap)->getSkBitmap(outBitmap);
359 SkPixelRef* GraphicsJNI::refSkPixelRef(JNIEnv* env, jobject bitmap) {
360 return getBitmap(env, bitmap)->refPixelRef();
397 // Assert that bitmap's SkAlphaType is consistent with isPremultiplied.
409 jobject GraphicsJNI::createBitmap(JNIEnv* env, android::Bitmap* bitmap,
416 assert_premultiplied(bitmap->info(), isPremultiplied);
419 reinterpret_cast<jlong>(bitmap), bitmap->javaByteArray(),
420 bitmap->width(), bitmap->height(), density, isMutable, isPremultiplied,
442 jobject GraphicsJNI::createBitmapRegionDecoder(JNIEnv* env, SkBitmapRegionDecoder* bitmap)
444 SkASSERT(bitmap != NULL);
448 reinterpret_cast<jlong>(bitmap));
475 static bool computeAllocationSize(const SkBitmap& bitmap, size_t* size) {
476 int32_t rowBytes32 = SkToS32(bitmap.rowBytes());
477 int64_t bigSize = (int64_t)bitmap.height() * rowBytes32;
486 android::Bitmap* GraphicsJNI::allocateJavaPixelRef(JNIEnv* env, SkBitmap* bitmap,
488 const SkImageInfo& info = bitmap->info();
490 doThrowIAE(env, "unknown bitmap configuration");
495 if (!computeAllocationSize(*bitmap, &size)) {
499 // we must respect the rowBytes value already set on the bitmap instead of
501 const size_t rowBytes = bitmap->rowBytes();
517 wrapper->getSkBitmap(bitmap);
520 bitmap->lockPixels();
539 bool GraphicsJNI::allocatePixels(JNIEnv* env, SkBitmap* bitmap, SkColorTable* ctable) {
540 const SkImageInfo& info = bitmap->info();
542 doThrowIAE(env, "unknown bitmap configuration");
547 if (!computeAllocationSize(*bitmap, &size)) {
551 // we must respect the rowBytes value already set on the bitmap instead of
553 const size_t rowBytes = bitmap->rowBytes();
572 bitmap->setPixelRef(pr)->unref();
574 bitmap->lockPixels();
579 android::Bitmap* GraphicsJNI::allocateAshmemPixelRef(JNIEnv* env, SkBitmap* bitmap,
583 const SkImageInfo& info = bitmap->info();
585 doThrowIAE(env, "unknown bitmap configuration");
590 if (!computeAllocationSize(*bitmap, &size)) {
594 // we must respect the rowBytes value already set on the bitmap instead of
596 const size_t rowBytes = bitmap->rowBytes();
599 fd = ashmem_create_region("bitmap", size);
617 wrapper->getSkBitmap(bitmap);
620 bitmap->lockPixels();
625 android::Bitmap* GraphicsJNI::mapAshmemPixelRef(JNIEnv* env, SkBitmap* bitmap,
627 const SkImageInfo& info = bitmap->info();
629 doThrowIAE(env, "unknown bitmap configuration");
642 // we must respect the rowBytes value already set on the bitmap instead of
644 const size_t rowBytes = bitmap->rowBytes();
647 wrapper->getSkBitmap(bitmap);
649 bitmap->pixelRef()->setImmutable();
653 bitmap->lockPixels();
671 bool JavaPixelAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) {
674 mStorage = GraphicsJNI::allocateJavaPixelRef(env, bitmap, ctable);
690 bool RecyclingClippingPixelAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) {
691 // Ensure that the caller did not pass in a NULL bitmap to the constructor or this
694 LOG_ALWAYS_FATAL_IF(!bitmap);
695 mSkiaBitmap = bitmap;
698 // compatibility, the original color type of the recycled bitmap must be maintained.
699 if (mRecycledBitmap->info().colorType() != bitmap->colorType()) {
703 // The Skia bitmap specifies the width and height needed by the decoder.
704 // mRecycledBitmap specifies the width and height of the bitmap that we
707 const int maxWidth = SkTMax(bitmap->width(), mRecycledBitmap->info().width());
708 const int maxHeight = SkTMax(bitmap->height(), mRecycledBitmap->info().height());
709 const SkImageInfo maxInfo = bitmap->info().makeWH(maxWidth, maxHeight);
720 // This call will give the bitmap the same pixelRef as mRecycledBitmap.
721 bitmap->setPixelRef(mRecycledBitmap->refPixelRef())->unref();
723 // Make sure that the recycled bitmap has the correct alpha type.
724 mRecycledBitmap->setAlphaType(bitmap->alphaType());
726 bitmap->notifyPixelsChanged();
727 bitmap->lockPixels();
743 return heapAllocator.allocPixelRef(bitmap, ctable);
779 bool AshmemPixelAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) {
781 mStorage = GraphicsJNI::allocateAshmemPixelRef(env, bitmap, ctable);