renderer: code clean++

This commit is contained in:
Hermet Park 2025-04-22 00:13:40 +09:00
parent 4c3beb1cb1
commit 4cf68b75e5
5 changed files with 14 additions and 9 deletions

View file

@ -1357,7 +1357,7 @@ bool GlRenderer::renderShape(RenderData data)
}
};
if (sdata->rshape->stroke && sdata->rshape->stroke->strokeFirst) {
if (sdata->rshape->strokeFirst()) {
processStroke();
processFill();
} else {

View file

@ -85,7 +85,7 @@ struct SwShapeTask : SwTask
Additionally, the stroke style should not be dashed. */
bool antialiasing(float strokeWidth)
{
return strokeWidth < 2.0f || rshape->stroke->dash.count > 0 || rshape->stroke->strokeFirst || rshape->trimpath() || rshape->stroke->color.a < 255;
return strokeWidth < 2.0f || rshape->stroke->dash.count > 0 || rshape->stroke->first || rshape->trimpath() || rshape->stroke->color.a < 255;
}
float validStrokeWidth(bool clipper)
@ -418,7 +418,7 @@ bool SwRenderer::renderShape(RenderData data)
if (task->opacity == 0) return true;
//Main raster stage
if (task->rshape->stroke && task->rshape->stroke->strokeFirst) {
if (task->rshape->strokeFirst()) {
_renderStroke(task, surface, task->opacity);
_renderFill(task, surface, task->opacity);
} else {

View file

@ -150,7 +150,7 @@ struct RenderStroke
RenderTrimPath trim;
StrokeCap cap = StrokeCap::Square;
StrokeJoin join = StrokeJoin::Bevel;
bool strokeFirst = false;
bool first = false;
void operator=(const RenderStroke& rhs)
{
@ -174,7 +174,7 @@ struct RenderStroke
miterlimit = rhs.miterlimit;
cap = rhs.cap;
join = rhs.join;
strokeFirst = rhs.strokeFirst;
first = rhs.first;
trim = rhs.trim;
}
@ -213,6 +213,11 @@ struct RenderShape
return stroke->trim.valid();
}
bool strokeFirst() const
{
return (stroke && stroke->first) ? true : false;
}
float strokeWidth() const
{
if (!stroke) return 0;

View file

@ -320,13 +320,13 @@ struct ShapeImpl : Shape
bool strokeFirst()
{
if (!rs.stroke) return true;
return rs.stroke->strokeFirst;
return rs.stroke->first;
}
void strokeFirst(bool strokeFirst)
void strokeFirst(bool first)
{
if (!rs.stroke) rs.stroke = new RenderStroke();
rs.stroke->strokeFirst = strokeFirst;
rs.stroke->first = first;
impl.mark(RenderUpdateFlag::Stroke);
}

View file

@ -366,7 +366,7 @@ void WgRenderDataShape::updateAABB(const Matrix& tr) {
void WgRenderDataShape::updateMeshes(WgContext& context, const RenderShape &rshape, const Matrix& tr, WgGeometryBufferPool* pool)
{
releaseMeshes(context);
strokeFirst = rshape.stroke ? rshape.stroke->strokeFirst : false;
strokeFirst = rshape.strokeFirst();
// get object scale
float scale = std::max(std::min(length(Point{tr.e11 + tr.e12,tr.e21 + tr.e22}), 8.0f), 1.0f);