addapted code as a result of removing viewColor, background and overlay bitmap members from LayerData
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13051 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9080b4b47c
commit
b81c5513c5
@ -44,8 +44,8 @@
|
||||
#include "ServerProtocol.h"
|
||||
#include "ServerWindow.h"
|
||||
#include "WinBorder.h"
|
||||
|
||||
#include "Layer.h"
|
||||
#include "ServerBitmap.h"
|
||||
|
||||
//#define DEBUG_LAYER
|
||||
#ifdef DEBUG_LAYER
|
||||
@ -108,7 +108,11 @@ Layer::Layer(BRect frame, const char* name, int32 token,
|
||||
fDriver(driver),
|
||||
fLayerData(new LayerData()),
|
||||
|
||||
fRootLayer(NULL)
|
||||
fRootLayer(NULL),
|
||||
|
||||
fViewColor(255, 255, 255, 255),
|
||||
fBackgroundBitmap(NULL),
|
||||
fOverlayBitmap(NULL)
|
||||
{
|
||||
if (!frame.IsValid()) {
|
||||
char helper[1024];
|
||||
@ -854,8 +858,8 @@ Layer::Draw(const BRect &rect)
|
||||
rect.PrintToStream();
|
||||
#endif
|
||||
|
||||
if (!fLayerData->ViewColor().IsTransparentMagic())
|
||||
fDriver->FillRect(rect, fLayerData->ViewColor());
|
||||
if (!ViewColor().IsTransparentMagic())
|
||||
fDriver->FillRect(rect, ViewColor());
|
||||
}
|
||||
|
||||
// EmptyGlobals
|
||||
@ -1506,6 +1510,32 @@ Layer::SendViewCoordUpdateMsg() const
|
||||
}
|
||||
}
|
||||
|
||||
// SetViewColor
|
||||
void
|
||||
Layer::SetViewColor(const RGBColor& color)
|
||||
{
|
||||
fViewColor = color;
|
||||
}
|
||||
|
||||
// SetBackgroundBitmap
|
||||
void
|
||||
Layer::SetBackgroundBitmap(const ServerBitmap* bitmap)
|
||||
{
|
||||
// TODO: What about reference counting?
|
||||
// "Release" old fBackgroundBitmap and "Aquire" new one?
|
||||
fBackgroundBitmap = bitmap;
|
||||
}
|
||||
|
||||
// SetOverlayBitmap
|
||||
void
|
||||
Layer::SetOverlayBitmap(const ServerBitmap* bitmap)
|
||||
{
|
||||
// TODO: What about reference counting?
|
||||
// "Release" old fOverlayBitmap and "Aquire" new one?
|
||||
fOverlayBitmap = bitmap;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//! Sends a B_VIEW_MOVED message to the client BWindow
|
||||
void
|
||||
|
@ -64,6 +64,7 @@ class ServerApp;
|
||||
class RootLayer;
|
||||
class DisplayDriver;
|
||||
class LayerData;
|
||||
class ServerBitmap;
|
||||
|
||||
class Layer {
|
||||
public:
|
||||
@ -190,6 +191,21 @@ class Layer {
|
||||
BRegion* ClippingRegion() const
|
||||
{ return fClipReg; }
|
||||
|
||||
// automatic background blanking by app_server
|
||||
void SetViewColor(const RGBColor& color);
|
||||
inline const RGBColor& ViewColor() const
|
||||
{ return fViewColor; }
|
||||
|
||||
void SetBackgroundBitmap(const ServerBitmap* bitmap);
|
||||
inline const ServerBitmap* BackgroundBitmap() const
|
||||
{ return fBackgroundBitmap; }
|
||||
|
||||
// overlay support
|
||||
// TODO: This can't be all, what about color key?
|
||||
void SetOverlayBitmap(const ServerBitmap* bitmap);
|
||||
inline const ServerBitmap* OverlayBitmap() const
|
||||
{ return fOverlayBitmap; }
|
||||
|
||||
protected:
|
||||
friend class RootLayer;
|
||||
friend class WinBorder;
|
||||
@ -252,6 +268,11 @@ class Layer {
|
||||
// void SendViewMovedMsg();
|
||||
// void SendViewResizedMsg();
|
||||
|
||||
RGBColor fViewColor;
|
||||
|
||||
const ServerBitmap* fBackgroundBitmap;
|
||||
const ServerBitmap* fOverlayBitmap;
|
||||
|
||||
};
|
||||
|
||||
#endif // _LAYER_H_
|
||||
|
@ -312,9 +312,6 @@ DrawData::SetMiterLimit(float limit)
|
||||
// constructpr
|
||||
LayerData::LayerData()
|
||||
: DrawData(),
|
||||
fViewColor(255, 255, 255, 255),
|
||||
fBackgroundBitmap(NULL),
|
||||
fOverlayBitmap(NULL),
|
||||
prevState(NULL)
|
||||
{
|
||||
}
|
||||
@ -338,43 +335,11 @@ LayerData::operator=(const LayerData& from)
|
||||
{
|
||||
DrawData::operator=(from);
|
||||
|
||||
fViewColor = from.fViewColor;
|
||||
|
||||
// TODO: Are we making any sense here?
|
||||
// How is operator= being used?
|
||||
fBackgroundBitmap = from.fBackgroundBitmap;
|
||||
fOverlayBitmap = from.fOverlayBitmap;
|
||||
|
||||
prevState = from.prevState;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// SetViewColor
|
||||
void
|
||||
LayerData::SetViewColor(const RGBColor& color)
|
||||
{
|
||||
fViewColor = color;
|
||||
}
|
||||
|
||||
// SetBackgroundBitmap
|
||||
void
|
||||
LayerData::SetBackgroundBitmap(const ServerBitmap* bitmap)
|
||||
{
|
||||
// TODO: What about reference counting?
|
||||
// "Release" old fBackgroundBitmap and "Aquire" new one?
|
||||
fBackgroundBitmap = bitmap;
|
||||
}
|
||||
|
||||
// SetOverlayBitmap
|
||||
void
|
||||
LayerData::SetOverlayBitmap(const ServerBitmap* bitmap)
|
||||
{
|
||||
// TODO: What about reference counting?
|
||||
// "Release" old fOverlayBitmap and "Aquire" new one?
|
||||
fOverlayBitmap = bitmap;
|
||||
}
|
||||
|
||||
// PrintToStream
|
||||
void
|
||||
LayerData::PrintToStream() const
|
||||
@ -387,7 +352,6 @@ LayerData::PrintToStream() const
|
||||
|
||||
printf("\t HighColor: "); fHighColor.PrintToStream();
|
||||
printf("\t LowColor: "); fLowColor.PrintToStream();
|
||||
printf("\t ViewColor "); fViewColor.PrintToStream();
|
||||
printf("\t Pattern: %llu\n", fPattern.GetInt64());
|
||||
|
||||
printf("\t DrawMode: %lu\n", (uint32)fDrawingMode);
|
||||
@ -473,14 +437,12 @@ LayerData::ReadFromLink(LinkMsgReader& link)
|
||||
{
|
||||
rgb_color highColor;
|
||||
rgb_color lowColor;
|
||||
rgb_color viewColor;
|
||||
pattern patt;
|
||||
|
||||
link.Read<BPoint>(&fPenLocation);
|
||||
link.Read<float>(&fPenSize);
|
||||
link.Read(&highColor, sizeof(rgb_color));
|
||||
link.Read(&lowColor, sizeof(rgb_color));
|
||||
link.Read(&viewColor, sizeof(rgb_color));
|
||||
link.Read(&patt, sizeof(pattern));
|
||||
link.Read<int8>((int8*)&fDrawingMode);
|
||||
link.Read<BPoint>(&fOrigin);
|
||||
@ -497,7 +459,6 @@ LayerData::ReadFromLink(LinkMsgReader& link)
|
||||
|
||||
fHighColor = highColor;
|
||||
fLowColor = lowColor;
|
||||
fViewColor = viewColor;
|
||||
fPattern = patt;
|
||||
|
||||
// read clipping
|
||||
@ -521,7 +482,6 @@ LayerData::WriteToLink(LinkMsgSender& link) const
|
||||
{
|
||||
rgb_color hc = fHighColor.GetColor32();
|
||||
rgb_color lc = fLowColor.GetColor32();
|
||||
rgb_color vc = fViewColor.GetColor32();
|
||||
|
||||
// Attach font state
|
||||
link.Attach<uint32>(fFont.GetFamilyAndStyle());
|
||||
@ -538,7 +498,6 @@ LayerData::WriteToLink(LinkMsgSender& link) const
|
||||
link.Attach<float>(fPenSize);
|
||||
link.Attach(&hc, sizeof(rgb_color));
|
||||
link.Attach(&lc, sizeof(rgb_color));
|
||||
link.Attach(&vc, sizeof(rgb_color));
|
||||
link.Attach<uint64>(fPattern.GetInt64());
|
||||
link.Attach<BPoint>(fOrigin);
|
||||
link.Attach<uint8>((uint8)fDrawingMode);
|
||||
|
@ -326,6 +326,7 @@ ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
|
||||
bool hidden;
|
||||
int32 childCount;
|
||||
char *name = NULL;
|
||||
rgb_color viewColor;
|
||||
|
||||
link.Read<int32>(&token);
|
||||
link.ReadString(&name);
|
||||
@ -335,6 +336,7 @@ ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
|
||||
link.Read<uint32>(&eventOptions);
|
||||
link.Read<uint32>(&flags);
|
||||
link.Read<bool>(&hidden);
|
||||
link.Read<rgb_color>(&viewColor );
|
||||
link.Read<int32>(&childCount);
|
||||
|
||||
STRACE(("ServerWindow(%s)::CreateLayerTree()-> layer %s, token %ld\n", fName,name,token));
|
||||
@ -345,6 +347,7 @@ ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
|
||||
free(name);
|
||||
|
||||
// there is no way of setting this, other than manually :-)
|
||||
newLayer->fViewColor = viewColor;
|
||||
newLayer->fHidden = hidden;
|
||||
newLayer->fEventMask = eventMask;
|
||||
newLayer->fEventOptions = eventOptions;
|
||||
@ -788,7 +791,7 @@ ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
|
||||
link.Read(&c, sizeof(rgb_color));
|
||||
|
||||
fCurrentLayer->fLayerData->SetViewColor(RGBColor(c));
|
||||
fCurrentLayer->SetViewColor(RGBColor(c));
|
||||
|
||||
// TODO: this should not trigger redraw, no?!?
|
||||
myRootLayer->GoRedraw(fCurrentLayer, fCurrentLayer->fVisible);
|
||||
@ -802,7 +805,7 @@ ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
|
||||
highColor = fCurrentLayer->fLayerData->HighColor().GetColor32();
|
||||
lowColor = fCurrentLayer->fLayerData->LowColor().GetColor32();
|
||||
viewColor = fCurrentLayer->fLayerData->ViewColor().GetColor32();
|
||||
viewColor = fCurrentLayer->ViewColor().GetColor32();
|
||||
|
||||
fMsgSender->StartMessage(SERVER_TRUE);
|
||||
fMsgSender->Attach(&highColor, sizeof(rgb_color));
|
||||
|
Loading…
Reference in New Issue
Block a user