File indexing completed on 2024-06-09 04:21:56

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_STYLE_PROJECTION_PLANE_H
0008 #define __KIS_LAYER_STYLE_PROJECTION_PLANE_H
0009 
0010 #include "kis_abstract_projection_plane.h"
0011 
0012 #include <QScopedPointer>
0013 
0014 #include "kis_types.h"
0015 
0016 #include <kritaimage_export.h>
0017 
0018 
0019 class KRITAIMAGE_EXPORT KisLayerStyleProjectionPlane : public KisAbstractProjectionPlane
0020 {
0021 public:
0022     KisLayerStyleProjectionPlane(KisLayer *sourceLayer);
0023     KisLayerStyleProjectionPlane(const KisLayerStyleProjectionPlane &rhs, KisLayer *sourceLayer, KisPSDLayerStyleSP clonedStyle);
0024 
0025     ~KisLayerStyleProjectionPlane() override;
0026 
0027     QRect recalculate(const QRect& rect, KisNodeSP filthyNode) override;
0028     void apply(KisPainter *painter, const QRect &rect) override;
0029 
0030     QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
0031     QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
0032     QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
0033     QRect needRectForOriginal(const QRect &rect) const override;
0034     QRect tightUserVisibleBounds() const override;
0035 
0036     KisPaintDeviceList getLodCapableDevices() const override;
0037 
0038 
0039     // a method for registering on KisLayerStyleProjectionPlaneFactory
0040     static KisAbstractProjectionPlaneSP factoryObject(KisLayer *sourceLayer);
0041 
0042 private:
0043     friend class KisLayerStyleProjectionPlaneTest;
0044     KisLayerStyleProjectionPlane(KisLayer *sourceLayer, KisPSDLayerStyleSP style);
0045 
0046     void init(KisLayer *sourceLayer, KisPSDLayerStyleSP layerStyle);
0047 
0048     QRect stylesNeedRect(const QRect &rect) const;
0049 
0050 private:
0051     struct Private;
0052     const QScopedPointer<Private> m_d;
0053 };
0054 
0055 typedef QSharedPointer<KisLayerStyleProjectionPlane> KisLayerStyleProjectionPlaneSP;
0056 typedef QWeakPointer<KisLayerStyleProjectionPlane> KisLayerStyleProjectionPlaneWSP;
0057 
0058 #endif /* __KIS_LAYER_STYLE_PROJECTION_PLANE_H */