Flutter Engine
 
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_LIB_WEB_UI_SKWASM_WRAPPERS_H_
6#define FLUTTER_LIB_WEB_UI_SKWASM_WRAPPERS_H_
7
8#include <emscripten/html5_webgl.h>
9#include "third_party/skia/include/core/SkCanvas.h"
10#include "third_party/skia/include/core/SkSurface.h"
11#include "third_party/skia/modules/skparagraph/include/FontCollection.h"
12#include "third_party/skia/modules/skparagraph/include/TypefaceFontProvider.h"
13
14namespace Skwasm {
15
16using SkwasmObject = __externref_t;
17
19 EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context;
20 sk_sp<GrDirectContext> grContext;
21 sk_sp<SkSurface> surface;
22};
23
24inline void makeCurrent(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE handle) {
25 if (!handle)
26 return;
27
28 int result = emscripten_webgl_make_context_current(handle);
29 if (result != EMSCRIPTEN_RESULT_SUCCESS) {
30 printf("make_context failed: %d", result);
31 }
32}
33
35 sk_sp<skia::textlayout::FontCollection> collection;
36 sk_sp<skia::textlayout::TypefaceFontProvider> provider;
37};
38
39} // namespace Skwasm
40
41#endif // FLUTTER_LIB_WEB_UI_SKWASM_WRAPPERS_H_
__externref_t SkwasmObject
Definition wrappers.h:16
void makeCurrent(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE handle)
Definition wrappers.h:24
sk_sp< skia::textlayout::TypefaceFontProvider > provider
Definition wrappers.h:36
sk_sp< skia::textlayout::FontCollection > collection
Definition wrappers.h:35
sk_sp< GrDirectContext > grContext
Definition wrappers.h:20
sk_sp< SkSurface > surface
Definition wrappers.h:21
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context
Definition wrappers.h:19