750 {
752 return false;
753 }
754 const SkImageInfo& info =
bitmap->info();
755 if (kUnknown_SkColorType == info.colorType() || info.width() < 0 ||
756 info.height() < 0 || !info.validRowBytes(
bitmap->rowBytes())) {
757 return false;
758 }
759
764
765 std::shared_ptr<impeller::DeviceBuffer> device_buffer =
766 allocator_->CreateBuffer(descriptor);
767 if (!device_buffer) {
768 return false;
769 }
770
771 struct ImpellerPixelRef final : public SkPixelRef {
772 ImpellerPixelRef(int w, int h, void* s, size_t r)
773 : SkPixelRef(w,
h, s, r) {}
774
775 ~ImpellerPixelRef() override {}
776 };
777
778 auto pixel_ref = sk_sp<SkPixelRef>(
779 new ImpellerPixelRef(info.width(), info.height(),
780 device_buffer->OnGetContents(),
bitmap->rowBytes()));
781
782 bitmap->setPixelRef(std::move(pixel_ref), 0, 0);
783 buffer_ = std::move(device_buffer);
784 return true;
785}
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