Changeset 3494 for libcaca/trunk/caca/dirty.c
- Timestamp:
- May 21, 2009, 10:55:13 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/dirty.c
r3484 r3494 42 42 * \return The number of dirty rectangles in the given canvas. 43 43 */ 44 int caca_get_dirty_rect angle_count(caca_canvas_t *cv)44 int caca_get_dirty_rect_count(caca_canvas_t *cv) 45 45 { 46 46 return cv->ndirty; … … 50 50 * 51 51 * Get the canvas's given dirty rectangle coordinates. The index must be 52 * within the dirty rectangle count. See caca_get_dirty_rect angle_count()52 * within the dirty rectangle count. See caca_get_dirty_rect_count() 53 53 * for how to compute this count. 54 54 * … … 59 59 * \param cv A libcaca canvas. 60 60 * \param r The requested rectangle index. 61 * \param x minA pointer to an integer where the leftmost edge of the62 * 63 * \param y minA pointer to an integer where the topmost edge of the64 * 65 * \param xmax A pointer to an integer where the rightmost edgeof the66 * dirty rectangle will be stored.67 * \param ymax A pointer to an integer where the bottommost edgeof the68 * dirty rectangle will be stored.61 * \param x A pointer to an integer where the leftmost edge of the 62 * dirty rectangle will be stored. 63 * \param y A pointer to an integer where the topmost edge of the 64 * dirty rectangle will be stored. 65 * \param width A pointer to an integer where the width of the 66 * dirty rectangle will be stored. 67 * \param height A pointer to an integer where the height of the 68 * dirty rectangle will be stored. 69 69 * \return 0 in case of success, -1 if an error occurred. 70 70 */ 71 int caca_get_dirty_rect angle(caca_canvas_t *cv, int r,72 int *xmin, int *ymin, int *xmax, int *ymax)71 int caca_get_dirty_rect(caca_canvas_t *cv, int r, 72 int *x, int *y, int *width, int *height) 73 73 { 74 74 if(r < 0 || r >= cv->ndirty) … … 91 91 cv->dirty_ymax = cv->height - 1; 92 92 93 *x min= cv->dirty_xmin;94 * xmax = cv->dirty_xmax;95 * ymin = cv->dirty_ymin;96 * ymax = cv->dirty_ymax;93 *x = cv->dirty_xmin; 94 *y = cv->dirty_ymin; 95 *width = cv->dirty_xmax - cv->dirty_xmin + 1; 96 *height = cv->dirty_ymax - cv->dirty_ymin + 1; 97 97 98 98 return 0; … … 102 102 * 103 103 * Add an invalidating zone to the canvas's dirty rectangle list. For more 104 * information about the dirty rectangles, see caca_get_dirty_rect angle().104 * information about the dirty rectangles, see caca_get_dirty_rect(). 105 105 * 106 106 * This function may be useful to force refresh of a given zone of the … … 113 113 * 114 114 * \param cv A libcaca canvas. 115 * \param x minThe leftmost edge of the additional dirty rectangle.116 * \param y minThe topmost edge of the additional dirty rectangle.117 * \param xmax The rightmost edgeof the additional dirty rectangle.118 * \param ymax The bottommost edgeof the additional dirty rectangle.115 * \param x The leftmost edge of the additional dirty rectangle. 116 * \param y The topmost edge of the additional dirty rectangle. 117 * \param width The width of the additional dirty rectangle. 118 * \param height The height of the additional dirty rectangle. 119 119 * \return 0 in case of success, -1 if an error occurred. 120 120 */ 121 int caca_add_dirty_rect angle(caca_canvas_t *cv, int xmin, int ymin,122 int xmax, int ymax)121 int caca_add_dirty_rect(caca_canvas_t *cv, int x, int y, 122 int width, int height) 123 123 { 124 124 /* Ignore empty and out-of-bounds rectangles */ 125 if( xmin > xmax || ymin > ymax126 || xmax < 0 || xmin >= cv->width || ymax < 0 || ymin>= cv->height)125 if(width <= 0 || height <= 0 || x + width <= 0 || x >= cv->width 126 || y + height <= 0 || y >= cv->height) 127 127 { 128 128 seterrno(EINVAL); … … 133 133 { 134 134 cv->ndirty = 1; 135 cv->dirty_xmin = x min;136 cv->dirty_xmax = x max;137 cv->dirty_ymin = y min;138 cv->dirty_ymax = y max;135 cv->dirty_xmin = x; 136 cv->dirty_xmax = x + width - 1; 137 cv->dirty_ymin = y; 138 cv->dirty_ymax = y + height - 1; 139 139 } 140 140 else 141 141 { 142 if(x min< cv->dirty_xmin)143 cv->dirty_xmin = x min;144 if(x max> cv->dirty_xmax)145 cv->dirty_xmax = x max;146 if(y min< cv->dirty_ymin)147 cv->dirty_ymin = y min;148 if(y max> cv->dirty_ymax)149 cv->dirty_ymax = y max;142 if(x < cv->dirty_xmin) 143 cv->dirty_xmin = x; 144 if(x + width - 1 > cv->dirty_xmax) 145 cv->dirty_xmax = x + width - 1; 146 if(y < cv->dirty_ymin) 147 cv->dirty_ymin = y; 148 if(y + height - 1 > cv->dirty_ymax) 149 cv->dirty_ymax = y + height - 1; 150 150 } 151 151 … … 156 156 * 157 157 * Mark a cell area in the canvas as not dirty. For more information about 158 * the dirty rectangles, see caca_get_dirty_rect angle().158 * the dirty rectangles, see caca_get_dirty_rect(). 159 159 * 160 160 * Values such that \b xmin > \b xmax or \b ymin > \b ymax indicate that … … 165 165 * 166 166 * \param cv A libcaca canvas. 167 * \param x minThe leftmost edge of the clean rectangle.168 * \param y minThe topmost edge of the clean rectangle.169 * \param xmax The rightmost edgeof the clean rectangle.170 * \param ymax The bottommost edgeof the clean rectangle.167 * \param x The leftmost edge of the clean rectangle. 168 * \param y The topmost edge of the clean rectangle. 169 * \param width The width of the clean rectangle. 170 * \param height The height of the clean rectangle. 171 171 * \return 0 in case of success, -1 if an error occurred. 172 172 */ 173 int caca_remove_dirty_rect angle(caca_canvas_t *cv, int xmin, int ymin,174 int xmax, int ymax)173 int caca_remove_dirty_rect(caca_canvas_t *cv, int x, int y, 174 int width, int height) 175 175 { 176 176 /* Ignore empty and out-of-bounds rectangles */ 177 if( xmin > xmax || ymin > ymax178 || xmax < 0 || xmin >= cv->width || ymax < 0 || ymin>= cv->height)177 if(width <= 0 || height <= 0 || x + width <= 0 || x >= cv->width 178 || y + height <= 0 || y >= cv->height) 179 179 { 180 180 seterrno(EINVAL); … … 198 198 * \return This function always returns 0. 199 199 */ 200 int caca_clear_dirty_rect angle_list(caca_canvas_t *cv)200 int caca_clear_dirty_rect_list(caca_canvas_t *cv) 201 201 { 202 202 cv->ndirty = 0;
Note: See TracChangeset
for help on using the changeset viewer.