Changeset 26


Ignore:
Timestamp:
05/20/13 21:29:15 (12 years ago)
Author:
melon
Message:

Added doxygen documentation to image.

Removed image::clear() as this function wasn't defined or used anywhere.

Image destructor is now virtual (as it allocated memory).

Removed warnings of unsigned/singed comparison from image.cc

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/gl/image.hh

    r21 r26  
    1313namespace nv
    1414{
     15        /**
     16         * Defines the starting position of some region and its size.
     17         */
    1518        struct region
    1619        {
     
    2225        };
    2326
     27        /**
     28         * Holder for images.
     29         *
     30         * By an image we understand a group of pixels, limited to X and Y
     31         * dimensions, of a certain depth (by depth we mean how rich
     32         * the colours are.
     33         */
    2434        class image
    2535        {
    2636        public:
     37                /**
     38                 * Constructor
     39                 *
     40                 * @arg[in] size : Dimensions of the image as a vector.
     41                 * @arg[in] depth :  Depth of the image.
     42                 */
    2743                image( glm::ivec2 size, size_t depth );
     44                /**
     45                 * Full constructor.
     46                 *
     47                 * Allows creation of an image with specified data. It is
     48                 * to reverse the image (from left to right).
     49                 *
     50                 * @arg[in] size : Dimensions of the image as a vector.
     51                 * @arg[in] depth : Depth of the image.
     52                 * @arg[in] data : Data of the image.
     53                 * @arg[in] reversed : Determines if the image should be
     54                 *      reversed or not.
     55                 */
    2856                image( glm::ivec2 size, size_t depth, const uint8 * data, bool reversed = false );
    29                 void clear();
     57                /**
     58                 * Fills the image with a given value.
     59                 *
     60                 * @arg[in] value : Value to fill.
     61                 */
    3062                void fill( uint8 value );
     63                /**
     64                 * Just like fill, but a region can be specified.
     65                 *
     66                 * @arg[in] r : Region to be filled.
     67                 * @arg[in] data : Data to fill the region
     68                 * @arg[in] stride :
     69                 */
    3170                void set_region( region r, const uint8 * data, size_t stride = 0 );
    32                 ~image();
     71                /**
     72                 * Default destructor. Deallocates data.
     73                 */
     74                virtual ~image();
     75                /**
     76                 * Getter for data.
     77                 *
     78                 * @return The data.
     79                 */
    3380                const uint8 * get_data() const { return m_data; }
     81                /**
     82                 * Getter for size.
     83                 *
     84                 * @return Returns the size of the image as a vector.
     85                 */
    3486                const glm::ivec2 get_size() const { return m_size; }
     87                /**
     88                 * Getter for depth.
     89                 *
     90                 * @return Returns depth of the image.
     91                 */
    3592                const size_t get_depth() const { return m_depth; }
    3693        protected:
     94                /** Defines the size of the image as a vector. */
    3795                glm::ivec2 m_size;
     96                /** Deefines the depth of the image. */
    3897                size_t     m_depth;
     98                /** Holder for data. */
    3999                uint8*     m_data;
    40100        };
     
    43103
    44104#endif // NV_IMAGE_HH
     105
  • trunk/src/gl/image.cc

    r21 r26  
    2222        if ( reversed )
    2323        {
    24                 for( size_t i = 0; i < size.y; ++i )
     24                for( int i = 0; i < size.y; ++i )
    2525                {
    2626                        memcpy( m_data + size.x * ( size.y - i - 1) * m_depth, data + i * size.x * m_depth, m_size.x * m_depth );
     
    4343        if ( stride == 0 ) stride = r.size.x;
    4444
    45     for( size_t i = 0; i < r.size.y; ++i )
    46     {
    47         memcpy( m_data+((r.pos.y+i)*m_size.x + r.pos.x ) * m_depth,
    48                 data + (i*stride), r.size.x * m_depth );
    49     }
     45        for( int i = 0; i < r.size.y; ++i )
     46        {
     47                memcpy( m_data+((r.pos.y+i)*m_size.x + r.pos.x ) * m_depth,
     48                        data + (i*stride), r.size.x * m_depth );
     49        }
    5050}
    5151
Note: See TracChangeset for help on using the changeset viewer.