[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Reminder
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2006-11-08 11:15:57
Message-ID: 200611081215.57913.boud () valdyas ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


The attached two diffs must be ported to trunk -- they fix the selectedRect() 
mess. I haven't got time to do that right now.



-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi

["selectedrect1.diff" (text/x-diff)]

Index: plugins/tools/tool_crop/kis_tool_crop.cc
===================================================================
--- plugins/tools/tool_crop/kis_tool_crop.cc	(revision 602941)
+++ plugins/tools/tool_crop/kis_tool_crop.cc	(working copy)
@@ -98,7 +98,7 @@
         }
         else {
 
-            m_rectCrop = device->selection()->exactBounds();
+            m_rectCrop = device->selection()->selectedRect();
             validateSelection();
             crop();
         }
@@ -150,16 +150,16 @@
             QPoint pos = e->pos().floorQPoint();
             QRect b = img->bounds();
 
-            if (pos.x() < b.x()) 
+            if (pos.x() < b.x())
                 pos.setX(b.x());
-            else if (pos.x() > b.x() + b.width()) 
+            else if (pos.x() > b.x() + b.width())
                 pos.setX(b.x() + b.width());
 
             if (pos.y() < b.y())
                 pos.setY(b.y());
             else if (pos.y() > b.y() + b.height())
                 pos.setY(b.y() + b.height());
-            
+
             m_selecting = true;
 
             if( !m_haveCropSelection ) //if the selection is not set
@@ -357,7 +357,7 @@
                         else if( m_mouseOnHandleType == LowerLeft)
                             m_mouseOnHandleType = LowerRight;
                     }
-                    
+
                     m_rectCrop = m_rectCrop.normalize();
                     m_rectCrop = m_rectCrop.intersect( QRect(0,0, imageWidth + 1, \
imageHeight + 1 ) );  m_dragStart = e->pos().floorQPoint();
Index: plugins/tools/selectiontools/kis_tool_select_contiguous.cc
===================================================================
--- plugins/tools/selectiontools/kis_tool_select_contiguous.cc	(revision 602941)
+++ plugins/tools/selectiontools/kis_tool_select_contiguous.cc	(working copy)
@@ -86,7 +86,7 @@
         KisPaintDeviceSP dev;
         QPoint pos;
 
-        if (e->button() != QMouseEvent::LeftButton && e->button() != \
QMouseEvent::RightButton)  +        if (e->button() != QMouseEvent::LeftButton && \
e->button() != QMouseEvent::RightButton)  return;
 
         if (!(img = m_subject->currentImg()))
@@ -107,31 +107,31 @@
         KisSelectionSP selection = fillpainter.createFloodSelection(pos.x(), \
pos.y());  KisSelectedTransaction *t = 0;
         if (img->undo()) t = new KisSelectedTransaction(i18n("Contiguous Area \
                Selection"), dev);
-        
+
         if (!dev->hasSelection()) {
             dev->selection()->clear();
             if(m_selectAction==SELECTION_SUBTRACT)
                 selection->invert();
         }
-        
+
         switch (m_selectAction) {
             case SELECTION_SUBTRACT:
                 dev->subtractSelection(selection);
                 break;
             case SELECTION_ADD:
-            default: 
+            default:
                 dev->addSelection(selection);
                 break;
 
         }
 
-        dev->setDirty(selection->extent()); // A bit too wide, but that's not that \
bad +        dev->setDirty(selection->selectedRect()); // A bit too wide, but that's \
not that bad  dev->emitSelectionChanged();
 
 
         if (img->undo())
             img->undoAdapter()->addCommand(t);
-            
+
         QApplication::restoreOverrideCursor();
     }
 
@@ -215,7 +215,7 @@
             this, SLOT(slotSetSampleMerged(int)));
 
     l->addItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding));
-    
+
     return m_optWidget;
 }
 
Index: plugins/filters/imageenhancement/kis_simple_noise_reducer.cpp
===================================================================
--- plugins/filters/imageenhancement/kis_simple_noise_reducer.cpp	(revision 602941)
+++ plugins/filters/imageenhancement/kis_simple_noise_reducer.cpp	(working copy)
@@ -74,27 +74,26 @@
         threshold = 50;
         windowsize = 1;
     }
-    
+
     KisColorSpace* cs = src->colorSpace();
