RemoteDesktop: Implement support for BAffineTransform.
It is currently somewhat broken client side though.
This commit is contained in:
@@ -699,6 +699,16 @@ RemoteView::_DrawThread()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case RP_SET_TRANSFORM:
|
||||||
|
{
|
||||||
|
BAffineTransform transform;
|
||||||
|
if (message.ReadTransform(transform) != B_OK)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
offscreen->SetTransform(transform);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case RP_SET_PATTERN:
|
case RP_SET_PATTERN:
|
||||||
{
|
{
|
||||||
if (message.Read(pattern) != B_OK)
|
if (message.Read(pattern) != B_OK)
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ RemoteDrawingEngine::SetDrawState(const DrawState* state, int32 xOffset,
|
|||||||
SetHighColor(state->HighColor());
|
SetHighColor(state->HighColor());
|
||||||
SetLowColor(state->LowColor());
|
SetLowColor(state->LowColor());
|
||||||
SetFont(state->Font());
|
SetFont(state->Font());
|
||||||
|
SetTransform(state->CombinedTransform());
|
||||||
|
|
||||||
RemoteMessage message(NULL, fHWInterface->SendBuffer());
|
RemoteMessage message(NULL, fHWInterface->SendBuffer());
|
||||||
message.Start(RP_SET_OFFSETS);
|
message.Start(RP_SET_OFFSETS);
|
||||||
@@ -268,6 +269,21 @@ RemoteDrawingEngine::SetFont(const DrawState* state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
RemoteDrawingEngine::SetTransform(const BAffineTransform& transform)
|
||||||
|
{
|
||||||
|
if (fState.Transform() == transform)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fState.SetTransform(transform);
|
||||||
|
|
||||||
|
RemoteMessage message(NULL, fHWInterface->SendBuffer());
|
||||||
|
message.Start(RP_SET_TRANSFORM);
|
||||||
|
message.Add(fToken);
|
||||||
|
message.AddTransform(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public:
|
|||||||
alpha_function alphaFunc);
|
alpha_function alphaFunc);
|
||||||
virtual void SetFont(const ServerFont& font);
|
virtual void SetFont(const ServerFont& font);
|
||||||
virtual void SetFont(const DrawState* state);
|
virtual void SetFont(const DrawState* state);
|
||||||
|
virtual void SetTransform(const BAffineTransform& transform);
|
||||||
|
|
||||||
// drawing functions
|
// drawing functions
|
||||||
virtual void InvertRect(BRect rect);
|
virtual void InvertRect(BRect rect);
|
||||||
|
|||||||
@@ -254,6 +254,24 @@ RemoteMessage::AddGradient(const BGradient& gradient)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
RemoteMessage::AddTransform(const BAffineTransform& transform)
|
||||||
|
{
|
||||||
|
bool isIdentity = transform.IsIdentity();
|
||||||
|
Add(isIdentity);
|
||||||
|
|
||||||
|
if (isIdentity)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Add(transform.sx);
|
||||||
|
Add(transform.shy);
|
||||||
|
Add(transform.shx);
|
||||||
|
Add(transform.sy);
|
||||||
|
Add(transform.tx);
|
||||||
|
Add(transform.ty);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
RemoteMessage::ReadString(char** _string, size_t& _length)
|
RemoteMessage::ReadString(char** _string, size_t& _length)
|
||||||
{
|
{
|
||||||
@@ -515,6 +533,28 @@ RemoteMessage::ReadGradient(BGradient** _gradient)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
RemoteMessage::ReadTransform(BAffineTransform& transform)
|
||||||
|
{
|
||||||
|
bool isIdentity;
|
||||||
|
status_t result = Read(isIdentity);
|
||||||
|
if (result != B_OK)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
if (isIdentity) {
|
||||||
|
transform = BAffineTransform();
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Read(transform.sx);
|
||||||
|
Read(transform.shy);
|
||||||
|
Read(transform.shx);
|
||||||
|
Read(transform.sy);
|
||||||
|
Read(transform.tx);
|
||||||
|
return Read(transform.ty);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
RemoteMessage::ReadArrayLine(BPoint& startPoint, BPoint& endPoint,
|
RemoteMessage::ReadArrayLine(BPoint& startPoint, BPoint& endPoint,
|
||||||
rgb_color& color)
|
rgb_color& color)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "StreamingRingBuffer.h"
|
#include "StreamingRingBuffer.h"
|
||||||
|
|
||||||
|
#include <AffineTransform.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
|
|
||||||
@@ -55,6 +56,7 @@ enum {
|
|||||||
RP_SET_PATTERN,
|
RP_SET_PATTERN,
|
||||||
RP_SET_DRAWING_MODE,
|
RP_SET_DRAWING_MODE,
|
||||||
RP_SET_FONT,
|
RP_SET_FONT,
|
||||||
|
RP_SET_TRANSFORM,
|
||||||
|
|
||||||
RP_CONSTRAIN_CLIPPING_REGION = 60,
|
RP_CONSTRAIN_CLIPPING_REGION = 60,
|
||||||
RP_COPY_RECT_NO_CLIPPING,
|
RP_COPY_RECT_NO_CLIPPING,
|
||||||
@@ -145,6 +147,7 @@ public:
|
|||||||
void AddString(const char* string, size_t length);
|
void AddString(const char* string, size_t length);
|
||||||
void AddRegion(const BRegion& region);
|
void AddRegion(const BRegion& region);
|
||||||
void AddGradient(const BGradient& gradient);
|
void AddGradient(const BGradient& gradient);
|
||||||
|
void AddTransform(const BAffineTransform& transform);
|
||||||
|
|
||||||
#ifndef CLIENT_COMPILE
|
#ifndef CLIENT_COMPILE
|
||||||
void AddBitmap(const ServerBitmap& bitmap,
|
void AddBitmap(const ServerBitmap& bitmap,
|
||||||
@@ -176,6 +179,7 @@ public:
|
|||||||
color_space colorSpace = B_RGB32,
|
color_space colorSpace = B_RGB32,
|
||||||
uint32 flags = 0);
|
uint32 flags = 0);
|
||||||
status_t ReadGradient(BGradient** _gradient);
|
status_t ReadGradient(BGradient** _gradient);
|
||||||
|
status_t ReadTransform(BAffineTransform& transform);
|
||||||
status_t ReadArrayLine(BPoint& startPoint,
|
status_t ReadArrayLine(BPoint& startPoint,
|
||||||
BPoint& endPoint, rgb_color& color);
|
BPoint& endPoint, rgb_color& color);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user