#include <surface.h>
Definition at line 54 of file surface.h.
◆ CallbackHandler
◆ Surface()
Definition at line 16 of file surface.cpp.
16 {
17 assert(emscripten_is_main_browser_thread());
18
19 pthread_attr_t attr;
20 pthread_attr_init(&attr);
21 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
22
23 pthread_create(
24 &_thread, &attr,
25 [](void* context) -> void* {
26 static_cast<Surface*
>(context)->_runWorker();
27 return nullptr;
28 },
29 this);
30
32
33
35}
void skwasm_syncTimeOriginForThread(pthread_t threadId)
void skwasm_registerMessageListener(pthread_t threadId)
◆ createTextureSourceWrapper()
Definition at line 74 of file surface.cpp.
75 {
76 return std::unique_ptr<TextureSourceWrapper>(
78}
◆ dispose()
void Surface::dispose |
( |
| ) |
|
Definition at line 38 of file surface.cpp.
38 {
39 assert(emscripten_is_main_browser_thread());
40 emscripten_dispatch_to_thread(_thread, EM_FUNC_SIG_VI,
41 reinterpret_cast<void*>(fDispose), nullptr,
42 this);
43}
◆ getThreadId()
unsigned long Skwasm::Surface::getThreadId |
( |
| ) |
|
|
inline |
◆ onRenderComplete()
void Surface::onRenderComplete |
( |
uint32_t |
callbackId, |
|
|
SkwasmObject |
imageBitmap |
|
) |
| |
Definition at line 210 of file surface.cpp.
210 {
211 assert(emscripten_is_main_browser_thread());
212 _callbackHandler(callbackId, nullptr, imageBitmap);
213}
◆ rasterizeImage()
Definition at line 63 of file surface.cpp.
63 {
64 assert(emscripten_is_main_browser_thread());
65 uint32_t callbackId = ++_currentCallbackId;
67
68 emscripten_dispatch_to_thread(_thread, EM_FUNC_SIG_VIIII,
69 reinterpret_cast<void*>(fRasterizeImage),
71 return callbackId;
72}
uint32_t uint32_t * format
sk_sp< const SkImage > image
◆ renderPictures()
uint32_t Surface::renderPictures |
( |
SkPicture ** |
picture, |
|
|
int |
count |
|
) |
| |
Definition at line 46 of file surface.cpp.
46 {
47 assert(emscripten_is_main_browser_thread());
48 uint32_t callbackId = ++_currentCallbackId;
49 std::unique_ptr<sk_sp<SkPicture>[]> picturePointers =
50 std::make_unique<sk_sp<SkPicture>[]>(
count);
53 }
54
55
56
58 callbackId);
59 return callbackId;
60}
sk_sp< T > sk_ref_sp(T *obj)
void skwasm_dispatchRenderPictures(unsigned long threadId, Skwasm::Surface *surface, sk_sp< SkPicture > *pictures, int count, uint32_t callbackId)
◆ renderPicturesOnWorker()
void Surface::renderPicturesOnWorker |
( |
sk_sp< SkPicture > * |
picture, |
|
|
int |
pictureCount, |
|
|
uint32_t |
callbackId, |
|
|
double |
rasterStart |
|
) |
| |
Definition at line 151 of file surface.cpp.
154 {
155
156
157 SkwasmObject imagePromiseArray = __builtin_wasm_ref_null_extern();
158 for (
int i = 0;
i < pictureCount;
i++) {
162 pictureRect.
roundOut(&roundedOutRect);
163 _resizeCanvasToFit(roundedOutRect.
width(), roundedOutRect.
height());
171 imagePromiseArray =
173 roundedOutRect.
height(), imagePromiseArray);
174 }
176}
constexpr SkColor SK_ColorTRANSPARENT
GrSemaphoresSubmitted flush(const GrFlushInfo &info)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
virtual SkRect cullRect() const =0
unsigned useCenter Optional< SkMatrix > matrix
sk_sp< const SkPicture > picture
void makeCurrent(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE handle)
SkwasmObject skwasm_captureImageBitmap(uint32_t contextHandle, int width, int height, SkwasmObject imagePromises)
void skwasm_resolveAndPostImages(Skwasm::Surface *surface, SkwasmObject imagePromises, double rasterStart, uint32_t callbackId)
__externref_t SkwasmObject
constexpr int32_t height() const
int32_t fTop
smaller y-axis bounds
constexpr int32_t width() const
int32_t fLeft
smaller x-axis bounds
void roundOut(SkIRect *dst) const
◆ setCallbackHandler()
Definition at line 81 of file surface.cpp.
81 {
82 assert(emscripten_is_main_browser_thread());
83 _callbackHandler = callbackHandler;
84}
The documentation for this class was generated from the following files: