614 {
615 if (!bitmap) {
616 return false;
617 }
618 const SkImageInfo& info = bitmap->info();
619 if (kUnknown_SkColorType == info.colorType() || info.width() < 0 ||
620 info.height() < 0 || !info.validRowBytes(bitmap->rowBytes())) {
621 return false;
622 }
623
626 descriptor.
size = ((bitmap->height() - 1) * bitmap->rowBytes()) +
627 (bitmap->width() * bitmap->bytesPerPixel());
628
629 std::shared_ptr<impeller::DeviceBuffer> device_buffer =
630 allocator_->CreateBuffer(descriptor);
631 if (!device_buffer) {
632 return false;
633 }
634
635 struct ImpellerPixelRef final : public SkPixelRef {
636 ImpellerPixelRef(int w, int h, void* s, size_t r)
637 : SkPixelRef(w,
h, s, r) {}
638
639 ~ImpellerPixelRef() override {}
640 };
641
642 auto pixel_ref = sk_sp<SkPixelRef>(
643 new ImpellerPixelRef(info.width(), info.height(),
644 device_buffer->OnGetContents(), bitmap->rowBytes()));
645
646 bitmap->setPixelRef(std::move(pixel_ref), 0, 0);
647 buffer_ = std::move(device_buffer);
648 return true;
649}
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