From 8a8b627a608a48a729ed37c9b51ef88aff4ba3dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mika=20Isoj=C3=A4rvi?= Date: Wed, 29 Apr 2015 16:14:12 -0700 Subject: [PATCH] Use de::ArrayBuffer in tcu::Surface. Change-Id: Ia55dbb91a9adc4b5842f42d7797678dd57f9dae3 --- framework/common/tcuSurface.cpp | 2 +- framework/common/tcuSurface.hpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/framework/common/tcuSurface.cpp b/framework/common/tcuSurface.cpp index 6e796e7..9a1238e 100644 --- a/framework/common/tcuSurface.cpp +++ b/framework/common/tcuSurface.cpp @@ -53,5 +53,5 @@ void Surface::setSize (int width, int height) { m_width = width; m_height = height; - m_pixels.resize(width*height); + m_pixels.setStorage(width * height); } diff --git a/framework/common/tcuSurface.hpp b/framework/common/tcuSurface.hpp index 89f2073..b9e4863 100644 --- a/framework/common/tcuSurface.hpp +++ b/framework/common/tcuSurface.hpp @@ -27,7 +27,7 @@ #include "tcuRGBA.hpp" #include "tcuTexture.hpp" -#include +#include "deArrayBuffer.hpp" namespace tcu { @@ -62,9 +62,9 @@ public: private: // \note Copy constructor and assignment operators are public and auto-generated - int m_width; - int m_height; - std::vector m_pixels; + int m_width; + int m_height; + de::ArrayBuffer m_pixels; } DE_WARN_UNUSED_TYPE; inline void Surface::setPixel (int x, int y, RGBA col) @@ -72,7 +72,7 @@ inline void Surface::setPixel (int x, int y, RGBA col) DE_ASSERT(de::inBounds(x, 0, m_width) && de::inBounds(y, 0, m_height)); const int pixOffset = y*m_width + x; - deUint32* pixAddr = &m_pixels[pixOffset]; + deUint32* pixAddr = m_pixels.getElementPtr(pixOffset); #if (DE_ENDIANNESS == DE_LITTLE_ENDIAN) *pixAddr = col.getPacked(); @@ -89,7 +89,7 @@ inline RGBA Surface::getPixel (int x, int y) const DE_ASSERT(de::inBounds(x, 0, m_width) && de::inBounds(y, 0, m_height)); const int pixOffset = y*m_width + x; - const deUint32* pixAddr = &m_pixels[pixOffset]; + const deUint32* pixAddr = m_pixels.getElementPtr(pixOffset); DE_STATIC_ASSERT(RGBA::RED_SHIFT == 0 && RGBA::GREEN_SHIFT == 8 && RGBA::BLUE_SHIFT == 16 && RGBA::ALPHA_SHIFT == 24); @@ -104,13 +104,13 @@ inline RGBA Surface::getPixel (int x, int y) const /** Get pixel buffer access from surface. */ inline ConstPixelBufferAccess Surface::getAccess (void) const { - return ConstPixelBufferAccess(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), m_width, m_height, 1, m_pixels.empty() ? DE_NULL : &m_pixels[0]); + return ConstPixelBufferAccess(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), m_width, m_height, 1, m_pixels.empty() ? DE_NULL : m_pixels.getPtr()); } /** Get pixel buffer access from surface. */ inline PixelBufferAccess Surface::getAccess (void) { - return PixelBufferAccess(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), m_width, m_height, 1, m_pixels.empty() ? DE_NULL : &m_pixels[0]); + return PixelBufferAccess(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), m_width, m_height, 1, m_pixels.empty() ? DE_NULL : m_pixels.getPtr()); } } // tcu -- 2.7.4