fixed some font related problems, Painter should now rely on the app_server font manager. maybe I fixed some compile problems too. Sorry if that was the case.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12144 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-03-29 22:57:43 +00:00
parent a4f89893df
commit d3b0b7b979
11 changed files with 64 additions and 59 deletions
@@ -365,7 +365,8 @@ AccelerantHWInterface::SetMode(const display_mode &mode)
void
AccelerantHWInterface::GetMode(display_mode *mode)
{
*mode = fDisplayMode;
if (mode)
*mode = fDisplayMode;
}
status_t
+31
View File
@@ -39,6 +39,9 @@
*/
DisplayDriver::DisplayDriver()
{
fDisplayMode.virtual_width = 640;
fDisplayMode.virtual_height = 480;
fDisplayMode.space = B_RGBA32;
}
/*!
@@ -76,4 +79,32 @@ DisplayDriver::Shutdown()
{
}
/*
\brief Sets the screen mode to specified resolution and color depth.
\param mode Data structure as defined in Screen.h
Subclasses must include calls to _SetDepth, _SetHeight, _SetWidth, and _SetMode
to update the state variables kept internally by the DisplayDriver class.
*/
void
DisplayDriver::SetMode(const display_mode &mode)
{
if (Lock()) {
fDisplayMode = mode;
Unlock();
}
}
// GetMode
void
DisplayDriver::GetMode(display_mode *mode)
{
if (!mode)
return;
if (Lock()) {
*mode = fDisplayMode;
Unlock();
}
}
@@ -56,9 +56,6 @@ DisplayDriverImpl::DisplayDriverImpl()
fDPMSState(B_DPMS_ON),
fDPMSCaps(B_DPMS_ON)
{
fDisplayMode.virtual_width = 640;
fDisplayMode.virtual_height = 480;
fDisplayMode.space = B_RGBA32;
}
@@ -2427,41 +2424,6 @@ DisplayDriverImpl::Unlock()
}
// Protected Internal Functions
/*
\brief Sets the screen mode to specified resolution and color depth.
\param mode Data structure as defined in Screen.h
Subclasses must include calls to _SetDepth, _SetHeight, _SetWidth, and _SetMode
to update the state variables kept internally by the DisplayDriver class.
*/
void
DisplayDriverImpl::SetMode(const display_mode &mode)
{
fDisplayMode = mode;
}
// GetMode
void
DisplayDriverImpl::GetMode(display_mode *mode)
{
if (!mode)
return;
Lock();
*mode = fDisplayMode;
Unlock();
}
// DisplayMode
const display_mode*
DisplayDriverImpl::DisplayMode()
{
const display_mode* mode = NULL;
Lock();
mode = &fDisplayMode;
Unlock();
return mode;
}
/*!
\brief Sets the driver's Display Power Management System state
@@ -297,11 +297,6 @@ class DisplayDriverImpl : public DisplayDriver {
virtual bool Lock(bigtime_t timeout = B_INFINITE_TIMEOUT);
virtual void Unlock();
// display mode access
virtual void SetMode(const display_mode &mode);
virtual void GetMode(display_mode *mode);
virtual const display_mode* DisplayMode();
virtual bool DumpToFile(const char *path);
virtual ServerBitmap* DumpToBitmap();
@@ -431,7 +426,6 @@ friend class WinBorder;
BLocker fLocker;
CursorHandler fCursorHandler;
display_mode fDisplayMode;
uint32 fDPMSState;
uint32 fDPMSCaps;
};
@@ -871,6 +871,7 @@ DisplayDriverPainter::SetMode(const display_mode &mode)
{
if (Lock() && fGraphicsCard->SetMode(mode) >= B_OK) {
fPainter->AttachToBuffer(fGraphicsCard->BackBuffer());
DisplayDriver::SetMode(mode);
Unlock();
} else {
fprintf(stderr, "DisplayDriverPainter::SetMode() - unsupported mode!\n");
@@ -234,7 +234,7 @@ class DisplayDriverPainter : public DisplayDriver {
// display mode access
virtual void SetMode(const display_mode &mode);
virtual bool DumpToFile(const char *path);
virtual ServerBitmap* DumpToBitmap();
+1 -1
View File
@@ -29,7 +29,7 @@ class HWInterface : public BLocker {
// screen mode stuff
virtual status_t SetMode(const display_mode &mode) = 0;
// virtual void GetMode(display_mode *mode) = 0;
virtual void GetMode(display_mode *mode) = 0;
virtual status_t GetDeviceInfo(accelerant_device_info *info) = 0;
virtual status_t GetModeList(display_mode **mode_list,
+15 -11
View File
@@ -277,7 +277,7 @@ Painter::SetFont(const ServerFont& font)
fFont.SetRotation(font.Rotation());
fFont.SetSize(font.Size());
_UpdateFont();
_UpdateFont(font.GetPath());
}
// #pragma mark -
@@ -1032,17 +1032,21 @@ Painter::_RebuildClipping()
// _UpdateFont
void
Painter::_UpdateFont()
Painter::_UpdateFont(const char* pathToFontFile)
{
font_family family;
font_style style;
fFont.GetFamilyAndStyle(&family, &style);
bool success = fTextRenderer->SetFamilyAndStyle(family, style);
if (!success) {
fprintf(stderr, "unable to set '%s' + '%s'\n", family, style);
fprintf(stderr, "font is still: '%s' + '%s'\n",
fTextRenderer->Family(), fTextRenderer->Style());
if (pathToFontFile) {
fTextRenderer->SetFont(pathToFontFile);
} else {
font_family family;
font_style style;
fFont.GetFamilyAndStyle(&family, &style);
bool success = fTextRenderer->SetFamilyAndStyle(family, style);
if (!success) {
fprintf(stderr, "unable to set '%s' + '%s'\n", family, style);
fprintf(stderr, "font is still: '%s' + '%s'\n",
fTextRenderer->Family(), fTextRenderer->Style());
}
}
fTextRenderer->SetPointSize(fFont.Size());
+4
View File
@@ -316,6 +316,10 @@ void ViewDriver::SetMode(const display_mode &mode)
return;
}
fDisplayMode.virtual_width = mode.virtual_width;
fDisplayMode.virtual_height = mode.virtual_height;
fDisplayMode.space = mode.space;
screenwin->Lock();
BBitmap *tempbmp=new BBitmap(BRect(0,0,mode.virtual_width-1, mode.virtual_height-1),
@@ -448,6 +448,14 @@ ViewHWInterface::SetMode(const display_mode &mode)
return ret;
}
// GetMode
void
ViewHWInterface::GetMode(display_mode* mode)
{
if (mode)
*mode = fDisplayMode;
}
// GetDeviceInfo
status_t
ViewHWInterface::GetDeviceInfo(accelerant_device_info *info)
+1 -1
View File
@@ -29,7 +29,7 @@ class ViewHWInterface : public HWInterface {
virtual status_t Shutdown();
virtual status_t SetMode(const display_mode &mode);
// virtual void GetMode(display_mode *mode);
virtual void GetMode(display_mode *mode);
virtual status_t GetDeviceInfo(accelerant_device_info *info);