[Piglit] [PATCH] glean: Drop TIFF (and PNG and ZLIB) dependencies.

jfonseca at vmware.com jfonseca at vmware.com
Sun Dec 30 04:12:02 PST 2012


From: José Fonseca <jose.r.fonseca at gmail.com>

Not actually necessary. rgbTriStrip test used it but it was just a proof
of concept, never part of any test list.

This greatly simplifies building piglit for Windows.
---
 CMakeLists.txt                |    4 +-
 README                        |   35 +-------
 tests/CMakeLists.txt          |    4 +-
 tests/glean/CMakeLists.gl.txt |    5 --
 tests/glean/environ.h         |    3 +-
 tests/glean/image.h           |   16 +---
 tests/glean/rdtiff.cpp        |  156 --------------------------------
 tests/glean/trgbtris.cpp      |  196 -----------------------------------------
 tests/glean/trgbtris.h        |   63 -------------
 tests/glean/wrtiff.cpp        |  134 ----------------------------
 10 files changed, 6 insertions(+), 610 deletions(-)
 delete mode 100644 tests/glean/rdtiff.cpp
 delete mode 100644 tests/glean/trgbtris.cpp
 delete mode 100644 tests/glean/trgbtris.h
 delete mode 100644 tests/glean/wrtiff.cpp

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 689631d..98fa713 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,8 +10,6 @@ INCLUDE (FindPkgConfig)
 
 project (piglit)
 
-find_package(TIFF)
-find_package(PNG REQUIRED)
 find_package(X11)
 
 
@@ -50,7 +48,7 @@ else()
 	find_package(GLUT REQUIRED)
 
 	# The 'REQUIRED' above correctly produces an error for
-	# OpenGL and PNG, but there's a bug involving FindGLUT.cmake
+	# OpenGL, but there's a bug involving FindGLUT.cmake
 	# that fails to produce the error as of CMake 2.8.5.
 	#
 	# Instead, CMake keeps going and eventually spams
