1) Publish methods for clearing and blackening the bitmap

2) Always do the calculations for a possibly scaled view.
Even if we prevent the user from changing the view size,
the Monitors control panel in the emulator may still try to
select a resolution which is too large for the screen,
and thus the window will have to be reduced to fit,
and thus the screen and bitmap co-ords may not match
This commit is contained in:
nigel 2003-03-26 23:37:42 +00:00
parent 18c58aa9d7
commit 1cbb3395d2

View File

@ -396,13 +396,11 @@ static NSPoint mouse; // Previous/current mouse location
mouse = location;
#ifdef CAN_RESIZE_VIEW
int mouseY = y - y * mouse.y / [self height];
int mouseX = x * mouse.x / [self width];
#else
int mouseY = y - (int) mouse.y;
int mouseX = (int) mouse.x;
#endif
// If the view was not resizable, then this would be simpler:
// int mouseY = y - (int) mouse.y;
// int mouseX = (int) mouse.x;
ADBMouseMoved(mouseX, mouseY);
return YES;
@ -479,6 +477,28 @@ static NSPoint mouse; // Previous/current mouse location
#endif
}
- (void) setTo: (int) val // Set all of bitmap to val
{
unsigned char *data
#ifdef NSBITMAP
= [bitmap bitmapData];
#else
= bitmap;
#endif
memset(data, val, numBytes);
}
- (void) blacken // Set bitmap black
{
[self setTo: 0];
}
- (void) clear // Set bitmap white
{
[self setTo: 0xFF];
}
//
// Extra drawing stuff
//