src/video/bwindow/SDL_bframebuffer.cc
changeset 5934 01531d8d1e01
parent 5933 5f8a7ebc88e5
child 5936 116b7457e73a
     1.1 --- a/src/video/bwindow/SDL_bframebuffer.cc	Wed Aug 03 06:22:33 2011 +0000
     1.2 +++ b/src/video/bwindow/SDL_bframebuffer.cc	Mon Aug 08 17:00:38 2011 +0000
     1.3 @@ -62,12 +62,20 @@
     1.4  
     1.5  	/* Create the new bitmap object */
     1.6  	BBitmap *bitmap = bwin->GetBitmap();
     1.7 +
     1.8  	if(bitmap) {
     1.9  		delete bitmap;
    1.10  	}
    1.11  	bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space,
    1.12  			false,	/* Views not accepted */
    1.13  			true);	/* Contiguous memory required */
    1.14 +			
    1.15 +	if(bitmap->InitCheck() != B_OK) {
    1.16 +		SDL_SetError("Could not initialize back buffer!\n");
    1.17 +		return -1;
    1.18 +	}
    1.19 +
    1.20 +
    1.21  	bwin->SetBitmap(bitmap);
    1.22  	
    1.23  	/* Set the pixel pointer */
    1.24 @@ -132,7 +140,7 @@
    1.25  				int32 height = clips[i].bottom - clips[i].top + 1;
    1.26  				bufferpx = bwin->GetBufferPx() + 
    1.27  					clips[i].top * bufferPitch + clips[i].left * BPP;
    1.28 -				windowpx = (uint8*)bitmap->Bits(); + 
    1.29 +				windowpx = (uint8*)bitmap->Bits() + 
    1.30  					clips[i].top * windowPitch + clips[i].left * BPP -
    1.31  					windowSub;
    1.32  
    1.33 @@ -143,11 +151,14 @@
    1.34  					if(bwin->CanTrashWindowBuffer()) {
    1.35  						goto escape;	/* Break out before the buffer is killed */
    1.36  					}
    1.37 +//					printf("memcpy(0x%x, 0x%x, %i) ", bufferpx, windowpx, width * BPP);
    1.38  					memcpy(bufferpx, windowpx, width * BPP);
    1.39  					bufferpx += bufferPitch;
    1.40  					windowpx += windowPitch;
    1.41  				}
    1.42 +//				printf("\t-\t");
    1.43  			}
    1.44 +//			printf("\n");
    1.45  			bwin->SetBufferDirty(false);
    1.46  escape:
    1.47  			bwin->UnlockBuffer();