Masterwork From Distant Lands
ActivePublic

Authored by dkazakov on Oct 11 2016, 9:26 AM.
diff --git a/libs/image/kis_layer.cc b/libs/image/kis_layer.cc
index b289095..ae63c12 100644
--- a/libs/image/kis_layer.cc
+++ b/libs/image/kis_layer.cc
@@ -815,7 +815,7 @@ void KisLayer::setY(qint32 y)
originalDevice->setY(y);
}
-QRect KisLayer::extent() const
+QRect KisLayer::layerExtentImpl(bool needExactBounds) const
{
QRect additionalMaskExtent = QRect();
QList<KisEffectMaskSP> effectMasks = this->effectMasks();
@@ -825,24 +825,32 @@ QRect KisLayer::extent() const
}
KisPaintDeviceSP originalDevice = original();
- QRect layerExtent = originalDevice ? originalDevice->extent() : QRect();
+ QRect layerExtent;
- return layerExtent | additionalMaskExtent;
-}
+ if (originalDevice) {
+ layerExtent = needExactBounds ?
+ originalDevice->exactBounds() :
+ originalDevice->extent();
+ }
-QRect KisLayer::exactBounds() const
-{
- QRect additionalMaskExtent = QRect();
- QList<KisEffectMaskSP> effectMasks = this->effectMasks();
+ QRect additionalCompositeOpExtent;
+ if (compositeOpId() == COMPOSITE_DESTINATION_IN ||
+ compositeOpId() == COMPOSITE_DESTINATION_ATOP) {
- Q_FOREACH(KisEffectMaskSP mask, effectMasks) {
- additionalMaskExtent |= mask->nonDependentExtent();
+ additionalCompositeOpExtent = originalDevice->defaultBounds()->bounds();
}
- KisPaintDeviceSP originalDevice = original();
- QRect layerExtent = originalDevice ? originalDevice->exactBounds() : QRect();
+ return layerExtent | additionalMaskExtent | additionalCompositeOpExtent;
+}
+
+QRect KisLayer::extent() const
+{
+ return layerExtentImpl(false);
+}
- return layerExtent | additionalMaskExtent;
+QRect KisLayer::exactBounds() const
+{
+ return layerExtentImpl(true);
}
KisLayerSP KisLayer::parentLayer() const
diff --git a/libs/image/kis_layer.h b/libs/image/kis_layer.h
index 9ed910b..f090f7e 100644
--- a/libs/image/kis_layer.h
+++ b/libs/image/kis_layer.h
@@ -375,6 +375,9 @@ private:
friend class KisLayerTest;
private:
+ QRect layerExtentImpl(bool exactBounds) const;
+
+private:
struct Private;
Private * const m_d;
};
diff --git a/libs/image/kis_layer_projection_plane.cpp b/libs/image/kis_layer_projection_plane.cpp
index 1161221..b45424f 100644
--- a/libs/image/kis_layer_projection_plane.cpp
+++ b/libs/image/kis_layer_projection_plane.cpp
@@ -54,7 +54,10 @@ void KisLayerProjectionPlane::apply(KisPainter *painter, const QRect &rect)
QRect needRect = rect;
- if (m_d->layer->compositeOpId() != COMPOSITE_COPY) {
+ if (m_d->layer->compositeOpId() != COMPOSITE_COPY &&
+ m_d->layer->compositeOpId() != COMPOSITE_DESTINATION_IN &&
+ m_d->layer->compositeOpId() != COMPOSITE_DESTINATION_ATOP) {
+
needRect &= device->extent();
}
diff --git a/libs/image/kis_painter.cc b/libs/image/kis_painter.cc
index 614c482..3cb0d5c 100644
--- a/libs/image/kis_painter.cc
+++ b/libs/image/kis_painter.cc
@@ -449,6 +449,8 @@ inline bool KisPainter::Private::tryReduceSourceRect(const KisPaintDevice *srcDe
* the image.
*/
if (compositeOp->id() != COMPOSITE_COPY &&
+ compositeOp->id() != COMPOSITE_DESTINATION_IN &&
+ compositeOp->id() != COMPOSITE_DESTINATION_ATOP &&
!srcDev->defaultBounds()->wrapAroundMode()) {
/**
dkazakov edited the content of this paste. (Show Details)Oct 11 2016, 9:26 AM
dkazakov changed the title of this paste from untitled to Masterwork From Distant Lands.
dkazakov updated the paste's language from autodetect to autodetect.