2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "vdrawhelper.h"
26 void drawRle(const VPoint &pos, const VRle &rle);
27 void drawRle(const VRle &rle, const VRle &clip);
30 VRasterBuffer mBuffer;
34 void VPainterImpl::drawRle(const VPoint &pos, const VRle &rle)
36 if (rle.empty()) return;
37 // mSpanData.updateSpanFunc();
39 if (!mSpanData.mUnclippedBlendFunc) return;
41 mSpanData.setPos(pos);
43 // do draw after applying clip.
44 rle.intersect(mSpanData.clipRect(), mSpanData.mUnclippedBlendFunc,
48 void VPainterImpl::drawRle(const VRle &rle, const VRle &clip)
50 if (rle.empty() || clip.empty()) return;
52 if (!mSpanData.mUnclippedBlendFunc) return;
54 rle.intersect(clip, mSpanData.mUnclippedBlendFunc,
66 mImpl = new VPainterImpl;
69 VPainter::VPainter(VBitmap *buffer)
71 mImpl = new VPainterImpl;
74 bool VPainter::begin(VBitmap *buffer)
76 mImpl->mBuffer.prepare(buffer);
77 mImpl->mSpanData.init(&mImpl->mBuffer);
78 // TODO find a better api to clear the surface
79 mImpl->mBuffer.clear();
82 void VPainter::end() {}
84 void VPainter::setBrush(const VBrush &brush)
86 mImpl->mSpanData.setup(brush);
89 void VPainter::drawRle(const VPoint &pos, const VRle &rle)
91 mImpl->drawRle(pos, rle);
94 void VPainter::drawRle(const VRle &rle, const VRle &clip)
96 mImpl->drawRle(rle, clip);
100 VRect VPainter::clipBoundingRect() const
102 return mImpl->mSpanData.mSystemClip;