Bläddra i källkod

math: Array2D now proxies Count(), Bytes() and Data() methods from Array.

undefined
Sam Hocevar 11 år sedan
förälder
incheckning
7d91e2c94f
1 ändrade filer med 10 tillägg och 3 borttagningar
  1. +10
    -3
      src/lol/math/array2d.h

+ 10
- 3
src/lol/math/array2d.h Visa fil

@@ -36,7 +36,8 @@ template<typename T1, typename T2 = void, typename T3 = void,
class Array2D : protected Array<T1, T2, T3, T4, T5, T6, T7, T8> class Array2D : protected Array<T1, T2, T3, T4, T5, T6, T7, T8>
{ {
public: public:
typedef typename Array<T1, T2, T3, T4, T5, T6, T7, T8>::Element Element;
typedef Array<T1, T2, T3, T4, T5, T6, T7, T8> Super;
typedef typename Super::Element Element;


inline Array2D() inline Array2D()
: m_size(0, 0) : m_size(0, 0)
@@ -141,9 +142,9 @@ public:


/* Resize the array. /* Resize the array.
* FIXME: data gets scrambled; should we care? */ * FIXME: data gets scrambled; should we care? */
inline void SetSize(ivec2 size)
inline void SetSize(ivec2 size, Element e = Element())
{ {
this->Resize(size.x * size.y);
this->Resize(size.x * size.y, e);
m_size = size; m_size = size;
} }


@@ -152,6 +153,12 @@ public:
return m_size; return m_size;
} }


public:
inline Element *Data() { return Super::Data(); }
inline Element const *Data() const { return Super::Data(); }
inline int Count() const { return Super::Count(); }
inline int Bytes() const { return Super::Bytes(); }

private: private:
ivec2 m_size; ivec2 m_size;
}; };


Laddar…
Avbryt
Spara