/usr/include/mapnik/agg/agg_rendering_buffer_dynarow.h is in libmapnik-dev 2.2.0+ds1-6build2.
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 | //----------------------------------------------------------------------------
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
//----------------------------------------------------------------------------
// Contact: mcseem@antigrain.com
// mcseemagg@yahoo.com
// http://www.antigrain.com
//----------------------------------------------------------------------------
//
// class rendering_buffer_dynarow
//
//----------------------------------------------------------------------------
#ifndef AGG_RENDERING_BUFFER_DYNAROW_INCLUDED
#define AGG_RENDERING_BUFFER_DYNAROW_INCLUDED
#include "agg_array.h"
namespace agg
{
//===============================================rendering_buffer_dynarow
// Rendering buffer class with dynamic allocation of the rows.
// The rows are allocated as needed when requesting for span_ptr().
// The class automatically calculates min_x and max_x for each row.
// Generally it's more efficient to use this class as a temporary buffer
// for rendering a few lines and then to blend it with another buffer.
//
class rendering_buffer_dynarow
{
public:
typedef row_info<int8u> row_data;
//-------------------------------------------------------------------
~rendering_buffer_dynarow()
{
init(0,0,0);
}
//-------------------------------------------------------------------
rendering_buffer_dynarow() :
m_rows(),
m_width(0),
m_height(0),
m_byte_width(0)
{
}
// Allocate and clear the buffer
//--------------------------------------------------------------------
rendering_buffer_dynarow(unsigned width, unsigned height,
unsigned byte_width) :
m_rows(height),
m_width(width),
m_height(height),
m_byte_width(byte_width)
{
memset(&m_rows[0], 0, sizeof(row_data) * height);
}
// Allocate and clear the buffer
//--------------------------------------------------------------------
void init(unsigned width, unsigned height, unsigned byte_width)
{
unsigned i;
for(i = 0; i < m_height; ++i)
{
pod_allocator<int8u>::deallocate((int8u*)m_rows[i].ptr, m_byte_width);
}
if(width && height)
{
m_width = width;
m_height = height;
m_byte_width = byte_width;
m_rows.resize(height);
memset(&m_rows[0], 0, sizeof(row_data) * height);
}
}
//--------------------------------------------------------------------
unsigned width() const { return m_width; }
unsigned height() const { return m_height; }
unsigned byte_width() const { return m_byte_width; }
// The main function used for rendering. Returns pointer to the
// pre-allocated span. Memory for the row is allocated as needed.
//--------------------------------------------------------------------
int8u* row_ptr(int x, int y, unsigned len)
{
row_data* r = &m_rows[y];
int x2 = x + len - 1;
if(r->ptr)
{
if(x < r->x1) { r->x1 = x; }
if(x2 > r->x2) { r->x2 = x2; }
}
else
{
int8u* p = pod_allocator<int8u>::allocate(m_byte_width);
r->ptr = p;
r->x1 = x;
r->x2 = x2;
memset(p, 0, m_byte_width);
}
return (int8u*)r->ptr;
}
//--------------------------------------------------------------------
const int8u* row_ptr(int y) const { return m_rows[y].ptr; }
int8u* row_ptr(int y) { return row_ptr(0, y, m_width); }
row_data row (int y) const { return m_rows[y]; }
private:
//--------------------------------------------------------------------
// Prohibit copying
rendering_buffer_dynarow(const rendering_buffer_dynarow&);
const rendering_buffer_dynarow& operator = (const rendering_buffer_dynarow&);
private:
//--------------------------------------------------------------------
pod_array<row_data> m_rows; // Pointers to each row of the buffer
unsigned m_width; // Width in pixels
unsigned m_height; // Height in pixels
unsigned m_byte_width; // Width in bytes
};
}
#endif
|