[canvaskit] Fix CPU build
Change-Id: Ia8f3ba66e76664e6643685f93cada3d32beedf37 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298343 Reviewed-by: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
e7ad8c0d3b
commit
0615aec6fd
@ -1564,14 +1564,20 @@ EMSCRIPTEN_BINDINGS(Skia) {
|
|||||||
.function("makeSurface", optional_override([](SkSurface& self, SimpleImageInfo sii)->sk_sp<SkSurface> {
|
.function("makeSurface", optional_override([](SkSurface& self, SimpleImageInfo sii)->sk_sp<SkSurface> {
|
||||||
return self.makeSurface(toSkImageInfo(sii));
|
return self.makeSurface(toSkImageInfo(sii));
|
||||||
}), allow_raw_pointers())
|
}), allow_raw_pointers())
|
||||||
.function("width", &SkSurface::width)
|
#ifdef SK_GL
|
||||||
|
.function("reportBackendType", optional_override([](SkSurface& self)->std::string {
|
||||||
|
return self.getCanvas()->getGrContext() == nullptr ? "CPU" : "GPU";
|
||||||
|
}))
|
||||||
.function("sampleCnt", optional_override([](SkSurface& self)->int {
|
.function("sampleCnt", optional_override([](SkSurface& self)->int {
|
||||||
auto backendRT = self.getBackendRenderTarget(SkSurface::kFlushRead_BackendHandleAccess);
|
auto backendRT = self.getBackendRenderTarget(SkSurface::kFlushRead_BackendHandleAccess);
|
||||||
return (backendRT.isValid()) ? backendRT.sampleCnt() : 0;
|
return (backendRT.isValid()) ? backendRT.sampleCnt() : 0;
|
||||||
}))
|
}))
|
||||||
|
#else
|
||||||
.function("reportBackendType", optional_override([](SkSurface& self)->std::string {
|
.function("reportBackendType", optional_override([](SkSurface& self)->std::string {
|
||||||
return self.getCanvas()->getGrContext() == nullptr ? "CPU" : "GPU";
|
return "CPU";
|
||||||
}));
|
}))
|
||||||
|
#endif
|
||||||
|
.function("width", &SkSurface::width);
|
||||||
|
|
||||||
#ifndef SK_NO_FONTS
|
#ifndef SK_NO_FONTS
|
||||||
class_<SkTextBlob>("SkTextBlob")
|
class_<SkTextBlob>("SkTextBlob")
|
||||||
|
Loading…
Reference in New Issue
Block a user