ConstPixelBufferAccess getAccess (void) const;
PixelBufferAccess getAccess (void);
- ConstPixelBufferAccess getSubAccess (int x, int y, int width, int height) const;
- PixelBufferAccess getSubAccess (int x, int y, int width, int height);
-
private:
// \note Copy constructor and assignment operators are public and auto-generated
#endif
}
-
-/** Get pixel sub buffer access from surface. */
-inline ConstPixelBufferAccess Surface::getSubAccess (int x, int y, int width, int height) const
-{
- DE_ASSERT(x >= 0);
- DE_ASSERT(width >= 1);
- DE_ASSERT(x < m_width);
-
- DE_ASSERT(y >= 0);
- DE_ASSERT(height >= 1);
- DE_ASSERT(y < m_height);
-
- DE_ASSERT(x + width <= m_width);
- DE_ASSERT(y + height <= m_height);
-
- const deUint8* ptr = (m_pixels.empty() ? NULL : ((deUint8*)&m_pixels[0]) + 4 * (x + y * m_width));
- return ConstPixelBufferAccess(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), width, height, 1, m_width*4, 0, ptr);
-}
-
-/** Get pixel sub buffer access from surface. */
-inline PixelBufferAccess Surface::getSubAccess (int x, int y, int width, int height)
-{
- DE_ASSERT(x >= 0);
- DE_ASSERT(width >= 1);
- DE_ASSERT(x < m_width);
-
- DE_ASSERT(y >= 0);
- DE_ASSERT(height >= 1);
- DE_ASSERT(y < m_height);
-
- DE_ASSERT(x + width <= m_width);
- DE_ASSERT(y + height <= m_height);
-
- deUint8* ptr = (m_pixels.empty() ? NULL : ((deUint8*)&m_pixels[0]) + 4 * (x + y * m_width));
- return PixelBufferAccess(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), width, height, 1, m_width*4, 0, ptr);
-}
-
/** Get pixel buffer access from surface. */
inline ConstPixelBufferAccess Surface::getAccess (void) const
{
bool compareToReference (tcu::TestLog& log, const char* name, const char* description, const tcu::Surface& reference, const tcu::Surface& screen, int x, int y, int width, int height)
{
- return tcu::fuzzyCompare(log, name, description, reference.getSubAccess(x, y, width, height), screen.getSubAccess(x, y, width, height), 0.05f, tcu::COMPARE_LOG_RESULT);
+ return tcu::fuzzyCompare(log, name, description,
+ getSubregion(reference.getAccess(), x, y, width, height),
+ getSubregion(screen.getAccess(), x, y, width, height),
+ 0.05f, tcu::COMPARE_LOG_RESULT);
}
bool comparePreAndPostSwapFramebuffers (tcu::TestLog& log, const tcu::Surface& preSwap, const tcu::Surface& postSwap)
#include "tcuPlatform.hpp"
#include "tcuTestLog.hpp"
#include "tcuInterval.hpp"
+#include "tcuTextureUtil.hpp"
#include "egluNativeDisplay.hpp"
#include "egluNativeWindow.hpp"
const int oldY = yCorner == 0 ? 0 : oldHeight - minHeight;
const int newY = yCorner == 0 ? 0 : newHeight - minHeight;
ConstPixelBufferAccess oldAccess =
- oldSurface.getSubAccess(oldX, oldY, minWidth, minHeight);
+ getSubregion(oldSurface.getAccess(), oldX, oldY, minWidth, minHeight);
ConstPixelBufferAccess newAccess =
- newSurface.getSubAccess(newX, newY, minWidth, minHeight);
+ getSubregion(newSurface.getAccess(), newX, newY, minWidth, minHeight);
if (compareRectangles(oldAccess, newAccess))
return true;