Hi,
I'm using Skia in my Qt Quick application. The integration is done through the QSGRenderNode class which allows OpenGL commands to be rendered in paralled with the other Qt Quick content.
To render the content I'm using the following code which creates an SkSurface from the default framebuffer:
sk_sp<SkSurface> SkiaQuickPainter::MakeSkiaSurface(QOpenGLFramebufferObject *fbo)
{
sk_sp<SkSurface> surface = nullptr;
GrGLFramebufferInfo info;
info.fFBOID = fbo ? fbo->handle() : 0;
info.fFormat = GL_RGBA8;
auto surfaceFormat = QOpenGLContext::currentContext()->format();
float renderWidth = fbo ? fbo->width() : m_window->width();
float renderHeight = fbo ? fbo->height() : m_window->height();
GrBackendRenderTarget desc
(renderWidth,
renderHeight,
surfaceFormat.samples(),
surfaceFormat.stencilBufferSize(),
info);
sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
surface = SkSurface::MakeFromBackendRenderTarget(m_skiaContext.get(), desc, kBottomLeft_GrSurfaceOrigin, kRGBA_8888_SkColorType, srgb, nullptr, nullptr);
return surface;
}
Then before rendering the content I call
GrDirectContext::resetContext() and then call the skia commands. This works fine, but there is a problem. If I try to draw an SkPath (e.g. like this one https://fiddle.skia.org/c/@bezier_curves) skia seems to introduce rendering artifacts on the Qt Quick UI elements. For example, below the text of the button below (which is a Qt Quick button) appears pixelated (the yellow path is an SkPath)
The strange thing is that if for example I draw a SkPath composed of a single line, this rendering artifact is not produced (if I call lineTo more than once in a SkPath the issue appears). Example below (yellow is an SkPath)
At first I thought, this was because Skia was messing with the opengl state but I made sure that I always call QQuickWindow::resetOpenGLState() after I finish the rendering with Skia so that shouldn't be a problem.
I've tested this on Linux and Windows.
Any clue on what might be the problem and how to fix it?
--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/67be7835-db41-4982-8898-82b082a82617n%40googlegroups.com.