748 {
750 return false;
751 }
752 const SkImageInfo& info =
bitmap->info();
753 if (kUnknown_SkColorType == info.colorType() || info.width() < 0 ||
754 info.height() < 0 || !info.validRowBytes(
bitmap->rowBytes())) {
755 return false;
756 }
757
762
763 std::shared_ptr<impeller::DeviceBuffer> device_buffer =
764 allocator_->CreateBuffer(descriptor);
765 if (!device_buffer) {
766 return false;
767 }
768
769 struct ImpellerPixelRef final : public SkPixelRef {
770 ImpellerPixelRef(int w, int h, void* s, size_t r)
771 : SkPixelRef(w,
h, s, r) {}
772
773 ~ImpellerPixelRef() override {}
774 };
775
776 auto pixel_ref = sk_sp<SkPixelRef>(
777 new ImpellerPixelRef(info.width(), info.height(),
778 device_buffer->OnGetContents(),
bitmap->rowBytes()));
779
780 bitmap->setPixelRef(std::move(pixel_ref), 0, 0);
781 buffer_ = std::move(device_buffer);
782 return true;
783}
std::shared_ptr< SkBitmap > bitmap
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder h