[Bug 163164] Allow more conservative memory management

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Bug 163164] Allow more conservative memory management

Gilles Caulier-4
http://bugs.kde.org/show_bug.cgi?id=163164





--- Comment #1 from Gilles Caulier <caulier gilles gmail com>  2008-08-24 14:06:36 ---
SVN commit 851712 by cgilles:

digiKam from KDE3 branch : AdjustCurves tool : memory consume optimization.
No need to duplicates original image data here: we can use the instance from
editor instead.

Andi, this way can be applied in others image plugins if necessary. i'm sure
that we will find old code to polish by thi way.

CCBUGS: 163164


 M  +7 -13     adjustcurves.cpp
 M  +1 -1      adjustcurves.h


---
branches/extragear/kde3/graphics/digikam/imageplugins/adjustcurves/adjustcurves.cpp
#851711:851712
@@ -87,18 +87,12 @@
 AdjustCurveTool::AdjustCurveTool(QObject* parent)
               : EditorTool(parent)
 {
-    m_destinationPreviewData = 0L;
+    m_destinationPreviewData = 0;

    ImageIface iface(0, 0);
-    uchar *data     = iface.getOriginalImage();
-    int w           = iface.originalWidth();
-    int h           = iface.originalHeight();
-    bool sixteenBit = iface.originalSixteenBit();
-    bool hasAlpha   = iface.originalHasAlpha();
-    m_originalImage = DImg(w, h, sixteenBit, hasAlpha ,data);
-    delete [] data;
+    m_originalImage = iface.getOriginalImg();

-    m_histoSegments = m_originalImage.sixteenBit() ? 65535 : 255;
+    m_histoSegments = m_originalImage->sixteenBit() ? 65535 : 255;

    setName("adjustcurves");
    setToolName(i18n("Adjust Curves"));
@@ -191,8 +185,8 @@
    QLabel *spacev = new QLabel(curveBox);
    spacev->setFixedWidth(1);

-    m_curvesWidget = new CurvesWidget(256, 256, m_originalImage.bits(),
m_originalImage.width(),
-                                                m_originalImage.height(),
m_originalImage.sixteenBit(),
+    m_curvesWidget = new CurvesWidget(256, 256, m_originalImage->bits(),
m_originalImage->width(),
+                                                m_originalImage->height(),
m_originalImage->sixteenBit(),
                                                curveBox);
    QWhatsThis::add( m_curvesWidget, i18n("<p>This is the curve drawing of the
selected channel from "
                                          "original image"));
@@ -576,7 +570,7 @@
            QPoint disable(-1, -1);
            QPoint p =
config->readPointEntry(QString("CurveAjustmentChannel%1Point%2").arg(i).arg(j),
&disable);

-            if (m_originalImage.sixteenBit() && p.x() != -1)
+            if (m_originalImage->sixteenBit() && p.x() != -1)
            {
                p.setX(p.x()*255);
                p.setY(p.y()*255);
@@ -607,7 +601,7 @@
        {
            QPoint p = m_curvesWidget->curves()->getCurvePoint(i, j);

-            if (m_originalImage.sixteenBit() && p.x() != -1)
+            if (m_originalImage->sixteenBit() && p.x() != -1)
            {
                p.setX(p.x()/255);
                p.setY(p.y()/255);
---
branches/extragear/kde3/graphics/digikam/imageplugins/adjustcurves/adjustcurves.h
#851711:851712
@@ -132,7 +132,7 @@

    Digikam::ImageWidget         *m_previewWidget;

-    Digikam::DImg                 m_originalImage;
+    Digikam::DImg                *m_originalImage;
 };

 }  // NameSpace DigikamAdjustCurvesImagesPlugin


--
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel