]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dynarray.cpp
implemented fallback for AlphaBlend() for the systems not supporting it
[wxWidgets.git] / src / common / dynarray.cpp
index 72284fcb73ca57ffe1520af6ee887457d16af0a5..012c6077a324155f5b7b24b1009c4659e3dc4098 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     12.09.97
 // RCS-ID:      $Id$
 // Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -221,7 +221,11 @@ void name::Shrink()                                                         \
         memcpy(pNew, m_pItems, m_nCount*sizeof(T));                         \
         delete [] m_pItems;                                                 \
         m_pItems = pNew;                                                    \
+                                                                            \
+        /* update the size of the new block */                              \
+        m_nSize = m_nCount;                                                 \
     }                                                                       \
+    /* else: don't do anything, better keep old memory block! */            \
   }                                                                         \
 }                                                                           \
                                                                             \
@@ -279,7 +283,10 @@ int name::Index(T lItem, CMPFUNC fnCompare) const                           \
 {                                                                           \
     size_t n = IndexForInsert(lItem, fnCompare);                            \
                                                                             \
-    return n < m_nCount && m_pItems[n] == lItem ? (int)n : wxNOT_FOUND;     \
+    return n < m_nCount &&                                                  \
+           (*fnCompare)((const void *)(long)lItem,                          \
+                        ((const void *)(long)m_pItems[n])) ? (int)n         \
+                                                           : wxNOT_FOUND;   \
 }                                                                           \
                                                                             \
 /* add item at the end */                                                   \