-    Q_INT32 depth = cs->nColorChannels();
-    
+
     // Compute the blur mask
     KisAutobrushShape* kas = new KisAutobrushCircleShape(2*windowsize+1, \
                2*windowsize+1, windowsize, windowsize);
-    
+
     QImage mask;
     kas->createBrush(&mask);
-    
+
     KisKernelSP kernel = KisKernel::fromQImage(mask);
-    
+
     KisPaintDeviceSP interm = new KisPaintDevice(*src);
     KisConvolutionPainter painter( interm );
 
     if (m_progressDisplay)
-        m_progressDisplay->setSubject( &painter, true, true );    
+        m_progressDisplay->setSubject( &painter, true, true );
 
     painter.beginTransaction("bouuh");
     painter.applyMatrix(kernel, rect.x(), rect.y(), rect.width(), rect.height(), \
                BORDER_REPEAT);
-    
+
     if (painter.cancelRequested()) {
         cancel();
     }
@@ -102,7 +101,7 @@
     KisHLineIteratorPixel dstIt = dst->createHLineIterator(rect.x(), rect.y(), \
                rect.width(), true );
     KisHLineIteratorPixel srcIt = src->createHLineIterator(rect.x(), rect.y(), \
                rect.width(), false);
     KisHLineIteratorPixel intermIt = interm->createHLineIterator(rect.x(), rect.y(), \
                rect.width(), false);
-    
+
     for( int j = 0; j < rect.height(); j++)
     {
         while( ! srcIt.isDone() )
@@ -124,7 +123,7 @@
         dstIt.nextRow();
         intermIt.nextRow();
     }
-    
+
     setProgressDone(); // Must be called even if you don't really support \
progression  }
 
Index: plugins/filters/blur/kis_wdg_blur.cc
===================================================================
--- plugins/filters/blur/kis_wdg_blur.cc	(revision 602941)
+++ plugins/filters/blur/kis_wdg_blur.cc	(working copy)
@@ -34,12 +34,14 @@
 
 KisWdgBlur::KisWdgBlur( KisFilter* nfilter, QWidget * parent, const char * name) : \
KisFilterConfigWidget ( parent, name )  {
+    Q_UNUSED( nfilter );
+
     QGridLayout *widgetLayout = new QGridLayout(this, 1, 1);
     m_widget = new WdgBlur(this);
     widgetLayout -> addWidget(m_widget,0,0);
-    
+
     linkSpacingToggled(true);
-    
+
     connect( widget()->bnLinkSize, SIGNAL(toggled(bool)), this, \
                SLOT(linkSpacingToggled( bool )));
     connect( widget()->intHalfWidth, \
                SIGNAL(valueChanged(int)),this,SLOT(spinBoxHalfWidthChanged(int)));
     connect( widget()->intHalfHeight, \
                SIGNAL(valueChanged(int)),this,SLOT(spinBoxHalfHeightChanged(int)));
Index: plugins/paintops/defaultpaintops/kis_duplicateop.cc
===================================================================
--- plugins/paintops/defaultpaintops/kis_duplicateop.cc	(revision 602941)
+++ plugins/paintops/defaultpaintops/kis_duplicateop.cc	(working copy)
@@ -49,7 +49,9 @@
 
 
 KisDuplicateOp::KisDuplicateOp(KisPainter * painter)
-    : super(painter), m_srcdev(0), m_target(0)
+    : super(painter)
+    , m_target(0)
+    , m_srcdev(0)
 {
 }
 
@@ -168,7 +170,7 @@
         // First look for the grid corresponding to the start point
         KisSubPerspectiveGrid* subGridStart = \
*device->image()->perspectiveGrid()->begin();//device->image()->perspectiveGrid()->gridAt(KisPoint(srcPoint.x() \
                +hotSpot.x(),srcPoint.y() +hotSpot.y()));
         QRect r = QRect(0,0, device->image()->width(), device->image()->height());
-        
+
 #if 1
         if(subGridStart)
         {
@@ -204,12 +206,12 @@
         }
 #endif
 //         kdDebug()<< " oouuuuh" << srcPointF << \
KisPerspectiveMath::matProd(startM,  KisPerspectiveMath::matProd(endM, srcPointF ) ) \
<< KisPerspectiveMath::matProd(endM,  KisPerspectiveMath::matProd(startM, srcPointF ) \
                );
