struct SwOutline
{
- uint32_t* cntrs; //the contour end points
- uint32_t cntrsCnt; //number of contours in glyph
- uint32_t reservedCntrsCnt;
SwPoint* pts; //the outline's points
- uint32_t ptsCnt; //number of points in the glyph
- uint32_t reservedPtsCnt;
+ uint16_t ptsCnt; //number of points in the glyph
+ uint16_t reservedPtsCnt;
+ uint16_t* cntrs; //the contour end points
+ uint16_t cntrsCnt; //number of contours in glyph
+ uint16_t reservedCntrsCnt;
uint8_t* types; //curve type
+ bool* closed; //opened or closed path?
FillRule fillRule;
- bool opened; //opened path?
};
struct SwSpan
};
struct SwRadial {
- float cx, cy;
+ float a11, a12, shiftX;
+ float a21, a22, shiftY;
+ float detSecDeriv;
float a;
- float inva;
};
union {
uint32_t* ctable;
FillSpread spread;
- float sx, sy;
bool translucent;
};
float sx, sy;
bool firstPt;
- bool openSubPath;
+ bool closedSubPath;
bool handleWideStrokes;
};
SwRleData* strokeRle = nullptr;
SwBBox bbox; //Keep it boundary without stroke region. Using for optimal filling.
- bool rect = false; //Fast Track: Othogonal rectangle?
+ bool fastTrack = false; //Fast Track: axis-aligned rectangle without any clips?
};
struct SwImage
SwOutline* outline = nullptr;
SwRleData* rle = nullptr;
uint32_t* data = nullptr;
- uint32_t w, h;
+ uint32_t w, h, stride;
+ int32_t ox = 0; //offset x
+ int32_t oy = 0; //offset y
+ float scale;
+
+ bool direct = false; //draw image directly (with offset)
+ bool scaled = false; //draw scaled image
};
struct SwBlender
{
uint32_t (*join)(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
uint32_t (*alpha)(uint32_t rgba);
+ uint32_t (*ialpha)(uint32_t rgba);
};
struct SwCompositor;
struct SwMpool
{
- SwOutline* outline = nullptr;
- SwOutline* strokeOutline = nullptr;
- unsigned allocSize = 0;
+ SwOutline* outline;
+ SwOutline* strokeOutline;
+ unsigned allocSize;
};
static inline SwCoord TO_SWCOORD(float val)
return (c1 |= t);
}
-static inline uint32_t ALPHA_MULTIPLY(uint32_t c, uint32_t a)
-{
- return ((c * a + 0xff) >> 8);
-}
-
static inline SwCoord HALF_STROKE(float width)
{
return TO_SWCOORD(width * 0.5f);
bool mathSmallCubic(const SwPoint* base, SwFixed& angleIn, SwFixed& angleMid, SwFixed& angleOut);
SwFixed mathMean(SwFixed angle1, SwFixed angle2);
SwPoint mathTransform(const Point* to, const Matrix* transform);
-bool mathUpdateOutlineBBox(const SwOutline* outline, const SwBBox& clipRegion, SwBBox& renderRegion);
+bool mathUpdateOutlineBBox(const SwOutline* outline, const SwBBox& clipRegion, SwBBox& renderRegion, bool fastTrack);
+bool mathClipBBox(const SwBBox& clipper, SwBBox& clipee);
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);
void strokeFree(SwStroke* stroke);
bool imagePrepare(SwImage* image, const Matrix* transform, const SwBBox& clipRegion, SwBBox& renderRegion, SwMpool* mpool, unsigned tid);
-bool imagePrepared(const SwImage* image);
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 rasterCompositor(SwSurface* surface);
bool rasterGradientShape(SwSurface* surface, SwShape* shape, unsigned id);
-bool rasterSolidShape(SwSurface* surface, SwShape* shape, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
+bool rasterShape(SwSurface* surface, SwShape* shape, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
bool rasterImage(SwSurface* surface, SwImage* image, const Matrix* transform, const SwBBox& bbox, uint32_t opacity);
bool rasterStroke(SwSurface* surface, SwShape* shape, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
bool rasterGradientStroke(SwSurface* surface, SwShape* shape, unsigned id);
bool rasterClear(SwSurface* surface);
void rasterRGBA32(uint32_t *dst, uint32_t val, uint32_t offset, int32_t len);
+void rasterUnpremultiply(SwSurface* surface);
#endif /* _TVG_SW_COMMON_H_ */