Antialiasing not working on GPU

48 views
Skip to first unread message

Inkling00

unread,
Jun 29, 2024, 7:19:56 PMJun 29
to skia-discuss
Hello everyone. The antialiasing seems not to be working on a GPU context when drawing strokes: Immagine 2024-06-29 200602.png

It seems to happen only to stroke, and not to fill operations. Here's the code I use to initialize skia and to draw the rectangle:

sk_sp<const GrGLInterface> i = GrGLMakeNativeInterface();
    if(GrDirectContexts::MakeGL(i) != nullptr)
    {
        ctx = GrDirectContexts::MakeGL(i).release();  
    }
    GrGLFramebufferInfo info;
    info.fFBOID = 0;
    info.fFormat = GL_RGBA8;
    rt = GrBackendRenderTargets::MakeGL(w, h, 8, 0, info);
    // rt = GrBackendRenderTargets::MakeGL(300, h, 0, 0, info);
    SkColorType colorType = kRGBA_8888_SkColorType;
    s = SkSurfaces::WrapBackendRenderTarget(ctx, rt, kBottomLeft_GrSurfaceOrigin, colorType, nullptr, nullptr).release();
    canvas = s->getCanvas(); SkRRect rect = SkRRect::MakeRectXY(SkRect::MakeXYWH(x, y, w, h), border->getCornerRadius(), border->getCornerRadius());
                        SkPaint pnt;
                        pnt.setColor(brush->getBackgroundColor().get());
                        pnt.setStroke(false);
                        pnt.setAntiAlias(true);
                        painter->canvas->drawRRect(rect, pnt);
                        pnt.setColor(brush->getBorderColor().get());
                        pnt.setStroke(true);
                        pnt.setStrokeWidth(border->getThickness());
                        painter->canvas->drawRRect(rect, pnt); Thanks in advance.

Taublast

unread,
Jul 11, 2024, 9:02:26 AM (11 days ago) Jul 11
to skia-discuss
Where does "8" sample count come from? Maybe it's not supported by your specific hardware?

воскресенье, 30 июня 2024 г. в 02:19:56 UTC+3, lo.mat...@gmail.com:
Reply all
Reply to author
Forward
0 new messages