5#include "flutter/shell/platform/android/android_surface_software.h"
10#include "flutter/fml/logging.h"
11#include "flutter/fml/platform/android/jni_weak_ref.h"
12#include "flutter/fml/platform/android/scoped_java_ref.h"
13#include "flutter/fml/trace_event.h"
14#include "flutter/shell/platform/android/android_shell_holder.h"
15#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
24bool GetSkColorType(int32_t buffer_format,
27 switch (buffer_format) {
28 case WINDOW_FORMAT_RGB_565:
32 case WINDOW_FORMAT_RGBA_8888:
44 GetSkColorType(WINDOW_FORMAT_RGBA_8888, &target_color_type_,
72 std::make_unique<GPUSurfaceSoftware>(
this,
true );
83 TRACE_EVENT0(
"flutter",
"AndroidSurfaceSoftware::AcquireBackingStore");
88 if (sk_surface_ !=
nullptr &&
105 TRACE_EVENT0(
"flutter",
"AndroidSurfaceSoftware::PresentBackingStore");
106 if (!
IsValid() || backing_store ==
nullptr) {
115 ANativeWindow_Buffer native_buffer;
116 if (ANativeWindow_lock(native_window_->handle(), &native_buffer,
nullptr)) {
127 native_image_info, native_buffer.bits,
132 if (
bitmap.installPixels(pixmap)) {
133 canvas->drawImageRect(
141 ANativeWindow_unlockAndPost(native_window_->handle());
154 native_window_ = std::move(
window);
155 if (!(native_window_ && native_window_->IsValid())) {
158 int32_t window_format = ANativeWindow_getFormat(native_window_->handle());
159 if (window_format < 0) {
162 if (!GetSkColorType(window_format, &target_color_type_,
163 &target_alpha_type_)) {
@ kOpaque_SkAlphaType
pixel is opaque
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
SK_API int SkColorTypeBytesPerPixel(SkColorType ct)
static std::unique_ptr< SkCanvas > MakeRasterDirect(const SkImageInfo &info, void *pixels, size_t rowBytes, const SkSurfaceProps *props=nullptr)
static sk_sp< SkColorSpace > MakeSRGB()
bool peekPixels(SkPixmap *pixmap)
bool ResourceContextMakeCurrent() override
bool ResourceContextClearCurrent() override
bool PresentBackingStore(sk_sp< SkSurface > backing_store) override
Called by the platform when a frame has been rendered into the backing store and the platform must di...
sk_sp< SkSurface > AcquireBackingStore(const SkISize &size) override
Called when the GPU surface needs a new buffer to render a new frame into.
bool IsValid() const override
~AndroidSurfaceSoftware() override
bool OnScreenSurfaceResize(const SkISize &size) override
bool SetNativeWindow(fml::RefPtr< AndroidNativeWindow > window) override
void TeardownOnScreenContext() override
std::unique_ptr< Surface > CreateGPUSurface(GrDirectContext *gr_context) override
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect MakeIWH(int w, int h)
#define TRACE_EVENT0(category_group, name)