diff --git a/README b/README
index c114023..68108c9 100644
--- a/README
+++ b/README
@@ -34,7 +34,6 @@ First of all, you need to make sure that the following are installed:
   - cmake (http://www.cmake.org)
   - GL, glu and glut libraries and development packages (i.e. headers)
   - X11 libraries and development packages (i.e. headers)
-  - libpng, libtiff and related development packages (i.e. headers)
   - waffle (http://people.freedesktop.org/~chadversary/waffle)
 
 Now configure the build system:
@@ -62,7 +61,7 @@ invoke cmake with option "-DCMAKE_SYSTEM_PROCESSOR=i386".
 ----------
 
 Install development packages.
-  $ sudo apt-get install cmake g++ mesa-common-dev libgl1-mesa-dev libtiff4-dev zlib1g-dev libpng12-dev python-numpy freeglut3-dev x11proto-gl-dev libxrender-dev
+  $ sudo apt-get install cmake g++ mesa-common-dev libgl1-mesa-dev python-numpy freeglut3-dev x11proto-gl-dev libxrender-dev
 
 Install additional components for which Ubuntu packages do not yet exist:
   - waffle (http://people.freedesktop.org/~chadversary/waffle)
@@ -87,19 +86,8 @@ Configure and build.
   $ make
 
 glean
-In order to build glean, TIFF is required but not included as part of 
-Xcode. TIFF must be obtained elsewhere and one solution is to get TIFF 
-from MacPorts.
 
-Install MacPorts.
-http://www.macports.org/install.php
-
-Install TIFF through MacPorts. The '+universal' option is needed as 
-glean cannot be built as x86_64, only as i386.
-  $ sudo port selfupdate
-  $ sudo port install tiff +universal
-
-glean will also not build with MacOSX10.7.sdk. If you are trying to 
+glean will not build with MacOSX10.7.sdk. If you are trying to 
 build glean on Mac OS 10.7 (Lion), you will have to use MacOSX10.6.sdk.
   $ ccmake .
 Set 'CMAKE_OSX_SYSROOT' to '/Developer/SDKs/MacOSX10.6.sdk'. Configure. 
@@ -116,10 +104,6 @@ Install development packages.
   - make
   - opengl
   - libGL-devel
-  - libpng12-devel
-  - libpng14-devel
-  - zlib-devel
-  - libtiff-devel
   - python
   - python-numpy
   - libglut-devel
@@ -146,15 +130,6 @@ Download and install 'Windows' platform.
 Install Microsoft Visual Studio.
 Install 'Visual C++' feature.
 
-Install TIFF for Windows.
-http://gnuwin32.sourceforge.net/packages/tiff.htm
-
-Install Zlib for Windows.
-http://gnuwin32.sourceforge.net/packages/zlib.htm
-
-Install LibPng for Windows.
-http://gnuwin32.sourceforge.net/packages/libpng.htm
-
 Download OpenGL Core API and Extension Header Files.
 http://www.opengl.org/registry/#headers
 Copy header files to MSVC.
@@ -173,12 +148,6 @@ Configure
   - NMake Makefiles
   - Use default native compilers
 Set these variables in the Advanced view.
-  - TIFF_INCLUDE_DIR
-  - TIFF_LIBRARY
-  - ZLIB_INCLUDE_DIR
-  - ZLIB_LIBRARY
-  - PNG_PNG_INCLUDE_DIR
-  - PNG_LIBRARY
   - GLUT_INCLUDE_DIR
   - GLUT_glut_LIBRARY
 Configure
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c38a72d..a85af2a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -16,9 +16,7 @@ add_subdirectory (shaders)
 add_subdirectory (texturing)
 add_subdirectory (spec)
 
-if (TIFF_FOUND)
-	add_subdirectory (glean)
-endif (TIFF_FOUND)
+add_subdirectory (glean)
 
 IF(OPENGL_egl_LIBRARY)
 	add_subdirectory (egl)
diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt
index 3485b42..b510f36 100644
--- a/tests/glean/CMakeLists.gl.txt
+++ b/tests/glean/CMakeLists.gl.txt
@@ -11,7 +11,6 @@ ENDIF ()
 include_directories(
 	${GLEXT_INCLUDE_DIR}
 	${OPENGL_INCLUDE_PATH}
-	${TIFF_INCLUDE_DIR}
 	${piglit_SOURCE_DIR}/tests/util
 )
 
@@ -56,7 +55,6 @@ piglit_add_executable (glean
 	tpointsprite.cpp
 	treadpix.cpp
 	treadpixperf.cpp
-	trgbtris.cpp
 	tscissor.cpp
 	tshaderapi.cpp
 	tstencil2.cpp
@@ -78,10 +76,8 @@ piglit_add_executable (glean
 	gl.cpp
 	image_misc.cpp
 	pack.cpp
-	rdtiff.cpp
 	reg.cpp
 	unpack.cpp
-	wrtiff.cpp
 	basic.cpp
 	lex.cpp
 	timer.cpp
@@ -93,6 +89,5 @@ target_link_libraries (glean
 	${OPENGL_gl_LIBRARY}
 	${OPENGL_glu_LIBRARY}
 	${X11_X11_LIB}
-	${TIFF_LIBRARY}
 	${CARBON_LIBRARY}
 )
diff --git a/tests/glean/environ.h b/tests/glean/environ.h
index 1bf08f0..bb0139e 100644
--- a/tests/glean/environ.h
+++ b/tests/glean/environ.h
@@ -87,8 +87,7 @@ class Environment {
 
 	string imageFileName(string& dbName, string& testName, int n);
 				// Return name of image file number ``n''
-				// associated with the given test.  Suitable
-				// for use with Image::readTIFF(), etc.
+				// associated with the given test.
 				// XXX Doesn't create results directory,
 				// so resultFileName() must be called before
 				// using this.
diff --git a/tests/glean/image.h b/tests/glean/image.h
index fd28f49..3c6d62c 100644
--- a/tests/glean/image.h
+++ b/tests/glean/image.h
@@ -95,7 +95,7 @@ class Image {
 	// descriptive information that might arise when an Image is reused,
 	// and might permit use of template functions instead of lots of
 	// switches.  Probably not; it would make dynamic type assignment
-	// (such as reading a TIFF file) quite awkward.
+	// quite awkward.
 
     public:
 
@@ -114,8 +114,6 @@ class Image {
 		const char* filename;
 		CantOpen(const char* p) {filename = p;}
 	};
-	struct UnsupportedTIFF: public Error {	// TIFF we can't handle.
-	};
 	struct RefImageTooLarge: public Error {	// Can't register ref image.
 	};
 
@@ -228,18 +226,6 @@ class Image {
         // test if images are identical
         bool operator==(const Image &ref) const;
 
-	// Image arithmetic
-	// XXX type and format conversions, with appropriate scaling.
-	// XXX image difference
-	// XXX minmax, histogram, contrast stretch?
-
-	// TIFF I/O utilities:
-
-	void readTIFF(const char* filename);
-	inline void readTIFF(const std::string& s)  { readTIFF(s.c_str()); }
-	void writeTIFF(const char* filename);
-	inline void writeTIFF(const std::string& s)  { writeTIFF(s.c_str()); }
-
 	// GL operation utilities:
 
 	void draw();				// Invoke glDrawPixels.
diff --git a/tests/glean/rdtiff.cpp b/tests/glean/rdtiff.cpp
deleted file mode 100644
index 5e5068f..0000000
--- a/tests/glean/rdtiff.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-// BEGIN_COPYRIGHT
-// 
-// Copyright (C) 1999  Allen Akin   All Rights Reserved.
-// 
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the
-// Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-// PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL ALLEN AKIN BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-// 
-// END_COPYRIGHT
-
-
-
-
-#include "image.h"
-#include "tiffio.h"
-
-namespace GLEAN {
-
-///////////////////////////////////////////////////////////////////////////////
-// readTIFF - read image from TIFF file, set attributes to match the file
-///////////////////////////////////////////////////////////////////////////////
-void
-Image::readTIFF(const char* filename) {
-	// XXX Things we explicitly don't handle:
-	//	Varying number of bits per sample.  Sam's library doesn't
-	//		handle that.
-	//	Bits per sample other than 8, 16, or 32.
-	//	Tile-oriented TIFF files.  We only do strip-oriented files.
-	//	Planar configurations other than contiguous (R,G,B,R,G,B,...).
-	//	Premultiplied alpha.  If there's a fourth color channel,
-	//		we just assume it's non-premultiplied alpha.
-	// Eventually would be good to add a ``validation'' function which
-	// checks a file before attempting to read the image it contains.
-	// Also:  need error-reporting code.
-
-	TIFF* tf = TIFFOpen(filename, "r");
-	if (!tf)
-		throw CantOpen(filename);
-
-	uint32 u32;
-
-	TIFFGetFieldDefaulted(tf, TIFFTAG_IMAGELENGTH, &u32);
-	height(u32);
-
-	TIFFGetFieldDefaulted(tf, TIFFTAG_IMAGEWIDTH, &u32);
-	width(u32);
-
-	uint16 samplesPerPixel;
-	TIFFGetFieldDefaulted(tf, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel);
-	switch (samplesPerPixel) {
-	case 1:
-		format(GL_LUMINANCE);
-		break;
-	case 2:
-		format(GL_LUMINANCE_ALPHA);
-		break;
-	case 3:
-		format(GL_RGB);
-		break;
-	case 4:
-		format(GL_RGBA);
-		break;
-	default:
-		TIFFClose(tf);
-		throw UnsupportedTIFF();
-	}
-
-	uint16 bitsPerSample;
-	TIFFGetFieldDefaulted(tf, TIFFTAG_BITSPERSAMPLE, &bitsPerSample);
-	uint16 sampleFormat;
-	if (TIFFGetField(tf, TIFFTAG_SAMPLEFORMAT, &sampleFormat) != 1)
-		sampleFormat = SAMPLEFORMAT_UINT;
-	switch ((sampleFormat << 8) | bitsPerSample) {
-	case (SAMPLEFORMAT_UINT << 8) | 8:
-		type(GL_UNSIGNED_BYTE);
-		break;
-	case (SAMPLEFORMAT_UINT << 8) | 16:
-		type(GL_UNSIGNED_SHORT);
-		break;
-	case (SAMPLEFORMAT_UINT << 8) | 32:
-		type(GL_UNSIGNED_INT);
-		break;
-	case (SAMPLEFORMAT_INT << 8) | 8:
-		type(GL_BYTE);
-		break;
-	case (SAMPLEFORMAT_INT << 8) | 16:
-		type(GL_SHORT);
-		break;
-	case (SAMPLEFORMAT_INT << 8) | 32:
-		type(GL_INT);
-		break;
-	case (SAMPLEFORMAT_IEEEFP << 8) | 32:
-		type(GL_FLOAT);
-		break;
-	default:
-		TIFFClose(tf);
-		throw UnsupportedTIFF();
-	}
-
-	// At the moment it's not obvious whether we should pad
-	// scanlines to achieve a preferred alignment, so we'll just
-	// return an alignment that matches the data.
-	alignment(1);
-	switch (rowSizeInBytes() & 0x7) {
-	case 0:
-		alignment(8);
-		break;
-	case 4:
-		alignment(4);
-		break;
-	case 2:
-	case 6:
-		alignment(2);
-		break;
-	case 1:
-	case 3:
-	case 5:
-	case 7:
-		alignment(1);
-		break;
-	}
-
-	reserve();
-
-	{
-		// Store rows in reverse order, so that the default TIFF
-		// orientation won't result in an upside-down image for
-		// OpenGL:
-		GLsizei rowStep = rowSizeInBytes();
-		char* row = pixels() + (height() - 1) * rowStep;
-		for (GLsizei r = 0; r < height(); ++r, row -= rowStep)
-			TIFFReadScanline(tf, row, r);
-	}
-
-	TIFFClose(tf);
-} // Image::readTIFF
-
-}; // namespace GLEAN
diff --git a/tests/glean/trgbtris.cpp b/tests/glean/trgbtris.cpp
deleted file mode 100644
index 565a85f..0000000
--- a/tests/glean/trgbtris.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-// BEGIN_COPYRIGHT -*- glean -*-
-// 
-// Copyright (C) 1999  Allen Akin   All Rights Reserved.
-// 
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the
-// Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-// PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL ALLEN AKIN BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-// 
-// END_COPYRIGHT
-
-// trgbtris.cpp:  example image-based test to show use of TIFF images
-
-#include "trgbtris.h"
-#include "stats.h"
-#include "rand.h"
-#include "geomutil.h"
-#include "image.h"
-
-#if 0
-#if defined __UNIX__
-#include <unistd.h>
-#endif
-
-#include <iostream>
-#include <fstream>
-#include <algorithm>
-#include "dsconfig.h"
-#include "dsfilt.h"
-#include "dsurf.h"
-#include "winsys.h"
-#include "environ.h"
-#include "rc.h"
-#include "glutils.h"
-#include "trgbtris.h"
-#include "misc.h"
-#endif
-
-namespace {
-
-void
-logStats(GLEAN::BasicStats& stats, GLEAN::Environment* env) {
-	env->log << "\t\tmin = " << stats.min() << ", max = " << stats.max()
-		<< "\n\t\tmean = " << stats.mean() << ", standard deviation = "
-		<< stats.deviation() << '\n';
-}
-
-} // anonymous namespace
-
-namespace GLEAN {
-
-///////////////////////////////////////////////////////////////////////////////
-// runOne:  Run a single test case
-///////////////////////////////////////////////////////////////////////////////
-void
-RGBTriStripTest::runOne(RGBTriStripResult& r, Window& w) {
-	static int this_config = 0;
-	r.imageNumber = ++this_config;
-	
-	GLUtils::useScreenCoords(drawingSize + 2, drawingSize + 2);
-
-	int nPoints = 20;	// Exact value doesn't really matter.
-	RandomDouble vRand(142857);
-	RandomMesh2D v(1.0, drawingSize, nPoints, 1.0, drawingSize, nPoints,
-		vRand);
-
-	RandomDouble cRand(271828);
-
-	glClear(GL_COLOR_BUFFER_BIT);
-	glShadeModel(GL_SMOOTH);
-
-	for (int row = 0; row < nPoints - 1; ++row) {
-		glBegin(GL_TRIANGLE_STRIP);
-			for (int col = 0; col < nPoints; ++col) {
-				float r = cRand.next();
-				float g = cRand.next();
-				float b = cRand.next();
-				glColor3f(r, g, b);
-				glVertex2fv(v(row, col));
-				r = cRand.next();
-				g = cRand.next();
-				b = cRand.next();
-				glColor3f(r, g, b);
-				glVertex2fv(v(row + 1, col));
-			}
-		glEnd();
-	}
-	w.swap();
-
-	Image image(drawingSize + 2, drawingSize + 2, GL_RGB, GL_FLOAT);
-	image.read(0, 0);	// Invoke glReadPixels to read the image.
-	image.writeTIFF(env->imageFileName(name, r.imageNumber));
-
-	r.pass = true;
-} // RGBTriStripTest::runOne
-
-///////////////////////////////////////////////////////////////////////////////
-// logOne:  Log a single test case
-///////////////////////////////////////////////////////////////////////////////
-void
-RGBTriStripTest::logOne(RGBTriStripResult& r) {
-	env->log << name << ":  NOTE "
-		 << r.config->conciseDescription() << '\n'
-		 << "\tImage number " << r.imageNumber << '\n';
-	if (env->options.verbosity)
-		env->log <<
-		   "\tThis test does not check its result.  Please view\n"
-		   "\tthe image to verify that the result is correct, or\n"
-		   "\tcompare it to a known-good result from a different\n"
-		   "\trun of glean.\n";
-} // RGBTriStripTest::logOne
-
-///////////////////////////////////////////////////////////////////////////////
-// compareOne:  Compare results for a single test case
-///////////////////////////////////////////////////////////////////////////////
-void
-RGBTriStripTest::compareOne(RGBTriStripResult& oldR, RGBTriStripResult& newR) {
-	// Fetch the old and new images:
-	Image oldI;
-	oldI.readTIFF(env->image1FileName(name, oldR.imageNumber));
-	Image newI;
-	newI.readTIFF(env->image2FileName(name, newR.imageNumber));
-
-	// Register the images, and gather statistics about the differences
-	// for each color channel:
-	Image::Registration reg(oldI.reg(newI));
-
-	// Compute worst-case tolerance (1 LSB in the shallowest drawing
-	// surface configuration) for each color channel:
-	double rTol = 1.0 / (1 << min(oldR.config->r, newR.config->r));
-	double gTol = 1.0 / (1 << min(oldR.config->g, newR.config->g));
-	double bTol = 1.0 / (1 << min(oldR.config->b, newR.config->b));
-
-	// We'll conclude that the images are the ``same'' if the maximum
-	// absolute error is no more than 1 LSB (in the shallowest config):
-	if (reg.stats[0].max() <= rTol && reg.stats[1].max() <= gTol
-	 && reg.stats[2].max() <= bTol) {
-		if (env->options.verbosity) {
-			env->log << name << ": SAME "
-				<< newR.config->conciseDescription() << '\n';
-			if (reg.stats[0].max() == 0 && reg.stats[1].max() == 0
-			 && reg.stats[1].max() == 0)
-				env->log << "\tImages are exactly equal\n";
-			else
-				env->log << "\tImages are approximately equal\n";
-		}
-	} else {
-		env->log << name << ":  DIFF "
-			<< newR.config->conciseDescription() << '\n'
-			<< "\tDifference exceeds 1 LSB in at least one "
-			   "color channel\n";
-	}
-	if (env->options.verbosity) {
-		env->log << "\tred:\n";
-		logStats(reg.stats[0], env);
-		env->log << "\tgreen:\n";
-		logStats(reg.stats[1], env);
-		env->log << "\tblue:\n";
-		logStats(reg.stats[2], env);
-	}
-} // RGBTriStripTest::compareOne
-
-///////////////////////////////////////////////////////////////////////////////
-// The test object itself:
-///////////////////////////////////////////////////////////////////////////////
-RGBTriStripTest rgbTriStripTest("rgbTriStrip", "window, rgb",
-
-	"The best approach when designing a test is to make it\n"
-	"self-checking; that is, the test itself should determine\n"
-	"whether the image or other data structure that it produces is\n"
-	"correct.  However, some tests are difficult to design in this\n"
-	"way, and for some other tests (like stress tests or regression\n"
-	"tests concerning previously-reported bugs) it may be\n"
-	"unnecessary.  For such tests, glean provides mechanisms to\n"
-	"save images and compare them to images generated from other\n"
-	"runs.  This test simply exercises those mechanisms.\n");
-
-
-} // namespace GLEAN
diff --git a/tests/glean/trgbtris.h b/tests/glean/trgbtris.h
deleted file mode 100644
index b41a10b..0000000
--- a/tests/glean/trgbtris.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// BEGIN_COPYRIGHT -*- glean -*-
-// 
-// Copyright (C) 1999  Allen Akin   All Rights Reserved.
-// 
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the
-// Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-// PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL ALLEN AKIN BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-// 
-// END_COPYRIGHT
-
-// trgbtris.h:  example image-based test to show use of TIFF images
-
-#ifndef __trgbtris_h__
-#define __trgbtris_h__
-
-#include "tbase.h"
-
-namespace GLEAN {
-
-#define drawingSize 64
-
-class RGBTriStripResult: public BaseResult {
-public:
-	bool pass;
-	int  imageNumber;
-
-	void putresults(ostream& s) const {
-		s << imageNumber << '\n';
-	}
-	
-	bool getresults(istream& s) {
-		s >> imageNumber;
-		return s.good();
-	}
-};
-
-class RGBTriStripTest: public BaseTest<RGBTriStripResult> {
-public:
-	GLEAN_CLASS_WH(RGBTriStripTest, RGBTriStripResult,
-		       drawingSize, drawingSize);
-}; // class RGBTriStripTest
-
-} // namespace GLEAN
-
-#endif // __trgbtris_h__
diff --git a/tests/glean/wrtiff.cpp b/tests/glean/wrtiff.cpp
deleted file mode 100644
index f4b95ba..0000000
--- a/tests/glean/wrtiff.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-// BEGIN_COPYRIGHT
-// 
-// Copyright (C) 1999  Allen Akin   All Rights Reserved.
-// 
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the
-// Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-// PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL ALLEN AKIN BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-// 
-// END_COPYRIGHT
-
-
-
-
-// Implementation of image data, attribute, and I/O
-
-#include "image.h"
-#include "tiffio.h"
-
-namespace GLEAN {
-
-///////////////////////////////////////////////////////////////////////////////
-// writeTIFF - write image to TIFF file
-///////////////////////////////////////////////////////////////////////////////
-void
-Image::writeTIFF(const char* filename) {
-	static uint16 unassocAlpha[] = {EXTRASAMPLE_UNASSALPHA};
-	GLsizei rowStep = rowSizeInBytes();
-
-	TIFF* tf = TIFFOpen(filename, "w");
-	if (!tf)
-		throw CantOpen(filename);
-
-	TIFFSetField(tf, TIFFTAG_IMAGELENGTH, height());
-	TIFFSetField(tf, TIFFTAG_IMAGEWIDTH, width());
-	TIFFSetField(tf, TIFFTAG_XRESOLUTION, 100.0);
-	TIFFSetField(tf, TIFFTAG_YRESOLUTION, 100.0);
-	TIFFSetField(tf, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
-	TIFFSetField(tf, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
-	TIFFSetField(tf, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
-	TIFFSetField(tf, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
-		// LZW would have been acceptable, were it not for patent
-		// issues.
-	TIFFSetField(tf, TIFFTAG_ROWSPERSTRIP, height());
-
-	switch (format()) {
-	case GL_LUMINANCE:
-		TIFFSetField(tf, TIFFTAG_SAMPLESPERPIXEL, 1);
-		TIFFSetField(tf, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
-		break;
-	case GL_LUMINANCE_ALPHA:
-		TIFFSetField(tf, TIFFTAG_SAMPLESPERPIXEL, 2);
-		TIFFSetField(tf, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
-		TIFFSetField(tf, TIFFTAG_EXTRASAMPLES, 1, unassocAlpha);
-		break;
-	case GL_RGB:
-		TIFFSetField(tf, TIFFTAG_SAMPLESPERPIXEL, 3);
-		TIFFSetField(tf, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
-		break;
-	case GL_RGBA:
-		TIFFSetField(tf, TIFFTAG_SAMPLESPERPIXEL, 4);
-		TIFFSetField(tf, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
-		TIFFSetField(tf, TIFFTAG_EXTRASAMPLES, 1, unassocAlpha);
-		break;
-	default:
-		TIFFClose(tf);
-		throw BadFormat(format());
-	}
-
-	switch (type()) {
-	case GL_BYTE:
-		TIFFSetField(tf, TIFFTAG_BITSPERSAMPLE, 8);
-		TIFFSetField(tf, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
-		break;
-	case GL_UNSIGNED_BYTE:
-		TIFFSetField(tf, TIFFTAG_BITSPERSAMPLE, 8);
-		TIFFSetField(tf, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
-		break;
-	case GL_SHORT:
-		TIFFSetField(tf, TIFFTAG_BITSPERSAMPLE, 16);
-		TIFFSetField(tf, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
-		break;
-	case GL_UNSIGNED_SHORT:
-		TIFFSetField(tf, TIFFTAG_BITSPERSAMPLE, 16);
-		TIFFSetField(tf, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
-		break;
-	case GL_INT:
-		TIFFSetField(tf, TIFFTAG_BITSPERSAMPLE, 32);
-		TIFFSetField(tf, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
-		break;
-	case GL_UNSIGNED_INT:
-		TIFFSetField(tf, TIFFTAG_BITSPERSAMPLE, 32);
-		TIFFSetField(tf, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
-		break;
-	case GL_FLOAT:
-		TIFFSetField(tf, TIFFTAG_BITSPERSAMPLE, 32);
-		TIFFSetField(tf, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
-		break;
-	default:
-		TIFFClose(tf);
-		throw BadType(type());
-	}
-
-	{
-		// Write rows in reverse order, so that the usual OpenGL
-		// orientation won't result in an upside-down image for
-		// naive TIFF readers:
-		char* row = pixels() + (height() - 1) * rowStep;
-		for (GLsizei r = 0; r < height(); ++r, row -= rowStep)
-			TIFFWriteScanline(tf, row, r, 0);
-	}
-
-	TIFFClose(tf);
-}; // Image::writeTIFF
-
-
-}; // namespace GLEAN
-- 
1.7.10.4



More information about the Piglit mailing list