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

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_LAYER_PROJECTION_PLANE_H
0008 #define __KIS_LAYER_PROJECTION_PLANE_H
0009 
0010 #include "kis_abstract_projection_plane.h"
0011 
0012 #include <QScopedPointer>
0013 #include "krita_utils.h"
0014 
0015 /**
0016  * An implementation of the KisAbstractProjectionPlane interface for a
0017  * layer object
0018  */
0019 class KisLayerProjectionPlane : public KisAbstractProjectionPlane
0020 {
0021 public:
0022     KisLayerProjectionPlane(KisLayer *layer);
0023     ~KisLayerProjectionPlane() override;
0024 
0025     QRect recalculate(const QRect& rect, KisNodeSP filthyNode) override;
0026     void apply(KisPainter *painter, const QRect &rect) override;
0027     void applyMaxOutAlpha(KisPainter *painter, const QRect &rect, KritaUtils::ThresholdMode thresholdMode);
0028 
0029     QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
0030     QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
0031     QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
0032     QRect needRectForOriginal(const QRect &rect) const override;
0033     QRect tightUserVisibleBounds() const override;
0034 
0035     KisPaintDeviceList getLodCapableDevices() const override;
0036 
0037 private:
0038     void applyImpl(KisPainter *painter, const QRect &rect, KritaUtils::ThresholdMode thresholdMode);
0039 
0040 private:
0041     struct Private;
0042     const QScopedPointer<Private> m_d;
0043 };
0044 
0045 typedef QSharedPointer<KisLayerProjectionPlane> KisLayerProjectionPlaneSP;
0046 typedef QWeakPointer<KisLayerProjectionPlane> KisLayerProjectionPlaneWSP;
0047 
0048 
0049 #endif /* __KIS_LAYER_PROJECTION_PLANE_H */