@@ -893,13 +893,14 @@ class Canvas(SceneNode):
893893 if not linear or colorbits not in COLOR_FORMATS:
894894 colorbits = 8
895895 if resized or colorbits != self ._colorbits or linear != self ._linear:
896- depth = COLOR_FORMATS[colorbits]
897- skia_colortype = TextureFormatColorType[depth .moderngl_dtype][1 ]
898- internal_format = None if linear else GL_SRGB8_ALPHA8
896+ color_format = COLOR_FORMATS[colorbits]
897+ skia_colortype = TextureFormatColorType[color_format .moderngl_dtype][1 ]
898+ internal_format = color_format.gl_format if linear else GL_SRGB8_ALPHA8
899899 self ._colorspace = skia.ColorSpace.MakeSRGBLinear() if linear else skia.ColorSpace.MakeSRGB()
900- self ._texture = self .glctx.texture((self .width, self .height), 4 , dtype = depth .moderngl_dtype, internal_format = internal_format)
900+ self ._texture = self .glctx.texture((self .width, self .height), 4 , dtype = color_format .moderngl_dtype, internal_format = internal_format)
901901 self ._framebuffer = self .glctx.framebuffer(color_attachments = (self ._texture,))
902- backend_render_target = skia.GrBackendRenderTarget(self .width, self .height, 0 , 0 , skia.GrGLFramebufferInfo(self ._framebuffer.glo, depth.gl_format))
902+ backend_render_target = skia.GrBackendRenderTarget(self .width, self .height, 0 , 0 ,
903+ skia.GrGLFramebufferInfo(self ._framebuffer.glo, color_format.gl_format))
903904 self ._surface = skia.Surface.MakeFromBackendRenderTarget(self ._graphics_context, backend_render_target, skia.kBottomLeft_GrSurfaceOrigin,
904905 skia_colortype, self ._colorspace)
905906 self ._canvas = self ._surface.getCanvas()
0 commit comments