[canvaskit] Fallback to CPU more gracefully
This should also trim down code size since WebGL should never want GrGLMakeAssembledGLInterface only GrGLMakeAssembledGLESInterface Bug: skia: Change-Id: I9246d467847eeb91517c56075077b3e26c4ee336 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201223 Reviewed-by: Nathaniel Nifong <nifong@google.com>
This commit is contained in:
parent
512e38091c
commit
832787ac6c
@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Fixed
|
||||
- Extern bug in `CanvasKit.SkMatrix.invert`
|
||||
- Fallback to CPU now properly refreshes the canvas to get access to the
|
||||
CanvasRenderingContext2D.
|
||||
|
||||
## [0.5.0] - 2019-03-08
|
||||
|
||||
|
@ -249,5 +249,6 @@ ${EMCXX} \
|
||||
-s USE_FREETYPE=1 \
|
||||
-s USE_LIBPNG=1 \
|
||||
-s WARN_UNALIGNED=1 \
|
||||
-s USE_WEBGL2=0 \
|
||||
-s WASM=1 \
|
||||
-o $BUILD_DIR/canvaskit.js
|
||||
|
@ -79,7 +79,15 @@
|
||||
height || canvas.height);
|
||||
if (!surface) {
|
||||
SkDebug('falling back from GPU implementation to a SW based one');
|
||||
return CanvasKit.MakeSWCanvasSurface(arg);
|
||||
// we need to throw away the old canvas (which was locked to
|
||||
// a webGL context) and create a new one so we can
|
||||
var newCanvas = canvas.cloneNode(true);
|
||||
var parent = canvas.parentNode;
|
||||
parent.replaceChild(newCanvas, canvas);
|
||||
// add a class so the user can detect that it was replaced.
|
||||
newCanvas.classList.add('ck-replaced');
|
||||
|
||||
return CanvasKit.MakeSWCanvasSurface(newCanvas);
|
||||
}
|
||||
return surface;
|
||||
};
|
||||
|
@ -16,6 +16,9 @@
|
||||
#define GET_EGL_PROC_SUFFIX(F, S) functions->fEGL##F = (GrEGL##F##Fn*)get(ctx, "egl" #F #S)
|
||||
|
||||
sk_sp<const GrGLInterface> GrGLMakeAssembledInterface(void *ctx, GrGLGetProc get) {
|
||||
#if IS_WEBGL==1
|
||||
return GrGLMakeAssembledGLESInterface(ctx, get);
|
||||
#else
|
||||
GET_PROC_LOCAL(GetString);
|
||||
if (nullptr == GetString) {
|
||||
return nullptr;
|
||||
@ -34,6 +37,7 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledInterface(void *ctx, GrGLGetProc get
|
||||
return GrGLMakeAssembledGLInterface(ctx, get);
|
||||
}
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void get_egl_query_and_display(GrEGLQueryStringFn** queryString, GrEGLDisplay* display,
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "SkTSearch.h"
|
||||
#include "SkTSort.h"
|
||||
|
||||
#if IS_WEBGL
|
||||
#if IS_WEBGL==1
|
||||
static constexpr bool kIsWebGL = true;
|
||||
#else
|
||||
static constexpr bool kIsWebGL = false;
|
||||
|
Loading…
Reference in New Issue
Block a user