This file is indexed.

/usr/include/OpenLayer/TexturedPoly.hpp is in libopenlayer-dev 2.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef OL_TEXTURED_POLY_HPP
#define OL_TEXTURED_POLY_HPP

#include "Polygon.hpp"
#include "Vec2D.hpp"
#include "Declspec.hpp"
#include <vector>
#include <utility>

//#define OL_DEBUG_TEXTURED_POLY


namespace ol {

class Bitmap;


class OL_LIB_DECLSPEC TexturedPoly : public Poly {
public:
   TexturedPoly( Vec2D rotationPivot = Vec2D( 0.0, 0.0 ))
      : Poly( rotationPivot ), texture( 0 ), dirty( true ) {}
      
   TexturedPoly( const Bitmap &texture, Vec2D rotationPivot = Vec2D( 0.0, 0.0 ))
      : Poly( rotationPivot ), texture( &texture ), dirty( true ) {}
   
   template< class std_container >
   TexturedPoly( const Bitmap &texture, const std_container &vertices, Vec2D rotationPivot = Vec2D( 0.0, 0.0 ))
      : Poly( vertices, rotationPivot ), texture( &texture ), dirty( true ) {}
   
   
   TexturedPoly( const Bitmap &texture, const Vec2D *vertices, int numVertices,
                 Vec2D rotationPivot = Vec2D( 0.0, 0.0 ))
      : Poly( vertices, numVertices, rotationPivot ), texture( &texture ), dirty( true ) {}
   
   virtual void Draw( float opacity );
   
   virtual void Add( Vec2D vec );
   
   virtual void SetVertex( int index, const Vec2D &newValue );
   
   virtual void SetTexture( const Bitmap &texture );
   
   void Construct();
   
protected:
   void AddEdgePoints( std::vector< Vec2D > &vecs, const Line &segment, Line **textureEdges, bool lowestFirst );
   
   bool LineCollides( const Line &line, std::vector< Vec2D > ::const_iterator start,
                      std::vector< Vec2D > ::const_iterator end );
   
   inline bool isInside( const Vec2D &vec, float x, float y, float w, float h ) const {
      return vec.x >= x && vec.y >= y && vec.x < x + w && vec.y < y + h;
   }
   
   class SideProcessed {
   public:
      SideProcessed() : isEmpty( false ) {}
      
      std::vector< Vec2D > vertices;
      bool isEmpty;
   };
   
   SideProcessed ProcessSide( std::vector< Vec2D > ::const_iterator start,
                              std::vector< Vec2D > ::const_iterator end,
                              float x, float y, bool isUpper, bool leftToRight );
   
   class SlicePart {
   public:
      SlicePart( float top, float bottom, float x, float textureStartX, float textureStartY, const Bitmap *bmp );
      
      inline void RenderStripPart() {
         glTexCoord2f( textureX, textureTop );
         glVertex2f( x, top );
         glTexCoord2f( textureX, textureBottom );
         glVertex2f( x, bottom );
      }
      
      inline bool IsHeightZero() {
         return bottom - top < 2.0;
      }

#ifndef OL_DEBUG_TEXTURED_POLY
   protected:
#endif // OL_DEBUG_TEXTURED_POLY
      float top, bottom;
      float textureTop, textureBottom;
      float x, textureX;
   };
   
   class HSlice {
   public:
      ~HSlice();
      
      inline void AddPart( SlicePart *part ) {
         parts.push_back( part );
      }
      
      void Render();
      
   private:
      std::vector< SlicePart *> parts;
   };
   
   std::vector< HSlice *> slices;
   const Bitmap *texture;
   bool dirty; // Indicates the need of reconstruction
};



}



#endif // OL_TEXTURED_POLY_HPP