Lines Matching refs:bitmap
51 explicit BitmapWrapper(Bitmap* bitmap) in BitmapWrapper() argument
52 : mBitmap(bitmap) { } in BitmapWrapper()
68 Bitmap& bitmap() { in bitmap() function in android::BitmapWrapper
163 return mBitmapWrapper->bitmap().pixels(); in pixels()
174 namespace bitmap { namespace
199 jobject createBitmap(JNIEnv* env, Bitmap* bitmap, in createBitmap() argument
206 assert_premultiplied(bitmap->info(), isPremultiplied); in createBitmap()
207 bool fromMalloc = bitmap->pixelStorageType() == PixelStorageType::Heap; in createBitmap()
208 BitmapWrapper* bitmapWrapper = new BitmapWrapper(bitmap); in createBitmap()
210 bitmapWrapper->bitmap().setImmutable(); in createBitmap()
213 reinterpret_cast<jlong>(bitmapWrapper), bitmap->width(), bitmap->height(), density, in createBitmap()
224 LocalScopedBitmap bitmap(bitmapHandle); in toSkBitmap() local
225 bitmap->getSkBitmap(outBitmap); in toSkBitmap()
230 return localBitmap->bitmap(); in toBitmap()
238 using namespace android::bitmap;
240 Bitmap* GraphicsJNI::getNativeBitmap(JNIEnv* env, jobject bitmap) { in getNativeBitmap() argument
242 SkASSERT(bitmap); in getNativeBitmap()
243 SkASSERT(env->IsInstanceOf(bitmap, gBitmap_class)); in getNativeBitmap()
244 jlong bitmapHandle = env->GetLongField(bitmap, gBitmap_nativePtr); in getNativeBitmap()
246 return localBitmap.valid() ? &localBitmap->bitmap() : nullptr; in getNativeBitmap()
249 SkImageInfo GraphicsJNI::getBitmapInfo(JNIEnv* env, jobject bitmap, uint32_t* outRowBytes, in getBitmapInfo() argument
252 SkASSERT(bitmap); in getBitmapInfo()
253 SkASSERT(env->IsInstanceOf(bitmap, gBitmap_class)); in getBitmapInfo()
254 jlong bitmapHandle = env->GetLongField(bitmap, gBitmap_nativePtr); in getBitmapInfo()
285 int flags = android::bitmap::kBitmapCreateFlag_Premultiplied; in getPremulBitmapCreateFlags()
286 if (isMutable) flags |= android::bitmap::kBitmapCreateFlag_Mutable; in getPremulBitmapCreateFlags()
315 SkBitmap bitmap; in Bitmap_creator() local
316 bitmap.setInfo(SkImageInfo::Make(width, height, colorType, kPremul_SkAlphaType, in Bitmap_creator()
319 sk_sp<Bitmap> nativeBitmap = Bitmap::allocateHeapBitmap(&bitmap); in Bitmap_creator()
327 GraphicsJNI::SetPixels(env, jColors, offset, stride, 0, 0, width, height, &bitmap); in Bitmap_creator()
376 sk_sp<Bitmap> bitmap(Bitmap::allocateHardwareBitmap(src)); in Bitmap_copy() local
377 if (!bitmap.get()) { in Bitmap_copy()
380 return createBitmap(env, bitmap.release(), getPremulBitmapCreateFlags(isMutable)); in Bitmap_copy()
390 auto bitmap = allocator.getStorageObjAndReset(); in Bitmap_copy() local
391 return createBitmap(env, bitmap, getPremulBitmapCreateFlags(isMutable)); in Bitmap_copy()
401 auto bitmap = allocator.getStorageObjAndReset(); in Bitmap_copyAshmemImpl() local
402 bitmap->setImmutable(); in Bitmap_copyAshmemImpl()
403 return bitmap; in Bitmap_copyAshmemImpl()
410 auto bitmap = Bitmap_copyAshmemImpl(env, src, dstCT); in Bitmap_copyAshmem() local
411 jobject ret = createBitmap(env, bitmap, getPremulBitmapCreateFlags(false)); in Bitmap_copyAshmem()
419 auto bitmap = Bitmap_copyAshmemImpl(env, src, dstCT); in Bitmap_copyAshmemConfig() local
420 jobject ret = createBitmap(env, bitmap, getPremulBitmapCreateFlags(false)); in Bitmap_copyAshmemConfig()
424 static void Bitmap_destruct(BitmapWrapper* bitmap) { in Bitmap_destruct() argument
425 delete bitmap; in Bitmap_destruct()
433 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_recycle() local
434 bitmap->freePixels(); in Bitmap_recycle()
439 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_reconfigure() local
440 bitmap->assertValid(); in Bitmap_reconfigure()
448 if (requestedSize > bitmap->getAllocationByteCount()) { in Bitmap_reconfigure()
454 if (bitmap->info().colorType() != kRGB_565_SkColorType in Bitmap_reconfigure()
455 && bitmap->info().alphaType() == kOpaque_SkAlphaType) { in Bitmap_reconfigure()
463 bitmap->bitmap().reconfigure(SkImageInfo::Make(width, height, colorType, alphaType, in Bitmap_reconfigure()
464 sk_ref_sp(bitmap->info().colorSpace()))); in Bitmap_reconfigure()
470 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_compress() local
471 if (!bitmap.valid()) { in Bitmap_compress()
481 return bitmap->bitmap().compress(fm, quality, strm.get()) ? JNI_TRUE : JNI_FALSE; in Bitmap_compress()
484 static inline void bitmapErase(SkBitmap bitmap, const SkColor4f& color, in bitmapErase() argument
489 SkCanvas canvas(bitmap); in bitmapErase()
494 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_erase() local
496 bitmap->getSkBitmap(&skBitmap); in Bitmap_erase()
502 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_eraseLong() local
504 bitmap->getSkBitmap(&skBitmap); in Bitmap_eraseLong()
512 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_rowBytes() local
513 return static_cast<jint>(bitmap->rowBytes()); in Bitmap_rowBytes()
517 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_config() local
518 if (bitmap->isHardware()) { in Bitmap_config()
521 return GraphicsJNI::colorTypeToLegacyBitmapConfig(bitmap->info().colorType()); in Bitmap_config()
525 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_getGenerationId() local
526 return static_cast<jint>(bitmap->getGenerationID()); in Bitmap_getGenerationId()
530 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_isPremultiplied() local
531 if (bitmap->info().alphaType() == kPremul_SkAlphaType) { in Bitmap_isPremultiplied()
538 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_hasAlpha() local
539 return !bitmap->info().isOpaque() ? JNI_TRUE : JNI_FALSE; in Bitmap_hasAlpha()
544 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_setHasAlpha() local
546 bitmap->setAlphaType( in Bitmap_setHasAlpha()
549 bitmap->setAlphaType(kOpaque_SkAlphaType); in Bitmap_setHasAlpha()
555 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_setPremultiplied() local
556 if (!bitmap->info().isOpaque()) { in Bitmap_setPremultiplied()
558 bitmap->setAlphaType(kPremul_SkAlphaType); in Bitmap_setPremultiplied()
560 bitmap->setAlphaType(kUnpremul_SkAlphaType); in Bitmap_setPremultiplied()
566 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_hasMipMap() local
567 return bitmap->hasHardwareMipMap() ? JNI_TRUE : JNI_FALSE; in Bitmap_hasMipMap()
572 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_setHasMipMap() local
573 bitmap->setHasHardwareMipMap(hasMipMap); in Bitmap_setHasMipMap()
892 SkBitmap bitmap; in Bitmap_writeToParcel() local
895 bitmapWrapper->getSkBitmap(&bitmap); in Bitmap_writeToParcel()
897 p.writeInt32(!bitmap.isImmutable()); in Bitmap_writeToParcel()
898 p.writeInt32(bitmap.colorType()); in Bitmap_writeToParcel()
899 p.writeInt32(bitmap.alphaType()); in Bitmap_writeToParcel()
900 SkColorSpace* colorSpace = bitmap.colorSpace(); in Bitmap_writeToParcel()
906 p.writeInt32(bitmap.width()); in Bitmap_writeToParcel()
907 p.writeInt32(bitmap.height()); in Bitmap_writeToParcel()
908 p.writeInt32(bitmap.rowBytes()); in Bitmap_writeToParcel()
913 int fd = bitmapWrapper->bitmap().getAshmemFd(); in Bitmap_writeToParcel()
914 if (fd >= 0 && p.allowFds() && bitmap.isImmutable()) { in Bitmap_writeToParcel()
921 status = writeBlobFromFd(p.get(), bitmapWrapper->bitmap().getAllocationByteCount(), fd); in Bitmap_writeToParcel()
935 size_t size = bitmap.computeByteSize(); in Bitmap_writeToParcel()
936 status = writeBlob(p.get(), size, bitmap.getPixels(), bitmap.isImmutable()); in Bitmap_writeToParcel()
1015 SkBitmap bitmap; in Bitmap_getPixel() local
1016 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_getPixel()
1023 bitmap.readPixels(dstInfo, &dst, dstInfo.minRowBytes(), x, y); in Bitmap_getPixel()
1029 SkBitmap bitmap; in Bitmap_getColor() local
1030 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_getColor()
1033 1, 1, kRGBA_F16_SkColorType, kUnpremul_SkAlphaType, bitmap.refColorSpace()); in Bitmap_getColor()
1036 bitmap.readPixels(dstInfo, &dst, dstInfo.minRowBytes(), x, y); in Bitmap_getColor()
1043 SkBitmap bitmap; in Bitmap_getPixels() local
1044 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_getPixels()
1051 bitmap.readPixels(dstInfo, dst + offset, stride * 4, x, y); in Bitmap_getPixels()
1059 SkBitmap bitmap; in Bitmap_setPixel() local
1060 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_setPixel()
1068 bitmap.writePixels(srcPM, x, y); in Bitmap_setPixel()
1074 SkBitmap bitmap; in Bitmap_setPixels() local
1075 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_setPixels()
1077 x, y, width, height, &bitmap); in Bitmap_setPixels()
1082 SkBitmap bitmap; in Bitmap_copyPixelsToBuffer() local
1083 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_copyPixelsToBuffer()
1084 const void* src = bitmap.getPixels(); in Bitmap_copyPixelsToBuffer()
1090 memcpy(abp.pointer(), src, bitmap.computeByteSize()); in Bitmap_copyPixelsToBuffer()
1096 SkBitmap bitmap; in Bitmap_copyPixelsFromBuffer() local
1097 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_copyPixelsFromBuffer()
1098 void* dst = bitmap.getPixels(); in Bitmap_copyPixelsFromBuffer()
1103 memcpy(dst, abp.pointer(), bitmap.computeByteSize()); in Bitmap_copyPixelsFromBuffer()
1104 bitmap.notifyPixelsChanged(); in Bitmap_copyPixelsFromBuffer()
1122 bitmap0->bitmap().getSkBitmap(&bm0); in Bitmap_sameAs()
1123 bitmap1->bitmap().getSkBitmap(&bm1); in Bitmap_sameAs()
1166 android::uirenderer::renderthread::RenderProxy::prepareToDraw(bitmapHandle->bitmap()); in Bitmap_prepareToDraw()
1179 Bitmap& hwuiBitmap = bitmapHandle->bitmap(); in Bitmap_copyPreserveInternalConfig()
1188 sk_sp<Bitmap> bitmap = Bitmap::createFrom(src.info(), *src.pixelRef()); in Bitmap_copyPreserveInternalConfig() local
1189 return createBitmap(env, bitmap.release(), getPremulBitmapCreateFlags(false)); in Bitmap_copyPreserveInternalConfig()
1204 sk_sp<Bitmap> bitmap = Bitmap::createFrom(buffer, in Bitmap_wrapHardwareBufferBitmap() local
1206 if (!bitmap.get()) { in Bitmap_wrapHardwareBufferBitmap()
1210 return bitmap::createBitmap(env, bitmap.release(), getPremulBitmapCreateFlags(false)); in Bitmap_wrapHardwareBufferBitmap()
1225 Bitmap& bitmap = bitmapHandle->bitmap(); in Bitmap_getHardwareBuffer() local
1226 return AHardwareBuffer_toHardwareBuffer(env, bitmap.hardwareBuffer()); in Bitmap_getHardwareBuffer()
1236 return bitmapHolder->bitmap().isImmutable() ? JNI_TRUE : JNI_FALSE; in Bitmap_isImmutable()
1243 return bitmapHolder->bitmap().pixelStorageType() == PixelStorageType::Ashmem ? JNI_TRUE in Bitmap_isBackedByAshmem()
1251 return bitmapHolder->bitmap().setImmutable(); in Bitmap_setImmutable()