Fixed scale calculation. The scaling is still ignored for the drawing coordinations.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14682 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1be1c7ccdf
commit
2c2fd7b237
@ -282,8 +282,16 @@ DrawState::OffsetOrigin(const BPoint& offset)
|
||||
void
|
||||
DrawState::SetScale(float scale)
|
||||
{
|
||||
if (fScale != scale) {
|
||||
// the scale is multiplied with the scale of the previous state if any
|
||||
float localScale = fScale;
|
||||
if (PreviousState() != NULL)
|
||||
localScale /= PreviousState()->Scale();
|
||||
|
||||
if (localScale != scale) {
|
||||
fScale = scale;
|
||||
if (PreviousState() != NULL)
|
||||
fScale *= PreviousState()->Scale();
|
||||
|
||||
// update font size
|
||||
// (pen size is currently calulated on the fly)
|
||||
fFont.SetSize(fUnscaledFontSize * fScale);
|
||||
|
@ -920,27 +920,16 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
||||
float scale;
|
||||
link.Read<float>(&scale);
|
||||
// TODO: The BeBook says, if you call SetScale() it will be
|
||||
// multiplied with the scale from all previous states on the stack
|
||||
|
||||
fCurrentLayer->fDrawState->SetScale(scale);
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_GET_SCALE:
|
||||
{
|
||||
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_SCALE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
||||
DrawState* layerData = fCurrentLayer->fDrawState;
|
||||
|
||||
// TODO: And here, we're taking that into account, but not above
|
||||
// -> refactor put scale into Layer, or better yet, when the
|
||||
// state stack is within Layer, PushState() should multiply
|
||||
// by the previous last states scale. Would fix the problem above too.
|
||||
float scale = layerData->Scale();
|
||||
|
||||
while ((layerData = layerData->PreviousState()) != NULL)
|
||||
scale *= layerData->Scale();
|
||||
|
||||
fLink.StartMessage(SERVER_TRUE);
|
||||
fLink.Attach<float>(scale);
|
||||
fLink.Attach<float>(fCurrentLayer->fDrawState->Scale());
|
||||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Stefano Ceccherini (burton666@libero.it)
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
#ifndef _SERVERWIN_H_
|
||||
#define _SERVERWIN_H_
|
||||
#ifndef SERVER_WINDOW_H
|
||||
#define SERVER_WINDOW_H
|
||||
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
@ -149,4 +149,4 @@ private:
|
||||
dw_data* fDirectWindowData;
|
||||
};
|
||||
|
||||
#endif // _SERVERWIN_H_
|
||||
#endif // SERVER_WINDOW_H
|
||||
|
Loading…
Reference in New Issue
Block a user