void fillFetchLinear(const SwFill* fill, uint32_t* dst, uint32_t y, uint32_t x, uint32_t offset, uint32_t len);
void fillFetchRadial(const SwFill* fill, uint32_t* dst, uint32_t y, uint32_t x, uint32_t len);
-SwRleData* rleRender(const SwOutline* outline, const SwBBox& bbox, const SwSize& clip, bool antiAlias);
+SwRleData* rleRender(SwRleData* rle, const SwOutline* outline, const SwBBox& bbox, const SwSize& clip, bool antiAlias);
void rleFree(SwRleData* rle);
+void rleReset(SwRleData* rle);
void rleClipPath(SwRleData *rle, const SwRleData *clip);
void rleClipRect(SwRleData *rle, const SwBBox* clip);
/* External Class Implementation */
/************************************************************************/
-SwRleData* rleRender(const SwOutline* outline, const SwBBox& bbox, const SwSize& clip, bool antiAlias)
+SwRleData* rleRender(SwRleData* rle, const SwOutline* outline, const SwBBox& bbox, const SwSize& clip, bool antiAlias)
{
constexpr auto RENDER_POOL_SIZE = 16384L;
constexpr auto BAND_SIZE = 40;
rw.bandShoot = 0;
rw.clip = clip;
rw.antiAlias = antiAlias;
- rw.rle = reinterpret_cast<SwRleData*>(calloc(1, sizeof(SwRleData)));
+
+ if (!rle) rw.rle = reinterpret_cast<SwRleData*>(calloc(1, sizeof(SwRleData)));
+ else rw.rle = rle;
//Generate RLE
Band bands[BAND_SIZE];
}
+void rleReset(SwRleData* rle)
+{
+ if (!rle) return;
+ rle->size = 0;
+}
+
+
void rleFree(SwRleData* rle)
{
if (!rle) return;
//Case A: Fast Track Rectangle Drawing
if (!hasComposite && (shape->rect = _fastTrack(shape->outline))) return true;
//Case B: Normale Shape RLE Drawing
- if ((shape->rle = rleRender(shape->outline, shape->bbox, clip, antiAlias))) return true;
+ if ((shape->rle = rleRender(shape->rle, shape->outline, shape->bbox, clip, antiAlias))) return true;
return false;
}
void shapeReset(SwShape* shape)
{
- rleFree(shape->rle);
- shape->rle = nullptr;
+ rleReset(shape->rle);
shape->rect = false;
_initBBox(shape->bbox);
}
if (!stroke) return;
strokeReset(stroke, sdata, transform);
-
- rleFree(shape->strokeRle);
- shape->strokeRle = nullptr;
+ rleReset(shape->strokeRle);
}
goto fail;
}
- shape->strokeRle = rleRender(strokeOutline, bbox, clip, true);
+ shape->strokeRle = rleRender(shape->strokeRle, strokeOutline, bbox, clip, true);
fail:
if (freeOutline) {
outline->pts = static_cast<SwPoint*>(realloc(outline->pts, sizeof(SwPoint) * ptsCnt));
outline->types = static_cast<uint8_t*>(realloc(outline->types, sizeof(uint8_t) * ptsCnt));
outline->reservedPtsCnt = ptsCnt;
- printf("pts(%d)\n", sizeof(SwPoint) * ptsCnt);
}
if (outline->reservedCntrsCnt < cntrsCnt) {
outline->cntrs = static_cast<uint32_t*>(realloc(outline->cntrs, sizeof(uint32_t) * cntrsCnt));
outline->reservedCntrsCnt = cntrsCnt;
- printf("cntrs(%d)\n", sizeof(SwPoint) * ptsCnt);
}
_exportBorderOutline(*stroke, outline, 0); //left