-        
+
         // Compute the translation in the perspective transformation space:
         KisPoint positionStartPaintingT = KisPerspectiveMath::matProd(endM, \
                m_painter->duplicateStart() );
         KisPoint duplicateStartPoisitionT = KisPerspectiveMath::matProd(endM, \
                m_painter->duplicateStart() - m_painter->duplicateOffset() );
         KisPoint translat = duplicateStartPoisitionT - positionStartPaintingT;
-        KisRectIteratorPixel dstIt = m_srcdev->createRectIterator(0, 0, sw, sh, \
true);  +        KisRectIteratorPixel dstIt = m_srcdev->createRectIterator(0, 0, sw, \
                sh, true);
         KisRandomSubAccessorPixel srcAcc = device->createRandomSubAccessor();
         //Action
         while(!dstIt.isDone())
@@ -223,15 +225,15 @@
             ++dstIt;
         }
 
-        
+
     } else {
         // Or, copy the source data on the temporary device:
         copyPainter.bitBlt(0, 0, COMPOSITE_COPY, device, srcPoint.x(), srcPoint.y(), \
sw, sh);  copyPainter.end();
     }
-    
+
     // heal ?
-    
+
     if(heal)
     {
         Q_UINT16 dataDevice[4];
@@ -271,7 +273,7 @@
                 iter++;
             } while( err < 0.00001 && iter < 100);
         }
-        
+
         // Finaly multiply
         deviceIt = device->createHLineIterator(x, y, sw, false );
         srcDevIt = m_srcdev->createHLineIterator(0, 0, sw, true );
@@ -296,8 +298,8 @@
             srcDevIt.nextRow();
         }
     }
-    
-    
+
+
     // Add the dab as selection to the srcdev
 //     KisPainter copySelection(srcdev->selection().data());
 //     copySelection.bitBlt(0, 0, COMPOSITE_OVER, dab, 0, 0, sw, sh);
@@ -325,7 +327,7 @@
     Q_INT32 sy = dstRect.y() - y;
     sw = dstRect.width();
     sh = dstRect.height();
-    
+
     if (m_source->hasSelection()) {
         m_painter->bltSelection(dstRect.x(), dstRect.y(), m_painter->compositeOp(), \
                m_target,
                                 m_source->selection(), m_painter->opacity(), sx, sy, \
                sw, sh);
Index: core/kis_perspectivetransform_worker.cpp
===================================================================
--- core/kis_perspectivetransform_worker.cpp	(revision 602941)
+++ core/kis_perspectivetransform_worker.cpp	(working copy)
@@ -74,7 +74,7 @@
     {
         m_r = m_dev->exactBounds();
     }
-    KisColorSpace * cs = m_dev->colorSpace();
+//    KisColorSpace * cs = m_dev->colorSpace();
 
     kdDebug() << "r = " << m_r << endl;
     KisRectIteratorPixel dstIt = m_dev->createRectIterator(m_r.x(), m_r.y(), \
m_r.width(), m_r.height(), true); @@ -100,7 +100,7 @@
 
                 srcAcc.moveTo( p );
                 srcAcc.sampledOldRawData( dstIt.rawData() );
-                
+
                 // TODO: Should set alpha = alpha*(1-selectedness)
 //                 cs->setAlpha( dstIt.rawData(), 255, 1);
             } else {
Index: core/kis_convolution_painter.cc
===================================================================
--- core/kis_convolution_painter.cc	(revision 603215)
+++ core/kis_convolution_painter.cc	(working copy)
@@ -92,8 +92,6 @@
     // Make the area we cover as small as possible
     if (m_device->hasSelection()) {
 
-
-
         QRect r =  m_device->selection()->selectedRect().intersect(QRect(x, y, w, \
h));  x = r.x();
         y = r.y();
Index: core/kis_paint_device.cc
===================================================================
--- core/kis_paint_device.cc	(revision 602941)
+++ core/kis_paint_device.cc	(working copy)
@@ -208,7 +208,7 @@
     }
     m_longRunningFilterTimer = 0;
     m_dcop = 0;
-    
+
     m_x = 0;
     m_y = 0;
 
@@ -243,7 +243,7 @@
 KisPaintDevice::KisPaintDevice(KisLayer *parent, KisColorSpace * colorSpace, const \
char * name) :  QObject(0, name), KShared(), m_exifInfo(0)
 {
-    
+
     m_longRunningFilterTimer = 0;
     m_dcop = 0;
 
@@ -264,7 +264,7 @@
     }
 
     Q_ASSERT( m_colorSpace );
-    
+
     m_pixelSize = m_colorSpace->pixelSize();
     m_nChannels = m_colorSpace->nChannels();
 
@@ -276,7 +276,7 @@
     Q_CHECK_PTR(m_datamanager);
     m_extentIsValid = true;
 
-    
+
     m_longRunningFilters = m_colorSpace->createBackgroundFilters();
     if (!m_longRunningFilters.isEmpty()) {
         m_longRunningFilterTimer = new QTimer(this);
@@ -285,7 +285,7 @@
     }
 }
 
