aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-11-14 22:14:46 -0800
committerKenneth Graunke <kenneth@whitecape.org>2013-01-03 13:40:41 -0800
commitda4d00bd5f81ec74bd5d0ac5bd0c5336182922e1 (patch)
tree8f4bdd401e5f7222a81a7158e970d692b9e6ef39
parentca19fd2ce4b102cec56e6c955f913fb810d4b21d (diff)
glean: Remove CodedID code.
This wasn't used for anything.
-rw-r--r--tests/glean/CMakeLists.gl.txt1
-rw-r--r--tests/glean/codedid.cpp146
-rw-r--r--tests/glean/codedid.h92
3 files changed, 0 insertions, 239 deletions
diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt
index 50282eae..eca5740d 100644
--- a/tests/glean/CMakeLists.gl.txt
+++ b/tests/glean/CMakeLists.gl.txt
@@ -15,7 +15,6 @@ include_directories(
)
piglit_add_executable (glean
- codedid.cpp
dsconfig.cpp
dsfilt.cpp
dsurf.cpp
diff --git a/tests/glean/codedid.cpp b/tests/glean/codedid.cpp
deleted file mode 100644
index 7921e829..00000000
--- a/tests/glean/codedid.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-// BEGIN_COPYRIGHT -*- glean -*-
-//
-// Copyright (C) 2000 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
-
-
-
-// codedid.h: tool to map integer IDs into colors, and vice-versa
-
-#include <algorithm>
-#include <vector>
-#include "codedid.h"
-#include "image.h"
-
-using namespace std;
-
-namespace GLEAN {
-
-///////////////////////////////////////////////////////////////////////////////
-// RGBCodedID: Create an object that maps integer identification numbers
-// to RGB triples, and vice-versa
-///////////////////////////////////////////////////////////////////////////////
-RGBCodedID::RGBCodedID(int r, int g, int b) {
- rBits = min(8, r); // 8 because we use GLubyte color values
- gBits = min(8, g);
- bBits = min(8, b);
- nsRBits = 8 - rBits;
- nsGBits = 8 - gBits;
- nsBBits = 8 - bBits;
- rMask = (1 << rBits) - 1;
- gMask = (1 << gBits) - 1;
- bMask = (1 << bBits) - 1;
-} // RGBCodedID::RGBCodedID
-
-RGBCodedID::~RGBCodedID() {
-} // RGBCodedID::~RGBCodedID
-
-///////////////////////////////////////////////////////////////////////////////
-// maxID: Return the maximum allowable integer ID number
-///////////////////////////////////////////////////////////////////////////////
-int
-RGBCodedID::maxID() const {
- return (1 << (rBits + gBits + bBits)) - 1;
-} // RGBCodedID::maxID
-
-///////////////////////////////////////////////////////////////////////////////
-// toRGB: Convert integer ID number to RGB triple
-///////////////////////////////////////////////////////////////////////////////
-void
-RGBCodedID::toRGB(int id, GLubyte& r, GLubyte& g, GLubyte& b) const {
- b = (id & bMask) << nsBBits;
- id >>= bBits;
- g = (id & gMask) << nsGBits;
- id >>= gBits;
- r = (id & rMask) << nsRBits;
-} // RGBCodedID::toRGB
-
-///////////////////////////////////////////////////////////////////////////////
-// toID: Convert RGB triple to integer ID number
-///////////////////////////////////////////////////////////////////////////////
-int
-RGBCodedID::toID(GLubyte r, GLubyte g, GLubyte b) const {
- int id = 0;
- id |= (r >> nsRBits) & rMask;
- id <<= gBits;
- id |= (g >> nsGBits) & gMask;
- id <<= bBits;
- id |= (b >> nsBBits) & bMask;
- return id;
-} // RGBCodedID::toID
-
-///////////////////////////////////////////////////////////////////////////////
-// histogram: Compute histogram of coded IDs in an UNSIGNED_BYTE RGB image
-///////////////////////////////////////////////////////////////////////////////
-void
-RGBCodedID::histogram(Image& img, vector<int>& hist) const {
- if (img.format() != GL_RGB || img.type() != GL_UNSIGNED_BYTE) {
- hist.resize(0);
- return;
- }
-
- int max = maxID();
- hist.resize(max + 1);
- for (vector<int>::iterator p = hist.begin(); p != hist.end(); ++p)
- *p = 0;
-
- GLubyte* row = reinterpret_cast<GLubyte*>(img.pixels());
- for (GLsizei r = 0; r < img.height(); ++r) {
- GLubyte* pix = row;
- for (GLsizei c = 0; c < img.width(); ++c) {
- int id = toID(pix[0], pix[1], pix[2]);
- if (id <= max)
- ++hist[id];
- pix += 3;
- }
- row += img.rowSizeInBytes();
- }
-} // RGBCodedID::histogram
-
-///////////////////////////////////////////////////////////////////////////////
-// allPresent: See if all of a range of IDs are present in a given RGB image
-///////////////////////////////////////////////////////////////////////////////
-bool
-RGBCodedID::allPresent(Image& img, int first, int last) const {
- vector<int> hist;
- histogram(img, hist);
- if (hist.size() == 0)
- return false;
- if (first >= static_cast<int>(hist.size()))
- return false;
- if (last >= static_cast<int>(hist.size()))
- return false;
- if (first > last)
- return false;
-
- for (vector<int>::const_iterator p = hist.begin() + first;
- p != hist.begin() + last + 1; ++p)
- if (*p == 0)
- return false;
- return true;
-} // RGBCodedID::allPresent
-
-} // namespace GLEAN
diff --git a/tests/glean/codedid.h b/tests/glean/codedid.h
deleted file mode 100644
index b7bbc066..00000000
--- a/tests/glean/codedid.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// BEGIN_COPYRIGHT -*- glean -*-
-//
-// Copyright (C) 2000 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
-
-
-
-// codedid.h: tool to map integer IDs into colors, and vice-versa
-
-// A note on principles of operation: The OpenGL spec normally allows
-// a reasonable amount of slop when converting user-specified colors
-// to a hardware-dependent representation in the framebuffer. One
-// exception to this lenience is when lighting is disabled and the
-// color is specified as an unsigned byte, short, or int. In this
-// case the conversion from user-supplied color to hardware-determined
-// color must be exact, up to the number of bits in the framebuffer or
-// in the value supplied by the user (whichever is smaller). This is
-// intended to allow object identification numbers to be encoded as
-// colors, so that applications can implement object selection by
-// drawing objects and reading back the image to determine the object
-// ID of the closest visible object. glean uses this property in a
-// number of cases, for example, where it needs to draw a large number
-// of primitives and verify that all of them were actually drawn. See
-// the OpenGL spec, version 1.2.1, section 2.13.9 (page 55) for the
-// description of this convertibility requirement.
-
-#ifndef __codedid_h__
-#define __codedid_h__
-
-using namespace std;
-
-#include <vector>
-#include "glwrap.h"
-
-namespace GLEAN {
-
-class Image; // forward reference
-
-class RGBCodedID {
- int rBits, gBits, bBits; // number of signif. bits in channels
- int nsRBits, nsGBits, nsBBits; // non-significant bits in each
- int rMask, gMask, bMask; // masks for significant bits in each
- public:
- RGBCodedID(int r, int g, int b);
- ~RGBCodedID();
-
- // Return the maximum ID number that the caller can use:
- int maxID() const;
-
- // Map an ID number to an RGB triple:
- void toRGB(int id, GLubyte& r, GLubyte& g, GLubyte& b) const;
-
- // Map an RGB triple to the equivalent ID number:
- int toID(GLubyte r, GLubyte g, GLubyte b) const;
-
- // Histogram an UNSIGNED_BYTE RGB image:
- void histogram(Image& img, vector<int>& hist) const;
-
- // Are all of a range of IDs present in an RGB image?
- bool allPresent(Image& img, int first, int last) const;
-
-}; // RGBCodedID
-
-// XXX Might want an IndexCodedID class for use with color index drawing
-// surfaces, even though such a class would be trivial.
-
-} // namespace GLEAN
-
-#endif // __codedid_h__