SwOutline* strokeExportOutline(SwStroke* stroke, SwMpool* mpool, unsigned tid);
void strokeFree(SwStroke* stroke);
-bool imagePrepare(SwImage* image, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid, bool outline);
+bool imagePrepare(SwImage* image, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid);
bool imageGenRle(SwImage* image, TVG_UNUSED const Picture* pdata, const SwBBox& renderRegion, bool antiAlias);
void imageDelOutline(SwImage* image, SwMpool* mpool, uint32_t tid);
void imageReset(SwImage* image);
/************************************************************************/
-bool imagePrepare(SwImage* image, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid, bool outline)
+bool imagePrepare(SwImage* image, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid)
{
- if (outline || !mathRightAngle(transform)) {
- if (!_genOutline(image, transform, mpool, tid)) return false;
- return mathUpdateOutlineBBox(image->outline, clipRegion, renderRegion, false);
- //Fast Track, don't need outlines.
- } else {
- auto w = static_cast<float>(image->w);
- auto h = static_cast<float>(image->h);
-
- Point pt[4] = {{0 ,0}, {w, 0}, {w, h}, {0, h}};
- for (int i = 0; i < 4; i++) mathMultiply(&pt[i], transform);
-
- auto xMin = pt[0].x;
- auto xMax = pt[0].x;
- auto yMin = pt[0].y;
- auto yMax = pt[0].y;
-
- for (uint32_t i = 1; i < 4; ++i) {
- if (xMin > pt[i].x) xMin = pt[i].x;
- if (xMax < pt[i].x) xMax = pt[i].x;
- if (yMin > pt[i].y) yMin = pt[i].y;
- if (yMax < pt[i].y) yMax = pt[i].y;
- }
-
- renderRegion.min.x = static_cast<SwCoord>(xMin);
- renderRegion.max.x = static_cast<SwCoord>(round(xMax));
- renderRegion.min.y = static_cast<SwCoord>(yMin);
- renderRegion.max.y = static_cast<SwCoord>(round(yMax));
-
- return mathClipBBox(clipRegion, renderRegion);
- }
+ if (!_genOutline(image, transform, mpool, tid)) return false;
+ return mathUpdateOutlineBBox(image->outline, clipRegion, renderRegion, false);
}
if (!image.data || image.w == 0 || image.h == 0) goto end;
image.stride = image.w; //same, pixel buffer size.
- auto clipPath = (clips.count > 0) ? true : false;
+ if (!imagePrepare(&image, transform, clipRegion, bbox, mpool, tid)) goto end;
- if (!imagePrepare(&image, transform, clipRegion, bbox, mpool, tid, clipPath)) goto end;
-
- if (clipPath) {
+ if (clips.count > 0) {
if (!imageGenRle(&image, pdata, bbox, false)) goto end;
if (image.rle) {
for (auto clip = clips.data; clip < (clips.data + clips.count); ++clip) {