- 
+
 KisPaintDevice::KisPaintDevice(const KisPaintDevice& rhs) : QObject(), KShared(rhs)
 {
     if (this != &rhs) {
@@ -520,7 +520,7 @@
     Q_INT32  x, y, w, h, boundX2, boundY2, boundW2, boundH2;
     extent(x, y, w, h);
     extent(boundX2, boundY2, boundW2, boundH2);
-    
+
     const Q_UINT8* defaultPixel = m_datamanager->defaultPixel();
     bool found = false;
     {
@@ -600,12 +600,14 @@
 
 QRect KisPaintDevice::exactBounds() const
 {
-    QRect r1 = exactBoundsOldMethod();
+    // XXX: Look, this code should never have gone into a release,
+    // right?
+    //QRect r1 = exactBoundsOldMethod();
     QRect r2 = exactBoundsImprovedOldMethod();
-    if(r1 != r2)
-    {
-        kdDebug() << "EXACTBOUNDSERROR : " << r1 << " " << r2 << endl;
-    }
+    //if(r1 != r2)
+    //{
+    //    kdDebug() << "EXACTBOUNDSERROR : " << r1 << " " << r2 << endl;
+    //}
     return r2;
 }
 
@@ -1075,7 +1077,7 @@
 
     QRect r = selection->selectedExactRect();
     painter.bitBlt(r.x(), r.y(), COMPOSITE_ERASE, selection.data(), r.x(), r.y(), \
                r.width(), r.height());
-    
+
     selection->invert();
     painter.end();
 }
Index: core/kis_adjustment_layer.cc
===================================================================
--- core/kis_adjustment_layer.cc	(revision 602941)
+++ core/kis_adjustment_layer.cc	(working copy)
@@ -39,7 +39,7 @@
     m_showSelection = true;
     Q_ASSERT(m_cachedPaintDev);
     connect(img, SIGNAL(sigSelectionChanged(KisImageSP)),
-            this, SLOT(sigSelectionChanged(KisImageSP)));
+            this, SLOT(slotSelectionChanged(KisImageSP)));
 }
 
 KisAdjustmentLayer::KisAdjustmentLayer(const KisAdjustmentLayer& rhs)
@@ -53,7 +53,7 @@
         if (!m_selection->hasSelection())
             m_selection->setSelection(m_selection);
         connect(rhs.image(), SIGNAL(sigSelectionChanged(KisImageSP)),
-                this, SLOT(sigSelectionChanged(KisImageSP)));
+                this, SLOT(slotSelectionChanged(KisImageSP)));
     }
     m_cachedPaintDev = new KisPaintDevice( *rhs.m_cachedPaintDev.data() );
     m_showSelection = false;
