sw_engine: fastTrack with clips

After 362d2df the fastTrack cases were applied even for shapes with clips.
These changes fixed this - the check whether a shape is a rect should be done
only if it has no clips.
This commit is contained in:
Mira Grudzinska 2021-11-01 14:10:40 +01:00 committed by Hermet Park
parent 3b2e1f4291
commit 26f99372b0
3 changed files with 11 additions and 11 deletions

View file

@ -304,9 +304,9 @@ bool mathMultiply(const Matrix* lhs, Matrix* rhs);
bool mathIdentity(const Matrix* m);
void shapeReset(SwShape* shape);
bool shapePrepare(SwShape* shape, const Shape* sdata, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid);
bool shapePrepare(SwShape* shape, const Shape* sdata, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid, bool hasComposite);
bool shapePrepared(const SwShape* shape);
bool shapeGenRle(SwShape* shape, const Shape* sdata, bool antiAlias, bool hasComposite);
bool shapeGenRle(SwShape* shape, const Shape* sdata, bool antiAlias);
void shapeDelOutline(SwShape* shape, SwMpool* mpool, uint32_t tid);
void shapeResetStroke(SwShape* shape, const Shape* sdata, const Matrix* transform);
bool shapeGenStrokeRle(SwShape* shape, const Shape* sdata, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid);

View file

@ -91,7 +91,7 @@ struct SwShapeTask : SwTask
visibleFill = (alpha > 0 || sdata->fill());
if (visibleFill || visibleStroke) {
shapeReset(&shape);
if (!shapePrepare(&shape, sdata, transform, clipRegion, bbox, mpool, tid)) goto err;
if (!shapePrepare(&shape, sdata, transform, clipRegion, bbox, mpool, tid, clips.count > 0 ? true : false)) goto err;
}
}
@ -107,7 +107,7 @@ struct SwShapeTask : SwTask
Thus it turns off antialising in that condition.
Also, it shouldn't be dash style. */
auto antiAlias = (strokeAlpha == 255 && sdata->strokeWidth() > 2 && sdata->strokeDash(nullptr) == 0) ? false : true;
if (!shapeGenRle(&shape, sdata, antiAlias, clips.count > 0 ? true : false)) goto err;
if (!shapeGenRle(&shape, sdata, antiAlias)) goto err;
}
if (auto fill = sdata->fill()) {
auto ctable = (flags & RenderUpdateFlag::Gradient) ? true : false;

View file

@ -380,7 +380,7 @@ static bool _fastTrack(const SwOutline* outline)
static bool _genOutline(SwShape* shape, const Shape* sdata, const Matrix* transform, SwMpool* mpool, unsigned tid)
static bool _genOutline(SwShape* shape, const Shape* sdata, const Matrix* transform, SwMpool* mpool, unsigned tid, bool hasComposite)
{
const PathCommand* cmds = nullptr;
auto cmdCnt = sdata->pathCommands(&cmds);
@ -469,7 +469,7 @@ static bool _genOutline(SwShape* shape, const Shape* sdata, const Matrix* transf
outline->fillRule = sdata->fillRule();
shape->outline = outline;
shape->rect = _fastTrack(shape->outline);
shape->rect = (!hasComposite && _fastTrack(shape->outline));
return true;
}
@ -478,9 +478,9 @@ static bool _genOutline(SwShape* shape, const Shape* sdata, const Matrix* transf
/* External Class Implementation */
/************************************************************************/
bool shapePrepare(SwShape* shape, const Shape* sdata, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid)
bool shapePrepare(SwShape* shape, const Shape* sdata, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid, bool hasComposite)
{
if (!_genOutline(shape, sdata, transform, mpool, tid)) return false;
if (!_genOutline(shape, sdata, transform, mpool, tid, hasComposite)) return false;
if (!mathUpdateOutlineBBox(shape->outline, clipRegion, renderRegion, shape->rect)) return false;
//Keep it for Rasterization Region
@ -503,14 +503,14 @@ bool shapePrepared(const SwShape* shape)
}
bool shapeGenRle(SwShape* shape, TVG_UNUSED const Shape* sdata, bool antiAlias, bool hasComposite)
bool shapeGenRle(SwShape* shape, TVG_UNUSED const Shape* sdata, bool antiAlias)
{
//FIXME: Should we draw it?
//Case: Stroke Line
//if (shape.outline->opened) return true;
//Case A: Fast Track Rectangle Drawing
if (!hasComposite && shape->rect) return true;
if (shape->rect) return true;
//Case B: Normal Shape RLE Drawing
if ((shape->rle = rleRender(shape->rle, shape->outline, shape->bbox, antiAlias))) return true;
@ -583,7 +583,7 @@ bool shapeGenStrokeRle(SwShape* shape, const Shape* sdata, const Matrix* transfo
//Normal Style stroke
} else {
if (!shape->outline) {
if (!_genOutline(shape, sdata, transform, mpool, tid)) return false;
if (!_genOutline(shape, sdata, transform, mpool, tid, false)) return false;
}
shapeOutline = shape->outline;
}