Samsung / skia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rounded rect limitation if half of the strokewidth is greater than radius

suyambulingamrm opened this issue · comments

rounded rects are not drawn if half of the strokewidth is greater than its radius.

Simple snippet to re-produce the issue.
line_width = 9;
skia_paint->setStrokeWidth(line_width);
skia_canvas->drawRoundRect(rect, 4.0, 4.0, *(ctx->skia_paint).

Attached is the expected output and actual output when rounded rects of size 100,40 with radius 4.0 drawn with stroke width 9.

expected.
actual

Attaching the expected and actual outputs of caskbench-skia's roundedrect test also.
Rounded rects of size 100,40 with radius 4.0 are drawn at different x,y positions with stroke width ranging from 1-64. In actual output only roundedrects with stroke width <= 8 are drawn.
cairo-roundrect
skia-roundrect

The issue is observed in PC with mesa 9.1.2 and 10.0 drivers with egl surface.

Adding more observations,
It seems the roundedrect implementation is fine for all stroke widths. Skia uses a different flow to draw rounded rect if stroke width is greater than twice of radius.
It uses SWPathRender in that case. (./src/gpu/GrSoftwarePathRenderer.cpp onDrawPath() ). It fails while creating textures.
This issue is very much related to Issue #6 (#6) .

If fStencilbit is set to 0 and fSampleCount is set to 4. The scenario works fine.

Thanks,
Suyambu

Works fine with fSampleCount=4 and fStencilBit=8.
Closing the issue.