aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/GLFWTest/glfw_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/GLFWTest/glfw_main.cpp')
-rw-r--r--experimental/GLFWTest/glfw_main.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/experimental/GLFWTest/glfw_main.cpp b/experimental/GLFWTest/glfw_main.cpp
index e83abc522c..358fbb89bb 100644
--- a/experimental/GLFWTest/glfw_main.cpp
+++ b/experimental/GLFWTest/glfw_main.cpp
@@ -34,14 +34,22 @@ static void init_skia(int w, int h) {
GrGLFramebufferInfo framebufferInfo;
framebufferInfo.fFBOID = 0; // assume default framebuffer
+ // We are always using OpenGL and we use RGBA8 internal format for both RGBA and BGRA configs in
+ // OpenGL.
+ framebufferInfo.fFormat = GR_GL_RGBA8;
+ SkColorType colorType;
+ if (kRGBA_8888_GrPixelConfig == kSkia8888_GrPixelConfig) {
+ colorType = kRGBA_8888_SkColorType;
+ } else {
+ colorType = kBGRA_8888_SkColorType;
+ }
GrBackendRenderTarget backendRenderTarget(w, h,
0, // sample count
0, // stencil bits
- kSkia8888_GrPixelConfig,
framebufferInfo);
sSurface = SkSurface::MakeFromBackendRenderTarget(sContext, backendRenderTarget,
- kBottomLeft_GrSurfaceOrigin,
+ kBottomLeft_GrSurfaceOrigin, colortype,
nullptr, nullptr).release();
}