2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the LGPL License, Version 2.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * https://www.gnu.org/licenses/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "vdrawhelper.h"
24 void drawRle(const VPoint &pos, const VRle &rle);
25 void drawRle(const VRle &rle, const VRle &clip);
28 VRasterBuffer mBuffer;
32 void VPainterImpl::drawRle(const VPoint &pos, const VRle &rle)
34 if (rle.empty()) return;
35 // mSpanData.updateSpanFunc();
37 if (!mSpanData.mUnclippedBlendFunc) return;
39 mSpanData.setPos(pos);
41 // do draw after applying clip.
42 rle.intersect(mSpanData.clipRect(), mSpanData.mUnclippedBlendFunc,
46 void VPainterImpl::drawRle(const VRle &rle, const VRle &clip)
48 if (rle.empty() || clip.empty()) return;
50 if (!mSpanData.mUnclippedBlendFunc) return;
52 rle.intersect(clip, mSpanData.mUnclippedBlendFunc,
64 mImpl = new VPainterImpl;
67 VPainter::VPainter(VBitmap *buffer)
69 mImpl = new VPainterImpl;
72 bool VPainter::begin(VBitmap *buffer)
74 mImpl->mBuffer.prepare(buffer);
75 mImpl->mSpanData.init(&mImpl->mBuffer);
76 // TODO find a better api to clear the surface
77 mImpl->mBuffer.clear();
80 void VPainter::end() {}
82 void VPainter::setBrush(const VBrush &brush)
84 mImpl->mSpanData.setup(brush);
87 void VPainter::drawRle(const VPoint &pos, const VRle &rle)
89 mImpl->drawRle(pos, rle);
92 void VPainter::drawRle(const VRle &rle, const VRle &clip)
94 mImpl->drawRle(rle, clip);
98 VRect VPainter::clipBoundingRect() const
100 return mImpl->mSpanData.mSystemClip;