Bitmap.cpp
Go to the documentation of this file.00001 //*** Bitmap.cpp *** 00002 00003 #include "Bitmap.h" 00004 #include "Debug.h" 00005 #include "ColorHelper.h" 00006 #include "Blitter.h" 00007 00008 00009 //*** Constructor *** 00010 00011 Bitmap::Bitmap(): 00012 color_(0), 00013 alpha_(0), 00014 width_(0), 00015 height_(0), 00016 hPitch_(0), 00017 vPitch_(0), 00018 hOffset_(0), 00019 vOffset_(0) 00020 { 00021 } 00022 00023 00024 //*** GetColorData *** 00025 00026 unsigned short* Bitmap::GetColorData() const 00027 { 00028 return color_; 00029 } 00030 00031 00032 //*** GetAlphaData *** 00033 00034 unsigned char* Bitmap::GetAlphaData() const 00035 { 00036 return alpha_; 00037 } 00038 00039 00040 00041 //*** GetHPitch *** 00042 00043 int Bitmap::GetHPitch() const 00044 { 00045 return hPitch_; 00046 } 00047 00048 00049 //*** GetVPitch *** 00050 00051 int Bitmap::GetVPitch() const 00052 { 00053 return vPitch_; 00054 } 00055 00056 00057 //*** GetHOffset *** 00058 00059 int Bitmap::GetHOffset() const 00060 { 00061 return hOffset_; 00062 } 00063 00064 00065 //*** GetVOffset *** 00066 00067 int Bitmap::GetVOffset() const 00068 { 00069 return vOffset_; 00070 } 00071 00072 00073 //*** Clear *** 00074 00075 void Bitmap::Clear() 00076 { 00077 int pixelCount=hPitch_*vPitch_; 00078 if (color_) 00079 { 00080 MemSet(color_,0,sizeof(unsigned short)*pixelCount); 00081 } 00082 if (alpha_) 00083 { 00084 MemSet(alpha_,0,sizeof(unsigned char)*pixelCount); 00085 } 00086 } 00087 00088 00089 //*** Fill *** 00090 00091 void Bitmap::Fill(int x1, int y1, int x2, int y2, unsigned short color, unsigned char alpha) 00092 { 00093 // Don't do anything if a fully transparent fill was requested 00094 if (alpha==0) 00095 { 00096 return; 00097 } 00098 00099 // Adjust for offset 00100 x1-=hOffset_; 00101 y1-=vOffset_; 00102 x2-=hOffset_; 00103 y2-=vOffset_; 00104 00105 // Clip 00106 if (x1<0) 00107 { 00108 x1=0; 00109 } 00110 if (y1<0) 00111 { 00112 y1=0; 00113 } 00114 if (x2>=hPitch_) 00115 { 00116 x2=hPitch_-1; 00117 } 00118 if (y2>=vPitch_) 00119 { 00120 y2=vPitch_-1; 00121 } 00122 00123 int targetWidth=x2-x1+1; 00124 int targetHeight=y2-y1+1; 00125 00126 Blitter::BlitArgs blitArgs; 00127 blitArgs.color=color; 00128 blitArgs.alpha=alpha; 00129 blitArgs.targetColor=color_; 00130 blitArgs.targetAlpha=alpha_; 00131 blitArgs.targetHPitch=hPitch_; 00132 blitArgs.sourceX=x1; 00133 blitArgs.sourceY=y1; 00134 blitArgs.sourceWidth=targetWidth; 00135 blitArgs.sourceHeight=targetHeight; 00136 blitArgs.targetX=x1; 00137 blitArgs.targetY=y1; 00138 00139 // If alpha is 255, we fill it all with a solid color and solid alpha 00140 if (alpha==255) 00141 { 00142 if (color_) 00143 { 00144 Blitter::Normal< 00145 Blitter::OpFill_Color_TC, 00146 Blitter::StepX_Normal_TC, 00147 Blitter::StepY_Normal_TC 00148 >(blitArgs); 00149 } 00150 if (alpha_) 00151 { 00152 Blitter::Normal_Fill_Alpha_TA(blitArgs); 00153 } 00154 } 00155 else 00156 { 00157 if (color_) 00158 { 00159 Blitter::Normal< 00160 Blitter::OpBlend_Color_Alpha_TC, 00161 Blitter::StepX_Normal_TC, 00162 Blitter::StepY_Normal_TC 00163 >(blitArgs); 00164 } 00165 if (alpha_) 00166 { 00167 Blitter::Normal< 00168 Blitter::OpMax_Alpha_TA, 00169 Blitter::StepX_Normal_TA, 00170 Blitter::StepY_Normal_TA 00171 >(blitArgs); 00172 } 00173 } 00174 00175 } 00176 00177 00178 //*** Fill *** 00179 00180 void Bitmap::Fill(unsigned short color, unsigned char alpha) 00181 { 00182 Blitter::BlitArgs blitArgs; 00183 blitArgs.color=color; 00184 blitArgs.alpha=alpha; 00185 blitArgs.targetColor=color_; 00186 blitArgs.targetAlpha=alpha_; 00187 blitArgs.targetHPitch=hPitch_; 00188 blitArgs.sourceX=0; 00189 blitArgs.sourceY=0; 00190 blitArgs.sourceWidth=hPitch_; 00191 blitArgs.sourceHeight=vPitch_; 00192 blitArgs.targetX=0; 00193 blitArgs.targetY=0; 00194 00195 // If alpha is 255, we fill it all with a solid color and solid alpha 00196 if (alpha==255) 00197 { 00198 if (color_) 00199 { 00200 Blitter::Normal< 00201 Blitter::OpFill_Color_TC, 00202 Blitter::StepX_Normal_TC, 00203 Blitter::StepY_Normal_TC 00204 >(blitArgs); 00205 } 00206 if (alpha_) 00207 { 00208 Blitter::Normal_Fill_Alpha_TA(blitArgs); 00209 } 00210 } 00211 else 00212 { 00213 if (color_) 00214 { 00215 Blitter::Normal< 00216 Blitter::OpBlend_Color_Alpha_TC, 00217 Blitter::StepX_Normal_TC, 00218 Blitter::StepY_Normal_TC 00219 >(blitArgs); 00220 } 00221 if (alpha_) 00222 { 00223 Blitter::Normal< 00224 Blitter::OpMax_Alpha_TA, 00225 Blitter::StepX_Normal_TA, 00226 Blitter::StepY_Normal_TA 00227 >(blitArgs); 00228 } 00229 } 00230 } 00231 00232 00233 //*** FillAlpha *** 00234 00235 void Bitmap::FillAlpha(int x1, int y1, int x2, int y2, unsigned char alpha) 00236 { 00237 if (!alpha_) 00238 { 00239 return; 00240 } 00241 00242 // Adjust for offset 00243 x1-=hOffset_; 00244 y1-=vOffset_; 00245 x2-=hOffset_; 00246 y2-=vOffset_; 00247 00248 // Clip 00249 if (x1<0) 00250 { 00251 x1=0; 00252 } 00253 if (y1<0) 00254 { 00255 y1=0; 00256 } 00257 if (x2>=hPitch_) 00258 { 00259 x2=hPitch_-1; 00260 } 00261 if (y2>=vPitch_) 00262 { 00263 y2=vPitch_-1; 00264 } 00265 00266 int targetWidth=x2-x1+1; 00267 int targetHeight=y2-y1+1; 00268 00269 Blitter::BlitArgs blitArgs; 00270 blitArgs.alpha=alpha; 00271 blitArgs.targetColor=color_; 00272 blitArgs.targetAlpha=alpha_; 00273 blitArgs.targetHPitch=hPitch_; 00274 blitArgs.sourceX=x1; 00275 blitArgs.sourceY=y1; 00276 blitArgs.sourceWidth=targetWidth; 00277 blitArgs.sourceHeight=targetHeight; 00278 blitArgs.targetX=x1; 00279 blitArgs.targetY=y1; 00280 00281 00282 Blitter::Normal_Fill_Alpha_TA(blitArgs); 00283 } 00284 00285 00286 //*** FillAlpha *** 00287 00288 void Bitmap::FillAlpha(unsigned char alpha) 00289 { 00290 if (alpha_) 00291 { 00292 Blitter::BlitArgs blitArgs; 00293 blitArgs.alpha=alpha; 00294 blitArgs.targetColor=color_; 00295 blitArgs.targetAlpha=alpha_; 00296 blitArgs.targetHPitch=hPitch_; 00297 blitArgs.sourceX=0; 00298 blitArgs.sourceY=0; 00299 blitArgs.sourceWidth=hPitch_; 00300 blitArgs.sourceHeight=vPitch_; 00301 blitArgs.targetX=0; 00302 blitArgs.targetY=0; 00303 00304 Blitter::Normal_Fill_Alpha_TA(blitArgs); 00305 } 00306 } 00307 00308 00309 //*** GetWidth *** 00310 00311 int Bitmap::GetWidth(Transformation transformation) const 00312 { 00313 switch (transformation) 00314 { 00315 case NoTransformation: 00316 case Rotate_180: 00317 case Mirror_X: 00318 case Mirror_Y: 00319 { 00320 return width_; 00321 } break; 00322 00323 case Rotate_90: 00324 case Rotate_270: 00325 { 00326 return height_; 00327 } break; 00328 } 00329 00330 return width_; 00331 } 00332 00333 00334 //*** GetHeight *** 00335 00336 int Bitmap::GetHeight(Transformation transformation) const 00337 { 00338 switch (transformation) 00339 { 00340 case NoTransformation: 00341 case Rotate_180: 00342 case Mirror_X: 00343 case Mirror_Y: 00344 { 00345 return height_; 00346 } break; 00347 00348 case Rotate_90: 00349 case Rotate_270: 00350 { 00351 return width_; 00352 } break; 00353 } 00354 00355 return height_; 00356 } 00357 00358 00359 //*** GetPixelColor *** 00360 00361 unsigned short Bitmap::GetPixelColor(int x, int y, Transformation transformation) const 00362 { 00363 if (color_) 00364 { 00365 TransformCoordinates(x,y,transformation); 00366 x-=hOffset_; 00367 y-=vOffset_; 00368 if (x>=0 && x<=hPitch_ && y>=0 && y<vPitch_) 00369 { 00370 return color_[x+y*hPitch_]; 00371 } 00372 } 00373 return 0; 00374 } 00375 00376 00377 //*** GetPixelAlpha *** 00378 00379 unsigned char Bitmap::GetPixelAlpha(int x, int y, Transformation transformation) const 00380 { 00381 TransformCoordinates(x,y,transformation); 00382 x-=hOffset_; 00383 y-=vOffset_; 00384 if (x>=0 && x<=hPitch_ && y>=0 && y<vPitch_) 00385 { 00386 if (alpha_) 00387 { 00388 return alpha_[x+y*hPitch_]; 00389 } 00390 return 255; 00391 } 00392 return 0; 00393 } 00394 00395 00396 //*** SetPixelColor *** 00397 00398 void Bitmap::SetPixelColor(int x, int y,unsigned short color, Transformation transformation) 00399 { 00400 if (color_) 00401 { 00402 TransformCoordinates(x,y,transformation); 00403 x-=hOffset_; 00404 y-=vOffset_; 00405 if (x>=0 && x<=hPitch_ && y>=0 && y<vPitch_) 00406 { 00407 color_[x+y*hPitch_]=color; 00408 } 00409 } 00410 } 00411 00412 00413 //*** SetPixelAlpha *** 00414 00415 void Bitmap::SetPixelAlpha(int x, int y,unsigned char alpha, Transformation transformation) 00416 { 00417 if (alpha_) 00418 { 00419 TransformCoordinates(x,y,transformation); 00420 x-=hOffset_; 00421 y-=vOffset_; 00422 if (x>=0 && x<=hPitch_ && y>=0 && y<vPitch_) 00423 { 00424 alpha_[x+y*hPitch_]=alpha; 00425 } 00426 } 00427 } 00428 00429 00430 //*** BlendPixel *** 00431 00432 void Bitmap::BlendPixel(int x, int y,unsigned short color, unsigned char alpha, Transformation transformation) 00433 { 00434 if (color_) 00435 { 00436 TransformCoordinates(x,y,transformation); 00437 x-=hOffset_; 00438 y-=vOffset_; 00439 if (x>=0 && x<=hPitch_ && y>=0 && y<vPitch_) 00440 { 00441 if (alpha==255) 00442 { 00443 color_[x+y*width_]=color; 00444 } 00445 else if (alpha>0) 00446 { 00447 unsigned short* destination=&color_[x+y*hPitch_]; 00448 *destination=AlphaBlend16(*destination,color,alpha); 00449 } 00450 } 00451 } 00452 } 00453 00454 00455 //*** Blit *** 00456 00457 void Bitmap::Blit(Bitmap& target, int x, int y, unsigned short modulate, unsigned char alpha, Transformation transformation) const 00458 { 00459 Blit(0, 0, width_-1, height_-1, target, x, y, modulate, alpha, transformation); 00460 } 00461 00462 00463 //*** Blit *** 00464 00465 void Bitmap::Blit(int x1, int y1, int x2, int y2, Bitmap& target, int x, int y, unsigned short modulate, unsigned char alpha, Transformation transformation) const 00466 { 00467 // Don't do anything if alpha is set to 0, as that means every pixel would be written at 100% transparent 00468 if (alpha==0) 00469 { 00470 return; 00471 } 00472 00473 00474 // Perform clipping 00475 int sourceX=x1; 00476 int sourceY=y1; 00477 int sourceWidth=(x2-x1)+1; 00478 int sourceHeight=(y2-y1)+1; 00479 int targetX=x; 00480 int targetY=y; 00481 00482 if (hPitch_!=width_ || vPitch_!=height_) 00483 { 00484 if (hOffset_>sourceX) 00485 { 00486 targetX+=hOffset_-sourceX; 00487 sourceWidth-=hOffset_-sourceX; 00488 sourceX=hOffset_; 00489 } 00490 if (vOffset_>sourceY) 00491 { 00492 targetY+=vOffset_-sourceY; 00493 sourceHeight-=vOffset_-sourceY; 00494 sourceY=vOffset_; 00495 } 00496 if (sourceX+sourceWidth>hOffset_+hPitch_) 00497 { 00498 sourceWidth-=(sourceX+sourceWidth)-(hOffset_+hPitch_); 00499 } 00500 if (sourceY+sourceHeight>vOffset_+vPitch_) 00501 { 00502 sourceHeight-=(sourceY+sourceHeight)-(vOffset_+vPitch_); 00503 } 00504 } 00505 00506 if (!Clip(sourceX,sourceY,sourceWidth,sourceHeight,targetX,targetY,target.GetWidth(),target.GetHeight(),transformation)) 00507 { 00508 // Nothing to draw, so bail out 00509 return; 00510 } 00511 00512 00513 // Sanity checks - will only trigger if there's a bug in the Clip code 00514 Assert(sourceX>=0 && sourceY>=0 && (sourceX+sourceWidth)<=GetWidth(transformation) && (sourceY+sourceHeight)<=GetHeight(transformation),"Source rect out of range"); 00515 Assert(targetX>=0 && targetY>=0 && (targetX+sourceWidth)<=target.GetWidth() && (targetY+sourceHeight)<=target.GetHeight(),"Target rect out of range"); 00516 00518 // Assert(sourceX>=hOffset_ && sourceY>=vOffset_ && (sourceX+sourceWidth)<=hOffset_+hPitch_ && (sourceY+sourceHeight)<=vOffset_+vPitch_,"Source rect out of range"); 00519 00520 // Set up the blitting parameters 00521 unsigned short* sourceColor=color_; 00522 unsigned char* sourceAlpha=alpha_; 00523 int sourceHPitch=hPitch_; 00524 int sourceVPitch=vPitch_; 00525 unsigned short* targetColor=target.GetColorData(); 00526 unsigned char* targetAlpha=target.GetAlphaData(); 00527 int targetPitch=target.GetHPitch(); 00528 00529 sourceX-=hOffset_; 00530 sourceY-=vOffset_; 00531 00532 Blitter::BlitArgs blitArgs; 00533 blitArgs.color=modulate; 00534 blitArgs.alpha=alpha; 00535 blitArgs.sourceColor=sourceColor; 00536 blitArgs.sourceAlpha=sourceAlpha; 00537 blitArgs.targetColor=targetColor; 00538 blitArgs.targetAlpha=targetAlpha; 00539 blitArgs.sourceHPitch=sourceHPitch; 00540 blitArgs.sourceVPitch=sourceVPitch; 00541 blitArgs.targetHPitch=targetPitch; 00542 blitArgs.sourceX=sourceX; 00543 blitArgs.sourceY=sourceY; 00544 blitArgs.sourceWidth=sourceWidth; 00545 blitArgs.sourceHeight=sourceHeight; 00546 blitArgs.targetX=targetX; 00547 blitArgs.targetY=targetY; 00548 00549 // If we have a color, and target does too, but we don't have an alpha channel 00550 if (sourceColor && targetColor && !sourceAlpha) 00551 { 00552 // Pick the right blitting for the specified transformation 00553 switch (transformation) 00554 { 00555 case NoTransformation: 00556 { 00557 if (modulate==0xffff && alpha==255) 00558 { 00559 Blitter::Normal_Copy_SC_TC(blitArgs); 00560 } 00561 else if (modulate!=0xffff && alpha==255) 00562 { 00563 Blitter::Normal< 00564 Blitter::OpCopy_Color_SC_TC, 00565 Blitter::StepX_Normal_SC_TC, 00566 Blitter::StepY_Normal_SC_TC 00567 >(blitArgs); 00568 } 00569 else if (modulate==0xffff && alpha!=255) 00570 { 00571 Blitter::Normal< 00572 Blitter::OpBlend_Alpha_SC_TC, 00573 Blitter::StepX_Normal_SC_TC, 00574 Blitter::StepY_Normal_SC_TC 00575 >(blitArgs); 00576 } 00577 else 00578 { 00579 Blitter::Normal< 00580 Blitter::OpBlend_Color_Alpha_SC_TC, 00581 Blitter::StepX_Normal_SC_TC, 00582 Blitter::StepY_Normal_SC_TC 00583 >(blitArgs); 00584 } 00585 } break; 00586 00587 case Rotate_90: 00588 { 00589 if (modulate==0xffff && alpha==255) 00590 { 00591 Blitter::Rot090< 00592 Blitter::OpCopy_SC_TC, 00593 Blitter::StepX_Rot090_SC_TC, 00594 Blitter::StepY_Rot090_SC_TC 00595 >(blitArgs); 00596 } 00597 else if (modulate!=0xffff && alpha==255) 00598 { 00599 Blitter::Rot090< 00600 Blitter::OpCopy_Color_SC_TC, 00601 Blitter::StepX_Rot090_SC_TC, 00602 Blitter::StepY_Rot090_SC_TC 00603 >(blitArgs); 00604 } 00605 else if (modulate==0xffff && alpha!=255) 00606 { 00607 Blitter::Rot090< 00608 Blitter::OpBlend_Alpha_SC_TC, 00609 Blitter::StepX_Rot090_SC_TC, 00610 Blitter::StepY_Rot090_SC_TC 00611 >(blitArgs); 00612 } 00613 else 00614 { 00615 Blitter::Rot090< 00616 Blitter::OpBlend_Color_Alpha_SC_TC, 00617 Blitter::StepX_Rot090_SC_TC, 00618 Blitter::StepY_Rot090_SC_TC 00619 >(blitArgs); 00620 } 00621 } break; 00622 00623 case Rotate_180: 00624 { 00625 if (modulate==0xffff && alpha==255) 00626 { 00627 Blitter::Rot180< 00628 Blitter::OpCopy_SC_TC, 00629 Blitter::StepX_Rot180_SC_TC, 00630 Blitter::StepY_Rot180_SC_TC 00631 >(blitArgs); 00632 } 00633 else if (modulate!=0xffff && alpha==255) 00634 { 00635 Blitter::Rot180< 00636 Blitter::OpCopy_Color_SC_TC, 00637 Blitter::StepX_Rot180_SC_TC, 00638 Blitter::StepY_Rot180_SC_TC 00639 >(blitArgs); 00640 } 00641 else if (modulate==0xffff && alpha!=255) 00642 { 00643 Blitter::Rot180< 00644 Blitter::OpBlend_Alpha_SC_TC, 00645 Blitter::StepX_Rot180_SC_TC, 00646 Blitter::StepY_Rot180_SC_TC 00647 >(blitArgs); 00648 } 00649 else 00650 { 00651 Blitter::Rot180< 00652 Blitter::OpBlend_Color_Alpha_SC_TC, 00653 Blitter::StepX_Rot180_SC_TC, 00654 Blitter::StepY_Rot180_SC_TC 00655 >(blitArgs); 00656 } 00657 } break; 00658 00659 case Rotate_270: 00660 { 00661 if (modulate==0xffff && alpha==255) 00662 { 00663 Blitter::Rot270< 00664 Blitter::OpCopy_SC_TC, 00665 Blitter::StepX_Rot270_SC_TC, 00666 Blitter::StepY_Rot270_SC_TC 00667 >(blitArgs); 00668 } 00669 else if (modulate!=0xffff && alpha==255) 00670 { 00671 Blitter::Rot270< 00672 Blitter::OpCopy_Color_SC_TC, 00673 Blitter::StepX_Rot270_SC_TC, 00674 Blitter::StepY_Rot270_SC_TC 00675 >(blitArgs); 00676 } 00677 else if (modulate==0xffff && alpha!=255) 00678 { 00679 Blitter::Rot270< 00680 Blitter::OpBlend_Alpha_SC_TC, 00681 Blitter::StepX_Rot270_SC_TC, 00682 Blitter::StepY_Rot270_SC_TC 00683 >(blitArgs); 00684 } 00685 else 00686 { 00687 Blitter::Rot270< 00688 Blitter::OpBlend_Color_Alpha_SC_TC, 00689 Blitter::StepX_Rot270_SC_TC, 00690 Blitter::StepY_Rot270_SC_TC 00691 >(blitArgs); 00692 } 00693 } break; 00694 00695 case Mirror_X: 00696 { 00697 if (modulate==0xffff && alpha==255) 00698 { 00699 Blitter::Flip_X< 00700 Blitter::OpCopy_SC_TC, 00701 Blitter::StepX_Flip_X_SC_TC, 00702 Blitter::StepY_Flip_X_SC_TC 00703 >(blitArgs); 00704 } 00705 else if (modulate!=0xffff && alpha==255) 00706 { 00707 Blitter::Flip_X< 00708 Blitter::OpCopy_Color_SC_TC, 00709 Blitter::StepX_Flip_X_SC_TC, 00710 Blitter::StepY_Flip_X_SC_TC 00711 >(blitArgs); 00712 } 00713 else if (modulate==0xffff && alpha!=255) 00714 { 00715 Blitter::Flip_X< 00716 Blitter::OpBlend_Alpha_SC_TC, 00717 Blitter::StepX_Flip_X_SC_TC, 00718 Blitter::StepY_Flip_X_SC_TC 00719 >(blitArgs); 00720 } 00721 else 00722 { 00723 Blitter::Flip_X< 00724 Blitter::OpBlend_Color_Alpha_SC_TC, 00725 Blitter::StepX_Flip_X_SC_TC, 00726 Blitter::StepY_Flip_X_SC_TC 00727 >(blitArgs); 00728 } 00729 } break; 00730 00731 case Mirror_Y: 00732 { 00733 if (modulate==0xffff && alpha==255) 00734 { 00735 Blitter::Flip_Y_Copy_SC_TC(blitArgs); 00736 } 00737 else if (modulate!=0xffff && alpha==255) 00738 { 00739 Blitter::Flip_Y< 00740 Blitter::OpCopy_Color_SC_TC, 00741 Blitter::StepX_Flip_Y_SC_TC, 00742 Blitter::StepY_Flip_Y_SC_TC 00743 >(blitArgs); 00744 } 00745 else if (modulate==0xffff && alpha!=255) 00746 { 00747 Blitter::Flip_Y< 00748 Blitter::OpBlend_Alpha_SC_TC, 00749 Blitter::StepX_Flip_Y_SC_TC, 00750 Blitter::StepY_Flip_Y_SC_TC 00751 >(blitArgs); 00752 } 00753 else 00754 { 00755 Blitter::Flip_Y< 00756 Blitter::OpBlend_Color_Alpha_SC_TC, 00757 Blitter::StepX_Flip_Y_SC_TC, 00758 Blitter::StepY_Flip_Y_SC_TC 00759 >(blitArgs); 00760 } 00761 } break; 00762 00763 } 00764 } 00765 00766 00767 // If we have a color, and target does too, but we have an alpha channel 00768 if (sourceColor && targetColor && sourceAlpha) 00769 { 00770 // Pick the right blitting for the specified transformation 00771 switch (transformation) 00772 { 00773 case NoTransformation: 00774 { 00775 if (modulate==0xffff && alpha==255) 00776 { 00777 Blitter::Normal< 00778 Blitter::OpBlend_SC_SA_TC, 00779 Blitter::StepX_Normal_SC_SA_TC, 00780 Blitter::StepY_Normal_SC_SA_TC 00781 >(blitArgs); 00782 } 00783 else if (modulate!=0xffff && alpha==255) 00784 { 00785 Blitter::Normal< 00786 Blitter::OpBlend_Color_SC_SA_TC, 00787 Blitter::StepX_Normal_SC_SA_TC, 00788 Blitter::StepY_Normal_SC_SA_TC 00789 >(blitArgs); 00790 } 00791 else if (modulate==0xffff && alpha!=255) 00792 { 00793 Blitter::Normal< 00794 Blitter::OpBlend_Alpha_SC_SA_TC, 00795 Blitter::StepX_Normal_SC_SA_TC, 00796 Blitter::StepY_Normal_SC_SA_TC 00797 >(blitArgs); 00798 } 00799 else 00800 { 00801 Blitter::Normal< 00802 Blitter::OpBlend_Color_Alpha_SC_SA_TC, 00803 Blitter::StepX_Normal_SC_SA_TC, 00804 Blitter::StepY_Normal_SC_SA_TC 00805 >(blitArgs); 00806 } 00807 } break; 00808 00809 case Rotate_90: 00810 { 00811 if (modulate==0xffff && alpha==255) 00812 { 00813 Blitter::Rot090< 00814 Blitter::OpBlend_SC_SA_TC, 00815 Blitter::StepX_Rot090_SC_SA_TC, 00816 Blitter::StepY_Rot090_SC_SA_TC 00817 >(blitArgs); 00818 } 00819 else if (modulate!=0xffff && alpha==255) 00820 { 00821 Blitter::Rot090< 00822 Blitter::OpBlend_Color_SC_SA_TC, 00823 Blitter::StepX_Rot090_SC_SA_TC, 00824 Blitter::StepY_Rot090_SC_SA_TC 00825 >(blitArgs); 00826 } 00827 else if (modulate==0xffff && alpha!=255) 00828 { 00829 Blitter::Rot090< 00830 Blitter::OpBlend_Alpha_SC_SA_TC, 00831 Blitter::StepX_Rot090_SC_SA_TC, 00832 Blitter::StepY_Rot090_SC_SA_TC 00833 >(blitArgs); 00834 } 00835 else 00836 { 00837 Blitter::Rot090< 00838 Blitter::OpBlend_Color_Alpha_SC_SA_TC, 00839 Blitter::StepX_Rot090_SC_SA_TC, 00840 Blitter::StepY_Rot090_SC_SA_TC 00841 >(blitArgs); 00842 } 00843 } break; 00844 00845 case Rotate_180: 00846 { 00847 if (modulate==0xffff && alpha==255) 00848 { 00849 Blitter::Rot180< 00850 Blitter::OpBlend_SC_SA_TC, 00851 Blitter::StepX_Rot180_SC_SA_TC, 00852 Blitter::StepY_Rot180_SC_SA_TC 00853 >(blitArgs); 00854 } 00855 else if (modulate!=0xffff && alpha==255) 00856 { 00857 Blitter::Rot180< 00858 Blitter::OpBlend_Color_SC_SA_TC, 00859 Blitter::StepX_Rot180_SC_SA_TC, 00860 Blitter::StepY_Rot180_SC_SA_TC 00861 >(blitArgs); 00862 } 00863 else if (modulate==0xffff && alpha!=255) 00864 { 00865 Blitter::Rot180< 00866 Blitter::OpBlend_Alpha_SC_SA_TC, 00867 Blitter::StepX_Rot180_SC_SA_TC, 00868 Blitter::StepY_Rot180_SC_SA_TC 00869 >(blitArgs); 00870 } 00871 else 00872 { 00873 Blitter::Rot180< 00874 Blitter::OpBlend_Color_Alpha_SC_SA_TC, 00875 Blitter::StepX_Rot180_SC_SA_TC, 00876 Blitter::StepY_Rot180_SC_SA_TC 00877 >(blitArgs); 00878 } 00879 } break; 00880 00881 case Rotate_270: 00882 { 00883 if (modulate==0xffff && alpha==255) 00884 { 00885 Blitter::Rot270< 00886 Blitter::OpBlend_SC_SA_TC, 00887 Blitter::StepX_Rot270_SC_SA_TC, 00888 Blitter::StepY_Rot270_SC_SA_TC 00889 >(blitArgs); 00890 } 00891 else if (modulate!=0xffff && alpha==255) 00892 { 00893 Blitter::Rot270< 00894 Blitter::OpBlend_Color_SC_SA_TC, 00895 Blitter::StepX_Rot270_SC_SA_TC, 00896 Blitter::StepY_Rot270_SC_SA_TC 00897 >(blitArgs); 00898 } 00899 else if (modulate==0xffff && alpha!=255) 00900 { 00901 Blitter::Rot270< 00902 Blitter::OpBlend_Alpha_SC_SA_TC, 00903 Blitter::StepX_Rot270_SC_SA_TC, 00904 Blitter::StepY_Rot270_SC_SA_TC 00905 >(blitArgs); 00906 } 00907 else 00908 { 00909 Blitter::Rot270< 00910 Blitter::OpBlend_Color_Alpha_SC_SA_TC, 00911 Blitter::StepX_Rot270_SC_SA_TC, 00912 Blitter::StepY_Rot270_SC_SA_TC 00913 >(blitArgs); 00914 } 00915 } break; 00916 00917 case Mirror_X: 00918 { 00919 if (modulate==0xffff && alpha==255) 00920 { 00921 Blitter::Flip_X< 00922 Blitter::OpBlend_SC_SA_TC, 00923 Blitter::StepX_Flip_X_SC_SA_TC, 00924 Blitter::StepY_Flip_X_SC_SA_TC 00925 >(blitArgs); 00926 } 00927 else if (modulate!=0xffff && alpha==255) 00928 { 00929 Blitter::Flip_X< 00930 Blitter::OpBlend_Color_SC_SA_TC, 00931 Blitter::StepX_Flip_X_SC_SA_TC, 00932 Blitter::StepY_Flip_X_SC_SA_TC 00933 >(blitArgs); 00934 } 00935 else if (modulate==0xffff && alpha!=255) 00936 { 00937 Blitter::Flip_X< 00938 Blitter::OpBlend_Alpha_SC_SA_TC, 00939 Blitter::StepX_Flip_X_SC_SA_TC, 00940 Blitter::StepY_Flip_X_SC_SA_TC 00941 >(blitArgs); 00942 } 00943 else 00944 { 00945 Blitter::Flip_X< 00946 Blitter::OpBlend_Color_Alpha_SC_SA_TC, 00947 Blitter::StepX_Flip_X_SC_SA_TC, 00948 Blitter::StepY_Flip_X_SC_SA_TC 00949 >(blitArgs); 00950 } 00951 } break; 00952 00953 case Mirror_Y: 00954 { 00955 if (modulate==0xffff && alpha==255) 00956 { 00957 Blitter::Flip_Y< 00958 Blitter::OpBlend_SC_SA_TC, 00959 Blitter::StepX_Flip_Y_SC_SA_TC, 00960 Blitter::StepY_Flip_Y_SC_SA_TC 00961 >(blitArgs); 00962 } 00963 else if (modulate!=0xffff && alpha==255) 00964 { 00965 Blitter::Flip_Y< 00966 Blitter::OpBlend_Color_SC_SA_TC, 00967 Blitter::StepX_Flip_Y_SC_SA_TC, 00968 Blitter::StepY_Flip_Y_SC_SA_TC 00969 >(blitArgs); 00970 } 00971 else if (modulate==0xffff && alpha!=255) 00972 { 00973 Blitter::Flip_Y< 00974 Blitter::OpBlend_Alpha_SC_SA_TC, 00975 Blitter::StepX_Flip_Y_SC_SA_TC, 00976 Blitter::StepY_Flip_Y_SC_SA_TC 00977 >(blitArgs); 00978 } 00979 else 00980 { 00981 Blitter::Flip_Y< 00982 Blitter::OpBlend_Color_Alpha_SC_SA_TC, 00983 Blitter::StepX_Flip_Y_SC_SA_TC, 00984 Blitter::StepY_Flip_Y_SC_SA_TC 00985 >(blitArgs); 00986 } 00987 } break; 00988 } 00989 } 00990 00991 // If we don't have color, but target does, and we have alpha channel 00992 if (!sourceColor && targetColor && sourceAlpha) 00993 { 00994 // Pick the right blitting for the specified transformation 00995 switch (transformation) 00996 { 00997 case NoTransformation: 00998 { 00999 if (alpha==255) 01000 { 01001 Blitter::Normal< 01002 Blitter::OpBlend_Color_SA_TC, 01003 Blitter::StepX_Normal_SA_TC, 01004 Blitter::StepY_Normal_SA_TC 01005 >(blitArgs); 01006 } 01007 else 01008 { 01009 Blitter::Normal< 01010 Blitter::OpBlend_Color_Alpha_SA_TC, 01011 Blitter::StepX_Normal_SA_TC, 01012 Blitter::StepY_Normal_SA_TC 01013 >(blitArgs); 01014 } 01015 } break; 01016 01017 case Rotate_90: 01018 { 01019 if (alpha==255) 01020 { 01021 Blitter::Rot090< 01022 Blitter::OpBlend_Color_SA_TC, 01023 Blitter::StepX_Rot090_SA_TC, 01024 Blitter::StepY_Rot090_SA_TC 01025 >(blitArgs); 01026 } 01027 else 01028 { 01029 Blitter::Rot090< 01030 Blitter::OpBlend_Color_Alpha_SA_TC, 01031 Blitter::StepX_Rot090_SA_TC, 01032 Blitter::StepY_Rot090_SA_TC 01033 >(blitArgs); 01034 } 01035 } break; 01036 01037 case Rotate_180: 01038 { 01039 if (alpha==255) 01040 { 01041 Blitter::Rot180< 01042 Blitter::OpBlend_Color_SA_TC, 01043 Blitter::StepX_Rot180_SA_TC, 01044 Blitter::StepY_Rot180_SA_TC 01045 >(blitArgs); 01046 } 01047 else 01048 { 01049 Blitter::Rot180< 01050 Blitter::OpBlend_Color_Alpha_SA_TC, 01051 Blitter::StepX_Rot180_SA_TC, 01052 Blitter::StepY_Rot180_SA_TC 01053 >(blitArgs); 01054 } 01055 } break; 01056 01057 case Rotate_270: 01058 { 01059 if (alpha==255) 01060 { 01061 Blitter::Rot270< 01062 Blitter::OpBlend_Color_SA_TC, 01063 Blitter::StepX_Rot270_SA_TC, 01064 Blitter::StepY_Rot270_SA_TC 01065 >(blitArgs); 01066 } 01067 else 01068 { 01069 Blitter::Rot270< 01070 Blitter::OpBlend_Color_Alpha_SA_TC, 01071 Blitter::StepX_Rot270_SA_TC, 01072 Blitter::StepY_Rot270_SA_TC 01073 >(blitArgs); 01074 } 01075 } break; 01076 01077 case Mirror_X: 01078 { 01079 if (alpha==255) 01080 { 01081 Blitter::Flip_X< 01082 Blitter::OpBlend_Color_SA_TC, 01083 Blitter::StepX_Flip_X_SA_TC, 01084 Blitter::StepY_Flip_X_SA_TC 01085 >(blitArgs); 01086 } 01087 else 01088 { 01089 Blitter::Flip_X< 01090 Blitter::OpBlend_Color_Alpha_SA_TC, 01091 Blitter::StepX_Flip_X_SA_TC, 01092 Blitter::StepY_Flip_X_SA_TC 01093 >(blitArgs); 01094 } 01095 } break; 01096 01097 case Mirror_Y: 01098 { 01099 if (alpha==255) 01100 { 01101 Blitter::Flip_Y< 01102 Blitter::OpBlend_Color_SA_TC, 01103 Blitter::StepX_Flip_Y_SA_TC, 01104 Blitter::StepY_Flip_Y_SA_TC 01105 >(blitArgs); 01106 } 01107 else 01108 { 01109 Blitter::Flip_Y< 01110 Blitter::OpBlend_Color_Alpha_SA_TC, 01111 Blitter::StepX_Flip_Y_SA_TC, 01112 Blitter::StepY_Flip_Y_SA_TC 01113 >(blitArgs); 01114 } 01115 } break; 01116 } 01117 } 01118 01119 // If we don't have color, but target does 01120 if (!sourceColor && targetColor && !sourceAlpha) 01121 { 01122 if (alpha==255) 01123 { 01124 Blitter::Normal< 01125 Blitter::OpFill_Color_TC, 01126 Blitter::StepX_Normal_TC, 01127 Blitter::StepY_Normal_TC 01128 >(blitArgs); 01129 } 01130 else 01131 { 01132 Blitter::Normal< 01133 Blitter::OpBlend_Color_Alpha_TC, 01134 Blitter::StepX_Normal_TC, 01135 Blitter::StepY_Normal_TC 01136 >(blitArgs); 01137 } 01138 } 01139 01140 // If we have an alpha channel, and target does too 01141 if (sourceAlpha && targetAlpha) 01142 { 01143 // Pick the right blitting for the specified transformation 01144 switch (transformation) 01145 { 01146 case NoTransformation: 01147 { 01148 if (alpha==255) 01149 { 01150 Blitter::Normal< 01151 Blitter::OpMax_SA_TA, 01152 Blitter::StepX_Normal_SA_TA, 01153 Blitter::StepY_Normal_SA_TA 01154 >(blitArgs); 01155 } 01156 else 01157 { 01158 Blitter::Normal< 01159 Blitter::OpMax_Alpha_SA_TA, 01160 Blitter::StepX_Normal_SA_TA, 01161 Blitter::StepY_Normal_SA_TA 01162 >(blitArgs); 01163 } 01164 } break; 01165 01166 case Rotate_90: 01167 { 01168 if (alpha==255) 01169 { 01170 Blitter::Rot090< 01171 Blitter::OpMax_SA_TA, 01172 Blitter::StepX_Rot090_SA_TA, 01173 Blitter::StepY_Rot090_SA_TA 01174 >(blitArgs); 01175 } 01176 else 01177 { 01178 Blitter::Rot090< 01179 Blitter::OpMax_Alpha_SA_TA, 01180 Blitter::StepX_Rot090_SA_TA, 01181 Blitter::StepY_Rot090_SA_TA 01182 >(blitArgs); 01183 } 01184 } break; 01185 01186 case Rotate_180: 01187 { 01188 if (alpha==255) 01189 { 01190 Blitter::Rot180< 01191 Blitter::OpMax_SA_TA, 01192 Blitter::StepX_Rot180_SA_TA, 01193 Blitter::StepY_Rot180_SA_TA 01194 >(blitArgs); 01195 } 01196 else 01197 { 01198 Blitter::Rot180< 01199 Blitter::OpMax_Alpha_SA_TA, 01200 Blitter::StepX_Rot180_SA_TA, 01201 Blitter::StepY_Rot180_SA_TA 01202 >(blitArgs); 01203 } 01204 } break; 01205 01206 case Rotate_270: 01207 { 01208 if (alpha==255) 01209 { 01210 Blitter::Rot270< 01211 Blitter::OpMax_SA_TA, 01212 Blitter::StepX_Rot270_SA_TA, 01213 Blitter::StepY_Rot270_SA_TA 01214 >(blitArgs); 01215 } 01216 else 01217 { 01218 Blitter::Rot270< 01219 Blitter::OpMax_Alpha_SA_TA, 01220 Blitter::StepX_Rot270_SA_TA, 01221 Blitter::StepY_Rot270_SA_TA 01222 >(blitArgs); 01223 } 01224 } break; 01225 01226 case Mirror_X: 01227 { 01228 if (alpha==255) 01229 { 01230 Blitter::Flip_X< 01231 Blitter::OpMax_SA_TA, 01232 Blitter::StepX_Flip_X_SA_TA, 01233 Blitter::StepY_Flip_X_SA_TA 01234 >(blitArgs); 01235 } 01236 else 01237 { 01238 Blitter::Flip_X< 01239 Blitter::OpMax_Alpha_SA_TA, 01240 Blitter::StepX_Flip_X_SA_TA, 01241 Blitter::StepY_Flip_X_SA_TA 01242 >(blitArgs); 01243 } 01244 } break; 01245 01246 case Mirror_Y: 01247 { 01248 if (alpha==255) 01249 { 01250 Blitter::Flip_Y< 01251 Blitter::OpMax_SA_TA, 01252 Blitter::StepX_Flip_Y_SA_TA, 01253 Blitter::StepY_Flip_Y_SA_TA 01254 >(blitArgs); 01255 } 01256 else 01257 { 01258 Blitter::Flip_Y< 01259 Blitter::OpMax_Alpha_SA_TA, 01260 Blitter::StepX_Flip_Y_SA_TA, 01261 Blitter::StepY_Flip_Y_SA_TA 01262 >(blitArgs); 01263 } 01264 } break; 01265 01266 } 01267 } 01268 01269 // If we don't have an alpha channel, but target does, set it to full opaque if alpha is 255, otherwise blend the alpha 01270 if (!sourceAlpha && targetAlpha) 01271 { 01272 if (alpha==255) 01273 { 01274 Blitter::Normal_Fill_Alpha_TA(blitArgs); 01275 } 01276 else 01277 { 01278 Blitter::Normal< 01279 Blitter::OpMax_Alpha_TA, 01280 Blitter::StepX_Normal_TA, 01281 Blitter::StepY_Normal_TA 01282 >(blitArgs); 01283 } 01284 } 01285 } 01286 01287 01288 01289 01290 //*** Copy *** 01291 01292 void Bitmap::Copy(Bitmap& target, int x, int y, unsigned short modulate, Transformation transformation) const 01293 { 01294 Copy(0, 0, width_-1, height_-1, target, x, y, modulate, transformation); 01295 } 01296 01297 01298 //*** Copy *** 01299 01300 void Bitmap::Copy(int x1, int y1, int x2, int y2, Bitmap& target, int x, int y, unsigned short modulate, Transformation transformation) const 01301 { 01302 // Perform clipping 01303 int sourceX=x1; 01304 int sourceY=y1; 01305 int sourceWidth=(x2-x1)+1; 01306 int sourceHeight=(y2-y1)+1; 01307 int targetX=x; 01308 int targetY=y; 01309 if (!Clip(sourceX,sourceY,sourceWidth,sourceHeight,targetX,targetY,target.GetWidth(),target.GetHeight(),transformation)) 01310 { 01311 // Nothing to draw, so bail out 01312 return; 01313 } 01314 01315 // Sanity checks - will only trigger if there's a bug in the Clip code 01316 Assert(sourceX>=0 && sourceY>=0 && (sourceX+sourceWidth)<=GetWidth(transformation) && (sourceY+sourceHeight)<=GetHeight(transformation),"Source rect out of range"); 01317 Assert(targetX>=0 && targetY>=0 && (targetX+sourceWidth)<=target.GetWidth() && (targetY+sourceHeight)<=target.GetHeight(),"Target rect out of range"); 01318 01319 // Set up the blitting parameters 01320 unsigned short* sourceColor=color_; 01321 unsigned char* sourceAlpha=alpha_; 01322 int sourceHPitch=width_; 01323 int sourceVPitch=height_; 01324 unsigned short* targetColor=target.GetColorData(); 01325 unsigned char* targetAlpha=target.GetAlphaData(); 01326 int targetPitch=target.GetWidth(); 01327 01328 Blitter::BlitArgs blitArgs; 01329 blitArgs.color=modulate; 01330 blitArgs.alpha=255; 01331 blitArgs.sourceColor=sourceColor; 01332 blitArgs.sourceAlpha=sourceAlpha; 01333 blitArgs.targetColor=targetColor; 01334 blitArgs.targetAlpha=targetAlpha; 01335 blitArgs.sourceHPitch=sourceHPitch; 01336 blitArgs.sourceVPitch=sourceVPitch; 01337 blitArgs.targetHPitch=targetPitch; 01338 blitArgs.sourceX=sourceX; 01339 blitArgs.sourceY=sourceY; 01340 blitArgs.sourceWidth=sourceWidth; 01341 blitArgs.sourceHeight=sourceHeight; 01342 blitArgs.targetX=targetX; 01343 blitArgs.targetY=targetY; 01344 01345 // Copy color channel, if we have one 01346 if (sourceColor && targetColor) 01347 { 01348 // Pick the right copy type for the specified transformation 01349 switch (transformation) 01350 { 01351 case NoTransformation: 01352 { 01353 if (modulate==0xffff) 01354 { 01355 Blitter::Normal_Copy_SC_TC(blitArgs); 01356 } 01357 else 01358 { 01359 Blitter::Normal< 01360 Blitter::OpCopy_Color_SC_TC, 01361 Blitter::StepX_Normal_SC_TC, 01362 Blitter::StepY_Normal_SC_TC 01363 >(blitArgs); 01364 } 01365 } break; 01366 01367 case Rotate_90: 01368 { 01369 if (modulate==0xffff) 01370 { 01371 Blitter::Rot090< 01372 Blitter::OpCopy_SC_TC, 01373 Blitter::StepX_Rot090_SC_TC, 01374 Blitter::StepY_Rot090_SC_TC 01375 >(blitArgs); 01376 } 01377 else 01378 { 01379 Blitter::Rot090< 01380 Blitter::OpCopy_Color_SC_TC, 01381 Blitter::StepX_Rot090_SC_TC, 01382 Blitter::StepY_Rot090_SC_TC 01383 >(blitArgs); 01384 } 01385 } break; 01386 01387 case Rotate_180: 01388 { 01389 if (modulate==0xffff) 01390 { 01391 Blitter::Rot180< 01392 Blitter::OpCopy_SC_TC, 01393 Blitter::StepX_Rot180_SC_TC, 01394 Blitter::StepY_Rot180_SC_TC 01395 >(blitArgs); 01396 } 01397 else 01398 { 01399 Blitter::Rot180< 01400 Blitter::OpCopy_Color_SC_TC, 01401 Blitter::StepX_Rot180_SC_TC, 01402 Blitter::StepY_Rot180_SC_TC 01403 >(blitArgs); 01404 } 01405 } break; 01406 01407 case Rotate_270: 01408 { 01409 if (modulate==0xffff) 01410 { 01411 Blitter::Rot270< 01412 Blitter::OpCopy_SC_TC, 01413 Blitter::StepX_Rot270_SC_TC, 01414 Blitter::StepY_Rot270_SC_TC 01415 >(blitArgs); 01416 } 01417 else 01418 { 01419 Blitter::Rot270< 01420 Blitter::OpCopy_Color_SC_TC, 01421 Blitter::StepX_Rot270_SC_TC, 01422 Blitter::StepY_Rot270_SC_TC 01423 >(blitArgs); 01424 } 01425 } break; 01426 01427 case Mirror_X: 01428 { 01429 if (modulate==0xffff) 01430 { 01431 Blitter::Flip_X< 01432 Blitter::OpCopy_SC_TC, 01433 Blitter::StepX_Flip_X_SC_TC, 01434 Blitter::StepY_Flip_X_SC_TC 01435 >(blitArgs); 01436 } 01437 else 01438 { 01439 Blitter::Flip_X< 01440 Blitter::OpCopy_Color_SC_TC, 01441 Blitter::StepX_Flip_X_SC_TC, 01442 Blitter::StepY_Flip_X_SC_TC 01443 >(blitArgs); 01444 } 01445 } break; 01446 01447 case Mirror_Y: 01448 { 01449 if (modulate==0xffff) 01450 { 01451 Blitter::Flip_Y_Copy_SC_TC(blitArgs); 01452 } 01453 else 01454 { 01455 Blitter::Flip_Y< 01456 Blitter::OpCopy_Color_SC_TC, 01457 Blitter::StepX_Flip_Y_SC_TC, 01458 Blitter::StepY_Flip_Y_SC_TC 01459 >(blitArgs); 01460 } 01461 } break; 01462 01463 } 01464 } 01465 01466 // Copy alpha channel, if we have one 01467 if (sourceAlpha && targetAlpha) 01468 { 01469 // Pick the right copy type for the specified transformation 01470 switch (transformation) 01471 { 01472 case NoTransformation: 01473 { 01474 Blitter::Normal_Copy_SA_TA(blitArgs); 01475 } break; 01476 01477 case Rotate_90: 01478 { 01479 Blitter::Rot090< 01480 Blitter::OpCopy_SA_TA, 01481 Blitter::StepX_Rot090_SA_TA, 01482 Blitter::StepY_Rot090_SA_TA 01483 >(blitArgs); 01484 } break; 01485 01486 case Rotate_180: 01487 { 01488 Blitter::Rot180< 01489 Blitter::OpCopy_SA_TA, 01490 Blitter::StepX_Rot180_SA_TA, 01491 Blitter::StepY_Rot180_SA_TA 01492 >(blitArgs); 01493 } break; 01494 01495 case Rotate_270: 01496 { 01497 Blitter::Rot270< 01498 Blitter::OpCopy_SA_TA, 01499 Blitter::StepX_Rot270_SA_TA, 01500 Blitter::StepY_Rot270_SA_TA 01501 >(blitArgs); 01502 } break; 01503 01504 case Mirror_X: 01505 { 01506 Blitter::Flip_X< 01507 Blitter::OpCopy_SA_TA, 01508 Blitter::StepX_Flip_X_SA_TA, 01509 Blitter::StepY_Flip_X_SA_TA 01510 >(blitArgs); 01511 } break; 01512 01513 case Mirror_Y: 01514 { 01515 Blitter::Flip_Y_Copy_SA_TA(blitArgs); 01516 } break; 01517 } 01518 } 01519 01520 01521 // If we don't have color, but target does, fill it with solid color 01522 if (!sourceColor && targetColor) 01523 { 01524 Blitter::Normal< 01525 Blitter::OpFill_Color_TC, 01526 Blitter::StepX_Normal_TC, 01527 Blitter::StepY_Normal_TC 01528 >(blitArgs); 01529 } 01530 01531 // If target has an alpha channel, fill it with full opaque 01532 if (!sourceAlpha && targetAlpha) 01533 { 01534 Blitter::Normal_Fill_Alpha_TA(blitArgs); 01535 } 01536 01537 } 01538 01539
Reproduction/republishing of any material on this site without permission is strictly prohibited.
