Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
surface.cc File Reference
#include "flutter/skwasm/surface.h"
#include <algorithm>
#include <emscripten/wasm_worker.h>
#include "flutter/display_list/display_list.h"
#include "flutter/display_list/image/dl_image.h"
#include "flutter/skwasm/live_objects.h"
#include "flutter/skwasm/skwasm_support.h"
#include "third_party/skia/include/core/SkColorSpace.h"

Go to the source code of this file.

Functions

SKWASM_EXPORT Skwasm::Surfacesurface_create ()
 
SKWASM_EXPORT unsigned long surface_getThreadId (Skwasm::Surface *surface)
 
SKWASM_EXPORT void surface_setCallbackHandler (Skwasm::Surface *surface, Skwasm::Surface::CallbackHandler *callback_handler)
 
SKWASM_EXPORT void surface_destroy (Skwasm::Surface *surface)
 
SKWASM_EXPORT void surface_dispose (Skwasm::Surface *surface)
 
SKWASM_EXPORT void surface_setResourceCacheLimitBytes (Skwasm::Surface *surface, int bytes)
 
SKWASM_EXPORT uint32_t surface_renderPictures (Skwasm::Surface *surface, flutter::DisplayList **pictures, int width, int height, int count)
 
SKWASM_EXPORT void surface_renderPicturesOnWorker (Skwasm::Surface *surface, sk_sp< flutter::DisplayList > *pictures, int width, int height, int picture_count, uint32_t callback_id, double raster_start)
 
SKWASM_EXPORT uint32_t surface_rasterizeImage (Skwasm::Surface *surface, flutter::DlImage *image, Skwasm::ImageByteFormat format)
 
SKWASM_EXPORT void surface_rasterizeImageOnWorker (Skwasm::Surface *surface, flutter::DlImage *image, Skwasm::ImageByteFormat format, uint32_t callback_id)
 
SKWASM_EXPORT void surface_onRenderComplete (Skwasm::Surface *surface, uint32_t callback_id, Skwasm::SkwasmObject image_bitmap)
 
SKWASM_EXPORT void surface_onRasterizeComplete (Skwasm::Surface *surface, SkData *data, uint32_t callback_id)
 
SKWASM_EXPORT bool skwasm_isMultiThreaded ()
 

Function Documentation

◆ skwasm_isMultiThreaded()

SKWASM_EXPORT bool skwasm_isMultiThreaded ( )

Definition at line 314 of file surface.cc.

314 {
315 return !skwasm_isSingleThreaded();
316}
bool skwasm_isSingleThreaded()

References skwasm_isSingleThreaded().

◆ surface_create()

SKWASM_EXPORT Skwasm::Surface * surface_create ( )

Definition at line 232 of file surface.cc.

232 {
234 return new Skwasm::Surface();
235}
uint32_t live_surface_count

References Skwasm::live_surface_count.

◆ surface_destroy()

SKWASM_EXPORT void surface_destroy ( Skwasm::Surface surface)

Definition at line 247 of file surface.cc.

247 {
249 // Dispatch to the worker
250 skwasm_dispatchDisposeSurface(surface->GetThreadId(), surface);
251}
VkSurfaceKHR surface
Definition main.cc:65
void skwasm_dispatchDisposeSurface(unsigned long thread_id, Skwasm::Surface *surface)

References Skwasm::live_surface_count, skwasm_dispatchDisposeSurface(), and surface.

◆ surface_dispose()

SKWASM_EXPORT void surface_dispose ( Skwasm::Surface surface)

Definition at line 253 of file surface.cc.

253 {
254 // This should be called directly only on the worker
255 surface->Dispose();
256}

References surface.

◆ surface_getThreadId()

SKWASM_EXPORT unsigned long surface_getThreadId ( Skwasm::Surface surface)

Definition at line 237 of file surface.cc.

237 {
238 return surface->GetThreadId();
239}

References surface.

◆ surface_onRasterizeComplete()

SKWASM_EXPORT void surface_onRasterizeComplete ( Skwasm::Surface surface,
SkData *  data,
uint32_t  callback_id 
)

Definition at line 308 of file surface.cc.

310 {
311 surface->OnRasterizeComplete(callback_id, data);
312}
std::shared_ptr< const fml::Mapping > data

References data, and surface.

◆ surface_onRenderComplete()

SKWASM_EXPORT void surface_onRenderComplete ( Skwasm::Surface surface,
uint32_t  callback_id,
Skwasm::SkwasmObject  image_bitmap 
)

Definition at line 302 of file surface.cc.

304 {
305 surface->OnRenderComplete(callback_id, image_bitmap);
306}

References surface.

◆ surface_rasterizeImage()

SKWASM_EXPORT uint32_t surface_rasterizeImage ( Skwasm::Surface surface,
flutter::DlImage image,
Skwasm::ImageByteFormat  format 
)

Definition at line 286 of file surface.cc.

288 {
289 return surface->RasterizeImage(image, format);
290}
FlutterVulkanImage * image

References format, image, and surface.

◆ surface_rasterizeImageOnWorker()

SKWASM_EXPORT void surface_rasterizeImageOnWorker ( Skwasm::Surface surface,
flutter::DlImage image,
Skwasm::ImageByteFormat  format,
uint32_t  callback_id 
)

Definition at line 292 of file surface.cc.

296 {
297 surface->RasterizeImageOnWorker(image, format, callback_id);
298}

References format, image, and surface.

◆ surface_renderPictures()

SKWASM_EXPORT uint32_t surface_renderPictures ( Skwasm::Surface surface,
flutter::DisplayList **  pictures,
int  width,
int  height,
int  count 
)

Definition at line 263 of file surface.cc.

267 {
268 return surface->RenderPictures(pictures, width, height, count);
269}
int32_t height
int32_t width

References height, surface, and width.

◆ surface_renderPicturesOnWorker()

SKWASM_EXPORT void surface_renderPicturesOnWorker ( Skwasm::Surface surface,
sk_sp< flutter::DisplayList > *  pictures,
int  width,
int  height,
int  picture_count,
uint32_t  callback_id,
double  raster_start 
)

Definition at line 271 of file surface.cc.

278 {
279 // This will release the pictures when they leave scope.
280 std::unique_ptr<sk_sp<flutter::DisplayList>[]> pictures_pointer =
281 std::unique_ptr<sk_sp<flutter::DisplayList>[]>(pictures);
282 surface->RenderPicturesOnWorker(pictures, width, height, picture_count,
283 callback_id, raster_start);
284}

References height, surface, and width.

◆ surface_setCallbackHandler()

SKWASM_EXPORT void surface_setCallbackHandler ( Skwasm::Surface surface,
Skwasm::Surface::CallbackHandler callback_handler 
)

Definition at line 241 of file surface.cc.

243 {
244 surface->SetCallbackHandler(callback_handler);
245}
CallbackHandler callback_handler

References callback_handler, and surface.

◆ surface_setResourceCacheLimitBytes()

SKWASM_EXPORT void surface_setResourceCacheLimitBytes ( Skwasm::Surface surface,
int  bytes 
)

Definition at line 258 of file surface.cc.

259 {
260 surface->SetResourceCacheLimit(bytes);
261}

References surface.