Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
wrappers.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SKWASM_WRAPPERS_H_
6#define FLUTTER_SKWASM_WRAPPERS_H_
7
8#include <emscripten/html5_webgl.h>
9
10#include "third_party/skia/include/core/SkCanvas.h"
11#include "third_party/skia/include/core/SkSurface.h"
12#include "third_party/skia/include/gpu/ganesh/GrDirectContext.h"
13#include "third_party/skia/modules/skparagraph/include/FontCollection.h"
14#include "third_party/skia/modules/skparagraph/include/TypefaceFontProvider.h"
15
16namespace Skwasm {
17
18using SkwasmObject = __externref_t;
19
21 EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context;
22 sk_sp<GrDirectContext> gr_context;
23 sk_sp<SkSurface> surface;
24};
25
26inline void makeCurrent(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE handle) {
27 if (!handle)
28 return;
29
30 int result = emscripten_webgl_make_context_current(handle);
31 if (result != EMSCRIPTEN_RESULT_SUCCESS) {
32 printf("make_context failed: %d", result);
33 }
34}
35
37 sk_sp<skia::textlayout::FontCollection> collection;
38 sk_sp<skia::textlayout::TypefaceFontProvider> provider;
39};
40
41} // namespace Skwasm
42
43#endif // FLUTTER_SKWASM_WRAPPERS_H_
__externref_t SkwasmObject
Definition wrappers.h:18
void makeCurrent(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE handle)
Definition wrappers.h:26
sk_sp< skia::textlayout::TypefaceFontProvider > provider
Definition wrappers.h:38
sk_sp< skia::textlayout::FontCollection > collection
Definition wrappers.h:37
sk_sp< SkSurface > surface
Definition wrappers.h:23
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context
Definition wrappers.h:21
sk_sp< GrDirectContext > gr_context
Definition wrappers.h:22