105 sk_sp<SkSurface> backing_store) {
106 TRACE_EVENT0(
"flutter",
"AndroidSurfaceSoftware::PresentBackingStore");
107 if (!
IsValid() || backing_store ==
nullptr) {
112 if (!backing_store->peekPixels(&pixmap)) {
116 ANativeWindow_Buffer native_buffer;
117 if (ANativeWindow_lock(native_window_->handle(), &native_buffer,
nullptr)) {
124 SkImageInfo native_image_info = SkImageInfo::Make(
127 std::unique_ptr<SkCanvas> canvas = SkCanvas::MakeRasterDirect(
128 native_image_info, native_buffer.bits,
129 native_buffer.stride * SkColorTypeBytesPerPixel(
color_type));
133 if (bitmap.installPixels(pixmap)) {
134 canvas->drawImageRect(
136 SkRect::MakeIWH(native_buffer.width, native_buffer.height),
137 SkSamplingOptions());
142 ANativeWindow_unlockAndPost(native_window_->handle());
155 const std::shared_ptr<PlatformViewAndroidJNI>& jni_facade) {
156 native_window_ = std::move(
window);
157 if (!(native_window_ && native_window_->IsValid())) {
160 int32_t window_format = ANativeWindow_getFormat(native_window_->handle());
161 if (window_format < 0) {
164 if (!GetSkColorType(window_format, &target_color_type_,
165 &target_alpha_type_)) {