Lines Matching refs:bitmap
48 jobject Gainmap_extractFromBitmap(JNIEnv* env, const Bitmap& bitmap);
52 explicit BitmapWrapper(Bitmap* bitmap) in BitmapWrapper() argument
53 : mBitmap(bitmap) { } in BitmapWrapper()
69 Bitmap& bitmap() { in bitmap() function in android::BitmapWrapper
164 return mBitmapWrapper->bitmap().pixels(); in pixels()
175 namespace bitmap { namespace
200 jobject createBitmap(JNIEnv* env, Bitmap* bitmap, in createBitmap() argument
207 assert_premultiplied(bitmap->info(), isPremultiplied); in createBitmap()
208 bool fromMalloc = bitmap->pixelStorageType() == PixelStorageType::Heap; in createBitmap()
209 BitmapWrapper* bitmapWrapper = new BitmapWrapper(bitmap); in createBitmap()
211 bitmapWrapper->bitmap().setImmutable(); in createBitmap()
214 reinterpret_cast<jlong>(bitmapWrapper), bitmap->width(), bitmap->height(), density, in createBitmap()
225 LocalScopedBitmap bitmap(bitmapHandle); in toSkBitmap() local
226 bitmap->getSkBitmap(outBitmap); in toSkBitmap()
231 return localBitmap->bitmap(); in toBitmap()
239 using namespace android::bitmap;
241 Bitmap* GraphicsJNI::getNativeBitmap(JNIEnv* env, jobject bitmap) { in getNativeBitmap() argument
243 SkASSERT(bitmap); in getNativeBitmap()
244 SkASSERT(env->IsInstanceOf(bitmap, gBitmap_class)); in getNativeBitmap()
245 jlong bitmapHandle = env->GetLongField(bitmap, gBitmap_nativePtr); in getNativeBitmap()
247 return localBitmap.valid() ? &localBitmap->bitmap() : nullptr; in getNativeBitmap()
250 SkImageInfo GraphicsJNI::getBitmapInfo(JNIEnv* env, jobject bitmap, uint32_t* outRowBytes, in getBitmapInfo() argument
253 SkASSERT(bitmap); in getBitmapInfo()
254 SkASSERT(env->IsInstanceOf(bitmap, gBitmap_class)); in getBitmapInfo()
255 jlong bitmapHandle = env->GetLongField(bitmap, gBitmap_nativePtr); in getBitmapInfo()
286 int flags = android::bitmap::kBitmapCreateFlag_Premultiplied; in getPremulBitmapCreateFlags()
287 if (isMutable) flags |= android::bitmap::kBitmapCreateFlag_Mutable; in getPremulBitmapCreateFlags()
316 SkBitmap bitmap; in Bitmap_creator() local
317 bitmap.setInfo(SkImageInfo::Make(width, height, colorType, kPremul_SkAlphaType, in Bitmap_creator()
320 sk_sp<Bitmap> nativeBitmap = Bitmap::allocateHeapBitmap(&bitmap); in Bitmap_creator()
328 GraphicsJNI::SetPixels(env, jColors, offset, stride, 0, 0, width, height, &bitmap); in Bitmap_creator()
378 const Bitmap& original = bitmapHolder->bitmap(); in Bitmap_copy()
384 sk_sp<Bitmap> bitmap(Bitmap::allocateHardwareBitmap(src)); in Bitmap_copy() local
385 if (!bitmap.get()) { in Bitmap_copy()
391 bitmap->setGainmap(std::move(gm)); in Bitmap_copy()
394 return createBitmap(env, bitmap.release(), getPremulBitmapCreateFlags(isMutable)); in Bitmap_copy()
404 auto bitmap = allocator.getStorageObjAndReset(); in Bitmap_copy() local
408 const SkBitmap skSrcBitmap = original.gainmap()->bitmap->getSkBitmap(); in Bitmap_copy()
414 gainmap->bitmap = sk_sp<Bitmap>(destAllocator.getStorageObjAndReset()); in Bitmap_copy()
415 bitmap->setGainmap(std::move(gainmap)); in Bitmap_copy()
417 return createBitmap(env, bitmap, getPremulBitmapCreateFlags(isMutable)); in Bitmap_copy()
427 auto bitmap = allocator.getStorageObjAndReset(); in Bitmap_copyAshmemImpl() local
428 bitmap->setImmutable(); in Bitmap_copyAshmemImpl()
429 return bitmap; in Bitmap_copyAshmemImpl()
436 auto bitmap = Bitmap_copyAshmemImpl(env, src, dstCT); in Bitmap_copyAshmem() local
437 jobject ret = createBitmap(env, bitmap, getPremulBitmapCreateFlags(false)); in Bitmap_copyAshmem()
445 auto bitmap = Bitmap_copyAshmemImpl(env, src, dstCT); in Bitmap_copyAshmemConfig() local
446 jobject ret = createBitmap(env, bitmap, getPremulBitmapCreateFlags(false)); in Bitmap_copyAshmemConfig()
451 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_getAshmemFd() local
452 return (bitmap.valid()) ? bitmap->bitmap().getAshmemFd() : -1; in Bitmap_getAshmemFd()
455 static void Bitmap_destruct(BitmapWrapper* bitmap) { in Bitmap_destruct() argument
456 delete bitmap; in Bitmap_destruct()
464 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_recycle() local
465 bitmap->freePixels(); in Bitmap_recycle()
470 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_reconfigure() local
471 bitmap->assertValid(); in Bitmap_reconfigure()
479 if (requestedSize > bitmap->getAllocationByteCount()) { in Bitmap_reconfigure()
485 if (bitmap->info().colorType() != kRGB_565_SkColorType in Bitmap_reconfigure()
486 && bitmap->info().alphaType() == kOpaque_SkAlphaType) { in Bitmap_reconfigure()
494 bitmap->bitmap().reconfigure(SkImageInfo::Make(width, height, colorType, alphaType, in Bitmap_reconfigure()
495 sk_ref_sp(bitmap->info().colorSpace()))); in Bitmap_reconfigure()
501 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_compress() local
502 if (!bitmap.valid()) { in Bitmap_compress()
512 return bitmap->bitmap().compress(fm, quality, strm.get()) ? JNI_TRUE : JNI_FALSE; in Bitmap_compress()
515 static inline void bitmapErase(SkBitmap bitmap, const SkColor4f& color, in bitmapErase() argument
520 SkCanvas canvas(bitmap); in bitmapErase()
525 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_erase() local
527 bitmap->getSkBitmap(&skBitmap); in Bitmap_erase()
533 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_eraseLong() local
535 bitmap->getSkBitmap(&skBitmap); in Bitmap_eraseLong()
543 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_rowBytes() local
544 return static_cast<jint>(bitmap->rowBytes()); in Bitmap_rowBytes()
548 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_config() local
549 if (bitmap->isHardware()) { in Bitmap_config()
552 return GraphicsJNI::colorTypeToLegacyBitmapConfig(bitmap->info().colorType()); in Bitmap_config()
556 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_getGenerationId() local
557 return static_cast<jint>(bitmap->getGenerationID()); in Bitmap_getGenerationId()
561 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_isPremultiplied() local
562 if (bitmap->info().alphaType() == kPremul_SkAlphaType) { in Bitmap_isPremultiplied()
569 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_hasAlpha() local
570 return !bitmap->info().isOpaque() ? JNI_TRUE : JNI_FALSE; in Bitmap_hasAlpha()
575 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_setHasAlpha() local
577 bitmap->setAlphaType( in Bitmap_setHasAlpha()
580 bitmap->setAlphaType(kOpaque_SkAlphaType); in Bitmap_setHasAlpha()
586 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_setPremultiplied() local
587 if (!bitmap->info().isOpaque()) { in Bitmap_setPremultiplied()
589 bitmap->setAlphaType(kPremul_SkAlphaType); in Bitmap_setPremultiplied()
591 bitmap->setAlphaType(kUnpremul_SkAlphaType); in Bitmap_setPremultiplied()
597 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_hasMipMap() local
598 return bitmap->hasHardwareMipMap() ? JNI_TRUE : JNI_FALSE; in Bitmap_hasMipMap()
603 LocalScopedBitmap bitmap(bitmapHandle); in Bitmap_setHasMipMap() local
604 bitmap->setHasHardwareMipMap(hasMipMap); in Bitmap_setHasMipMap()
839 SkBitmap bitmap; in Bitmap_writeToParcel() local
842 bitmapWrapper->getSkBitmap(&bitmap); in Bitmap_writeToParcel()
844 p.writeInt32(!bitmap.isImmutable()); in Bitmap_writeToParcel()
845 p.writeInt32(bitmap.colorType()); in Bitmap_writeToParcel()
846 p.writeInt32(bitmap.alphaType()); in Bitmap_writeToParcel()
847 SkColorSpace* colorSpace = bitmap.colorSpace(); in Bitmap_writeToParcel()
853 p.writeInt32(bitmap.width()); in Bitmap_writeToParcel()
854 p.writeInt32(bitmap.height()); in Bitmap_writeToParcel()
855 p.writeInt32(bitmap.rowBytes()); in Bitmap_writeToParcel()
860 int fd = bitmapWrapper->bitmap().getAshmemFd(); in Bitmap_writeToParcel()
861 if (fd >= 0 && p.allowFds() && bitmap.isImmutable()) { in Bitmap_writeToParcel()
868 status = writeBlobFromFd(p.get(), bitmapWrapper->bitmap().getAllocationByteCount(), fd); in Bitmap_writeToParcel()
882 size_t size = bitmap.computeByteSize(); in Bitmap_writeToParcel()
883 status = writeBlob(p.get(), size, bitmap.getPixels(), bitmap.isImmutable()); in Bitmap_writeToParcel()
962 SkBitmap bitmap; in Bitmap_getPixel() local
963 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_getPixel()
970 bitmap.readPixels(dstInfo, &dst, dstInfo.minRowBytes(), x, y); in Bitmap_getPixel()
976 SkBitmap bitmap; in Bitmap_getColor() local
977 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_getColor()
980 1, 1, kRGBA_F16_SkColorType, kUnpremul_SkAlphaType, bitmap.refColorSpace()); in Bitmap_getColor()
983 bitmap.readPixels(dstInfo, &dst, dstInfo.minRowBytes(), x, y); in Bitmap_getColor()
990 SkBitmap bitmap; in Bitmap_getPixels() local
991 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_getPixels()
998 bitmap.readPixels(dstInfo, dst + offset, stride * 4, x, y); in Bitmap_getPixels()
1006 SkBitmap bitmap; in Bitmap_setPixel() local
1007 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_setPixel()
1015 bitmap.writePixels(srcPM, x, y); in Bitmap_setPixel()
1021 SkBitmap bitmap; in Bitmap_setPixels() local
1022 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_setPixels()
1024 x, y, width, height, &bitmap); in Bitmap_setPixels()
1029 SkBitmap bitmap; in Bitmap_copyPixelsToBuffer() local
1030 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_copyPixelsToBuffer()
1031 const void* src = bitmap.getPixels(); in Bitmap_copyPixelsToBuffer()
1037 memcpy(abp.pointer(), src, bitmap.computeByteSize()); in Bitmap_copyPixelsToBuffer()
1043 SkBitmap bitmap; in Bitmap_copyPixelsFromBuffer() local
1044 reinterpret_cast<BitmapWrapper*>(bitmapHandle)->getSkBitmap(&bitmap); in Bitmap_copyPixelsFromBuffer()
1045 void* dst = bitmap.getPixels(); in Bitmap_copyPixelsFromBuffer()
1050 memcpy(dst, abp.pointer(), bitmap.computeByteSize()); in Bitmap_copyPixelsFromBuffer()
1051 bitmap.notifyPixelsChanged(); in Bitmap_copyPixelsFromBuffer()
1069 bitmap0->bitmap().getSkBitmap(&bm0); in Bitmap_sameAs()
1070 bitmap1->bitmap().getSkBitmap(&bm1); in Bitmap_sameAs()
1113 android::uirenderer::renderthread::RenderProxy::prepareToDraw(bitmapHandle->bitmap()); in Bitmap_prepareToDraw()
1126 Bitmap& hwuiBitmap = bitmapHandle->bitmap(); in Bitmap_copyPreserveInternalConfig()
1135 sk_sp<Bitmap> bitmap = Bitmap::createFrom(src.info(), *src.pixelRef()); in Bitmap_copyPreserveInternalConfig() local
1136 return createBitmap(env, bitmap.release(), getPremulBitmapCreateFlags(false)); in Bitmap_copyPreserveInternalConfig()
1144 sk_sp<Bitmap> bitmap = Bitmap::createFrom(buffer, in Bitmap_wrapHardwareBufferBitmap() local
1146 if (!bitmap.get()) { in Bitmap_wrapHardwareBufferBitmap()
1150 return bitmap::createBitmap(env, bitmap.release(), getPremulBitmapCreateFlags(false)); in Bitmap_wrapHardwareBufferBitmap()
1165 Bitmap& bitmap = bitmapHandle->bitmap(); in Bitmap_getHardwareBuffer() local
1167 env, bitmap.hardwareBuffer()); in Bitmap_getHardwareBuffer()
1177 return bitmapHolder->bitmap().isImmutable() ? JNI_TRUE : JNI_FALSE; in Bitmap_isImmutable()
1184 return bitmapHolder->bitmap().pixelStorageType() == PixelStorageType::Ashmem ? JNI_TRUE in Bitmap_isBackedByAshmem()
1192 return bitmapHolder->bitmap().setImmutable(); in Bitmap_setImmutable()
1199 return bitmapHolder->bitmap().hasGainmap(); in Bitmap_hasGainmap()
1205 if (!bitmapHolder->bitmap().hasGainmap()) return nullptr; in Bitmap_extractGainmap()
1207 return Gainmap_extractFromBitmap(env, bitmapHolder->bitmap()); in Bitmap_extractGainmap()
1214 bitmapHolder->bitmap().setGainmap(sp<uirenderer::Gainmap>::fromExisting(gainmap)); in Bitmap_setGainmap()