[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:
Kevin Lubick 2020-06-23 10:07:45 -04:00
parent e7ad8c0d3b
commit 0615aec6fd

View File

@ -1564,14 +1564,20 @@ EMSCRIPTEN_BINDINGS(Skia) {
.function("makeSurface", optional_override([](SkSurface& self, SimpleImageInfo sii)->sk_sp<SkSurface> {
return self.makeSurface(toSkImageInfo(sii));
}), 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 {
auto backendRT = self.getBackendRenderTarget(SkSurface::kFlushRead_BackendHandleAccess);
return (backendRT.isValid()) ? backendRT.sampleCnt() : 0;
}))
#else
.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
class_<SkTextBlob>("SkTextBlob")