@@ -155,7 +155,7 @@
 QRect KisAdjustmentLayer::extent() const
 {
     if (m_selection)
-        return m_selection->extent();
+        return m_selection->selectedRect();
     else if (image())
         return image()->bounds();
     else
@@ -165,7 +165,7 @@
 QRect KisAdjustmentLayer::exactBounds() const
 {
     if (m_selection)
-        return m_selection->exactBounds();
+        return m_selection->selectedRect();
     else if (image())
         return image()->bounds();
     else
Index: core/kis_selection.cc
===================================================================
--- core/kis_selection.cc	(revision 602941)
+++ core/kis_selection.cc	(working copy)
@@ -35,8 +35,12 @@
 #include "kis_selection.h"
 
 KisSelection::KisSelection(KisPaintDeviceSP dev)
-    : super(dev->parentLayer(), \
KisMetaRegistry::instance()->csRegistry()->getAlpha8(), (QString("selection for ") + \
                dev->name()).latin1()), m_doCacheExactRect(false)
-    , m_parentPaintDevice(dev), m_dirty(false)
+    : super(dev->parentLayer()
+            , KisMetaRegistry::instance()->csRegistry()->getAlpha8()
+            , (QString("selection for ") + dev->name()).latin1())
+    , m_parentPaintDevice(dev)
+    , m_doCacheExactRect(false)
+    , m_dirty(false)
 {
     Q_ASSERT(dev);
 }
@@ -162,7 +166,7 @@
 }
 
 
-QRect KisSelection::selectedRect()
+QRect KisSelection::selectedRect() const
 {
     if(*(m_datamanager->defaultPixel()) == MIN_SELECTED || !m_parentPaintDevice)
         return extent();
@@ -170,7 +174,7 @@
         return extent().unite(m_parentPaintDevice->extent());
 }
 
-QRect KisSelection::selectedExactRect()
+QRect KisSelection::selectedExactRect() const
 {
     if(m_doCacheExactRect)
         return m_cachedExactRect;
@@ -280,65 +284,65 @@
         imageRectHeight = nonuniformRect.height();
 
         const Q_INT32 NUM_SELECTION_ROWS = 3;
-    
+
         Q_UINT8 *selectionRow[NUM_SELECTION_ROWS];
-    
+
         Q_INT32 aboveRowIndex = 0;
         Q_INT32 centreRowIndex = 1;
         Q_INT32 belowRowIndex = 2;
-    
+
         selectionRow[aboveRowIndex] = new Q_UINT8[imageRectWidth + 2];
         selectionRow[centreRowIndex] = new Q_UINT8[imageRectWidth + 2];
         selectionRow[belowRowIndex] = new Q_UINT8[imageRectWidth + 2];
-    
+
         readBytes(selectionRow[centreRowIndex], imageRectX - 1, imageRectY - 1, \
                imageRectWidth + 2, 1);
         readBytes(selectionRow[belowRowIndex], imageRectX - 1, imageRectY, \
                imageRectWidth + 2, 1);
-    
+
         for (Q_INT32 y = 0; y < imageRectHeight; ++y) {
-    
+
             Q_INT32 oldAboveRowIndex = aboveRowIndex;
             aboveRowIndex = centreRowIndex;
             centreRowIndex = belowRowIndex;
             belowRowIndex = oldAboveRowIndex;
-    
+
             readBytes(selectionRow[belowRowIndex], imageRectX - 1, imageRectY + y + \
                1, imageRectWidth + 2, 1);
-    
+
             const Q_UINT8 *aboveRow = selectionRow[aboveRowIndex] + 1;
             const Q_UINT8 *centreRow = selectionRow[centreRowIndex] + 1;
             const Q_UINT8 *belowRow = selectionRow[belowRowIndex] + 1;
-    
+
             QRgb *imagePixel = reinterpret_cast<QRgb \
*>(img.scanLine(imageRectOffsetY + y));  imagePixel += imageRectOffsetX;
-    
+
             for (Q_INT32 x = 0; x < imageRectWidth; ++x) {
-    
+
                 Q_UINT8 centre = *centreRow;
-    
+
                 if (centre != MAX_SELECTED) {
-    
+
                     // this is where we come if the pixels should be blue or bluish
-    
+
                     QRgb srcPixel = *imagePixel;
                     Q_UINT8 srcGrey = (qRed(srcPixel) + qGreen(srcPixel) + \
qBlue(srcPixel)) / 9;  Q_UINT8 srcAlpha = qAlpha(srcPixel);
-    
+
                     // Colour influence is proportional to alphaPixel.
                     srcGrey = UINT8_MULT(srcGrey, srcAlpha);
-    
+
                     QRgb dstPixel;
-    
+
                     if (centre == MIN_SELECTED) {
                         //this is where we come if the pixels should be blue (or red \
                outline)
-    
+
                         Q_UINT8 left = *(centreRow - 1);
                         Q_UINT8 right = *(centreRow + 1);
                         Q_UINT8 above = *aboveRow;
                         Q_UINT8 below = *belowRow;
-    
+
                         // Stop unselected transparent areas from appearing the same
                         // as selected transparent areas.
                         Q_UINT8 dstAlpha = QMAX(srcAlpha, 192);
-    
+
                         // now for a simple outline based on 4-connectivity
                         if (left != MIN_SELECTED || right != MIN_SELECTED || above \
!= MIN_SELECTED || below != MIN_SELECTED) {  dstPixel = qRgba(255, 0, 0, dstAlpha);
@@ -348,20 +352,20 @@
                     } else {
                         dstPixel = qRgba(UINT8_BLEND(qRed(srcPixel), srcGrey + 128, \
                centre),
                                          UINT8_BLEND(qGreen(srcPixel), srcGrey + \
                128, centre),
-                                         UINT8_BLEND(qBlue(srcPixel), srcGrey + 165, \
centre),  +                                         UINT8_BLEND(qBlue(srcPixel), \
srcGrey + 165, centre),  srcAlpha);
                     }
-    
+
                     *imagePixel = dstPixel;
                 }
-    
+
                 aboveRow++;
                 centreRow++;
                 belowRow++;
                 imagePixel++;
             }
         }
-    
+
         delete [] selectionRow[aboveRowIndex];
         delete [] selectionRow[centreRowIndex];
         delete [] selectionRow[belowRowIndex];
@@ -550,7 +554,7 @@
                     } else {
                         dstPixel = qRgba(UINT8_BLEND(qRed(srcPixel), srcGrey + 128, \
                centre),
                                          UINT8_BLEND(qGreen(srcPixel), srcGrey + \
                128, centre),
-                                         UINT8_BLEND(qBlue(srcPixel), srcGrey + 165, \
centre),  +                                         UINT8_BLEND(qBlue(srcPixel), \
srcGrey + 165, centre),  srcAlpha);
                     }
 
Index: core/kis_selection.h
===================================================================
--- core/kis_selection.h	(revision 602941)
+++ core/kis_selection.h	(working copy)
@@ -85,6 +85,8 @@
     /**
      * Tests if the the rect is totally outside the selection, but uses selectedRect
      * instead of selectedRect, and this is faster (but might deliver false \
positives!) +     *
+     * XXX: This comment makes no sense anymore! (BSAR)
      */
     bool isProbablyTotallyUnselected(QRect r);
 
@@ -92,13 +94,13 @@
      * Rough, but fastish way of determining the area
      * of the tiles used by the selection.
      */
-    QRect selectedRect();
+    QRect selectedRect() const;
 
     /**
      * Slow, but exact way of determining the rectangle
      * that encloses the selection
      */
-    QRect selectedExactRect();
+    QRect selectedExactRect() const;
 
     void paintSelection(QImage img, Q_INT32 x, Q_INT32 y, Q_INT32 w, Q_INT32 h);
     void paintSelection(QImage img, const QRect& scaledImageRect, const QSize& \
                scaledImageSize, const QSize& imageSize);
Index: core/kis_fill_painter.cc
===================================================================
--- core/kis_fill_painter.cc	(revision 602941)
+++ core/kis_fill_painter.cc	(working copy)
@@ -192,11 +192,10 @@
         return;
     }
 
