File indexing completed on 2024-05-12 15:58:27

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "kis_mask_projection_plane.h"
0008 
0009 #include <QBitArray>
0010 #include <KoColorSpace.h>
0011 #include <KoChannelInfo.h>
0012 #include "kis_painter.h"
0013 #include "kis_mask.h"
0014 
0015 
0016 struct KisMaskProjectionPlane::Private
0017 {
0018     KisMask *mask;
0019 };
0020 
0021 
0022 KisMaskProjectionPlane::KisMaskProjectionPlane(KisMask *mask)
0023     : m_d(new Private)
0024 {
0025     m_d->mask = mask;
0026 }
0027 
0028 KisMaskProjectionPlane::~KisMaskProjectionPlane()
0029 {
0030 }
0031 
0032 QRect KisMaskProjectionPlane::recalculate(const QRect& rect, KisNodeSP filthyNode)
0033 {
0034     Q_UNUSED(filthyNode);
0035 
0036     KIS_ASSERT_RECOVER_NOOP(0 && "KisMaskProjectionPlane::recalculate() is not defined!");
0037 
0038     return rect;
0039 }
0040 
0041 void KisMaskProjectionPlane::apply(KisPainter *painter, const QRect &rect)
0042 {
0043     Q_UNUSED(painter);
0044     Q_UNUSED(rect);
0045 
0046     KIS_ASSERT_RECOVER_NOOP(0 && "KisMaskProjectionPlane::apply() is not defined!");
0047 }
0048 
0049 KisPaintDeviceList KisMaskProjectionPlane::getLodCapableDevices() const
0050 {
0051     // masks have no projection
0052     return KisPaintDeviceList();
0053 }
0054 
0055 QRect KisMaskProjectionPlane::needRect(const QRect &rect, KisNode::PositionToFilthy pos) const
0056 {
0057     return m_d->mask->needRect(rect, pos);
0058 }
0059 
0060 QRect KisMaskProjectionPlane::changeRect(const QRect &rect, KisNode::PositionToFilthy pos) const
0061 {
0062     return m_d->mask->changeRect(rect, pos);
0063 }
0064 
0065 QRect KisMaskProjectionPlane::accessRect(const QRect &rect, KisNode::PositionToFilthy pos) const
0066 {
0067     return m_d->mask->accessRect(rect, pos);
0068 }
0069 
0070 QRect KisMaskProjectionPlane::needRectForOriginal(const QRect &rect) const
0071 {
0072     return rect;
0073 }
0074 
0075 QRect KisMaskProjectionPlane::tightUserVisibleBounds() const
0076 {
0077     // masks don't have any internal rendering subtrees,
0078     // so just return the extent of the mask
0079     return m_d->mask->extent();
0080 }
0081