Changeset 532 for abuse/trunk/src/imlib/timage.cpp
- Timestamp:
- Apr 22, 2011, 7:32:09 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/imlib/timage.cpp
r531 r532 106 106 } 107 107 108 void trans_image::put_scan_line(image *screen, int x, int y, int line) // always transparent109 {110 int x1, y1, x2, y2;111 screen->GetClip(x1, y1, x2, y2);112 if (y + line < y1 || y + line >= y2 || x >= x2 || x + m_size.x - 1 < x1)113 return; // clipped off completely?114 115 uint8_t *datap=m_data;116 int ix;117 while (line) // skip scan line data until we get to the line of interest118 {119 for (ix=0; ix<m_size.x; )120 {121 ix+=*datap; // skip blank space122 datap++;123 if (ix<m_size.x)124 {125 int run_length=*datap; // skip run126 ix+=run_length;127 datap+=run_length+1;128 }129 }130 line--;131 y++;132 }133 134 135 // now slam this list of runs to the screen136 screen->Lock();137 uint8_t *screen_line=screen->scan_line(y)+x;138 139 for (ix=0; ix<m_size.x; )140 {141 int skip=*datap; // how much space to skip?142 datap++;143 screen_line+=skip;144 ix+=skip;145 146 if (ix<m_size.x)147 {148 int run_length=*datap;149 datap++;150 151 if (x+ix+run_length-1<x1) // is this run clipped out totally?152 {153 datap+=run_length;154 ix+=run_length;155 screen_line+=run_length;156 }157 else158 {159 if (x+ix<x1) // is the run clipped partially?160 {161 int clip=(x1-(x+ix));162 datap+=clip;163 run_length-=clip;164 screen_line+=clip;165 ix+=clip;166 }167 168 if (x + ix >= x2) // clipped totally on the right?169 {170 screen->Unlock();171 return ; // we are done, return!172 }173 else if (x + ix + run_length > x2) // partially clipped?174 {175 memcpy(screen_line, datap, x + ix + run_length - x2); // slam what we can176 screen->Unlock();177 return ; // and return 'cause we are done with the line178 } else179 {180 memcpy(screen_line,datap,run_length);181 screen_line+=run_length;182 datap+=run_length;183 ix+=run_length;184 }185 }186 }187 }188 screen->Unlock();189 }190 191 192 108 uint8_t *trans_image::ClipToLine(image *screen, int x1, int y1, int x2, int y2, 193 109 int x, int &y, int &ysteps) … … 219 135 screen->AddDirty(Max(x, x1), y, Min(x + m_size.x, x2), y + m_size.y); 220 136 return parser; 221 }222 223 void trans_image::PutFilled(image *screen, int x, int y, uint8_t color)224 {225 PutImageGeneric<FILLED>(screen, x, y, color, NULL, 0, 0, NULL, NULL,226 0, 1, NULL, NULL, NULL);227 137 } 228 138 … … 238 148 239 149 screen->GetClip(x1, y1, x2, y2); 150 151 if (N == SCANLINE) 152 { 153 y1 = Max(y1, y + amount); 154 y2 = Min(y2, y + amount + 1); 155 if (y1 >= y2) 156 return; 157 } 158 240 159 uint8_t *datap = ClipToLine(screen, x1, y1, x2, y2, x, y, ysteps), 241 160 *screen_line, *blend_line = NULL, *paddr = NULL; … … 294 213 int count = Min(todo, Max(x2 - ix, 0)); 295 214 296 if (N == NORMAL )215 if (N == NORMAL || N == SCANLINE) 297 216 { 298 217 memcpy(screen_line, datap, count); … … 312 231 *sl++ = remap[*sl2++]; 313 232 } 314 else if (N == DOUBLE_REMAP)233 else if (N == REMAP2) 315 234 { 316 235 uint8_t *sl = screen_line, *sl2 = datap; … … 361 280 uint8_t *remap, uint8_t *remap2) 362 281 { 363 PutImageGeneric< DOUBLE_REMAP>(screen, x, y, 0, NULL, 0, 0, remap, remap2,364 282 PutImageGeneric<REMAP2>(screen, x, y, 0, NULL, 0, 0, remap, remap2, 283 0, 1, NULL, NULL, NULL); 365 284 } 366 285 … … 398 317 } 399 318 319 void trans_image::PutFilled(image *screen, int x, int y, uint8_t color) 320 { 321 PutImageGeneric<FILLED>(screen, x, y, color, NULL, 0, 0, NULL, NULL, 322 0, 1, NULL, NULL, NULL); 323 } 324 400 325 void trans_image::PutPredator(image *screen, int x, int y) 401 326 { … … 404 329 } 405 330 331 void trans_image::PutScanLine(image *screen, int x, int y, int line) 332 { 333 PutImageGeneric<SCANLINE>(screen, x, y, 0, NULL, 0, 0, NULL, NULL, 334 line, 1, NULL, NULL, NULL); 335 } 336 406 337 size_t trans_image::MemUsage() 407 338 {
Note: See TracChangeset
for help on using the changeset viewer.