-    int x, y, w, h;
-    m_selection->extent(x, y, w, h);
+    QRect rc = m_selection->selectedRect();
 
-    bltSelection(x, y, m_compositeOp, filled, m_selection, m_opacity,
-                 x, y, w, h);
+    bltSelection(rc.x(), rc.y(), m_compositeOp, filled, m_selection, m_opacity,
+                 rc.x(), rc.y(), rc.width(), rc.height());
 
     emit notifyProgressDone();
 
@@ -215,13 +214,16 @@
 KisSelectionSP KisFillPainter::createFloodSelection(int startX, int startY) {
     if (m_width < 0 || m_height < 0) {
         if (m_device->hasSelection() && m_careForSelection) {
-            Q_INT32 x,y,w,h;
-            m_device->selection()->extent(x,y,w,h);
-            m_width = w - (startX - x);
-            m_height = h - (startY - y);
+
+            QRect rc = m_device->selection()->selectedRect();
+            m_width = rc.width() - (startX - rc.x());
+            m_height = rc.height() - (startY - rc.y());
+
         } else if (m_device->image()) {
+
             m_width = m_device->image()->width();
             m_height = m_device->image()->height();
+
         } else {
             m_width = m_height = 500;
         }
Index: ui/kis_selection_manager.cc
===================================================================
--- ui/kis_selection_manager.cc	(revision 602941)
+++ ui/kis_selection_manager.cc	(working copy)
@@ -499,7 +499,7 @@
 
     KisPaintDeviceSP dev = img->activeDevice();
     if (!dev) return;
-    
+
     KisSelectedTransaction * t = 0;
     if (img->undo()) t = new KisSelectedTransaction(i18n("Select All"), dev);
     Q_CHECK_PTR(t);
@@ -728,7 +728,7 @@
     k->data[7] = 2;
     k->data[8] = 1;
 
-    QRect rect = selection->extent();
+    QRect rect = selection->selectedRect();
     // Make sure we've got enough space around the edges.
     rect = QRect(rect.x() - 3, rect.y() - 3, rect.width() + 6, rect.height() + 6);
     rect &= QRect(0, 0, img->width(), img->height());
Index: ui/kis_view.cc
===================================================================
--- ui/kis_view.cc	(revision 602941)
+++ ui/kis_view.cc	(working copy)
@@ -2477,10 +2477,12 @@
 
 void KisView::canvasGotEnterEvent(QEvent *e)
 {
+    Q_UNUSED( e );
 }
 
 void KisView::canvasGotLeaveEvent (QEvent *e)
 {
+    Q_UNUSED( e );
 }
 
 void KisView::canvasGotMouseWheelEvent(QWheelEvent *event)


["selectedrect2.diff" (text/x-diff)]

Index: plugins/tools/tool_perspectivetransform/kis_tool_perspectivetransform.cc
===================================================================
--- plugins/tools/tool_perspectivetransform/kis_tool_perspectivetransform.cc	(revision \
                602941)
+++ plugins/tools/tool_perspectivetransform/kis_tool_perspectivetransform.cc	(working \
copy) @@ -603,7 +603,7 @@
     // Also restore the original selection.
     if(m_origSelection)
     {
-        QRect rc = m_origSelection->extent();
+        QRect rc = m_origSelection->selectedRect();
         rc = rc.normalize();
         img->activeDevice()->selection()->clear();
         KisPainter sgc(img->activeDevice()->selection().data());
Index: plugins/tools/tool_transform/kis_tool_transform.cc
===================================================================
--- plugins/tools/tool_transform/kis_tool_transform.cc	(revision 602941)
+++ plugins/tools/tool_transform/kis_tool_transform.cc	(working copy)
@@ -769,7 +769,7 @@
     // Also restore the original selection.
     if(m_origSelection)
     {
-        QRect rc = m_origSelection->extent();
+        QRect rc = m_origSelection->selectedRect();
         rc = rc.normalize();
         img->activeDevice()->selection()->clear();
         KisPainter sgc(img->activeDevice()->selection().data());
Index: core/kis_paint_device.cc
===================================================================
--- core/kis_paint_device.cc	(revision 603233)
+++ core/kis_paint_device.cc	(working copy)
@@ -636,7 +636,7 @@
 {
     QRect r;
     if (hasSelection()) {
-        r = selection()->exactBounds();
+        r = selection()->selectedRect();
     }
     else {
         r = exactBounds();
@@ -667,7 +667,7 @@
     /* Read a line from bottom to top and and from top to bottom and write their \
values to each other */  QRect r;
     if (hasSelection()) {
-        r = selection()->exactBounds();
+        r = selection()->selectedRect();
     }
     else {
         r = exactBounds();
@@ -1113,7 +1113,7 @@
 
 void KisPaintDevice::applySelectionMask(KisSelectionSP mask)
 {
-    QRect r = mask->extent();
+    QRect r = mask->selectedRect();
     crop(r);
 
     for (Q_INT32 y = r.top(); y <= r.bottom(); ++y) {
Index: core/kis_selection.h
===================================================================
--- core/kis_selection.h	(revision 603233)
+++ core/kis_selection.h	(working copy)
@@ -119,6 +119,37 @@
     void paintUniformSelectionRegion(QImage img, const QRect& imageRect, const \
QRegion& uniformRegion);  
 private:
+
+    // We don't want these methods to be used on selections:
+    void extent(Q_INT32 &x, Q_INT32 &y, Q_INT32 &w, Q_INT32 &h) const 
+        { 
+            KisPaintDevice::extent(x,y,w,h);
+        }
+    
+    QRect extent() const { return KisPaintDevice::extent(); }
+    
+    void exactBounds(Q_INT32 &x, Q_INT32 &y, Q_INT32 &w, Q_INT32 &h) const 
+        {
+            return KisPaintDevice::exactBounds(x,y,w,h);
+        }   
+
+    QRect exactBounds() const
+        {
+            return KisPaintDevice::extent();
+        }
+
+    QRect exactBoundsOldMethod() const 
+        {
+            return KisPaintDevice::exactBoundsOldMethod();
+        }
+
+    QRect exactBoundsImprovedOldMethod() const
+        {
+            return KisPaintDevice::exactBoundsImprovedOldMethod();
+        }
+
+
+private:
     KisPaintDeviceSP m_parentPaintDevice;
     bool m_doCacheExactRect;
     QRect m_cachedExactRect;
Index: core/kis_paint_device.h
===================================================================
--- core/kis_paint_device.h	(revision 602941)
+++ core/kis_paint_device.h	(working copy)
@@ -148,7 +148,7 @@
      * For instance, the tiled datamanager keeps the extent to the nearest
      * multiple of 64.
      */
-    void extent(Q_INT32 &x, Q_INT32 &y, Q_INT32 &w, Q_INT32 &h) const;
+    virtual void extent(Q_INT32 &x, Q_INT32 &y, Q_INT32 &w, Q_INT32 &h) const;
     virtual QRect extent() const;
 
     /**
@@ -167,7 +167,7 @@
      * Get the exact bounds of this paint device. This may be very slow,
      * especially on larger paint devices because it does a linear scanline search.
      */
-    void exactBounds(Q_INT32 &x, Q_INT32 &y, Q_INT32 &w, Q_INT32 &h) const;
+    virtual void exactBounds(Q_INT32 &x, Q_INT32 &y, Q_INT32 &w, Q_INT32 &h) const;
     virtual QRect exactBounds() const;
     virtual QRect exactBoundsOldMethod() const;
     virtual QRect exactBoundsImprovedOldMethod() const;
Index: ui/kis_grid_drawer.cpp
===================================================================
--- ui/kis_grid_drawer.cpp	(revision 602941)
+++ ui/kis_grid_drawer.cpp	(working copy)
@@ -52,6 +52,7 @@
 
 void GridDrawer::drawPerspectiveGrid(KisImageSP image, const QRect& /*wr*/, const \
KisSubPerspectiveGrid* grid)  {
+    Q_UNUSED(image);
     KisConfig cfg;
     QPen mainPen = QPen ( cfg.getGridMainColor(), 1, gs2style( \
                cfg.getGridMainStyle() ) );
     QPen subdivisionPen =  QPen ( cfg.getGridSubdivisionColor(), 1, gs2style( \
cfg.getGridSubdivisionStyle() ) ); @@ -74,7 +75,7 @@
     KisPoint horizVanishingPoint = KisPerspectiveMath::computeIntersection(d12,d34);
     KisPoint vertVanishingPoint = KisPerspectiveMath::computeIntersection(d23,d41);
     
-    for(uint i = 1; i < grid->subdivisions(); i ++)
+    for(uint i = 1; i < static_cast<uint>(grid->subdivisions()); i ++)
     {
         KisPoint pol1 = *grid->topRight() + i * v12;
         KisPerspectiveMath::LineEquation d1 = \
                KisPerspectiveMath::computeLineEquation( &pol1, &vertVanishingPoint \
                );
Index: ui/kis_perspective_grid_manager.cpp
===================================================================
--- ui/kis_perspective_grid_manager.cpp	(revision 602941)
+++ ui/kis_perspective_grid_manager.cpp	(working copy)
@@ -30,7 +30,9 @@
 #include "kis_view.h"
 
 KisPerspectiveGridManager::KisPerspectiveGridManager(KisView * parent)
-    : QObject(), m_view(parent), m_toggleEdition(false)
+    : QObject()
+    , m_toggleEdition(false)
+    , m_view(parent)
 {
     
 }


[Attachment #9 (application/pgp-signature)]

_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic