if (op.mode == VPainter::CompModeSrc) {
// inline for performance
while (count--) {
- uint *target =
- ((uint *)data->mRasterBuffer->scanLine(spans->y)) + spans->x;
+ uint *target = data->buffer(spans->x, spans->y);
if (spans->coverage == 255) {
memfill32(target, color, spans->len);
} else {
}
while (count--) {
- uint *target =
- ((uint *)data->mRasterBuffer->scanLine(spans->y)) + spans->x;
+ uint *target = data->buffer(spans->x, spans->y);
op.funcSolid(target, spans->len, color, spans->coverage);
++spans;
}
if (!op.srcFetch) return;
while (count--) {
- uint *target =
- ((uint *)data->mRasterBuffer->scanLine(spans->y)) + spans->x;
- int length = spans->len;
+ uint *target = data->buffer(spans->x, spans->y);
+ int length = spans->len;
while (length) {
int l = std::min(length, BLEND_GRADIENT_BUFFER_SIZE);
op.srcFetch(buffer, &op, data, spans->y, spans->x, l);
};
enum class Type { None, Solid, LinearGradient, RadialGradient };
- void updateSpanFunc();
- void init(VRasterBuffer *image);
- void setup(const VBrush & brush,
- VPainter::CompositionMode mode = VPainter::CompModeSrcOver,
- int alpha = 255);
- void setupMatrix(const VMatrix &matrix);
+ void updateSpanFunc();
+ void init(VRasterBuffer *image);
+ void setup(const VBrush & brush,
+ VPainter::CompositionMode mode = VPainter::CompModeSrcOver,
+ int alpha = 255);
+ void setupMatrix(const VMatrix &matrix);
+ void setPos(const VPoint &pos) { mPos = pos; }
+ VRect clipRect() const
+ {
+ return mSystemClip.translated(-mPos.x(), -mPos.y());
+ }
+
+ uint *buffer(int x, int y) const
+ {
+ return (uint *)(mRasterBuffer->scanLine(y + mPos.y())) + x + mPos.x();
+ }
VRasterBuffer * mRasterBuffer;
ProcessRleSpan mBlendFunc;
VRect mSystemClip;
VSpanData::Type mType;
std::shared_ptr<VSpanData::Pinnable> mCachedGradient;
+ VPoint mPos;
union {
uint32_t mSolid;
VGradientData mGradient;
if (!mSpanData.mUnclippedBlendFunc) return;
+ mSpanData.setPos(pos);
+
// do draw after applying clip.
- rle.intersect(mSpanData.mSystemClip, mSpanData.mUnclippedBlendFunc,
+ rle.intersect(mSpanData.clipRect(), mSpanData.mUnclippedBlendFunc,
&mSpanData);
}