Fixed some font-related deadlocks
Added B_OP_OVERLAY support to BlitBitmap Fixed a cursor display bug Rudimentary mouse click support for input server emulation code git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2174 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a4d52d3edf
commit
e11a052e91
@ -510,6 +510,7 @@ void AppServer::Poller(void)
|
|||||||
// onto the active application. Eventually, we will pass them onto
|
// onto the active application. Eventually, we will pass them onto
|
||||||
// the window which is currently under the cursor.
|
// the window which is currently under the cursor.
|
||||||
case B_MOUSE_DOWN:
|
case B_MOUSE_DOWN:
|
||||||
|
{
|
||||||
if(!msgbuffer)
|
if(!msgbuffer)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_POLLER_THREAD
|
#ifdef DEBUG_POLLER_THREAD
|
||||||
@ -518,6 +519,13 @@ printf("Poller: MouseDown() - Empty buffer\n");
|
|||||||
ServerWindow::HandleMouseEvent(msgcode,msgbuffer);
|
ServerWindow::HandleMouseEvent(msgcode,msgbuffer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_POLLER_THREAD
|
||||||
|
printf("Poller: MouseDown\n");
|
||||||
|
#endif
|
||||||
|
ServerWindow::HandleMouseEvent(msgcode,msgbuffer);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case B_MOUSE_UP:
|
case B_MOUSE_UP:
|
||||||
{
|
{
|
||||||
if(!msgbuffer)
|
if(!msgbuffer)
|
||||||
@ -534,7 +542,7 @@ printf("Poller: MouseUp() - Empty buffer\n");
|
|||||||
active_lock->Unlock();
|
active_lock->Unlock();
|
||||||
*/
|
*/
|
||||||
#ifdef DEBUG_POLLER_THREAD
|
#ifdef DEBUG_POLLER_THREAD
|
||||||
printf("Poller: MouseDown/MouseUp\n");
|
printf("Poller: MouseUp\n");
|
||||||
#endif
|
#endif
|
||||||
ServerWindow::HandleMouseEvent(msgcode,msgbuffer);
|
ServerWindow::HandleMouseEvent(msgcode,msgbuffer);
|
||||||
break;
|
break;
|
||||||
|
@ -59,7 +59,7 @@ FrameBuffer::FrameBuffer(const char *title, uint32 space, status_t *st,bool debu
|
|||||||
port_id serverport=find_port(SERVER_INPUT_PORT);
|
port_id serverport=find_port(SERVER_INPUT_PORT);
|
||||||
serverlink=new PortLink(serverport);
|
serverlink=new PortLink(serverport);
|
||||||
mousepos.Set(0,0);
|
mousepos.Set(0,0);
|
||||||
buttons = 0;
|
buttons=0;
|
||||||
#ifdef DEBUG_SERVER_EMU
|
#ifdef DEBUG_SERVER_EMU
|
||||||
printf("ScreenDriver:: app_server input port: %ld\n",serverlink->GetPort());
|
printf("ScreenDriver:: app_server input port: %ld\n",serverlink->GetPort());
|
||||||
#endif
|
#endif
|
||||||
@ -93,6 +93,54 @@ void FrameBuffer::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
|
case 0x4c: // Z key on American QWERTY keymap
|
||||||
|
{
|
||||||
|
uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :(
|
||||||
|
int64 time=(int64)real_time_clock();
|
||||||
|
buttons=B_TERTIARY_MOUSE_BUTTON;
|
||||||
|
|
||||||
|
serverlink->SetOpCode(B_MOUSE_DOWN);
|
||||||
|
serverlink->Attach(&time, sizeof(int64));
|
||||||
|
serverlink->Attach(&mousepos.x,sizeof(float));
|
||||||
|
serverlink->Attach(&mousepos.y,sizeof(float));
|
||||||
|
serverlink->Attach(&modifiers, sizeof(uint32));
|
||||||
|
serverlink->Attach(&buttons, sizeof(uint32));
|
||||||
|
serverlink->Attach(&clicks, sizeof(uint32));
|
||||||
|
serverlink->Flush();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x4d: // X key on American QWERTY keymap
|
||||||
|
{
|
||||||
|
uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :(
|
||||||
|
int64 time=(int64)real_time_clock();
|
||||||
|
buttons=B_SECONDARY_MOUSE_BUTTON;
|
||||||
|
|
||||||
|
serverlink->SetOpCode(B_MOUSE_DOWN);
|
||||||
|
serverlink->Attach(&time, sizeof(int64));
|
||||||
|
serverlink->Attach(&mousepos.x,sizeof(float));
|
||||||
|
serverlink->Attach(&mousepos.y,sizeof(float));
|
||||||
|
serverlink->Attach(&modifiers, sizeof(uint32));
|
||||||
|
serverlink->Attach(&buttons, sizeof(uint32));
|
||||||
|
serverlink->Attach(&clicks, sizeof(uint32));
|
||||||
|
serverlink->Flush();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x4e: // C key on American QWERTY keymap
|
||||||
|
{
|
||||||
|
uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :(
|
||||||
|
int64 time=(int64)real_time_clock();
|
||||||
|
buttons=B_PRIMARY_MOUSE_BUTTON;
|
||||||
|
|
||||||
|
serverlink->SetOpCode(B_MOUSE_DOWN);
|
||||||
|
serverlink->Attach(&time, sizeof(int64));
|
||||||
|
serverlink->Attach(&mousepos.x,sizeof(float));
|
||||||
|
serverlink->Attach(&mousepos.y,sizeof(float));
|
||||||
|
serverlink->Attach(&modifiers, sizeof(uint32));
|
||||||
|
serverlink->Attach(&buttons, sizeof(uint32));
|
||||||
|
serverlink->Attach(&clicks, sizeof(uint32));
|
||||||
|
serverlink->Flush();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 0x47: // Enter key
|
case 0x47: // Enter key
|
||||||
{
|
{
|
||||||
port_id serverport=find_port(SERVER_PORT_NAME);
|
port_id serverport=find_port(SERVER_PORT_NAME);
|
||||||
@ -105,7 +153,8 @@ void FrameBuffer::MessageReceived(BMessage *msg)
|
|||||||
{
|
{
|
||||||
printf("Launching test app\n");
|
printf("Launching test app\n");
|
||||||
status_t value;
|
status_t value;
|
||||||
BEntry entry("/boot/home/Desktop/openbeos/sources/proto6/OBApplication/OBApplication");
|
// BEntry entry("/boot/home/Desktop/openbeos/sources/proto6/OBApplication/OBApplication");
|
||||||
|
BEntry entry("/boot/home/Desktop/openbeos/sources/proto7/OBApplication/OBApplication");
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
entry.GetRef(&ref);
|
entry.GetRef(&ref);
|
||||||
value=be_roster->Launch(&ref);
|
value=be_roster->Launch(&ref);
|
||||||
@ -278,7 +327,68 @@ void FrameBuffer::MessageReceived(BMessage *msg)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case B_KEY_UP:
|
||||||
|
{
|
||||||
|
#ifndef DISABLE_SERVER_EMU
|
||||||
|
int32 key,modifiers;
|
||||||
|
msg->FindInt32("key",&key);
|
||||||
|
msg->FindInt32("modifiers",&modifiers);
|
||||||
|
|
||||||
|
switch(key)
|
||||||
|
{
|
||||||
|
case 0x4c: // Z key on American QWERTY keymap
|
||||||
|
{
|
||||||
|
uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :(
|
||||||
|
int64 time=(int64)real_time_clock();
|
||||||
|
buttons=B_TERTIARY_MOUSE_BUTTON;
|
||||||
|
|
||||||
|
serverlink->SetOpCode(B_MOUSE_UP);
|
||||||
|
serverlink->Attach(&time, sizeof(int64));
|
||||||
|
serverlink->Attach(&mousepos.x,sizeof(float));
|
||||||
|
serverlink->Attach(&mousepos.y,sizeof(float));
|
||||||
|
serverlink->Attach(&modifiers, sizeof(uint32));
|
||||||
|
serverlink->Attach(&buttons, sizeof(uint32));
|
||||||
|
serverlink->Attach(&clicks, sizeof(uint32));
|
||||||
|
serverlink->Flush();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x4d: // X key on American QWERTY keymap
|
||||||
|
{
|
||||||
|
uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :(
|
||||||
|
int64 time=(int64)real_time_clock();
|
||||||
|
buttons=B_SECONDARY_MOUSE_BUTTON;
|
||||||
|
|
||||||
|
serverlink->SetOpCode(B_MOUSE_UP);
|
||||||
|
serverlink->Attach(&time, sizeof(int64));
|
||||||
|
serverlink->Attach(&mousepos.x,sizeof(float));
|
||||||
|
serverlink->Attach(&mousepos.y,sizeof(float));
|
||||||
|
serverlink->Attach(&modifiers, sizeof(uint32));
|
||||||
|
serverlink->Attach(&buttons, sizeof(uint32));
|
||||||
|
serverlink->Attach(&clicks, sizeof(uint32));
|
||||||
|
serverlink->Flush();
|
||||||
|
break;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x4e: // C key on American QWERTY keymap
|
||||||
|
{
|
||||||
|
uint32 clicks=1; // can't get the # of clicks without a *lot* of extra work :(
|
||||||
|
int64 time=(int64)real_time_clock();
|
||||||
|
buttons=B_PRIMARY_MOUSE_BUTTON;
|
||||||
|
|
||||||
|
serverlink->SetOpCode(B_MOUSE_UP);
|
||||||
|
serverlink->Attach(&time, sizeof(int64));
|
||||||
|
serverlink->Attach(&mousepos.x,sizeof(float));
|
||||||
|
serverlink->Attach(&mousepos.y,sizeof(float));
|
||||||
|
serverlink->Attach(&modifiers, sizeof(uint32));
|
||||||
|
serverlink->Attach(&buttons, sizeof(uint32));
|
||||||
|
serverlink->Attach(&clicks, sizeof(uint32));
|
||||||
|
serverlink->Flush();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
BWindowScreen::MessageReceived(msg);
|
BWindowScreen::MessageReceived(msg);
|
||||||
@ -302,10 +412,8 @@ ScreenDriver::ScreenDriver(void) : DisplayDriver()
|
|||||||
|
|
||||||
drawmode = DRAW_COPY;
|
drawmode = DRAW_COPY;
|
||||||
|
|
||||||
// We start without a cursor
|
|
||||||
cursor=NULL;
|
cursor=NULL;
|
||||||
under_cursor=NULL;
|
under_cursor=NULL;
|
||||||
|
|
||||||
cursorframe.Set(0,0,0,0);
|
cursorframe.Set(0,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,19 +427,13 @@ ScreenDriver::~ScreenDriver(void)
|
|||||||
|
|
||||||
bool ScreenDriver::Initialize(void)
|
bool ScreenDriver::Initialize(void)
|
||||||
{
|
{
|
||||||
int8 cross[] = { 16,1,5,5,
|
|
||||||
14,0,4,0,4,0,4,0,128,32,241,224,128,32,4,0,
|
|
||||||
4,0,4,0,14,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
14,0,4,0,4,0,4,0,128,32,245,224,128,32,4,0,
|
|
||||||
4,0,4,0,14,0,0,0,0,0,0,0,0,0,0,0 };
|
|
||||||
ServerBitmap *crosscursor;
|
|
||||||
fbuffer->Show();
|
fbuffer->Show();
|
||||||
|
|
||||||
// wait 1 sec for the window to show...
|
// wait 1 sec for the window to show...
|
||||||
snooze(500000);
|
snooze(500000);
|
||||||
crosscursor = new ServerBitmap(cross);
|
|
||||||
SetCursor(crosscursor,BPoint(5,5));
|
// we start out without a cursor shown because otherwise we get glitches in the
|
||||||
delete crosscursor;
|
// upper left corner. init_desktop *always* sets a cursor, so this shouldn't be a problem
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1298,7 +1400,7 @@ printf("ScreenDriver::HideCursor\n");
|
|||||||
{
|
{
|
||||||
SetCursorHidden(true);
|
SetCursorHidden(true);
|
||||||
if(CursorStateChanged())
|
if(CursorStateChanged())
|
||||||
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe);
|
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe, B_OP_COPY);
|
||||||
|
|
||||||
}
|
}
|
||||||
Unlock();
|
Unlock();
|
||||||
@ -1311,13 +1413,13 @@ printf("ScreenDriver::MoveCursorTo(%f,%f)\n",x,y);
|
|||||||
#endif
|
#endif
|
||||||
Lock();
|
Lock();
|
||||||
if(!IsCursorHidden())
|
if(!IsCursorHidden())
|
||||||
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe);
|
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe, B_OP_COPY);
|
||||||
|
|
||||||
cursorframe.OffsetTo(x,y);
|
cursorframe.OffsetTo(x,y);
|
||||||
ExtractToBitmap(under_cursor,under_cursor->Bounds(),cursorframe);
|
ExtractToBitmap(under_cursor,under_cursor->Bounds(),cursorframe);
|
||||||
|
|
||||||
if(!IsCursorHidden())
|
if(!IsCursorHidden())
|
||||||
BlitBitmap(cursor,cursor->Bounds(),cursorframe);
|
BlitBitmap(cursor,cursor->Bounds(),cursorframe, B_OP_OVER);
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
@ -1332,7 +1434,7 @@ printf("ScreenDriver::ShowCursor\n");
|
|||||||
{
|
{
|
||||||
SetCursorHidden(false);
|
SetCursorHidden(false);
|
||||||
if(CursorStateChanged())
|
if(CursorStateChanged())
|
||||||
BlitBitmap(cursor,cursor->Bounds(),cursorframe);
|
BlitBitmap(cursor,cursor->Bounds(),cursorframe, B_OP_OVER);
|
||||||
}
|
}
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
@ -1345,7 +1447,7 @@ printf("ScreenDriver::ObscureCursor\n");
|
|||||||
Lock();
|
Lock();
|
||||||
SetCursorObscured(true);
|
SetCursorObscured(true);
|
||||||
if(!IsCursorHidden() && fbuffer->IsConnected())
|
if(!IsCursorHidden() && fbuffer->IsConnected())
|
||||||
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe);
|
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe, B_OP_COPY);
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1361,7 +1463,7 @@ printf("ScreenDriver::SetCursor\n");
|
|||||||
|
|
||||||
// erase old if visible
|
// erase old if visible
|
||||||
if(!IsCursorHidden() && under_cursor)
|
if(!IsCursorHidden() && under_cursor)
|
||||||
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe);
|
BlitBitmap(under_cursor,under_cursor->Bounds(),cursorframe, B_OP_COPY);
|
||||||
|
|
||||||
if(cursor)
|
if(cursor)
|
||||||
delete cursor;
|
delete cursor;
|
||||||
@ -1382,7 +1484,7 @@ printf("ScreenDriver::SetCursor\n");
|
|||||||
ExtractToBitmap(under_cursor,under_cursor->Bounds(),cursorframe);
|
ExtractToBitmap(under_cursor,under_cursor->Bounds(),cursorframe);
|
||||||
|
|
||||||
if(!IsCursorHidden())
|
if(!IsCursorHidden())
|
||||||
BlitBitmap(cursor,cursor->Bounds(),cursorframe);
|
BlitBitmap(cursor,cursor->Bounds(),cursorframe, B_OP_OVER);
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
@ -1391,7 +1493,7 @@ void ScreenDriver::HLine(int32 x1, int32 x2, int32 y, RGBColor color)
|
|||||||
{
|
{
|
||||||
// Internal function called from others in the driver
|
// Internal function called from others in the driver
|
||||||
|
|
||||||
// TODO: Implment and substitute Line() calls with HLine calls as appropriate
|
// TODO: Implement and substitute Line() calls with HLine calls as appropriate
|
||||||
// elsewhere in the driver
|
// elsewhere in the driver
|
||||||
|
|
||||||
switch(fbuffer->gcinfo.bits_per_pixel)
|
switch(fbuffer->gcinfo.bits_per_pixel)
|
||||||
@ -1460,7 +1562,10 @@ printf("HLine(%u,%u,length %u,%u)\n",x,y,length,col);
|
|||||||
memset(pcolor,col,bytes);
|
memset(pcolor,col,bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenDriver::BlitBitmap(ServerBitmap *sourcebmp,BRect sourcerect, BRect destrect)
|
// This function is intended to eventually take care of most of the heavy lifting for
|
||||||
|
// DrawBitmap in 32-bit mode, with others coming later. Right now, it is *just* used for
|
||||||
|
// the
|
||||||
|
void ScreenDriver::BlitBitmap(ServerBitmap *sourcebmp,BRect sourcerect, BRect destrect, drawing_mode mode=B_OP_COPY)
|
||||||
{
|
{
|
||||||
// Another internal function called from other functions.
|
// Another internal function called from other functions.
|
||||||
|
|
||||||
@ -1538,19 +1643,64 @@ printf("ScreenDriver::BlitBitmap(): Incompatible bitmap pixel depth\n");
|
|||||||
uint32 line_length = uint32 ((destrect.right - destrect.left+1)*colorspace_size);
|
uint32 line_length = uint32 ((destrect.right - destrect.left+1)*colorspace_size);
|
||||||
uint32 lines = uint32 (destrect.bottom-destrect.top+1);
|
uint32 lines = uint32 (destrect.bottom-destrect.top+1);
|
||||||
|
|
||||||
for (uint32 pos_y = 0; pos_y != lines; pos_y++)
|
switch(mode)
|
||||||
{
|
{
|
||||||
memcpy(dest_bits,src_bits,line_length);
|
case B_OP_OVER:
|
||||||
|
{
|
||||||
// Increment offsets
|
uint32 srow_pixels=src_width>>2;
|
||||||
src_bits += src_width;
|
uint8 *srow_index, *drow_index;
|
||||||
dest_bits += dest_width;
|
|
||||||
|
|
||||||
|
// This could later be optimized to use uint32's for faster copying
|
||||||
|
for (uint32 pos_y=0; pos_y!=lines; pos_y++)
|
||||||
|
{
|
||||||
|
|
||||||
|
srow_index=src_bits;
|
||||||
|
drow_index=dest_bits;
|
||||||
|
|
||||||
|
for(uint32 pos_x=0; pos_x!=srow_pixels;pos_x++)
|
||||||
|
{
|
||||||
|
// 32-bit RGBA32 mode byte order is BGRA
|
||||||
|
if(srow_index[3]>127)
|
||||||
|
{
|
||||||
|
*drow_index=*srow_index; drow_index++; srow_index++;
|
||||||
|
*drow_index=*srow_index; drow_index++; srow_index++;
|
||||||
|
*drow_index=*srow_index; drow_index++; srow_index++;
|
||||||
|
// we don't copy the alpha channel
|
||||||
|
drow_index++; srow_index++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
srow_index+=4;
|
||||||
|
drow_index+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increment offsets
|
||||||
|
src_bits += src_width;
|
||||||
|
dest_bits += dest_width;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: // B_OP_COPY
|
||||||
|
{
|
||||||
|
for (uint32 pos_y = 0; pos_y != lines; pos_y++)
|
||||||
|
{
|
||||||
|
memcpy(dest_bits,src_bits,line_length);
|
||||||
|
|
||||||
|
// Increment offsets
|
||||||
|
src_bits += src_width;
|
||||||
|
dest_bits += dest_width;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenDriver::ExtractToBitmap(ServerBitmap *destbmp,BRect destrect, BRect sourcerect)
|
void ScreenDriver::ExtractToBitmap(ServerBitmap *destbmp,BRect destrect, BRect sourcerect)
|
||||||
{
|
{
|
||||||
// Another internal function called from other functions.
|
// Another internal function called from other functions. Extracts data from
|
||||||
|
// the framebuffer to a target ServerBitmap
|
||||||
|
|
||||||
if(!destbmp)
|
if(!destbmp)
|
||||||
{
|
{
|
||||||
@ -1694,7 +1844,10 @@ float ScreenDriver::StringWidth(const char *string, int32 length, LayerData *d)
|
|||||||
FontStyle *style=font->Style();
|
FontStyle *style=font->Style();
|
||||||
|
|
||||||
if(!style)
|
if(!style)
|
||||||
|
{
|
||||||
|
Unlock();
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
FT_Face face;
|
FT_Face face;
|
||||||
FT_GlyphSlot slot;
|
FT_GlyphSlot slot;
|
||||||
@ -1708,6 +1861,7 @@ float ScreenDriver::StringWidth(const char *string, int32 length, LayerData *d)
|
|||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
printf("Couldn't create face object\n");
|
printf("Couldn't create face object\n");
|
||||||
|
Unlock();
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1719,6 +1873,7 @@ float ScreenDriver::StringWidth(const char *string, int32 length, LayerData *d)
|
|||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
printf("Couldn't set character size - error 0x%x\n",error);
|
printf("Couldn't set character size - error 0x%x\n",error);
|
||||||
|
Unlock();
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1746,11 +1901,11 @@ float ScreenDriver::StringWidth(const char *string, int32 length, LayerData *d)
|
|||||||
pen.x+=slot->advance.x;
|
pen.x+=slot->advance.x;
|
||||||
previous=glyph_index;
|
previous=glyph_index;
|
||||||
}
|
}
|
||||||
Unlock();
|
|
||||||
|
|
||||||
FT_Done_Face(face);
|
FT_Done_Face(face);
|
||||||
|
|
||||||
returnval=pen.x>>6;
|
returnval=pen.x>>6;
|
||||||
|
Unlock();
|
||||||
return returnval;
|
return returnval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1764,7 +1919,10 @@ float ScreenDriver::StringHeight(const char *string, int32 length, LayerData *d)
|
|||||||
FontStyle *style=font->Style();
|
FontStyle *style=font->Style();
|
||||||
|
|
||||||
if(!style)
|
if(!style)
|
||||||
|
{
|
||||||
|
Unlock();
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
FT_Face face;
|
FT_Face face;
|
||||||
FT_GlyphSlot slot;
|
FT_GlyphSlot slot;
|
||||||
@ -1776,6 +1934,7 @@ float ScreenDriver::StringHeight(const char *string, int32 length, LayerData *d)
|
|||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
printf("Couldn't create face object\n");
|
printf("Couldn't create face object\n");
|
||||||
|
Unlock();
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1785,6 +1944,7 @@ float ScreenDriver::StringHeight(const char *string, int32 length, LayerData *d)
|
|||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
printf("Couldn't set character size - error 0x%x\n",error);
|
printf("Couldn't set character size - error 0x%x\n",error);
|
||||||
|
Unlock();
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1807,6 +1967,7 @@ float ScreenDriver::StringHeight(const char *string, int32 length, LayerData *d)
|
|||||||
FT_Done_Face(face);
|
FT_Done_Face(face);
|
||||||
|
|
||||||
returnval=ascent+descent;
|
returnval=ascent+descent;
|
||||||
|
Unlock();
|
||||||
return returnval;
|
return returnval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1815,13 +1976,18 @@ void ScreenDriver::DrawString(const char *string, int32 length, BPoint pt, Layer
|
|||||||
if(!string || !d || !d->font)
|
if(!string || !d || !d->font)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Lock();
|
||||||
|
|
||||||
pt.y--; // because of Be's backward compatibility hack
|
pt.y--; // because of Be's backward compatibility hack
|
||||||
|
|
||||||
ServerFont *font=d->font;
|
ServerFont *font=d->font;
|
||||||
FontStyle *style=font->Style();
|
FontStyle *style=font->Style();
|
||||||
|
|
||||||
if(!style)
|
if(!style)
|
||||||
|
{
|
||||||
|
Unlock();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FT_Face face;
|
FT_Face face;
|
||||||
FT_GlyphSlot slot;
|
FT_GlyphSlot slot;
|
||||||
@ -1852,6 +2018,7 @@ void ScreenDriver::DrawString(const char *string, int32 length, BPoint pt, Layer
|
|||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
printf("Couldn't create face object\n");
|
printf("Couldn't create face object\n");
|
||||||
|
Unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1863,18 +2030,13 @@ void ScreenDriver::DrawString(const char *string, int32 length, BPoint pt, Layer
|
|||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
printf("Couldn't set character size - error 0x%x\n",error);
|
printf("Couldn't set character size - error 0x%x\n",error);
|
||||||
|
Unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we do any transformation, we do a call to FT_Set_Transform() here
|
// if we do any transformation, we do a call to FT_Set_Transform() here
|
||||||
|
|
||||||
// First, rotate
|
// First, rotate
|
||||||
/*
|
|
||||||
rmatrix.xx = (FT_Fixed)( rotation.Cosine()*0x10000);
|
|
||||||
rmatrix.xy = (FT_Fixed)(-rotation.Sine()*0x10000);
|
|
||||||
rmatrix.yx = (FT_Fixed)( rotation.Sine()*0x10000);
|
|
||||||
rmatrix.yy = (FT_Fixed)( rotation.Cosine()*0x10000);
|
|
||||||
*/
|
|
||||||
rmatrix.xx = (FT_Fixed)( rotation.Cosine()*0x10000);
|
rmatrix.xx = (FT_Fixed)( rotation.Cosine()*0x10000);
|
||||||
rmatrix.xy = (FT_Fixed)( rotation.Sine()*0x10000);
|
rmatrix.xy = (FT_Fixed)( rotation.Sine()*0x10000);
|
||||||
rmatrix.yx = (FT_Fixed)(-rotation.Sine()*0x10000);
|
rmatrix.yx = (FT_Fixed)(-rotation.Sine()*0x10000);
|
||||||
@ -1953,6 +2115,7 @@ void ScreenDriver::DrawString(const char *string, int32 length, BPoint pt, Layer
|
|||||||
previous=glyph_index;
|
previous=glyph_index;
|
||||||
}
|
}
|
||||||
FT_Done_Face(face);
|
FT_Done_Face(face);
|
||||||
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenDriver::BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
|
void ScreenDriver::BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d)
|
||||||
@ -2253,5 +2416,6 @@ rgb_color ScreenDriver::GetBlitColor(rgb_color src, rgb_color dest, LayerData *d
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Unlock();
|
||||||
return returncolor;
|
return returncolor;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ protected:
|
|||||||
bool is_connected;
|
bool is_connected;
|
||||||
PortLink *serverlink;
|
PortLink *serverlink;
|
||||||
BPoint mousepos;
|
BPoint mousepos;
|
||||||
int32 buttons;
|
uint32 buttons;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScreenDriver : public DisplayDriver
|
class ScreenDriver : public DisplayDriver
|
||||||
@ -88,7 +88,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
|
void BlitMono2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
|
||||||
void BlitGray2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
|
void BlitGray2RGB32(FT_Bitmap *src, BPoint pt, LayerData *d);
|
||||||
void BlitBitmap(ServerBitmap *sourcebmp, BRect sourcerect, BRect destrect);
|
void BlitBitmap(ServerBitmap *sourcebmp, BRect sourcerect, BRect destrect, drawing_mode mode=B_OP_COPY);
|
||||||
void ExtractToBitmap(ServerBitmap *destbmp, BRect destrect, BRect sourcerect);
|
void ExtractToBitmap(ServerBitmap *destbmp, BRect destrect, BRect sourcerect);
|
||||||
void SetPixelPattern(int x, int y, uint8 *pattern, uint8 patternindex);
|
void SetPixelPattern(int x, int y, uint8 *pattern, uint8 patternindex);
|
||||||
void Line(BPoint start, BPoint end, LayerData *d, int8 *pat);
|
void Line(BPoint start, BPoint end, LayerData *d, int8 *pat);
|
||||||
|
Loading…
Reference in New Issue
Block a user