/* decrement bitmap reference counter and free memory if counter hits 0 */
void Bitmap::releaseInternalBitmap(){
const int MAGIC_DEBUG = 0xa5a5a5;
if (own != NULL){
if (*own == MAGIC_DEBUG){
printf("[bitmap] Trying to delete an already deleted reference counter %p\n", own);
}
(*own) -= 1;
if ( *own == 0 ){
*own = MAGIC_DEBUG;
delete own;
destroyPrivateData();
own = NULL;
}
}
}
void Bitmap::BlitToScreen() const {
// this->Blit( *Bitmap::Screen );
this->BlitToScreen(0, 0);
}
void Bitmap::load( const std::string & str ){
releaseInternalBitmap();
internalLoadFile( str.c_str() );
}
void Bitmap::border( int min, int max, int color ) const {
- int w = getWidth();
- int h = getHeight();
- for ( int i = min; i < max; i++ ){
- rectangle( i, i, w - 1 - i, h - 1 - i, color );
- }
+ int w = getWidth();
+ int h = getHeight();
+ for (int i = min; i < max; i++){
+ rectangle(i, i, w - 1 - i, h - 1 - i, color);
+ }
}
void Bitmap::drawHFlip(const int x, const int y, const int startWidth, const int startHeight, const int width, const int height, const Bitmap & where) const {
// sub.drawHFlip(x + startWidth, y + startHeight, where);
// sub.drawHFlip(x + startWidth, y + startHeight, where);
sub.drawHFlip(x + startWidth, y + startHeight, where);
}
void Bitmap::draw(const int x, const int y, const int startWidth, const int startHeight, const int width, const int height, const Bitmap & where) const {