Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_canvas_updates_compressor.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
10{
11 const int levelOfDetail = info->levelOfDetail();
12 const QRect newUpdateRect = info->dirtyImageRect();
13 if (newUpdateRect.isEmpty()) return false;
14
15 QMutexLocker l(&m_mutex);
16
17 if (info->canBeCompressed()) {
18 KisUpdateInfoList::iterator it = m_updatesList.begin();
19 while (it != m_updatesList.end()) {
20 if ((*it)->canBeCompressed() &&
21 levelOfDetail == (*it)->levelOfDetail() &&
22 newUpdateRect.contains((*it)->dirtyImageRect())) {
23
29 it = m_updatesList.erase(it);
30 } else {
31 ++it;
32 }
33 }
34 }
35
36 m_updatesList.append(info);
37
38 return m_updatesList.size() <= 1;
39}
40
42{
43 KIS_SAFE_ASSERT_RECOVER(list.isEmpty()) { list.clear(); }
44
45 QMutexLocker l(&m_mutex);
46 m_updatesList.swap(list);
47}
bool putUpdateInfo(KisUpdateInfoSP info)
void takeUpdateInfo(KisUpdateInfoList &list)
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126