mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-13 19:49:36 +00:00
Finish removing QDState
This commit is contained in:
@@ -14,6 +14,8 @@
|
|||||||
#include "FontManager.h"
|
#include "FontManager.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "RectUtils.h"
|
#include "RectUtils.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
|
#include "RenderedFontMetrics.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
#include "Room.h"
|
#include "Room.h"
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
@@ -120,16 +122,15 @@ void DrawBannerMessage (Point topLeft)
|
|||||||
|
|
||||||
PasStringCopy((*thisHouse)->banner, bannerStr);
|
PasStringCopy((*thisHouse)->banner, bannerStr);
|
||||||
|
|
||||||
workSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
||||||
|
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
GetLineOfText(bannerStr, count, subStr);
|
GetLineOfText(bannerStr, count, subStr);
|
||||||
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 32 + (count * 20)), subStr, true, blackColor);
|
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 32 + (count * 20)), subStr, blackColor, appFont);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
while (subStr[0] > 0);
|
while (subStr[0] > 0);
|
||||||
@@ -151,10 +152,10 @@ void DrawBannerMessage (Point topLeft)
|
|||||||
PasStringConcat(bannerStr, subStr);
|
PasStringConcat(bannerStr, subStr);
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor redColor = StdColors::Red();
|
PortabilityLayer::ResolveCachingColor redColor = StdColors::Red();
|
||||||
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 164), bannerStr, true, redColor);
|
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 164), bannerStr, redColor, appFont);
|
||||||
|
|
||||||
GetLocalizedString(5, subStr);
|
GetLocalizedString(5, subStr);
|
||||||
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr, true, redColor);
|
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr, redColor, appFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGraphicsPort(wasGWorld);
|
SetGraphicsPort(wasGWorld);
|
||||||
@@ -226,7 +227,7 @@ void DisplayStarsRemaining(void)
|
|||||||
|
|
||||||
DrawSurface *surface = starsWindow->GetDrawSurface();
|
DrawSurface *surface = starsWindow->GetDrawSurface();
|
||||||
|
|
||||||
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
NumToString((long)numStarsRemaining, theStr);
|
NumToString((long)numStarsRemaining, theStr);
|
||||||
|
|
||||||
@@ -235,8 +236,8 @@ void DisplayStarsRemaining(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LoadScaledGraphic(surface, kStarsRemainingPICT, &bounds);
|
LoadScaledGraphic(surface, kStarsRemainingPICT, &bounds);
|
||||||
const Point textPoint = Point::Create(bounds.left + 102 - (surface->MeasureString(theStr) / 2), bounds.top + 23);
|
const Point textPoint = Point::Create(bounds.left + 102 - (appFont->MeasurePStr(theStr) / 2), bounds.top + 23);
|
||||||
ColorText(surface, textPoint, theStr, 4L);
|
ColorText(surface, textPoint, theStr, 4L, appFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doZooms)
|
if (doZooms)
|
||||||
|
|||||||
@@ -20,11 +20,11 @@
|
|||||||
// this function draws text in that color. It assumes the current port,<2C>
|
// this function draws text in that color. It assumes the current port,<2C>
|
||||||
// the current font, the current pen location, etc.
|
// the current font, the current pen location, etc.
|
||||||
|
|
||||||
void ColorText (DrawSurface *surface, const Point &point, StringPtr theStr, long color)
|
void ColorText (DrawSurface *surface, const Point &point, StringPtr theStr, long color, PortabilityLayer::RenderedFont *font)
|
||||||
{
|
{
|
||||||
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
|
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
|
||||||
|
|
||||||
surface->DrawString(point, theStr, true, rColor);
|
surface->DrawString(point, theStr, rColor, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- ColorRect
|
//-------------------------------------------------------------- ColorRect
|
||||||
|
|||||||
@@ -71,11 +71,12 @@ void UpdateCoordWindow (void)
|
|||||||
if (coordWindow == nil)
|
if (coordWindow == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
||||||
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
||||||
PortabilityLayer::ResolveCachingColor blueColor = StdColors::Blue();
|
PortabilityLayer::ResolveCachingColor blueColor = StdColors::Blue();
|
||||||
|
|
||||||
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, 0, true);
|
||||||
|
|
||||||
DrawSurface *surface = coordWindow->GetDrawSurface();
|
DrawSurface *surface = coordWindow->GetDrawSurface();
|
||||||
|
|
||||||
surface->FillRect(coordWindowRect, whiteColor);
|
surface->FillRect(coordWindowRect, whiteColor);
|
||||||
@@ -89,7 +90,7 @@ void UpdateCoordWindow (void)
|
|||||||
else
|
else
|
||||||
PasStringConcat(tempStr, PSTR("-"));
|
PasStringConcat(tempStr, PSTR("-"));
|
||||||
|
|
||||||
surface->DrawString(Point::Create(5, 12), tempStr, true, blackColor);
|
surface->DrawString(Point::Create(5, 12), tempStr, blackColor, appFont);
|
||||||
|
|
||||||
PasStringCopy(PSTR("v: "), tempStr);
|
PasStringCopy(PSTR("v: "), tempStr);
|
||||||
if (coordV != -1)
|
if (coordV != -1)
|
||||||
@@ -100,7 +101,7 @@ void UpdateCoordWindow (void)
|
|||||||
else
|
else
|
||||||
PasStringConcat(tempStr, PSTR("-"));
|
PasStringConcat(tempStr, PSTR("-"));
|
||||||
|
|
||||||
surface->DrawString(Point::Create(4, 22), tempStr, true, blackColor);
|
surface->DrawString(Point::Create(4, 22), tempStr, blackColor, appFont);
|
||||||
|
|
||||||
PasStringCopy(PSTR("d: "), tempStr);
|
PasStringCopy(PSTR("d: "), tempStr);
|
||||||
if (coordD != -1)
|
if (coordD != -1)
|
||||||
@@ -111,7 +112,7 @@ void UpdateCoordWindow (void)
|
|||||||
else
|
else
|
||||||
PasStringConcat(tempStr, PSTR("-"));
|
PasStringConcat(tempStr, PSTR("-"));
|
||||||
|
|
||||||
surface->DrawString(Point::Create(5, 32), tempStr, true, blueColor);
|
surface->DrawString(Point::Create(5, 32), tempStr, blueColor, appFont);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,8 +158,6 @@ void OpenCoordWindow (void)
|
|||||||
coordV = -1;
|
coordV = -1;
|
||||||
coordD = -1;
|
coordD = -1;
|
||||||
|
|
||||||
coordWindow->GetDrawSurface()->SetApplicationFont(9, 0);
|
|
||||||
|
|
||||||
if (objActive != kNoObjectSelected)
|
if (objActive != kNoObjectSelected)
|
||||||
{
|
{
|
||||||
if (ObjectHasHandle(&direction, &dist))
|
if (ObjectHasHandle(&direction, &dist))
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
#include "FontFamily.h"
|
#include "FontFamily.h"
|
||||||
#include "ResourceManager.h"
|
#include "ResourceManager.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
|
#include "RenderedFontMetrics.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -573,26 +575,26 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
|
|||||||
|
|
||||||
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
||||||
|
|
||||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
|
||||||
|
|
||||||
PasStringCopy(text, stringCopy);
|
PasStringCopy(text, stringCopy);
|
||||||
|
|
||||||
Rect iRect = dial->GetItems()[item - 1].GetWidget()->GetRect();
|
Rect iRect = dial->GetItems()[item - 1].GetWidget()->GetRect();
|
||||||
|
|
||||||
if ((surface->MeasureString(stringCopy) + 2) > (iRect.right - iRect.left))
|
if ((appFont->MeasurePStr(stringCopy) + 2) > (iRect.right - iRect.left))
|
||||||
CollapseStringToWidth(surface, stringCopy, iRect.right - iRect.left - 2);
|
CollapseStringToWidth(appFont, stringCopy, iRect.right - iRect.left - 2);
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
||||||
surface->FillRect(iRect, whiteColor);
|
surface->FillRect(iRect, whiteColor);
|
||||||
|
|
||||||
short strWidth = surface->MeasureString(stringCopy);
|
short strWidth = appFont->MeasurePStr(stringCopy);
|
||||||
inset = ((iRect.right - iRect.left) - (strWidth + 2)) / 2;
|
inset = ((iRect.right - iRect.left) - (strWidth + 2)) / 2;
|
||||||
iRect.left += inset;
|
iRect.left += inset;
|
||||||
iRect.right -= inset;
|
iRect.right -= inset;
|
||||||
|
|
||||||
// Draw centered
|
// Draw centered
|
||||||
|
|
||||||
const int32_t ascender = surface->MeasureFontAscender();
|
const int32_t ascender = appFont->GetMetrics().m_ascent;
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor backgroundColor;
|
PortabilityLayer::ResolveCachingColor backgroundColor;
|
||||||
PortabilityLayer::ResolveCachingColor textColor;
|
PortabilityLayer::ResolveCachingColor textColor;
|
||||||
@@ -611,7 +613,7 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
|
|||||||
surface->FillRect(iRect, backgroundColor);
|
surface->FillRect(iRect, backgroundColor);
|
||||||
|
|
||||||
const Point centeredDrawPoint = Point::Create((iRect.left + iRect.right - strWidth) / 2, (iRect.top + iRect.bottom + ascender) / 2);
|
const Point centeredDrawPoint = Point::Create((iRect.left + iRect.right - strWidth) / 2, (iRect.top + iRect.bottom + ascender) / 2);
|
||||||
surface->DrawString(centeredDrawPoint, stringCopy, true, textColor);
|
surface->DrawString(centeredDrawPoint, stringCopy, textColor, appFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawDialogUserText
|
//-------------------------------------------------------------- DrawDialogUserText
|
||||||
@@ -626,16 +628,16 @@ void DrawDialogUserText2 (Dialog *dial, short item, StringPtr text)
|
|||||||
short iType;
|
short iType;
|
||||||
|
|
||||||
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
||||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
|
||||||
|
|
||||||
PasStringCopy(text, stringCopy);
|
PasStringCopy(text, stringCopy);
|
||||||
const Rect iRect = dial->GetItems()[item - 1].GetWidget()->GetRect();
|
const Rect iRect = dial->GetItems()[item - 1].GetWidget()->GetRect();
|
||||||
|
|
||||||
if ((surface->MeasureString(stringCopy) + 2) > (iRect.right - iRect.left))
|
if ((appFont->MeasurePStr(stringCopy) + 2) > (iRect.right - iRect.left))
|
||||||
CollapseStringToWidth(surface, stringCopy, iRect.right - iRect.left - 2);
|
CollapseStringToWidth(appFont, stringCopy, iRect.right - iRect.left - 2);
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
||||||
surface->DrawString(Point::Create(iRect.left, iRect.bottom), stringCopy, true, blackColor);
|
surface->DrawString(Point::Create(iRect.left, iRect.bottom), stringCopy, blackColor, appFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- LoadDialogPICT
|
//-------------------------------------------------------------- LoadDialogPICT
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace PortabilityLayer
|
|||||||
class ScanlineMask;
|
class ScanlineMask;
|
||||||
class ResTypeID;
|
class ResTypeID;
|
||||||
struct RGBAColor;
|
struct RGBAColor;
|
||||||
|
class RenderedFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define kPreferredDepth 8
|
#define kPreferredDepth 8
|
||||||
@@ -134,7 +135,7 @@ void DecrementCursor (void);
|
|||||||
void SpinCursor (short);
|
void SpinCursor (short);
|
||||||
void BackSpinCursor (short);
|
void BackSpinCursor (short);
|
||||||
|
|
||||||
void ColorText (DrawSurface *surface, const Point &, StringPtr, long); // --- ColorUtils.c
|
void ColorText (DrawSurface *surface, const Point &, StringPtr, long, PortabilityLayer::RenderedFont *font); // --- ColorUtils.c
|
||||||
void ColorRect (DrawSurface *surface, const Rect &, long);
|
void ColorRect (DrawSurface *surface, const Rect &, long);
|
||||||
void ColorOval (DrawSurface *surface, const Rect &, long);
|
void ColorOval (DrawSurface *surface, const Rect &, long);
|
||||||
void ColorOvalMaskPattern (DrawSurface *surface, const Rect &, long, const uint8_t *);
|
void ColorOvalMaskPattern (DrawSurface *surface, const Rect &, long, const uint8_t *);
|
||||||
@@ -189,7 +190,7 @@ void PasStringConcat (StringPtr, const PLPasStr &);
|
|||||||
void GetLineOfText (StringPtr, short, StringPtr);
|
void GetLineOfText (StringPtr, short, StringPtr);
|
||||||
void WrapText (StringPtr, short);
|
void WrapText (StringPtr, short);
|
||||||
void GetFirstWordOfString (StringPtr, StringPtr);
|
void GetFirstWordOfString (StringPtr, StringPtr);
|
||||||
void CollapseStringToWidth (DrawSurface *, StringPtr, short);
|
void CollapseStringToWidth (PortabilityLayer::RenderedFont *, StringPtr, short);
|
||||||
void GetChooserName (StringPtr);
|
void GetChooserName (StringPtr);
|
||||||
StringPtr GetLocalizedString (short, StringPtr);
|
StringPtr GetLocalizedString (short, StringPtr);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "Objects.h"
|
#include "Objects.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
#include "RectUtils.h"
|
#include "RectUtils.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
|
|
||||||
@@ -108,16 +109,16 @@ void SetUpFinalScreen (void)
|
|||||||
{
|
{
|
||||||
GetLineOfText(tempStr, count, subStr);
|
GetLineOfText(tempStr, count, subStr);
|
||||||
|
|
||||||
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
offset = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) -
|
offset = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) -
|
||||||
surface->MeasureString(subStr)) / 2;
|
appFont->MeasurePStr(subStr)) / 2;
|
||||||
|
|
||||||
const Point textShadowPos = Point::Create(offset + 1, textDown + 33 + (count * 20));
|
const Point textShadowPos = Point::Create(offset + 1, textDown + 33 + (count * 20));
|
||||||
|
|
||||||
surface->DrawString(textShadowPos, subStr, true, blackColor);
|
surface->DrawString(textShadowPos, subStr, blackColor, appFont);
|
||||||
|
|
||||||
const Point textPos = Point::Create(offset, textDown + 32 + (count * 20));
|
const Point textPos = Point::Create(offset, textDown + 32 + (count * 20));
|
||||||
surface->DrawString(textPos, subStr, true, whiteColor);
|
surface->DrawString(textPos, subStr, whiteColor, appFont);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
while (subStr[0] > 0);
|
while (subStr[0] > 0);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
#include "PLTimeTaggedVOSEvent.h"
|
#include "PLTimeTaggedVOSEvent.h"
|
||||||
#include "RectUtils.h"
|
#include "RectUtils.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
#include "WindowManager.h"
|
#include "WindowManager.h"
|
||||||
@@ -148,29 +149,29 @@ void DrawHighScores (DrawSurface *surface)
|
|||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
DisposeGWorld(tempMask);
|
DisposeGWorld(tempMask);
|
||||||
|
|
||||||
surface->SetApplicationFont(14, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *appFont14 = GetApplicationFont(14, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
PasStringCopy(PSTR("<EFBFBD> "), tempStr);
|
PasStringCopy(PSTR("<EFBFBD> "), tempStr);
|
||||||
PasStringConcat(tempStr, thisHouseName);
|
PasStringConcat(tempStr, thisHouseName);
|
||||||
PasStringConcat(tempStr, PSTR(" <20>"));
|
PasStringConcat(tempStr, PSTR(" <20>"));
|
||||||
|
|
||||||
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - surface->MeasureString(tempStr)) / 2) - 1, dropIt - 66);
|
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - appFont14->MeasurePStr(tempStr)) / 2) - 1, dropIt - 66);
|
||||||
surface->DrawString(scoreShadowPoint, tempStr, true, blackColor);
|
surface->DrawString(scoreShadowPoint, tempStr, blackColor, appFont14);
|
||||||
|
|
||||||
const Point scoreTextPoint = Point::Create(scoreLeft + ((kScoreWide - surface->MeasureString(tempStr)) / 2), dropIt - 65);
|
const Point scoreTextPoint = Point::Create(scoreLeft + ((kScoreWide - appFont14->MeasurePStr(tempStr)) / 2), dropIt - 65);
|
||||||
surface->DrawString(scoreTextPoint, tempStr, true, cyanColor);
|
surface->DrawString(scoreTextPoint, tempStr, cyanColor, appFont14);
|
||||||
|
|
||||||
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *appFont12 = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
thisHousePtr = *thisHouse;
|
thisHousePtr = *thisHouse;
|
||||||
// message for score #1
|
// message for score #1
|
||||||
PasStringCopy(thisHousePtr->highScores.banner, tempStr);
|
PasStringCopy(thisHousePtr->highScores.banner, tempStr);
|
||||||
bannerWidth = surface->MeasureString(tempStr);
|
bannerWidth = appFont12->MeasurePStr(tempStr);
|
||||||
const Point topScoreShadowPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted);
|
const Point topScoreShadowPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted);
|
||||||
surface->DrawString(topScoreShadowPoint, tempStr, true, blackColor);
|
surface->DrawString(topScoreShadowPoint, tempStr, blackColor, appFont12);
|
||||||
|
|
||||||
const Point topScoreTextPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted - 1);
|
const Point topScoreTextPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted - 1);
|
||||||
surface->DrawString(topScoreTextPoint, tempStr, true, yellowColor);
|
surface->DrawString(topScoreTextPoint, tempStr, yellowColor, appFont12);
|
||||||
|
|
||||||
QSetRect(&tempRect, 0, 0, bannerWidth + 8, kScoreSpacing);
|
QSetRect(&tempRect, 0, 0, bannerWidth + 8, kScoreSpacing);
|
||||||
QOffsetRect(&tempRect, scoreLeft - 3 + (kScoreWide - bannerWidth) / 2,
|
QOffsetRect(&tempRect, scoreLeft - 3 + (kScoreWide - bannerWidth) / 2,
|
||||||
@@ -192,7 +193,7 @@ void DrawHighScores (DrawSurface *surface)
|
|||||||
strPos = Point::Create(scoreLeft + 1, dropIt - kScoreSpacing - kKimsLifted);
|
strPos = Point::Create(scoreLeft + 1, dropIt - kScoreSpacing - kKimsLifted);
|
||||||
else
|
else
|
||||||
strPos = Point::Create(scoreLeft + 1, dropIt + (i * kScoreSpacing));
|
strPos = Point::Create(scoreLeft + 1, dropIt + (i * kScoreSpacing));
|
||||||
surface->DrawString(strPos, tempStr, true, blackColor);
|
surface->DrawString(strPos, tempStr, blackColor, appFont12);
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor *scoreColor = (i == lastHighScore) ? &whiteColor : &cyanColor;
|
PortabilityLayer::ResolveCachingColor *scoreColor = (i == lastHighScore) ? &whiteColor : &cyanColor;
|
||||||
|
|
||||||
@@ -200,7 +201,7 @@ void DrawHighScores (DrawSurface *surface)
|
|||||||
strPos = Point::Create(scoreLeft + 0, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
strPos = Point::Create(scoreLeft + 0, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||||
else
|
else
|
||||||
strPos = Point::Create(scoreLeft + 0, dropIt - 1 + (i * kScoreSpacing));
|
strPos = Point::Create(scoreLeft + 0, dropIt - 1 + (i * kScoreSpacing));
|
||||||
surface->DrawString(strPos, tempStr, true, *scoreColor);
|
surface->DrawString(strPos, tempStr, *scoreColor, appFont12);
|
||||||
// draw high score name
|
// draw high score name
|
||||||
PasStringCopy(thisHousePtr->highScores.names[i], tempStr);
|
PasStringCopy(thisHousePtr->highScores.names[i], tempStr);
|
||||||
|
|
||||||
@@ -208,7 +209,7 @@ void DrawHighScores (DrawSurface *surface)
|
|||||||
strPos = Point::Create(scoreLeft + 31, dropIt - kScoreSpacing - kKimsLifted);
|
strPos = Point::Create(scoreLeft + 31, dropIt - kScoreSpacing - kKimsLifted);
|
||||||
else
|
else
|
||||||
strPos = Point::Create(scoreLeft + 31, dropIt + (i * kScoreSpacing));
|
strPos = Point::Create(scoreLeft + 31, dropIt + (i * kScoreSpacing));
|
||||||
surface->DrawString(strPos, tempStr, true, blackColor);
|
surface->DrawString(strPos, tempStr, blackColor, appFont12);
|
||||||
|
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor *nameColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
|
PortabilityLayer::ResolveCachingColor *nameColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
|
||||||
@@ -217,7 +218,7 @@ void DrawHighScores (DrawSurface *surface)
|
|||||||
strPos = Point::Create(scoreLeft + 30, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
strPos = Point::Create(scoreLeft + 30, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||||
else
|
else
|
||||||
strPos = Point::Create(scoreLeft + 30, dropIt - 1 + (i * kScoreSpacing));
|
strPos = Point::Create(scoreLeft + 30, dropIt - 1 + (i * kScoreSpacing));
|
||||||
surface->DrawString(strPos, tempStr, true, *nameColor);
|
surface->DrawString(strPos, tempStr, *nameColor, appFont12);
|
||||||
// draw level number
|
// draw level number
|
||||||
NumToString(thisHousePtr->highScores.levels[i], tempStr);
|
NumToString(thisHousePtr->highScores.levels[i], tempStr);
|
||||||
|
|
||||||
@@ -225,14 +226,14 @@ void DrawHighScores (DrawSurface *surface)
|
|||||||
strPos = Point::Create(scoreLeft + 161, dropIt - kScoreSpacing - kKimsLifted);
|
strPos = Point::Create(scoreLeft + 161, dropIt - kScoreSpacing - kKimsLifted);
|
||||||
else
|
else
|
||||||
strPos = Point::Create(scoreLeft + 161, dropIt + (i * kScoreSpacing));
|
strPos = Point::Create(scoreLeft + 161, dropIt + (i * kScoreSpacing));
|
||||||
surface->DrawString(strPos, tempStr, true, blackColor);
|
surface->DrawString(strPos, tempStr, blackColor, appFont12);
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor *levelColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
|
PortabilityLayer::ResolveCachingColor *levelColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
strPos = Point::Create(scoreLeft + 160, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
strPos = Point::Create(scoreLeft + 160, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||||
else
|
else
|
||||||
strPos = Point::Create(scoreLeft + 160, dropIt - 1 + (i * kScoreSpacing));
|
strPos = Point::Create(scoreLeft + 160, dropIt - 1 + (i * kScoreSpacing));
|
||||||
surface->DrawString(strPos, tempStr, true, *levelColor);
|
surface->DrawString(strPos, tempStr, *levelColor, appFont12);
|
||||||
// draw word "rooms"
|
// draw word "rooms"
|
||||||
if (thisHousePtr->highScores.levels[i] == 1)
|
if (thisHousePtr->highScores.levels[i] == 1)
|
||||||
GetLocalizedString(6, tempStr);
|
GetLocalizedString(6, tempStr);
|
||||||
@@ -243,19 +244,19 @@ void DrawHighScores (DrawSurface *surface)
|
|||||||
strPos = Point::Create(scoreLeft + 193, dropIt - kScoreSpacing - kKimsLifted);
|
strPos = Point::Create(scoreLeft + 193, dropIt - kScoreSpacing - kKimsLifted);
|
||||||
else
|
else
|
||||||
strPos = Point::Create(scoreLeft + 193, dropIt + (i * kScoreSpacing));
|
strPos = Point::Create(scoreLeft + 193, dropIt + (i * kScoreSpacing));
|
||||||
surface->DrawString(strPos, tempStr, true, blackColor);
|
surface->DrawString(strPos, tempStr, blackColor, appFont12);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
strPos = Point::Create(scoreLeft + 192, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
strPos = Point::Create(scoreLeft + 192, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||||
else
|
else
|
||||||
strPos = Point::Create(scoreLeft + 192, dropIt - 1 + (i * kScoreSpacing));
|
strPos = Point::Create(scoreLeft + 192, dropIt - 1 + (i * kScoreSpacing));
|
||||||
surface->DrawString(strPos, tempStr, true, cyanColor);
|
surface->DrawString(strPos, tempStr, cyanColor, appFont12);
|
||||||
// draw high score points
|
// draw high score points
|
||||||
NumToString(thisHousePtr->highScores.scores[i], tempStr);
|
NumToString(thisHousePtr->highScores.scores[i], tempStr);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
strPos = Point::Create(scoreLeft + 291, dropIt - kScoreSpacing - kKimsLifted);
|
strPos = Point::Create(scoreLeft + 291, dropIt - kScoreSpacing - kKimsLifted);
|
||||||
else
|
else
|
||||||
strPos = Point::Create(scoreLeft + 291, dropIt + (i * kScoreSpacing));
|
strPos = Point::Create(scoreLeft + 291, dropIt + (i * kScoreSpacing));
|
||||||
surface->DrawString(strPos, tempStr, true, blackColor);
|
surface->DrawString(strPos, tempStr, blackColor, appFont12);
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor *pointsColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
|
PortabilityLayer::ResolveCachingColor *pointsColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
|
||||||
|
|
||||||
@@ -263,15 +264,15 @@ void DrawHighScores (DrawSurface *surface)
|
|||||||
strPos = Point::Create(scoreLeft + 290, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
strPos = Point::Create(scoreLeft + 290, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||||
else
|
else
|
||||||
strPos = Point::Create(scoreLeft + 290, dropIt - 1 + (i * kScoreSpacing));
|
strPos = Point::Create(scoreLeft + 290, dropIt - 1 + (i * kScoreSpacing));
|
||||||
surface->DrawString(strPos, tempStr, true, *pointsColor);
|
surface->DrawString(strPos, tempStr, *pointsColor, appFont12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *appFont9 = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
const Point textPos = Point::Create(scoreLeft + 80, dropIt - 1 + (10 * kScoreSpacing));
|
const Point textPos = Point::Create(scoreLeft + 80, dropIt - 1 + (10 * kScoreSpacing));
|
||||||
GetLocalizedString(8, tempStr);
|
GetLocalizedString(8, tempStr);
|
||||||
surface->DrawString(textPos, tempStr, true, blueColor);
|
surface->DrawString(textPos, tempStr, blueColor, appFont9);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- SortHighScores
|
//-------------------------------------------------------------- SortHighScores
|
||||||
|
|||||||
@@ -70,20 +70,20 @@ void DrawOnSplash(DrawSurface *surface)
|
|||||||
if ((thisMac.hasQT) && (hasMovie))
|
if ((thisMac.hasQT) && (hasMovie))
|
||||||
PasStringConcat(houseLoadedStr, PSTR(" (TV)"));
|
PasStringConcat(houseLoadedStr, PSTR(" (TV)"));
|
||||||
|
|
||||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
const Point textPoint = Point::Create(splashOriginH + 436, splashOriginV + 314);
|
const Point textPoint = Point::Create(splashOriginH + 436, splashOriginV + 314);
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
{
|
{
|
||||||
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
||||||
surface->DrawString(textPoint, houseLoadedStr, true, whiteColor);
|
surface->DrawString(textPoint, houseLoadedStr, whiteColor, appFont);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (houseIsReadOnly)
|
if (houseIsReadOnly)
|
||||||
ColorText(surface, textPoint, houseLoadedStr, 5L);
|
ColorText(surface, textPoint, houseLoadedStr, 5L, appFont);
|
||||||
else
|
else
|
||||||
ColorText(surface, textPoint, houseLoadedStr, 28L);
|
ColorText(surface, textPoint, houseLoadedStr, 28L, appFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(powerc) || defined(__powerc)
|
#if defined(powerc) || defined(__powerc)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "Environ.h"
|
#include "Environ.h"
|
||||||
#include "Objects.h"
|
#include "Objects.h"
|
||||||
#include "RectUtils.h"
|
#include "RectUtils.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
#include "ResourceManager.h"
|
#include "ResourceManager.h"
|
||||||
#include "Room.h"
|
#include "Room.h"
|
||||||
@@ -1061,13 +1062,13 @@ void DrawCalendar (Rect *theRect)
|
|||||||
backSrcMap->DrawPicture(thePicture, bounds);
|
backSrcMap->DrawPicture(thePicture, bounds);
|
||||||
thePicture.Dispose();
|
thePicture.Dispose();
|
||||||
|
|
||||||
backSrcMap->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
GetTime(&timeRec);
|
GetTime(&timeRec);
|
||||||
GetIndString(monthStr, kMonthStringID, timeRec.month);
|
GetIndString(monthStr, kMonthStringID, timeRec.month);
|
||||||
|
|
||||||
const Point textPos = Point::Create(theRect->left + ((64 - backSrcMap->MeasureString(monthStr)) / 2), theRect->top + 55);
|
const Point textPos = Point::Create(theRect->left + ((64 - appFont->MeasurePStr(monthStr)) / 2), theRect->top + 55);
|
||||||
ColorText(backSrcMap, textPos, monthStr, kDarkFleshColor);
|
ColorText(backSrcMap, textPos, monthStr, kDarkFleshColor, appFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawBulletin
|
//-------------------------------------------------------------- DrawBulletin
|
||||||
|
|||||||
@@ -252,13 +252,13 @@ void ReadyBackground (short theID, short *theTiles)
|
|||||||
|
|
||||||
workSrcMap->FillRect(workSrcRect, ltGrayColor);
|
workSrcMap->FillRect(workSrcRect, ltGrayColor);
|
||||||
|
|
||||||
workSrcMap->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
|
||||||
|
|
||||||
const Point textPoint = Point::Create(10, 20);
|
const Point textPoint = Point::Create(10, 20);
|
||||||
if (houseUnlocked)
|
if (houseUnlocked)
|
||||||
workSrcMap->DrawString(textPoint, PSTR("No rooms"), true, blackColor);
|
workSrcMap->DrawString(textPoint, PSTR("No rooms"), blackColor, appFont);
|
||||||
else
|
else
|
||||||
workSrcMap->DrawString(textPoint, PSTR("Nothing to show"), true, blackColor);
|
workSrcMap->DrawString(textPoint, PSTR("Nothing to show"), blackColor, appFont);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
|
|||||||
@@ -10,11 +10,13 @@
|
|||||||
#include "PLPasStr.h"
|
#include "PLPasStr.h"
|
||||||
#include "Externs.h"
|
#include "Externs.h"
|
||||||
#include "Environ.h"
|
#include "Environ.h"
|
||||||
|
#include "FontFamily.h"
|
||||||
#include "MenuManager.h"
|
#include "MenuManager.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
#include "QDPixMap.h"
|
#include "QDPixMap.h"
|
||||||
#include "QDStandardPalette.h"
|
#include "QDStandardPalette.h"
|
||||||
#include "RectUtils.h"
|
#include "RectUtils.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -164,33 +166,35 @@ void RefreshRoomTitle (short mode)
|
|||||||
const Point strShadowPoint = Point::Create(1, 10);
|
const Point strShadowPoint = Point::Create(1, 10);
|
||||||
const Point strPoint = Point::Create(0, 9);
|
const Point strPoint = Point::Create(0, 9);
|
||||||
|
|
||||||
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case kEscapedTitleMode:
|
case kEscapedTitleMode:
|
||||||
surface->DrawString(strShadowPoint, PSTR("Hit Delete key if unable to Follow"), true, blackColor);
|
surface->DrawString(strShadowPoint, PSTR("Hit Delete key if unable to Follow"), blackColor, appFont);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kSavingTitleMode:
|
case kSavingTitleMode:
|
||||||
surface->DrawString(strShadowPoint, PSTR("Saving Game<6D>"), true, blackColor);
|
surface->DrawString(strShadowPoint, PSTR("Saving Game<6D>"), blackColor, appFont);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
surface->DrawString(strShadowPoint, thisRoom->name, true, blackColor);
|
surface->DrawString(strShadowPoint, thisRoom->name, blackColor, appFont);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case kEscapedTitleMode:
|
case kEscapedTitleMode:
|
||||||
surface->DrawString(strPoint, PSTR("Hit Delete key if unable to Follow"), true, whiteColor);
|
surface->DrawString(strPoint, PSTR("Hit Delete key if unable to Follow"), whiteColor, appFont);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kSavingTitleMode:
|
case kSavingTitleMode:
|
||||||
surface->DrawString(strPoint, PSTR("Saving Game<6D>"), true, whiteColor);
|
surface->DrawString(strPoint, PSTR("Saving Game<6D>"), whiteColor, appFont);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
surface->DrawString(strPoint, thisRoom->name, true, whiteColor);
|
surface->DrawString(strPoint, thisRoom->name, whiteColor, appFont);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,6 +211,8 @@ void RefreshNumGliders (void)
|
|||||||
long displayMortals;
|
long displayMortals;
|
||||||
DrawSurface *surface = boardGSrcMap;
|
DrawSurface *surface = boardGSrcMap;
|
||||||
|
|
||||||
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor theRGBColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(kGrayBackgroundColor);
|
PortabilityLayer::ResolveCachingColor theRGBColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(kGrayBackgroundColor);
|
||||||
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
||||||
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
||||||
@@ -221,8 +227,8 @@ void RefreshNumGliders (void)
|
|||||||
const Point shadowPoint = Point::Create(1, 10);
|
const Point shadowPoint = Point::Create(1, 10);
|
||||||
const Point textPoint = Point::Create(0, 9);
|
const Point textPoint = Point::Create(0, 9);
|
||||||
|
|
||||||
surface->DrawString(shadowPoint, nGlidersStr, true, blackColor);
|
surface->DrawString(shadowPoint, nGlidersStr, blackColor, appFont);
|
||||||
surface->DrawString(textPoint, nGlidersStr, true, whiteColor);
|
surface->DrawString(textPoint, nGlidersStr, whiteColor, appFont);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
|
||||||
(BitMap *)*GetGWorldPixMap(boardSrcMap),
|
(BitMap *)*GetGWorldPixMap(boardSrcMap),
|
||||||
@@ -240,6 +246,8 @@ void RefreshPoints (void)
|
|||||||
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
||||||
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
||||||
|
|
||||||
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
surface->FillRect(boardPSrcRect, theRGBColor);
|
surface->FillRect(boardPSrcRect, theRGBColor);
|
||||||
|
|
||||||
NumToString(theScore, scoreStr);
|
NumToString(theScore, scoreStr);
|
||||||
@@ -247,8 +255,8 @@ void RefreshPoints (void)
|
|||||||
const Point shadowPoint = Point::Create(1, 10);
|
const Point shadowPoint = Point::Create(1, 10);
|
||||||
const Point textPoint = Point::Create(0, 9);
|
const Point textPoint = Point::Create(0, 9);
|
||||||
|
|
||||||
surface->DrawString(shadowPoint, scoreStr, true, blackColor);
|
surface->DrawString(shadowPoint, scoreStr, blackColor, appFont);
|
||||||
surface->DrawString(textPoint, scoreStr, true, whiteColor);
|
surface->DrawString(textPoint, scoreStr, whiteColor, appFont);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
|
||||||
(BitMap *)*GetGWorldPixMap(boardSrcMap),
|
(BitMap *)*GetGWorldPixMap(boardSrcMap),
|
||||||
@@ -268,6 +276,8 @@ void QuickGlidersRefresh (void)
|
|||||||
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
||||||
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
||||||
|
|
||||||
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
surface->FillRect(boardGSrcRect, theRGBColor);
|
surface->FillRect(boardGSrcRect, theRGBColor);
|
||||||
|
|
||||||
NumToString((long)mortals, nGlidersStr);
|
NumToString((long)mortals, nGlidersStr);
|
||||||
@@ -275,8 +285,8 @@ void QuickGlidersRefresh (void)
|
|||||||
const Point shadowPoint = Point::Create(1, 10);
|
const Point shadowPoint = Point::Create(1, 10);
|
||||||
const Point textPoint = Point::Create(0, 9);
|
const Point textPoint = Point::Create(0, 9);
|
||||||
|
|
||||||
surface->DrawString(shadowPoint, nGlidersStr, true, blackColor);
|
surface->DrawString(shadowPoint, nGlidersStr, blackColor, appFont);
|
||||||
surface->DrawString(textPoint, nGlidersStr, true, whiteColor);
|
surface->DrawString(textPoint, nGlidersStr, whiteColor, appFont);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
|
||||||
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
@@ -296,6 +306,8 @@ void QuickScoreRefresh (void)
|
|||||||
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
|
||||||
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
|
||||||
|
|
||||||
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
surface->FillRect(boardPSrcRect, theRGBColor);
|
surface->FillRect(boardPSrcRect, theRGBColor);
|
||||||
|
|
||||||
NumToString(displayedScore, scoreStr);
|
NumToString(displayedScore, scoreStr);
|
||||||
@@ -303,8 +315,8 @@ void QuickScoreRefresh (void)
|
|||||||
const Point shadowPoint = Point::Create(1, 10);
|
const Point shadowPoint = Point::Create(1, 10);
|
||||||
const Point textPoint = Point::Create(0, 9);
|
const Point textPoint = Point::Create(0, 9);
|
||||||
|
|
||||||
surface->DrawString(shadowPoint, scoreStr, true, blackColor);
|
surface->DrawString(shadowPoint, scoreStr, blackColor, appFont);
|
||||||
surface->DrawString(textPoint, scoreStr, true, whiteColor);
|
surface->DrawString(textPoint, scoreStr, whiteColor, appFont);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
|
||||||
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "PLPasStr.h"
|
#include "PLPasStr.h"
|
||||||
#include "Externs.h"
|
#include "Externs.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -275,17 +276,17 @@ void GetFirstWordOfString (StringPtr stringIn, StringPtr stringOut)
|
|||||||
// font. If the text would exceed our width limit, characters<72>
|
// font. If the text would exceed our width limit, characters<72>
|
||||||
// are dropped off the end of the string and "<22>" appended.
|
// are dropped off the end of the string and "<22>" appended.
|
||||||
|
|
||||||
void CollapseStringToWidth (DrawSurface *surface, StringPtr theStr, short wide)
|
void CollapseStringToWidth (PortabilityLayer::RenderedFont *font, StringPtr theStr, short wide)
|
||||||
{
|
{
|
||||||
short dotsWide;
|
short dotsWide;
|
||||||
Boolean tooWide;
|
Boolean tooWide;
|
||||||
|
|
||||||
dotsWide = surface->MeasureString(PSTR("<EFBFBD>"));
|
dotsWide = font->MeasurePStr(PSTR("<EFBFBD>"));
|
||||||
tooWide = surface->MeasureString(theStr) > wide;
|
tooWide = font->MeasurePStr(theStr) > wide;
|
||||||
while (tooWide)
|
while (tooWide && theStr[0] > 0)
|
||||||
{
|
{
|
||||||
theStr[0]--;
|
theStr[0]--;
|
||||||
tooWide = ((surface->MeasureString(theStr) + dotsWide) > wide);
|
tooWide = ((font->MeasurePStr(theStr) + dotsWide) > wide);
|
||||||
if (!tooWide)
|
if (!tooWide)
|
||||||
PasStringConcat(theStr, PSTR("<EFBFBD>"));
|
PasStringConcat(theStr, PSTR("<EFBFBD>"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ void InitScoreboardMap(void)
|
|||||||
if (!boardTSrcMap)
|
if (!boardTSrcMap)
|
||||||
{
|
{
|
||||||
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
|
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
|
||||||
boardTSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
|
||||||
}
|
}
|
||||||
boardTDestRect = boardTSrcRect;
|
boardTDestRect = boardTSrcRect;
|
||||||
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
|
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
|
||||||
@@ -114,7 +113,6 @@ void InitScoreboardMap(void)
|
|||||||
if (!boardGSrcMap)
|
if (!boardGSrcMap)
|
||||||
{
|
{
|
||||||
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
|
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
|
||||||
boardGSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
|
||||||
}
|
}
|
||||||
boardGDestRect = boardGSrcRect;
|
boardGDestRect = boardGSrcRect;
|
||||||
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
|
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
|
||||||
@@ -124,7 +122,6 @@ void InitScoreboardMap(void)
|
|||||||
if (!boardPSrcMap)
|
if (!boardPSrcMap)
|
||||||
{
|
{
|
||||||
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
|
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
|
||||||
boardPSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
|
||||||
}
|
}
|
||||||
boardPDestRect = boardPSrcRect;
|
boardPDestRect = boardPSrcRect;
|
||||||
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
|
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
|
||||||
|
|||||||
@@ -157,8 +157,8 @@ void DrawToolName (DrawSurface *surface)
|
|||||||
|
|
||||||
const Point textPoint = Point::Create(toolTextRect.left + 3, toolTextRect.bottom - 6);
|
const Point textPoint = Point::Create(toolTextRect.left + 3, toolTextRect.bottom - 6);
|
||||||
|
|
||||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
ColorText(surface, textPoint, theString, 171L);
|
ColorText(surface, textPoint, theString, 171L, appFont);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "PLPasStr.h"
|
#include "PLPasStr.h"
|
||||||
#include "Externs.h"
|
#include "Externs.h"
|
||||||
#include "Environ.h"
|
#include "Environ.h"
|
||||||
|
#include "FontFamily.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
#include "RectUtils.h"
|
#include "RectUtils.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
@@ -125,8 +126,6 @@ void OpenMessageWindow (const PLPasStr &title)
|
|||||||
ShowWindow(mssgWindow);
|
ShowWindow(mssgWindow);
|
||||||
|
|
||||||
DrawSurface *surface = mssgWindow->GetDrawSurface();
|
DrawSurface *surface = mssgWindow->GetDrawSurface();
|
||||||
|
|
||||||
surface->SetSystemFont(12, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mssgWindowExclusiveStack = mssgWindow;
|
mssgWindowExclusiveStack = mssgWindow;
|
||||||
@@ -150,6 +149,8 @@ void SetMessageWindowMessage (StringPtr message, const PortabilityLayer::RGBACol
|
|||||||
{
|
{
|
||||||
DrawSurface *surface = mssgWindow->GetDrawSurface();
|
DrawSurface *surface = mssgWindow->GetDrawSurface();
|
||||||
|
|
||||||
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(12, PortabilityLayer::FontFamilyFlag_None, true);
|
||||||
|
|
||||||
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
|
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
|
||||||
InsetRect(&mssgWindowRect, 16, 16);
|
InsetRect(&mssgWindowRect, 16, 16);
|
||||||
|
|
||||||
@@ -159,7 +160,7 @@ void SetMessageWindowMessage (StringPtr message, const PortabilityLayer::RGBACol
|
|||||||
const Point textPoint = Point::Create(mssgWindowRect.left, mssgWindowRect.bottom - 6);
|
const Point textPoint = Point::Create(mssgWindowRect.left, mssgWindowRect.bottom - 6);
|
||||||
|
|
||||||
PortabilityLayer::ResolveCachingColor specifiedColor = color;
|
PortabilityLayer::ResolveCachingColor specifiedColor = color;
|
||||||
surface->DrawString(textPoint, message, true, specifiedColor);
|
surface->DrawString(textPoint, message, specifiedColor, sysFont);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -811,8 +811,6 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
SetGraphicsPort(m_menuBarGraf);
|
SetGraphicsPort(m_menuBarGraf);
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
|
||||||
|
|
||||||
ResolveCachingColor barMidColor = gs_barMidColor;
|
ResolveCachingColor barMidColor = gs_barMidColor;
|
||||||
|
|
||||||
graf->FillRect(menuRect, barMidColor);
|
graf->FillRect(menuRect, barMidColor);
|
||||||
@@ -894,7 +892,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
// Text items
|
// Text items
|
||||||
ResolveCachingColor barNormalTextColor = gs_barNormalTextColor;
|
ResolveCachingColor barNormalTextColor = gs_barNormalTextColor;
|
||||||
m_menuBarGraf->SetSystemFont(kMenuFontSize, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(kMenuFontSize, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
{
|
{
|
||||||
Menu **menuHdl = m_firstMenu;
|
Menu **menuHdl = m_firstMenu;
|
||||||
@@ -916,7 +914,7 @@ namespace PortabilityLayer
|
|||||||
if (menuHdl != selectedMenuHdl)
|
if (menuHdl != selectedMenuHdl)
|
||||||
{
|
{
|
||||||
const Point itemPos = Point::Create(static_cast<int16_t>(xCoordinate), kMenuBarTextYOffset);
|
const Point itemPos = Point::Create(static_cast<int16_t>(xCoordinate), kMenuBarTextYOffset);
|
||||||
graf->DrawString(itemPos, PLPasStr(static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents)), true, barNormalTextColor);
|
graf->DrawString(itemPos, PLPasStr(static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents)), barNormalTextColor, sysFont);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -936,7 +934,7 @@ namespace PortabilityLayer
|
|||||||
size_t xCoordinate = menu->cumulativeOffset + (menu->menuIndex * 2) * kMenuBarItemPadding + kMenuBarInitialPadding;
|
size_t xCoordinate = menu->cumulativeOffset + (menu->menuIndex * 2) * kMenuBarItemPadding + kMenuBarInitialPadding;
|
||||||
|
|
||||||
const Point itemPos = Point::Create(static_cast<int16_t>(xCoordinate), kMenuBarTextYOffset);
|
const Point itemPos = Point::Create(static_cast<int16_t>(xCoordinate), kMenuBarTextYOffset);
|
||||||
graf->DrawString(itemPos, PLPasStr(static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents)), true, barHighlightTextColor);
|
graf->DrawString(itemPos, PLPasStr(static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents)), barHighlightTextColor, sysFont);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1375,8 +1373,6 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
SetGraphicsPort(m_menuGraf);
|
SetGraphicsPort(m_menuGraf);
|
||||||
|
|
||||||
QDState *qdState = qdManager->GetState();
|
|
||||||
|
|
||||||
ResolveCachingColor barMidColor = gs_barMidColor;
|
ResolveCachingColor barMidColor = gs_barMidColor;
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -1394,7 +1390,7 @@ namespace PortabilityLayer
|
|||||||
surface->FillRect(Rect::Create(menu->layoutFinalHeight - 1, 1, menu->layoutFinalHeight, menu->layoutWidth - 1), darkGrayColor);
|
surface->FillRect(Rect::Create(menu->layoutFinalHeight - 1, 1, menu->layoutFinalHeight, menu->layoutWidth - 1), darkGrayColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_menuGraf->SetSystemFont(kMenuFontSize, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(kMenuFontSize, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
const uint8_t *strBlob = static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents);
|
const uint8_t *strBlob = static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents);
|
||||||
|
|
||||||
@@ -1425,7 +1421,7 @@ namespace PortabilityLayer
|
|||||||
else
|
else
|
||||||
itemTextAndCheckColor = gs_barDisabledTextColor;
|
itemTextAndCheckColor = gs_barDisabledTextColor;
|
||||||
|
|
||||||
surface->DrawString(itemPos, PLPasStr(strBlob + item.nameOffsetInStringBlob), true, itemTextAndCheckColor);
|
surface->DrawString(itemPos, PLPasStr(strBlob + item.nameOffsetInStringBlob), itemTextAndCheckColor, sysFont);
|
||||||
|
|
||||||
if (item.key)
|
if (item.key)
|
||||||
{
|
{
|
||||||
@@ -1433,7 +1429,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
uint8_t hintText[kHintTextCapacity];
|
uint8_t hintText[kHintTextCapacity];
|
||||||
const size_t hintLength = FormatHintText(hintText, item.key);
|
const size_t hintLength = FormatHintText(hintText, item.key);
|
||||||
surface->DrawString(hintPos, PLPasStr(hintLength, reinterpret_cast<const char*>(hintText)), true, itemTextAndCheckColor);
|
surface->DrawString(hintPos, PLPasStr(hintLength, reinterpret_cast<const char*>(hintText)), itemTextAndCheckColor, sysFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.checked)
|
if (item.checked)
|
||||||
@@ -1465,7 +1461,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
itemPos.v = item.layoutYOffset + kMenuItemTextYOffset;
|
itemPos.v = item.layoutYOffset + kMenuItemTextYOffset;
|
||||||
|
|
||||||
surface->DrawString(itemPos, PLPasStr(strBlob + item.nameOffsetInStringBlob), true, barHighlightTextColor);
|
surface->DrawString(itemPos, PLPasStr(strBlob + item.nameOffsetInStringBlob), barHighlightTextColor, sysFont);
|
||||||
|
|
||||||
if (item.key)
|
if (item.key)
|
||||||
{
|
{
|
||||||
@@ -1473,7 +1469,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
uint8_t hintText[kHintTextCapacity];
|
uint8_t hintText[kHintTextCapacity];
|
||||||
const size_t hintLength = FormatHintText(hintText, item.key);
|
const size_t hintLength = FormatHintText(hintText, item.key);
|
||||||
surface->DrawString(hintPos, PLPasStr(hintLength, reinterpret_cast<const char*>(hintText)), true, barHighlightTextColor);
|
surface->DrawString(hintPos, PLPasStr(hintLength, reinterpret_cast<const char*>(hintText)), barHighlightTextColor, sysFont);
|
||||||
|
|
||||||
if (item.checked)
|
if (item.checked)
|
||||||
surface->FillRect(Rect::Create(item.layoutYOffset + kMenuItemCheckTopOffset, kMenuItemCheckLeftOffset, item.layoutYOffset + kMenuItemCheckBottomOffset, kMenuItemCheckRightOffset), barHighlightTextColor);
|
surface->FillRect(Rect::Create(item.layoutYOffset + kMenuItemCheckTopOffset, kMenuItemCheckLeftOffset, item.layoutYOffset + kMenuItemCheckBottomOffset, kMenuItemCheckRightOffset), barHighlightTextColor);
|
||||||
|
|||||||
@@ -4,7 +4,10 @@
|
|||||||
#include "PLRegions.h"
|
#include "PLRegions.h"
|
||||||
#include "PLTimeTaggedVOSEvent.h"
|
#include "PLTimeTaggedVOSEvent.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
|
#include "PLQDraw.h"
|
||||||
#include "FontFamily.h"
|
#include "FontFamily.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
|
#include "RenderedFontMetrics.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
#include "SimpleGraphic.h"
|
#include "SimpleGraphic.h"
|
||||||
|
|
||||||
@@ -442,10 +445,11 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
ResolveCachingColor textCacheColor = textColor;
|
ResolveCachingColor textCacheColor = textColor;
|
||||||
|
|
||||||
surface->SetSystemFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
int32_t x = (m_rect.left + m_rect.right - static_cast<int32_t>(surface->MeasureString(m_text.ToShortStr()))) / 2;
|
|
||||||
int32_t y = (m_rect.top + m_rect.bottom + static_cast<int32_t>(surface->MeasureFontAscender())) / 2;
|
int32_t x = (m_rect.left + m_rect.right - static_cast<int32_t>(sysFont->MeasureString(reinterpret_cast<const uint8_t*>(m_text.UnsafeCharPtr()), m_text.Length()))) / 2;
|
||||||
surface->DrawString(Point::Create(x, y), m_text.ToShortStr(), true, textCacheColor);
|
int32_t y = (m_rect.top + m_rect.bottom + static_cast<int32_t>(sysFont->GetMetrics().m_ascent)) / 2;
|
||||||
|
surface->DrawString(Point::Create(x, y), m_text.ToShortStr(), textCacheColor, sysFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonWidget::DrawAsCheck(DrawSurface *surface, bool inverted)
|
void ButtonWidget::DrawAsCheck(DrawSurface *surface, bool inverted)
|
||||||
@@ -531,9 +535,9 @@ namespace PortabilityLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->SetSystemFont(12, FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(12, FontFamilyFlag_Bold, true);
|
||||||
int32_t textV = (m_rect.top + m_rect.bottom + surface->MeasureFontAscender()) / 2;
|
int32_t textV = (m_rect.top + m_rect.bottom + sysFont->GetMetrics().m_ascent) / 2;
|
||||||
surface->DrawString(Point::Create(m_rect.left + checkFrameSize + 2, textV), m_text.ToShortStr(), true, *textColor);
|
surface->DrawString(Point::Create(m_rect.left + checkFrameSize + 2, textV), m_text.ToShortStr(), *textColor, sysFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -592,9 +596,9 @@ namespace PortabilityLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->SetSystemFont(12, FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(12, FontFamilyFlag_Bold, true);
|
||||||
int32_t textV = (m_rect.top + m_rect.bottom + surface->MeasureFontAscender()) / 2;
|
int32_t textV = (m_rect.top + m_rect.bottom + sysFont->GetMetrics().m_ascent) / 2;
|
||||||
surface->DrawString(Point::Create(m_rect.left + checkFrameSize + 2, textV), m_text.ToShortStr(), true, *textColor);
|
surface->DrawString(Point::Create(m_rect.left + checkFrameSize + 2, textV), m_text.ToShortStr(), *textColor, sysFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonWidget::DrawDefaultButtonChrome(const Rect &rectRef, DrawSurface *surface)
|
void ButtonWidget::DrawDefaultButtonChrome(const Rect &rectRef, DrawSurface *surface)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "RenderedFont.h"
|
#include "RenderedFont.h"
|
||||||
#include "RenderedFontMetrics.h"
|
#include "RenderedFontMetrics.h"
|
||||||
#include "PLKeyEncoding.h"
|
#include "PLKeyEncoding.h"
|
||||||
|
#include "PLQDraw.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
#include "PLTimeTaggedVOSEvent.h"
|
#include "PLTimeTaggedVOSEvent.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
@@ -70,9 +71,9 @@ namespace PortabilityLayer
|
|||||||
surface->FillRect(outerRect, blackColor);
|
surface->FillRect(outerRect, blackColor);
|
||||||
surface->FillRect(innerRect, whiteColor);
|
surface->FillRect(innerRect, whiteColor);
|
||||||
|
|
||||||
surface->SetSystemFont(12, PortabilityLayer::FontFamilyFlag_None);
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(12, PortabilityLayer::FontFamilyFlag_None, true);
|
||||||
int32_t ascender = surface->MeasureFontAscender();
|
int32_t ascender = sysFont->GetMetrics().m_ascent;
|
||||||
int32_t lineGap = surface->MeasureFontLineGap();
|
int32_t lineGap = sysFont->GetMetrics().m_linegap;
|
||||||
|
|
||||||
const PLPasStr str = this->GetString();
|
const PLPasStr str = this->GetString();
|
||||||
|
|
||||||
@@ -85,20 +86,20 @@ namespace PortabilityLayer
|
|||||||
Vec2i basePoint = ResolveBasePoint();
|
Vec2i basePoint = ResolveBasePoint();
|
||||||
|
|
||||||
if (m_hasFocus && m_selStartChar != m_selEndChar)
|
if (m_hasFocus && m_selStartChar != m_selEndChar)
|
||||||
DrawSelection(surface, basePoint);
|
DrawSelection(surface, basePoint, sysFont);
|
||||||
|
|
||||||
int32_t verticalOffset = (ascender + lineGap + 1) / 2;
|
int32_t verticalOffset = (ascender + lineGap + 1) / 2;
|
||||||
|
|
||||||
const Point stringBasePoint = Point::Create(basePoint.m_x, basePoint.m_y + verticalOffset);
|
const Point stringBasePoint = Point::Create(basePoint.m_x, basePoint.m_y + verticalOffset);
|
||||||
|
|
||||||
if (m_isMultiLine)
|
if (m_isMultiLine)
|
||||||
surface->DrawStringWrap(stringBasePoint, m_rect, this->GetString(), true, blackColor);
|
surface->DrawStringWrap(stringBasePoint, m_rect, this->GetString(), blackColor, sysFont);
|
||||||
else
|
else
|
||||||
surface->DrawStringConstrained(stringBasePoint, this->GetString(), true, m_rect, blackColor);
|
surface->DrawStringConstrained(stringBasePoint, this->GetString(), m_rect, blackColor, sysFont);
|
||||||
|
|
||||||
if (m_hasFocus && m_selEndChar == m_selStartChar && m_caratTimer < kCaratBlinkRate)
|
if (m_hasFocus && m_selEndChar == m_selStartChar && m_caratTimer < kCaratBlinkRate)
|
||||||
{
|
{
|
||||||
PortabilityLayer::Vec2i caratPos = ResolveCaratPos(basePoint, surface->ResolveFont(true));
|
PortabilityLayer::Vec2i caratPos = ResolveCaratPos(basePoint, sysFont);
|
||||||
|
|
||||||
int32_t caratTop = caratPos.m_y;
|
int32_t caratTop = caratPos.m_y;
|
||||||
int32_t caratBottom = caratTop + lineGap;
|
int32_t caratBottom = caratTop + lineGap;
|
||||||
@@ -654,9 +655,8 @@ namespace PortabilityLayer
|
|||||||
return WidgetHandleStates::kCaptured;
|
return WidgetHandleStates::kCaptured;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditboxWidget::DrawSelection(DrawSurface *surface, const Vec2i &basePoint) const
|
void EditboxWidget::DrawSelection(DrawSurface *surface, const Vec2i &basePoint, PortabilityLayer::RenderedFont *rfont) const
|
||||||
{
|
{
|
||||||
PortabilityLayer::RenderedFont *rfont = surface->ResolveFont(true);
|
|
||||||
PortabilityLayer::TextPlacer placer(basePoint, m_isMultiLine ? m_rect.Width() : -1, rfont, GetString());
|
PortabilityLayer::TextPlacer placer(basePoint, m_isMultiLine ? m_rect.Width() : -1, rfont, GetString());
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
WidgetHandleState_t HandleDragSelection(const TimeTaggedVOSEvent &evt);
|
WidgetHandleState_t HandleDragSelection(const TimeTaggedVOSEvent &evt);
|
||||||
|
|
||||||
void DrawSelection(DrawSurface *surface, const Vec2i &basePoint) const;
|
void DrawSelection(DrawSurface *surface, const Vec2i &basePoint, PortabilityLayer::RenderedFont *font) const;
|
||||||
|
|
||||||
Vec2i ResolveCaratPos(const Vec2i &basePoint, PortabilityLayer::RenderedFont *rfont) const;
|
Vec2i ResolveCaratPos(const Vec2i &basePoint, PortabilityLayer::RenderedFont *rfont) const;
|
||||||
Vec2i ResolveBasePoint() const;
|
Vec2i ResolveBasePoint() const;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#include "PLQDraw.h"
|
#include "PLQDraw.h"
|
||||||
#include "FontFamily.h"
|
#include "FontFamily.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
|
#include "RenderedFontMetrics.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -37,11 +39,11 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
surface->FillRect(m_rect, whiteColor);
|
surface->FillRect(m_rect, whiteColor);
|
||||||
|
|
||||||
surface->SetSystemFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
|
|
||||||
const Point topLeftCorner = Point::Create(m_rect.left, m_rect.top);
|
const Point topLeftCorner = Point::Create(m_rect.left, m_rect.top);
|
||||||
const Point textStartPoint = topLeftCorner + Point::Create(0, surface->MeasureFontAscender());
|
const Point textStartPoint = topLeftCorner + Point::Create(0, sysFont->GetMetrics().m_ascent);
|
||||||
|
|
||||||
surface->DrawStringWrap(textStartPoint, m_rect, m_text.ToShortStr(), true, blackColor);
|
surface->DrawStringWrap(textStartPoint, m_rect, m_text.ToShortStr(), blackColor, sysFont);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,11 @@
|
|||||||
#include "MenuManager.h"
|
#include "MenuManager.h"
|
||||||
#include "PLMenus.h"
|
#include "PLMenus.h"
|
||||||
#include "PLPasStr.h"
|
#include "PLPasStr.h"
|
||||||
|
#include "PLQDraw.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
#include "PLTimeTaggedVOSEvent.h"
|
#include "PLTimeTaggedVOSEvent.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
|
#include "RenderedFontMetrics.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
#include "FontFamily.h"
|
#include "FontFamily.h"
|
||||||
#include "Vec2i.h"
|
#include "Vec2i.h"
|
||||||
@@ -100,10 +103,10 @@ namespace PortabilityLayer
|
|||||||
Rect textRect = innerRect;
|
Rect textRect = innerRect;
|
||||||
textRect.right -= 11;
|
textRect.right -= 11;
|
||||||
|
|
||||||
surface->SetSystemFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
|
||||||
Point basePoint = Point::Create(textRect.left + 2, (textRect.top + textRect.bottom + surface->MeasureFontAscender() + 1) / 2 - 1);
|
Point basePoint = Point::Create(textRect.left + 2, (textRect.top + textRect.bottom + sysFont->GetMetrics().m_ascent + 1) / 2 - 1);
|
||||||
|
|
||||||
surface->DrawStringConstrained(basePoint, GetString(), true, textRect, blackColor);
|
surface->DrawStringConstrained(basePoint, GetString(), textRect, blackColor, sysFont);
|
||||||
|
|
||||||
Point arrowMidPoint = Point::Create(textRect.right + 5, (textRect.top + textRect.bottom + 1) / 2);
|
Point arrowMidPoint = Point::Create(textRect.right + 5, (textRect.top + textRect.bottom + 1) / 2);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "PLQDraw.h"
|
#include "PLQDraw.h"
|
||||||
#include "QDManager.h"
|
#include "QDManager.h"
|
||||||
#include "QDState.h"
|
|
||||||
#include "BitmapImage.h"
|
#include "BitmapImage.h"
|
||||||
#include "DisplayDeviceManager.h"
|
#include "DisplayDeviceManager.h"
|
||||||
#include "EllipsePlotter.h"
|
#include "EllipsePlotter.h"
|
||||||
@@ -63,7 +62,7 @@ void SetPortWindowPort(WindowPtr window)
|
|||||||
PortabilityLayer::QDManager::GetInstance()->SetPort(window->GetDrawSurface());
|
PortabilityLayer::QDManager::GetInstance()->SetPort(window->GetDrawSurface());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PlotLine(PortabilityLayer::QDState *qdState, DrawSurface *surface, const PortabilityLayer::Vec2i &pointA, const PortabilityLayer::Vec2i &pointB, PortabilityLayer::ResolveCachingColor &foreColor)
|
static void PlotLine(DrawSurface *surface, const PortabilityLayer::Vec2i &pointA, const PortabilityLayer::Vec2i &pointB, PortabilityLayer::ResolveCachingColor &foreColor)
|
||||||
{
|
{
|
||||||
const Rect lineRect = Rect::Create(
|
const Rect lineRect = Rect::Create(
|
||||||
std::min(pointA.m_y, pointB.m_y),
|
std::min(pointA.m_y, pointB.m_y),
|
||||||
@@ -84,7 +83,6 @@ static void PlotLine(PortabilityLayer::QDState *qdState, DrawSurface *surface, c
|
|||||||
|
|
||||||
Rect constrainedRect = port->GetRect();
|
Rect constrainedRect = port->GetRect();
|
||||||
|
|
||||||
constrainedRect = constrainedRect.Intersect(qdState->m_clipRect);
|
|
||||||
constrainedRect = constrainedRect.Intersect(lineRect);
|
constrainedRect = constrainedRect.Intersect(lineRect);
|
||||||
|
|
||||||
if (!constrainedRect.IsValid())
|
if (!constrainedRect.IsValid())
|
||||||
@@ -182,7 +180,7 @@ static void PlotLine(PortabilityLayer::QDState *qdState, DrawSurface *surface, c
|
|||||||
surface->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
surface->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DrawGlyph(PortabilityLayer::QDState *qdState, PixMap *pixMap, const Rect &rect, const Point &penPos, const PortabilityLayer::RenderedFont *rfont, unsigned int character,
|
static void DrawGlyph(PixMap *pixMap, const Rect &rect, const Point &penPos, const PortabilityLayer::RenderedFont *rfont, unsigned int character,
|
||||||
PortabilityLayer::AntiAliasTable *&cachedAATable, PortabilityLayer::RGBAColor &cachedAATableColor, PortabilityLayer::ResolveCachingColor &cacheColor)
|
PortabilityLayer::AntiAliasTable *&cachedAATable, PortabilityLayer::RGBAColor &cachedAATableColor, PortabilityLayer::ResolveCachingColor &cacheColor)
|
||||||
{
|
{
|
||||||
assert(rect.IsValid());
|
assert(rect.IsValid());
|
||||||
@@ -288,35 +286,28 @@ static void DrawGlyph(PortabilityLayer::QDState *qdState, PixMap *pixMap, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DrawText(PortabilityLayer::TextPlacer &placer, PortabilityLayer::QDState *qdState, PixMap *pixMap, const Rect &rect, const PortabilityLayer::RenderedFont *rfont,
|
static void DrawText(PortabilityLayer::TextPlacer &placer, PixMap *pixMap, const Rect &rect, const PortabilityLayer::RenderedFont *rfont,
|
||||||
PortabilityLayer::AntiAliasTable *&cachedAATable, PortabilityLayer::RGBAColor &cachedAATableColor, PortabilityLayer::ResolveCachingColor &cacheColor)
|
PortabilityLayer::AntiAliasTable *&cachedAATable, PortabilityLayer::RGBAColor &cachedAATableColor, PortabilityLayer::ResolveCachingColor &cacheColor)
|
||||||
{
|
{
|
||||||
PortabilityLayer::GlyphPlacementCharacteristics characteristics;
|
PortabilityLayer::GlyphPlacementCharacteristics characteristics;
|
||||||
while (placer.PlaceGlyph(characteristics))
|
while (placer.PlaceGlyph(characteristics))
|
||||||
{
|
{
|
||||||
if (characteristics.m_haveGlyph)
|
if (characteristics.m_haveGlyph)
|
||||||
DrawGlyph(qdState, pixMap, rect, Point::Create(characteristics.m_glyphStartPos.m_x, characteristics.m_glyphStartPos.m_y), rfont, characteristics.m_character, cachedAATable, cachedAATableColor, cacheColor);
|
DrawGlyph(pixMap, rect, Point::Create(characteristics.m_glyphStartPos.m_x, characteristics.m_glyphStartPos.m_y), rfont, characteristics.m_character, cachedAATable, cachedAATableColor, cacheColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSurface::DrawString(const Point &point, const PLPasStr &str, bool aa, PortabilityLayer::ResolveCachingColor &cacheColor)
|
void DrawSurface::DrawString(const Point &point, const PLPasStr &str, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *font)
|
||||||
{
|
{
|
||||||
DrawStringConstrained(point, str, aa, Rect::CreateLargest(), cacheColor);
|
DrawStringConstrained(point, str, Rect::CreateLargest(), cacheColor, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSurface::DrawStringConstrained(const Point &point, const PLPasStr &str, bool aa, const Rect &constraintRect, PortabilityLayer::ResolveCachingColor &cacheColor)
|
void DrawSurface::DrawStringConstrained(const Point &point, const PLPasStr &str, const Rect &constraintRect, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *rfont)
|
||||||
{
|
{
|
||||||
PortabilityLayer::QDPort *port = &m_port;
|
PortabilityLayer::QDPort *port = &m_port;
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = m_port.GetState();
|
|
||||||
|
|
||||||
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
||||||
|
|
||||||
const int fontSize = qdState->m_fontSize;
|
|
||||||
const int fontVariationFlags = qdState->m_fontVariationFlags;
|
|
||||||
PortabilityLayer::FontFamily *fontFamily = qdState->m_fontFamily;
|
|
||||||
|
|
||||||
PortabilityLayer::RenderedFont *rfont = fontManager->GetRenderedFontFromFamily(fontFamily, fontSize, aa, fontVariationFlags);
|
|
||||||
PixMap *pixMap = *port->GetPixMap();
|
PixMap *pixMap = *port->GetPixMap();
|
||||||
|
|
||||||
const Rect rect = pixMap->m_rect.Intersect(constraintRect);
|
const Rect rect = pixMap->m_rect.Intersect(constraintRect);
|
||||||
@@ -326,25 +317,17 @@ void DrawSurface::DrawStringConstrained(const Point &point, const PLPasStr &str,
|
|||||||
|
|
||||||
PortabilityLayer::TextPlacer placer(PortabilityLayer::Vec2i(point.h, point.v), -1, rfont, str);
|
PortabilityLayer::TextPlacer placer(PortabilityLayer::Vec2i(point.h, point.v), -1, rfont, str);
|
||||||
|
|
||||||
DrawText(placer, qdState, pixMap, rect, rfont, m_cachedAATable, m_cachedAAColor, cacheColor);
|
DrawText(placer, pixMap, rect, rfont, m_cachedAATable, m_cachedAAColor, cacheColor);
|
||||||
|
|
||||||
m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSurface::DrawStringWrap(const Point &point, const Rect &constrainRect, const PLPasStr &str, bool aa, PortabilityLayer::ResolveCachingColor &cacheColor)
|
void DrawSurface::DrawStringWrap(const Point &point, const Rect &constrainRect, const PLPasStr &str, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *rfont)
|
||||||
{
|
{
|
||||||
PortabilityLayer::QDPort *port = &m_port;
|
PortabilityLayer::QDPort *port = &m_port;
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = m_port.GetState();
|
|
||||||
|
|
||||||
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
||||||
|
|
||||||
const int fontSize = qdState->m_fontSize;
|
|
||||||
const int fontVariationFlags = qdState->m_fontVariationFlags;
|
|
||||||
PortabilityLayer::FontFamily *fontFamily = qdState->m_fontFamily;
|
|
||||||
|
|
||||||
PortabilityLayer::RenderedFont *rfont = fontManager->GetRenderedFontFromFamily(fontFamily, fontSize, aa, fontVariationFlags);
|
|
||||||
|
|
||||||
Point penPos = point;
|
Point penPos = point;
|
||||||
const size_t len = str.Length();
|
const size_t len = str.Length();
|
||||||
const uint8_t *chars = str.UChars();
|
const uint8_t *chars = str.UChars();
|
||||||
@@ -359,70 +342,11 @@ void DrawSurface::DrawStringWrap(const Point &point, const Rect &constrainRect,
|
|||||||
|
|
||||||
PortabilityLayer::TextPlacer placer(PortabilityLayer::Vec2i(point.h, point.v), areaRect.Width(), rfont, str);
|
PortabilityLayer::TextPlacer placer(PortabilityLayer::Vec2i(point.h, point.v), areaRect.Width(), rfont, str);
|
||||||
|
|
||||||
DrawText(placer, qdState, pixMap, limitRect, rfont, m_cachedAATable, m_cachedAAColor, cacheColor);
|
DrawText(placer, pixMap, limitRect, rfont, m_cachedAATable, m_cachedAAColor, cacheColor);
|
||||||
|
|
||||||
m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t DrawSurface::MeasureString(const PLPasStr &str)
|
|
||||||
{
|
|
||||||
const PortabilityLayer::QDState *qdState = m_port.GetState();
|
|
||||||
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
|
||||||
|
|
||||||
PortabilityLayer::FontFamily *fontFamily = qdState->m_fontFamily;
|
|
||||||
|
|
||||||
if (!fontFamily)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
const int variationFlags = qdState->m_fontVariationFlags;
|
|
||||||
const int fontSize = qdState->m_fontSize;
|
|
||||||
|
|
||||||
PortabilityLayer::RenderedFont *rfont = fontManager->GetRenderedFontFromFamily(fontFamily, fontSize, false, variationFlags);
|
|
||||||
if (!rfont)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return rfont->MeasureString(str.UChars(), str.Length());
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t DrawSurface::MeasureFontAscender()
|
|
||||||
{
|
|
||||||
const PortabilityLayer::QDState *qdState = m_port.GetState();
|
|
||||||
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
|
||||||
|
|
||||||
PortabilityLayer::FontFamily *fontFamily = qdState->m_fontFamily;
|
|
||||||
|
|
||||||
if (!fontFamily)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
const int variationFlags = qdState->m_fontVariationFlags;
|
|
||||||
const int fontSize = qdState->m_fontSize;
|
|
||||||
|
|
||||||
PortabilityLayer::RenderedFont *rfont = fontManager->GetRenderedFontFromFamily(fontFamily, fontSize, false, variationFlags);
|
|
||||||
if (!rfont)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return rfont->GetMetrics().m_ascent;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t DrawSurface::MeasureFontLineGap()
|
|
||||||
{
|
|
||||||
const PortabilityLayer::QDState *qdState = m_port.GetState();
|
|
||||||
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
|
||||||
|
|
||||||
PortabilityLayer::FontFamily *fontFamily = qdState->m_fontFamily;
|
|
||||||
|
|
||||||
if (!fontFamily)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
const int variationFlags = qdState->m_fontVariationFlags;
|
|
||||||
const int fontSize = qdState->m_fontSize;
|
|
||||||
|
|
||||||
PortabilityLayer::RenderedFont *rfont = fontManager->GetRenderedFontFromFamily(fontFamily, fontSize, false, variationFlags);
|
|
||||||
if (!rfont)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return rfont->GetMetrics().m_linegap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds)
|
void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds)
|
||||||
{
|
{
|
||||||
@@ -732,19 +656,6 @@ void DrawSurface::DrawPicture(THandle<BitmapImage> pictHdl, const Rect &bounds)
|
|||||||
m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
PortabilityLayer::RenderedFont *DrawSurface::ResolveFont(bool aa) const
|
|
||||||
{
|
|
||||||
const PortabilityLayer::QDState *qdState = m_port.GetState();
|
|
||||||
|
|
||||||
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
|
||||||
|
|
||||||
const int fontSize = qdState->m_fontSize;
|
|
||||||
const int fontVariationFlags = qdState->m_fontVariationFlags;
|
|
||||||
PortabilityLayer::FontFamily *fontFamily = qdState->m_fontFamily;
|
|
||||||
|
|
||||||
return fontManager->GetRenderedFontFromFamily(fontFamily, fontSize, aa, fontVariationFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawSurface::FillRect(const Rect &rect, PortabilityLayer::ResolveCachingColor &cacheColor)
|
void DrawSurface::FillRect(const Rect &rect, PortabilityLayer::ResolveCachingColor &cacheColor)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid())
|
if (!rect.IsValid())
|
||||||
@@ -756,8 +667,6 @@ void DrawSurface::FillRect(const Rect &rect, PortabilityLayer::ResolveCachingCol
|
|||||||
|
|
||||||
Rect constrainedRect = rect;
|
Rect constrainedRect = rect;
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = qdPort->GetState();
|
|
||||||
constrainedRect = constrainedRect.Intersect(qdState->m_clipRect);
|
|
||||||
constrainedRect = constrainedRect.Intersect(qdPort->GetRect());
|
constrainedRect = constrainedRect.Intersect(qdPort->GetRect());
|
||||||
|
|
||||||
if (!constrainedRect.IsValid())
|
if (!constrainedRect.IsValid())
|
||||||
@@ -805,8 +714,6 @@ void DrawSurface::FillRectWithMaskPattern8x8(const Rect &rect, const uint8_t *pa
|
|||||||
Rect constrainedRect = rect;
|
Rect constrainedRect = rect;
|
||||||
const Rect portRect = qdPort->GetRect();
|
const Rect portRect = qdPort->GetRect();
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = qdPort->GetState();
|
|
||||||
constrainedRect = constrainedRect.Intersect(qdState->m_clipRect);
|
|
||||||
constrainedRect = constrainedRect.Intersect(qdPort->GetRect());
|
constrainedRect = constrainedRect.Intersect(qdPort->GetRect());
|
||||||
|
|
||||||
if (!constrainedRect.IsValid())
|
if (!constrainedRect.IsValid())
|
||||||
@@ -854,32 +761,6 @@ void DrawSurface::FillRectWithMaskPattern8x8(const Rect &rect, const uint8_t *pa
|
|||||||
m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSurface::SetApplicationFont(int size, int variationFlags)
|
|
||||||
{
|
|
||||||
PortabilityLayer::FontFamily *fontFamily = PortabilityLayer::FontManager::GetInstance()->GetApplicationFont(size, variationFlags);
|
|
||||||
if (!fontFamily)
|
|
||||||
return;
|
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = m_port.GetState();
|
|
||||||
|
|
||||||
qdState->m_fontFamily = fontFamily;
|
|
||||||
qdState->m_fontSize = size;
|
|
||||||
qdState->m_fontVariationFlags = variationFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawSurface::SetSystemFont(int size, int variationFlags)
|
|
||||||
{
|
|
||||||
PortabilityLayer::FontFamily *fontFamily = PortabilityLayer::FontManager::GetInstance()->GetSystemFont(size, variationFlags);
|
|
||||||
if (!fontFamily)
|
|
||||||
return;
|
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = m_port.GetState();
|
|
||||||
|
|
||||||
qdState->m_fontFamily = fontFamily;
|
|
||||||
qdState->m_fontSize = size;
|
|
||||||
qdState->m_fontVariationFlags = variationFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawSurface::FillEllipse(const Rect &rect, PortabilityLayer::ResolveCachingColor &cacheColor)
|
void DrawSurface::FillEllipse(const Rect &rect, PortabilityLayer::ResolveCachingColor &cacheColor)
|
||||||
{
|
{
|
||||||
if (!rect.IsValid() || rect.Width() < 1 || rect.Height() < 1)
|
if (!rect.IsValid() || rect.Width() < 1 || rect.Height() < 1)
|
||||||
@@ -935,8 +816,6 @@ void DrawSurface::FrameEllipse(const Rect &rect, PortabilityLayer::ResolveCachin
|
|||||||
|
|
||||||
const Rect portRect = qdPort->GetRect();
|
const Rect portRect = qdPort->GetRect();
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = qdPort->GetState();
|
|
||||||
constrainedRect = constrainedRect.Intersect(qdState->m_clipRect);
|
|
||||||
constrainedRect = constrainedRect.Intersect(portRect);
|
constrainedRect = constrainedRect.Intersect(portRect);
|
||||||
|
|
||||||
if (!constrainedRect.IsValid())
|
if (!constrainedRect.IsValid())
|
||||||
@@ -1013,7 +892,6 @@ void DrawSurface::FillScanlineMaskWithMaskPattern(const PortabilityLayer::Scanli
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
PortabilityLayer::QDPort *port = &m_port;
|
PortabilityLayer::QDPort *port = &m_port;
|
||||||
PortabilityLayer::QDState *qdState = port->GetState();
|
|
||||||
|
|
||||||
PixMap *pixMap = *port->GetPixMap();
|
PixMap *pixMap = *port->GetPixMap();
|
||||||
const Rect portRect = port->GetRect();
|
const Rect portRect = port->GetRect();
|
||||||
@@ -1157,22 +1035,7 @@ void DrawSurface::FillScanlineMaskWithMaskPattern(const PortabilityLayer::Scanli
|
|||||||
|
|
||||||
void DrawSurface::DrawLine(const Point &a, const Point &b, PortabilityLayer::ResolveCachingColor &cacheColor)
|
void DrawSurface::DrawLine(const Point &a, const Point &b, PortabilityLayer::ResolveCachingColor &cacheColor)
|
||||||
{
|
{
|
||||||
PlotLine(m_port.GetState(), this, PortabilityLayer::Vec2i(a.h, a.v), PortabilityLayer::Vec2i(b.h, b.v), cacheColor);
|
PlotLine(this, PortabilityLayer::Vec2i(a.h, a.v), PortabilityLayer::Vec2i(b.h, b.v), cacheColor);
|
||||||
}
|
|
||||||
|
|
||||||
void GetClip(Rect *rect)
|
|
||||||
{
|
|
||||||
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
|
||||||
*rect = qdState->m_clipRect;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClipRect(const Rect *rect)
|
|
||||||
{
|
|
||||||
if (!rect->IsValid())
|
|
||||||
return;
|
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
|
||||||
qdState->m_clipRect = *rect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSurface::FrameRect(const Rect &rect, PortabilityLayer::ResolveCachingColor &cacheColor)
|
void DrawSurface::FrameRect(const Rect &rect, PortabilityLayer::ResolveCachingColor &cacheColor)
|
||||||
@@ -1247,8 +1110,6 @@ void DrawSurface::InvertFillRect(const Rect &rect, const uint8_t *pattern)
|
|||||||
Rect constrainedRect = rect;
|
Rect constrainedRect = rect;
|
||||||
const Rect portRect = qdPort->GetRect();
|
const Rect portRect = qdPort->GetRect();
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = qdPort->GetState();
|
|
||||||
constrainedRect = constrainedRect.Intersect(qdState->m_clipRect);
|
|
||||||
constrainedRect = constrainedRect.Intersect(qdPort->GetRect());
|
constrainedRect = constrainedRect.Intersect(qdPort->GetRect());
|
||||||
|
|
||||||
if (!constrainedRect.IsValid())
|
if (!constrainedRect.IsValid())
|
||||||
@@ -1628,11 +1489,6 @@ Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RestoreDeviceClut(void *unknown)
|
|
||||||
{
|
|
||||||
PL_NotYetImplemented();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BitMap::Init(const Rect &rect, GpPixelFormat_t pixelFormat, size_t pitch, void *dataPtr)
|
void BitMap::Init(const Rect &rect, GpPixelFormat_t pixelFormat, size_t pitch, void *dataPtr)
|
||||||
{
|
{
|
||||||
m_rect = rect;
|
m_rect = rect;
|
||||||
@@ -1641,6 +1497,25 @@ void BitMap::Init(const Rect &rect, GpPixelFormat_t pixelFormat, size_t pitch, v
|
|||||||
m_data = dataPtr;
|
m_data = dataPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PortabilityLayer::RenderedFont *GetApplicationFont(int size, int variationFlags, bool aa)
|
||||||
|
{
|
||||||
|
PortabilityLayer::FontFamily *fontFamily = PortabilityLayer::FontManager::GetInstance()->GetApplicationFont(size, variationFlags);
|
||||||
|
if (!fontFamily)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return PortabilityLayer::FontManager::GetInstance()->GetRenderedFontFromFamily(fontFamily, size, aa, variationFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
PortabilityLayer::RenderedFont *GetSystemFont(int size, int variationFlags, bool aa)
|
||||||
|
{
|
||||||
|
PortabilityLayer::FontFamily *fontFamily = PortabilityLayer::FontManager::GetInstance()->GetSystemFont(size, variationFlags);
|
||||||
|
if (!fontFamily)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return PortabilityLayer::FontManager::GetInstance()->GetRenderedFontFromFamily(fontFamily, size, aa, variationFlags);
|
||||||
|
}
|
||||||
|
|
||||||
#include "stb_image_write.h"
|
#include "stb_image_write.h"
|
||||||
|
|
||||||
void DebugPixMap(PixMap **pixMapH, const char *outName)
|
void DebugPixMap(PixMap **pixMapH, const char *outName)
|
||||||
@@ -1652,3 +1527,4 @@ void DebugPixMap(PixMap **pixMapH, const char *outName)
|
|||||||
|
|
||||||
stbi_write_png(outPath, pixMap->m_rect.right - pixMap->m_rect.left, pixMap->m_rect.bottom - pixMap->m_rect.top, 1, pixMap->m_data, pixMap->m_pitch);
|
stbi_write_png(outPath, pixMap->m_rect.right - pixMap->m_rect.left, pixMap->m_rect.bottom - pixMap->m_rect.top, 1, pixMap->m_data, pixMap->m_pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
class ScanlineMask;
|
class ScanlineMask;
|
||||||
|
class RenderedFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Dialog;
|
struct Dialog;
|
||||||
@@ -94,7 +95,8 @@ PixMap *GetPortBitMapForCopyBits(DrawSurface *grafPtr);
|
|||||||
|
|
||||||
Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection);
|
Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection);
|
||||||
|
|
||||||
void RestoreDeviceClut(void *unknown);
|
PortabilityLayer::RenderedFont *GetApplicationFont(int size, int variationFlags, bool aa);
|
||||||
|
PortabilityLayer::RenderedFont *GetSystemFont(int size, int variationFlags, bool aa);
|
||||||
|
|
||||||
|
|
||||||
inline RGBColor::RGBColor(uint8_t r, uint8_t g, uint8_t b)
|
inline RGBColor::RGBColor(uint8_t r, uint8_t g, uint8_t b)
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "UnsafePascalStr.h"
|
#include "UnsafePascalStr.h"
|
||||||
|
|
||||||
class PLPasStr;
|
class PLPasStr;
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
template<size_t TSize>
|
template<size_t TSize>
|
||||||
class PascalStr : public UnsafePascalStr<TSize, true>
|
class PascalStr : public UnsafePascalStr<TSize, true>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PascalStr();
|
PascalStr();
|
||||||
PascalStr(size_t size, const char *str);
|
PascalStr(size_t size, const char *str);
|
||||||
explicit PascalStr(const PLPasStr &pstr);
|
explicit PascalStr(const PLPasStr &pstr);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "PLPasStr.h"
|
#include "PLPasStr.h"
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
template<size_t TSize>
|
template<size_t TSize>
|
||||||
inline PascalStr<TSize>::PascalStr()
|
inline PascalStr<TSize>::PascalStr()
|
||||||
: UnsafePascalStr<TSize, true>(0, nullptr)
|
: UnsafePascalStr<TSize, true>(0, nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t TSize>
|
template<size_t TSize>
|
||||||
PascalStr<TSize>::PascalStr(size_t size, const char *str)
|
PascalStr<TSize>::PascalStr(size_t size, const char *str)
|
||||||
: UnsafePascalStr<TSize, true>(size, str)
|
: UnsafePascalStr<TSize, true>(size, str)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t TSize>
|
template<size_t TSize>
|
||||||
PascalStr<TSize>::PascalStr(const PLPasStr &pstr)
|
PascalStr<TSize>::PascalStr(const PLPasStr &pstr)
|
||||||
: UnsafePascalStr<TSize, true>(pstr.Length(), pstr.Chars())
|
: UnsafePascalStr<TSize, true>(pstr.Length(), pstr.Chars())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,7 +257,6 @@
|
|||||||
<ClInclude Include="QDPort.h" />
|
<ClInclude Include="QDPort.h" />
|
||||||
<ClInclude Include="QDRegion.h" />
|
<ClInclude Include="QDRegion.h" />
|
||||||
<ClInclude Include="QDStandardPalette.h" />
|
<ClInclude Include="QDStandardPalette.h" />
|
||||||
<ClInclude Include="QDState.h" />
|
|
||||||
<ClInclude Include="RandomNumberGenerator.h" />
|
<ClInclude Include="RandomNumberGenerator.h" />
|
||||||
<ClInclude Include="Rect2i.h" />
|
<ClInclude Include="Rect2i.h" />
|
||||||
<ClInclude Include="RenderedFont.h" />
|
<ClInclude Include="RenderedFont.h" />
|
||||||
@@ -379,7 +378,6 @@
|
|||||||
<ClCompile Include="QDPixMap.cpp" />
|
<ClCompile Include="QDPixMap.cpp" />
|
||||||
<ClCompile Include="QDPort.cpp" />
|
<ClCompile Include="QDPort.cpp" />
|
||||||
<ClCompile Include="QDStandardPalette.cpp" />
|
<ClCompile Include="QDStandardPalette.cpp" />
|
||||||
<ClCompile Include="QDState.cpp" />
|
|
||||||
<ClCompile Include="RandomNumberGenerator.cpp" />
|
<ClCompile Include="RandomNumberGenerator.cpp" />
|
||||||
<ClCompile Include="ResourceCompiledRef.cpp" />
|
<ClCompile Include="ResourceCompiledRef.cpp" />
|
||||||
<ClCompile Include="ResourceFile.cpp" />
|
<ClCompile Include="ResourceFile.cpp" />
|
||||||
|
|||||||
@@ -243,9 +243,6 @@
|
|||||||
<ClInclude Include="QDRegion.h">
|
<ClInclude Include="QDRegion.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="QDState.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="ResourceCompiledTypeList.h">
|
<ClInclude Include="ResourceCompiledTypeList.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -605,9 +602,6 @@
|
|||||||
<ClCompile Include="QDPictHeader.cpp">
|
<ClCompile Include="QDPictHeader.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="QDState.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="QDPictDecoder.cpp">
|
<ClCompile Include="QDPictDecoder.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
#include "GpPixelFormat.h"
|
#include "GpPixelFormat.h"
|
||||||
#include "PLHandle.h"
|
#include "PLHandle.h"
|
||||||
#include "QDState.h"
|
|
||||||
#include "QDPort.h"
|
#include "QDPort.h"
|
||||||
|
#include "RGBAColor.h"
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
@@ -15,6 +15,7 @@ namespace PortabilityLayer
|
|||||||
class RenderedFont;
|
class RenderedFont;
|
||||||
class ResolveCachingColor;
|
class ResolveCachingColor;
|
||||||
class ScanlineMask;
|
class ScanlineMask;
|
||||||
|
class FontSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PixMap;
|
struct PixMap;
|
||||||
@@ -76,20 +77,12 @@ struct DrawSurface
|
|||||||
|
|
||||||
void DrawLine(const Point &a, const Point &b, PortabilityLayer::ResolveCachingColor &cacheColor);
|
void DrawLine(const Point &a, const Point &b, PortabilityLayer::ResolveCachingColor &cacheColor);
|
||||||
|
|
||||||
void SetApplicationFont(int size, int variationFlags);
|
void DrawString(const Point &point, const PLPasStr &str, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *font);
|
||||||
void SetSystemFont(int size, int variationFlags);
|
void DrawStringConstrained(const Point &point, const PLPasStr &str, const Rect &constraintRect, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *font);
|
||||||
void DrawString(const Point &point, const PLPasStr &str, bool aa, PortabilityLayer::ResolveCachingColor &cacheColor);
|
void DrawStringWrap(const Point &point, const Rect &constrainRect, const PLPasStr &str, PortabilityLayer::ResolveCachingColor &cacheColor, PortabilityLayer::RenderedFont *font);
|
||||||
void DrawStringConstrained(const Point &point, const PLPasStr &str, bool aa, const Rect &constraintRect, PortabilityLayer::ResolveCachingColor &cacheColor);
|
|
||||||
void DrawStringWrap(const Point &point, const Rect &constrainRect, const PLPasStr &str, bool aa, PortabilityLayer::ResolveCachingColor &cacheColor);
|
|
||||||
|
|
||||||
size_t MeasureString(const PLPasStr &str);
|
|
||||||
int32_t MeasureFontAscender();
|
|
||||||
int32_t MeasureFontLineGap();
|
|
||||||
|
|
||||||
void DrawPicture(THandle<BitmapImage> pictHandle, const Rect &rect);
|
void DrawPicture(THandle<BitmapImage> pictHandle, const Rect &rect);
|
||||||
|
|
||||||
PortabilityLayer::RenderedFont *ResolveFont(bool aa) const;
|
|
||||||
|
|
||||||
IGpDisplayDriverSurface *m_ddSurface;
|
IGpDisplayDriverSurface *m_ddSurface;
|
||||||
|
|
||||||
PortabilityLayer::AntiAliasTable *m_cachedAATable;
|
PortabilityLayer::AntiAliasTable *m_cachedAATable;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "PLCore.h"
|
#include "PLCore.h"
|
||||||
#include "PLQDOffscreen.h"
|
#include "PLQDOffscreen.h"
|
||||||
#include "QDGraf.h"
|
#include "QDGraf.h"
|
||||||
#include "QDState.h"
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@@ -20,7 +19,6 @@ namespace PortabilityLayer
|
|||||||
void SetPort(DrawSurface *gw) override;
|
void SetPort(DrawSurface *gw) override;
|
||||||
PLError_t NewGWorld(DrawSurface **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable) override;
|
PLError_t NewGWorld(DrawSurface **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable) override;
|
||||||
void DisposeGWorld(DrawSurface *gw) override;
|
void DisposeGWorld(DrawSurface *gw) override;
|
||||||
QDState *GetState() override;
|
|
||||||
|
|
||||||
static QDManagerImpl *GetInstance();
|
static QDManagerImpl *GetInstance();
|
||||||
|
|
||||||
@@ -81,11 +79,6 @@ namespace PortabilityLayer
|
|||||||
MemoryManager::GetInstance()->Release(gw);
|
MemoryManager::GetInstance()->Release(gw);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDState *QDManagerImpl::GetState()
|
|
||||||
{
|
|
||||||
return m_port->m_port.GetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
QDManagerImpl *QDManagerImpl::GetInstance()
|
QDManagerImpl *QDManagerImpl::GetInstance()
|
||||||
{
|
{
|
||||||
return &ms_instance;
|
return &ms_instance;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ struct Rect;
|
|||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
class QDPort;
|
class QDPort;
|
||||||
struct QDState;
|
|
||||||
|
|
||||||
class QDManager
|
class QDManager
|
||||||
{
|
{
|
||||||
@@ -21,8 +20,6 @@ namespace PortabilityLayer
|
|||||||
virtual PLError_t NewGWorld(DrawSurface **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable) = 0;
|
virtual PLError_t NewGWorld(DrawSurface **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable) = 0;
|
||||||
virtual void DisposeGWorld(DrawSurface *gw) = 0;
|
virtual void DisposeGWorld(DrawSurface *gw) = 0;
|
||||||
|
|
||||||
virtual QDState *GetState() = 0;
|
|
||||||
|
|
||||||
static QDManager *GetInstance();
|
static QDManager *GetInstance();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,16 +102,6 @@ namespace PortabilityLayer
|
|||||||
return m_pixMap.ImplicitCast<PixMap>();
|
return m_pixMap.ImplicitCast<PixMap>();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QDState *QDPort::GetState() const
|
|
||||||
{
|
|
||||||
return &m_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDState *QDPort::GetState()
|
|
||||||
{
|
|
||||||
return &m_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
GpPixelFormat_t QDPort::GetPixelFormat() const
|
GpPixelFormat_t QDPort::GetPixelFormat() const
|
||||||
{
|
{
|
||||||
return m_pixelFormat;
|
return m_pixelFormat;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "GpPixelFormat.h"
|
#include "GpPixelFormat.h"
|
||||||
#include "PLErrorCodes.h"
|
#include "PLErrorCodes.h"
|
||||||
#include "PLHandle.h"
|
#include "PLHandle.h"
|
||||||
#include "QDState.h"
|
|
||||||
|
|
||||||
struct PixMap;
|
struct PixMap;
|
||||||
struct Rect;
|
struct Rect;
|
||||||
@@ -37,8 +36,6 @@ namespace PortabilityLayer
|
|||||||
QDPortType GetPortType() const;
|
QDPortType GetPortType() const;
|
||||||
|
|
||||||
THandle<PixMap> GetPixMap() const;
|
THandle<PixMap> GetPixMap() const;
|
||||||
const QDState *GetState() const;
|
|
||||||
QDState *GetState();
|
|
||||||
GpPixelFormat_t GetPixelFormat() const;
|
GpPixelFormat_t GetPixelFormat() const;
|
||||||
Rect GetRect() const;
|
Rect GetRect() const;
|
||||||
|
|
||||||
@@ -61,7 +58,6 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
QDPortType m_portType;
|
QDPortType m_portType;
|
||||||
|
|
||||||
QDState m_state;
|
|
||||||
THandle<PixMapImpl> m_pixMap;
|
THandle<PixMapImpl> m_pixMap;
|
||||||
|
|
||||||
int16_t m_left;
|
int16_t m_left;
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
#include "QDState.h"
|
|
||||||
|
|
||||||
#include "PLQDraw.h"
|
|
||||||
#include "QDStandardPalette.h"
|
|
||||||
|
|
||||||
namespace PortabilityLayer
|
|
||||||
{
|
|
||||||
QDState::QDState()
|
|
||||||
: m_fontFamily(nullptr)
|
|
||||||
, m_fontSize(12)
|
|
||||||
, m_fontVariationFlags(0)
|
|
||||||
, m_clipRect(Rect::Create(INT16_MIN, INT16_MIN, INT16_MAX, INT16_MAX))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "RGBAColor.h"
|
|
||||||
#include "SharedTypes.h"
|
|
||||||
|
|
||||||
namespace PortabilityLayer
|
|
||||||
{
|
|
||||||
class FontFamily;
|
|
||||||
|
|
||||||
struct QDState
|
|
||||||
{
|
|
||||||
QDState();
|
|
||||||
|
|
||||||
FontFamily *m_fontFamily;
|
|
||||||
int m_fontVariationFlags;
|
|
||||||
int m_fontSize;
|
|
||||||
Rect m_clipRect;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
class PLPasStr;
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
struct RenderedFontMetrics;
|
struct RenderedFontMetrics;
|
||||||
@@ -17,5 +19,20 @@ namespace PortabilityLayer
|
|||||||
virtual bool IsAntiAliased() const = 0;
|
virtual bool IsAntiAliased() const = 0;
|
||||||
|
|
||||||
virtual void Destroy() = 0;
|
virtual void Destroy() = 0;
|
||||||
|
|
||||||
|
size_t MeasureCharStr(const char *str, size_t len) const;
|
||||||
|
size_t MeasurePStr(const PLPasStr &pstr) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "PLPasStr.h"
|
||||||
|
|
||||||
|
inline size_t PortabilityLayer::RenderedFont::MeasurePStr(const PLPasStr &pstr) const
|
||||||
|
{
|
||||||
|
return this->MeasureString(pstr.UChars(), pstr.Length());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline size_t PortabilityLayer::RenderedFont::MeasureCharStr(const char *str, size_t len) const
|
||||||
|
{
|
||||||
|
return this->MeasureString(reinterpret_cast<const uint8_t*>(str), len);
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include "QDPixMap.h"
|
#include "QDPixMap.h"
|
||||||
#include "PLTimeTaggedVOSEvent.h"
|
#include "PLTimeTaggedVOSEvent.h"
|
||||||
#include "Rect2i.h"
|
#include "Rect2i.h"
|
||||||
|
#include "RenderedFont.h"
|
||||||
|
#include "RenderedFontMetrics.h"
|
||||||
#include "ResolveCachingColor.h"
|
#include "ResolveCachingColor.h"
|
||||||
#include "Vec2i.h"
|
#include "Vec2i.h"
|
||||||
#include "WindowDef.h"
|
#include "WindowDef.h"
|
||||||
@@ -447,16 +449,16 @@ namespace PortabilityLayer
|
|||||||
if (window->GetStyleFlags() & WindowStyleFlags::kCloseBox)
|
if (window->GetStyleFlags() & WindowStyleFlags::kCloseBox)
|
||||||
RenderChromeCloseBox(surface, rect, false);
|
RenderChromeCloseBox(surface, rect, false);
|
||||||
|
|
||||||
surface->SetSystemFont(12, PortabilityLayer::FontFamilyFlags::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(12, PortabilityLayer::FontFamilyFlags::FontFamilyFlag_Bold, true);
|
||||||
int32_t ascender = surface->MeasureFontAscender();
|
int32_t ascender = sysFont->GetMetrics().m_ascent;
|
||||||
|
|
||||||
const PLPasStr titlePStr = window->GetTitle().ToShortStr();
|
const PLPasStr titlePStr = window->GetTitle().ToShortStr();
|
||||||
size_t titleWidth = surface->MeasureString(titlePStr);
|
size_t titleWidth = sysFont->MeasureString(titlePStr.UChars(), titlePStr.Length());
|
||||||
|
|
||||||
int32_t titleH = (rect.left + rect.right - static_cast<int32_t>(titleWidth) + 1) / 2;
|
int32_t titleH = (rect.left + rect.right - static_cast<int32_t>(titleWidth) + 1) / 2;
|
||||||
int32_t titleV = (rect.top + rect.bottom + ascender + 1) / 2;
|
int32_t titleV = (rect.top + rect.bottom + ascender + 1) / 2;
|
||||||
|
|
||||||
surface->DrawString(Point::Create(titleH, titleV), titlePStr, true, blackColor);
|
surface->DrawString(Point::Create(titleH, titleV), titlePStr, blackColor, sysFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericWindowChromeTheme::RenderChromeLeft(WindowImpl *window, DrawSurface *surface) const
|
void GenericWindowChromeTheme::RenderChromeLeft(WindowImpl *window, DrawSurface *surface) const
|
||||||
@@ -551,16 +553,16 @@ namespace PortabilityLayer
|
|||||||
if (window->GetStyleFlags() & WindowStyleFlags::kCloseBox)
|
if (window->GetStyleFlags() & WindowStyleFlags::kCloseBox)
|
||||||
RenderChromeCloseBox(surface, rect, false);
|
RenderChromeCloseBox(surface, rect, false);
|
||||||
|
|
||||||
surface->SetApplicationFont(10, PortabilityLayer::FontFamilyFlags::FontFamilyFlag_Bold);
|
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(10, PortabilityLayer::FontFamilyFlags::FontFamilyFlag_Bold, true);
|
||||||
int32_t ascender = surface->MeasureFontAscender();
|
int32_t ascender = appFont->GetMetrics().m_ascent;
|
||||||
|
|
||||||
const PLPasStr titlePStr = window->GetTitle().ToShortStr();
|
const PLPasStr titlePStr = window->GetTitle().ToShortStr();
|
||||||
size_t titleWidth = surface->MeasureString(titlePStr);
|
size_t titleWidth = appFont->MeasureString(titlePStr.UChars(), titlePStr.Length());
|
||||||
|
|
||||||
int32_t titleH = (rect.left + rect.right - static_cast<int32_t>(titleWidth) + 1) / 2;
|
int32_t titleH = (rect.left + rect.right - static_cast<int32_t>(titleWidth) + 1) / 2;
|
||||||
int32_t titleV = (rect.top + rect.bottom + ascender + 1) / 2;
|
int32_t titleV = (rect.top + rect.bottom + ascender + 1) / 2;
|
||||||
|
|
||||||
surface->DrawString(Point::Create(titleH, titleV), titlePStr, true, blackColor);
|
surface->DrawString(Point::Create(titleH, titleV), titlePStr, blackColor, appFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericWindowChromeTheme::RenderChromeLeftMini(WindowImpl *window, DrawSurface *surface) const
|
void GenericWindowChromeTheme::RenderChromeLeftMini(WindowImpl *window, DrawSurface *surface) const
|
||||||
|
|||||||
Reference in New Issue
Block a user