This file is indexed.

/usr/include/OpenLayer/Canvas.hpp is in libopenlayer-dev 2.1-2.1+b1.

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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#ifndef OL_CANVAS_HPP
#define OL_CANVAS_HPP


#include "Includes.hpp"
#include "Bitmap.hpp"
#include "Rectangle.hpp"
#include "OlRectangle.hpp"
#include "Declspec.hpp"

#include <stack>
#include <map>
#include <string>


namespace ol {


enum RenderTarget {
   BITMAP_TARGET,
   SCREEN_BACKBUF,
   SCREEN_FRONTBUF
};



enum PixelWriteMode {
   COLOR_AND_ALPHA,
   COLOR_ONLY,
   ALPHA_ONLY
};


class Rect;

// The rendering surface //

class OL_LIB_DECLSPEC Canvas {
public:
   // Sets the Bitmap as the active rendering surface //
   static void SetTo( const Bitmap &image );
   
   // Sets the specified OpenGL buffer as the active backbuffer //
   // Restores the clipping and pixel write settings of the RenderTarget //
   static void SetTo( RenderTarget buffer );
   
   // Refresh the active canvas (backbuffer) //
   static void Refresh();
   
   // Fills the active rendering surface with the specified color //
   static void Fill( Rgba fillColor, PixelWriteMode filledComponents = COLOR_AND_ALPHA );
   
   // Sets the clipping region of the active rendering surface //
   static inline void SetClipping( int x, int y, int w, int h ) {
      activeSurface.SetClipping( x, y, w, h );
   }
   
   // Sets the clipping region of the active rendering surface //
   // Warning: The area will be rounded down to whole pixels! //
   static inline void SetClipping( const Rect &area ) {
      SetClipping( int(floor( area.pos.x )), int(floor( area.pos.y )), int(ceil( area.size.x )), int(ceil( area.size.y )));
   }
   
   // Restores previous clipping region //
   static inline void RevertClipping() {
      activeSurface.RevertClipping();
   }
   
   // Disables the clipping region //
   static inline void DisableClipping() {
      activeSurface.DisableClipping();
   }
   
   // Returns the active clipping region //
   static inline Rect GetClippingRegion() {
      return activeSurface.GetClippingRegion();
   }
   
   // Returns the width of the canvas //
   inline static int Width() {
      return activeSurface.width;
   }
   
   // Returns the height of the canvas //
   inline static int Height() {
      return activeSurface.height;
   }
   
   // Sets which color components OpenLayer will render to the canvas //
   // Defaults:
   // - For SCREEN_BACKBUF: COLOR_ONLY (Alpha channel of the canvas is not modified) //
   // - For Bitmaps: COLOR_AND_ALPHA (All color componens of the canvas are modified) //
   static void SetPixelWriteMode( PixelWriteMode mode ) {
      return activeSurface.SetPixelWriteMode( mode );
   }
   
   // Returns which color componenents will be rendered to the canvas (see above) //
   static PixelWriteMode GetPixelWriteMode() {
      return activeSurface.GetPixelWriteMode();
   }
   
   // Stores the Canvas in a stack //
   inline static void Push() {
      pushedSurfaces.push( activeSurface );
   }
   
   // Pops the topmost Canvas from the stack //
   // Returns true if there was a Canvas stored in the stack //
   inline static bool Pop() {
      if( pushedSurfaces.size() > 0 ) {
         SetTo( pushedSurfaces.top() );
         pushedSurfaces.pop();
         return true;
      }
      
      return false;
   }
   
   // Saves the contents of the surface with the given name //
   static void Save( std::string filename );
   
   // Returns the contents of the surface as a memory bitmap //
   static OL_MEMORY_IMG *GetMemoryBitmap();
   
   // Retrieves the sizes of the screen buffers from Setup //
   static void ReadBufferSizes();
   
   static int GetScreenshotBPP();
   
   static int GetScreenshotFormat();
   
private:
   static void FinishSurfaceSelection();
   static void ReleaseSurface();
   
   static void SelectBuffer( RenderTarget buffer );
   static void SelectImage( const Bitmap &image );
   
   class SurfaceInfo {
   public:
      SurfaceInfo()
         : width( 0 ), height( 0 ), target( BITMAP_TARGET ), image( 0 ) {}
      
      SurfaceInfo( RenderTarget target, int width, int height, const Bitmap *image = 0 )
         : width( width ), height( height ), target( target ), image( image ) {}
      
      void ApplySettings();
      
      inline RenderTarget GetType() const {
         return target;
      }
      
      inline const Bitmap *GetImage() const {
         return image;
      }
      
      void SetClipping( int x, int y, int w, int h );
      Rect GetClippingRegion();
      void RevertClipping();
      void DisableClipping();
      
      void SelectDefaultBufferSize();
      
      void SetPixelWriteMode( PixelWriteMode mode );
      inline PixelWriteMode GetPixelWriteMode() {
         return writeMode;
      }
      void ChooseDefaultPixelWriteMode();
      
      int width, height;
   private:
      void ApplyClipping();
      void ApplyPixelWriteMode();
      
      std::stack< OlRectangle< int > > clippingRegions;
      PixelWriteMode writeMode;
      RenderTarget target;
      const Bitmap *image;
   };
   
   static void SetTo( const Canvas::SurfaceInfo &info );
   
   static SurfaceInfo activeSurface;
   static std::map< RenderTarget, SurfaceInfo > storedSurfaces;
   static std::stack< SurfaceInfo > pushedSurfaces;
};


};





#endif // OL_CANVAS_HPP