Remove tcu::Surface::getSubAccess()
authorPyry Haulos <phaulos@google.com>
Thu, 8 Jan 2015 21:30:57 +0000 (13:30 -0800)
committerPyry Haulos <phaulos@google.com>
Thu, 8 Jan 2015 21:30:57 +0000 (13:30 -0800)
Functionality is already provided by tcu::getSubregion(access).

Bug: 18862074
Change-Id: I5160c31b2fba168dd1ce944ef8389a86f4a8bbba

framework/common/tcuSurface.hpp
modules/egl/teglPreservingSwapTests.cpp
modules/egl/teglResizeTests.cpp

index 3434764..ef8f95e 100644 (file)
@@ -59,9 +59,6 @@ public:
        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
 
@@ -104,43 +101,6 @@ inline RGBA Surface::getPixel (int x, int y) const
 #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
 {
index 1e335b7..e94fb44 100644 (file)
@@ -430,7 +430,10 @@ void PreservingSwapTest::deinit (void)
 
 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)
index 1fb1070..7c7e3c3 100644 (file)
@@ -30,6 +30,7 @@
 #include "tcuPlatform.hpp"
 #include "tcuTestLog.hpp"
 #include "tcuInterval.hpp"
+#include "tcuTextureUtil.hpp"
 
 #include "egluNativeDisplay.hpp"
 #include "egluNativeWindow.hpp"
@@ -274,9 +275,9 @@ bool compareCorners (const Surface& oldSurface, const Surface& newSurface)
                        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;