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

List:       kde-commits
Subject:    koffice/krita/image
From:       Lukáš Tvrdý <lukast.dev () gmail ! com>
Date:       2010-10-13 18:45:39
Message-ID: 20101013184539.20B85AC897 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1185564 by lukast:

Add new API for the optimization purposes.

KisFixedPaintDevice::initialize() is not needed to call sometimes and to know
that, you need to know the size of the memory occupied by KisFixedPaintDevice.

 M  +8 -0      kis_fixed_paint_device.cpp  
 M  +7 -0      kis_fixed_paint_device.h  


--- trunk/koffice/krita/image/kis_fixed_paint_device.cpp #1185563:1185564
@@ -53,6 +53,13 @@
     return m_bounds;
 }
 
+
+int KisFixedPaintDevice::allocatedPixels() const
+{
+    return m_data.size() / m_colorSpace->pixelSize();
+}
+
+
 quint32 KisFixedPaintDevice::pixelSize() const
 {
     return m_colorSpace->pixelSize();
@@ -190,6 +197,7 @@
             memcpy(dabPointer, fillPixel, pixelSize);
             dabPointer += pixelSize;
         }
+        
     } else {
         int deviceWidth = bounds().width();
         quint8* rowPointer = dabPointer + ((y - bounds().y()) * deviceWidth + (x - \
                bounds().x())) * pixelSize;
--- trunk/koffice/krita/image/kis_fixed_paint_device.h #1185563:1185564
@@ -62,6 +62,13 @@
     QRect bounds() const;
 
     /**
+     * @return the amount of allocated pixels (you can fake the size with \
setRect/bounds) +     * It is useful to know the accumulated memory size in pixels \
(not in bytes) for optimizations to avoid re-allocation. +     */
+    int allocatedPixels() const;
+    
+    
+    /**
      * @return the pixelSize associated with this fixed paint device.
      */
     quint32 pixelSize() const;


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

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