Preparation of more correct support for state stack.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13201 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-06-17 13:20:45 +00:00
parent 12f043c1e2
commit 2734243aca
2 changed files with 22 additions and 4 deletions

View File

@ -51,6 +51,9 @@ class DrawData {
DrawData(const DrawData& from);
virtual ~DrawData();
// NOTE: this operator will not make a 1:1 copy, it is used
// for the state stack and therefor origin and scale are reset
// to B_ORIGIN and 1.0.
DrawData& operator=(const DrawData& from);
// coordinate transformation
@ -155,13 +158,16 @@ class DrawData {
float fPenSize;
ServerFont fFont;
// TODO: Remove, see above
bool fFontAntiAliasing;
escapement_delta fEscapementDelta;
//
cap_mode fLineCapMode;
join_mode fLineJoinMode;
float fMiterLimit;
// "internal", used to calculate the size
// of the font (again) when the scale changes
float fUnscaledFontSize;
};

View File

@ -81,8 +81,16 @@ DrawData::~DrawData()
DrawData&
DrawData::operator=(const DrawData& from)
{
fOrigin = from.fOrigin;
fScale = from.fScale;
// NOTE: This function is intended for use by the Layer
// state stack only.
// So it does not make a true copy of the DrawData, but resets
// fOrigin and fScale and uses the current the font size as
// fUnscaledFontSize.
// fOrigin = from.fOrigin;
// fScale = from.fScale;
fOrigin = BPoint(0.0, 0.0);
fScale = 1.0;
if (from.fClippingRegion) {
SetClippingRegion(*(from.fClippingRegion));
@ -110,7 +118,11 @@ DrawData::operator=(const DrawData& from)
fLineJoinMode = from.fLineJoinMode;
fMiterLimit = from.fMiterLimit;
fUnscaledFontSize = from.fUnscaledFontSize;
// fUnscaledFontSize = from.fUnscaledFontSize;
// Since fScale is reset to 1.0, the unscaled
// font size is the current size of the font
// (which is from.fFont.Size() * from.fScale)
fUnscaledFontSize = fFont.Size();
return *this;
}