work in progress to get scrolling working, so Adi can have a look, no changes to existing functionality, cleanup in Layer.cpp
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12481 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -54,6 +54,7 @@ class DrawData {
|
|||||||
|
|
||||||
// coordinate transformation
|
// coordinate transformation
|
||||||
void SetOrigin(const BPoint& origin);
|
void SetOrigin(const BPoint& origin);
|
||||||
|
void OffsetOrigin(const BPoint& offset);
|
||||||
inline const BPoint& Origin() const
|
inline const BPoint& Origin() const
|
||||||
{ return fOrigin; }
|
{ return fOrigin; }
|
||||||
|
|
||||||
|
|||||||
+823
-826
File diff suppressed because it is too large
Load Diff
+170
-132
@@ -22,6 +22,7 @@
|
|||||||
// File Name: Layer.h
|
// File Name: Layer.h
|
||||||
// Author: DarkWyrm <[email protected]>
|
// Author: DarkWyrm <[email protected]>
|
||||||
// Adi Oanca <[email protected]>
|
// Adi Oanca <[email protected]>
|
||||||
|
// Stephan Aßmus <[email protected]>
|
||||||
// Description: Class used for rendering to the frame buffer. One layer per
|
// Description: Class used for rendering to the frame buffer. One layer per
|
||||||
// view on screen and also for window decorators
|
// view on screen and also for window decorators
|
||||||
//
|
//
|
||||||
@@ -30,17 +31,17 @@
|
|||||||
#define _LAYER_H_
|
#define _LAYER_H_
|
||||||
|
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
|
#include <List.h>
|
||||||
|
#include <Locker.h>
|
||||||
|
#include <OS.h>
|
||||||
|
#include <String.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
#include <List.h>
|
|
||||||
#include <String.h>
|
|
||||||
#include <OS.h>
|
|
||||||
#include <Locker.h>
|
|
||||||
#include "ServerWindow.h"
|
|
||||||
#include "RGBColor.h"
|
|
||||||
|
|
||||||
enum
|
#include "RGBColor.h"
|
||||||
{
|
#include "ServerWindow.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
B_LAYER_NONE = 1,
|
B_LAYER_NONE = 1,
|
||||||
B_LAYER_MOVE = 2,
|
B_LAYER_MOVE = 2,
|
||||||
B_LAYER_SIMPLE_MOVE = 3,
|
B_LAYER_SIMPLE_MOVE = 3,
|
||||||
@@ -48,14 +49,12 @@ enum
|
|||||||
B_LAYER_MASK_RESIZE = 5,
|
B_LAYER_MASK_RESIZE = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum {
|
||||||
{
|
|
||||||
B_LAYER_CHILDREN_DEPENDANT = 0x1000U,
|
B_LAYER_CHILDREN_DEPENDANT = 0x1000U,
|
||||||
};
|
};
|
||||||
|
|
||||||
// easy way to determine class type
|
// easy way to determine class type
|
||||||
enum
|
enum {
|
||||||
{
|
|
||||||
AS_LAYER_CLASS = 1,
|
AS_LAYER_CLASS = 1,
|
||||||
AS_WINBORDER_CLASS = 2,
|
AS_WINBORDER_CLASS = 2,
|
||||||
AS_ROOTLAYER_CLASS = 3,
|
AS_ROOTLAYER_CLASS = 3,
|
||||||
@@ -66,90 +65,128 @@ class RootLayer;
|
|||||||
class DisplayDriver;
|
class DisplayDriver;
|
||||||
class LayerData;
|
class LayerData;
|
||||||
|
|
||||||
class Layer
|
class Layer {
|
||||||
{
|
public:
|
||||||
public:
|
Layer(BRect frame, const char* name,
|
||||||
Layer(BRect frame, const char *name, int32 token, uint32 resize,
|
int32 token, uint32 resize,
|
||||||
uint32 flags, DisplayDriver *driver);
|
uint32 flags, DisplayDriver* driver);
|
||||||
virtual ~Layer(void);
|
virtual ~Layer();
|
||||||
|
|
||||||
void AddChild(Layer *child, ServerWindow *serverWin);
|
void AddChild(Layer* child, ServerWindow* serverWin);
|
||||||
void RemoveChild(Layer *child);
|
void RemoveChild(Layer* child);
|
||||||
void RemoveSelf(void);
|
void RemoveSelf();
|
||||||
bool HasChild(Layer *layer);
|
bool HasChild(Layer* layer);
|
||||||
RootLayer *GetRootLayer(void) const { return fRootLayer; }
|
|
||||||
|
|
||||||
uint32 CountChildren(void) const;
|
|
||||||
Layer *FindLayer(const int32 token);
|
|
||||||
Layer *LayerAt(const BPoint &pt);
|
|
||||||
bool IsTopLayer(void) { return fIsTopLayer; }
|
|
||||||
|
|
||||||
virtual Layer *VirtualTopChild(void) const;
|
|
||||||
virtual Layer *VirtualLowerSibling(void) const;
|
|
||||||
virtual Layer *VirtualUpperSibling(void) const;
|
|
||||||
virtual Layer *VirtualBottomChild(void) const;
|
|
||||||
|
|
||||||
const char *GetName(void) const { return (fName)?fName->String():NULL; }
|
|
||||||
|
|
||||||
virtual void RebuildFullRegion(void);
|
|
||||||
void StartRebuildRegions( const BRegion& reg, Layer *target, uint32 action, BPoint& pt);
|
|
||||||
void RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint ptOffset);
|
|
||||||
uint32 ResizeOthers(float x, float y, BPoint coords[], BPoint *ptOffset);
|
|
||||||
|
|
||||||
void Redraw(const BRegion& reg, Layer *startFrom=NULL);
|
|
||||||
|
|
||||||
void EmptyGlobals(void);
|
|
||||||
|
|
||||||
virtual void Draw(const BRect &r);
|
|
||||||
|
|
||||||
void Show(bool invalidate=true);
|
|
||||||
void Hide(bool invalidate=true);
|
|
||||||
bool IsHidden(void) const;
|
|
||||||
|
|
||||||
BRect Bounds(void) const;
|
|
||||||
BRect Frame(void) const;
|
|
||||||
|
|
||||||
virtual void MoveBy(float x, float y);
|
|
||||||
virtual void ResizeBy(float x, float y);
|
|
||||||
|
|
||||||
BRect ConvertToParent(BRect rect);
|
|
||||||
BRegion ConvertToParent(BRegion *reg);
|
|
||||||
BPoint ConvertFromParent(BPoint pt);
|
|
||||||
BRect ConvertFromParent(BRect rect);
|
|
||||||
BRegion ConvertFromParent(BRegion *reg);
|
|
||||||
|
|
||||||
BPoint ConvertToTop(BPoint pt);
|
|
||||||
BRegion ConvertToTop(BRegion *reg);
|
|
||||||
BRect ConvertToTop(BRect rect);
|
|
||||||
|
|
||||||
BPoint ConvertFromTop(BPoint pt);
|
RootLayer* GetRootLayer() const
|
||||||
BRegion ConvertFromTop(BRegion *reg);
|
{ return fRootLayer; }
|
||||||
BRect ConvertFromTop(BRect rect);
|
|
||||||
|
|
||||||
DisplayDriver *GetDisplayDriver(void) const { return fDriver; }
|
uint32 CountChildren() const;
|
||||||
ServerWindow *Window(void) const { return fServerWin; }
|
Layer* FindLayer(const int32 token);
|
||||||
ServerApp *App(void) const { return fServerWin? fServerWin->App(): NULL; }
|
Layer* LayerAt(const BPoint &pt);
|
||||||
virtual bool HasClient(void) { return true; }
|
|
||||||
bool IsServerLayer() const;
|
|
||||||
uint32 EventMask(void) const { return fEventMask; }
|
|
||||||
uint32 EventOptions(void) const { return fEventOptions; }
|
|
||||||
|
|
||||||
void PruneTree(void);
|
virtual Layer* VirtualTopChild() const;
|
||||||
|
virtual Layer* VirtualLowerSibling() const;
|
||||||
|
virtual Layer* VirtualUpperSibling() const;
|
||||||
|
virtual Layer* VirtualBottomChild() const;
|
||||||
|
|
||||||
void PrintToStream(void);
|
const char* GetName() const
|
||||||
void PrintNode(void);
|
{ return (fName) ? fName->String() : NULL; }
|
||||||
void PrintTree(void);
|
|
||||||
|
virtual void RebuildFullRegion();
|
||||||
|
void StartRebuildRegions(const BRegion& reg,
|
||||||
|
Layer* target,
|
||||||
|
uint32 action,
|
||||||
|
BPoint& pt);
|
||||||
|
|
||||||
|
void RebuildRegions(const BRegion& reg,
|
||||||
|
uint32 action,
|
||||||
|
BPoint pt,
|
||||||
|
BPoint ptOffset);
|
||||||
|
|
||||||
|
uint32 ResizeOthers(float x, float y,
|
||||||
|
BPoint coords[],
|
||||||
|
BPoint* ptOffset);
|
||||||
|
|
||||||
|
void Redraw(const BRegion& reg,
|
||||||
|
Layer* startFrom = NULL);
|
||||||
|
|
||||||
|
virtual void Draw(const BRect& r);
|
||||||
|
|
||||||
|
void EmptyGlobals();
|
||||||
|
|
||||||
|
void Show(bool invalidate = true);
|
||||||
|
void Hide(bool invalidate = true);
|
||||||
|
bool IsHidden() const;
|
||||||
|
|
||||||
|
// coordinate system
|
||||||
|
BRect Bounds() const;
|
||||||
|
BRect Frame() const;
|
||||||
|
|
||||||
|
virtual void MoveBy(float x, float y);
|
||||||
|
virtual void ResizeBy(float x, float y);
|
||||||
|
|
||||||
|
BPoint BoundsOrigin() const; // BoundsFrameDiff()?
|
||||||
|
|
||||||
|
BPoint ConvertToParent(BPoint pt);
|
||||||
|
BRect ConvertToParent(BRect rect);
|
||||||
|
BRegion ConvertToParent(BRegion* reg);
|
||||||
|
|
||||||
|
BPoint ConvertFromParent(BPoint pt);
|
||||||
|
BRect ConvertFromParent(BRect rect);
|
||||||
|
BRegion ConvertFromParent(BRegion* reg);
|
||||||
|
|
||||||
|
BPoint ConvertToTop(BPoint pt);
|
||||||
|
BRect ConvertToTop(BRect rect);
|
||||||
|
BRegion ConvertToTop(BRegion* reg);
|
||||||
|
|
||||||
|
BPoint ConvertFromTop(BPoint pt);
|
||||||
|
BRect ConvertFromTop(BRect rect);
|
||||||
|
BRegion ConvertFromTop(BRegion *reg);
|
||||||
|
|
||||||
|
|
||||||
|
DisplayDriver* GetDisplayDriver() const
|
||||||
|
{ return fDriver; }
|
||||||
|
|
||||||
|
ServerWindow* Window() const
|
||||||
|
{ return fServerWin; }
|
||||||
|
|
||||||
|
ServerApp* App() const
|
||||||
|
{ return fServerWin? fServerWin->App(): NULL; }
|
||||||
|
|
||||||
|
virtual bool HasClient()
|
||||||
|
{ return true; }
|
||||||
|
// bool IsServerLayer() const;
|
||||||
|
|
||||||
|
uint32 EventMask() const
|
||||||
|
{ return fEventMask; }
|
||||||
|
|
||||||
|
uint32 EventOptions() const
|
||||||
|
{ return fEventOptions; }
|
||||||
|
|
||||||
|
void PruneTree();
|
||||||
|
|
||||||
|
// debugging
|
||||||
|
void PrintToStream();
|
||||||
|
void PrintNode();
|
||||||
|
void PrintTree();
|
||||||
|
|
||||||
// server "private" - should not be used
|
// server "private" - should not be used
|
||||||
void SetRootLayer(RootLayer *rl){ fRootLayer = rl; }
|
void SetRootLayer(RootLayer* rl)
|
||||||
void SetAsTopLayer(bool option) { fIsTopLayer = option; }
|
{ fRootLayer = rl; }
|
||||||
bool IsTopLayer() const { return fIsTopLayer; }
|
|
||||||
|
|
||||||
void UpdateStart();
|
void SetAsTopLayer(bool option)
|
||||||
void UpdateEnd();
|
{ fIsTopLayer = option; }
|
||||||
BRegion* ClippingRegion() const { return fClipReg; }
|
|
||||||
|
|
||||||
protected:
|
bool IsTopLayer() const
|
||||||
|
{ return fIsTopLayer; }
|
||||||
|
|
||||||
|
void UpdateStart();
|
||||||
|
void UpdateEnd();
|
||||||
|
|
||||||
|
BRegion* ClippingRegion() const
|
||||||
|
{ return fClipReg; }
|
||||||
|
|
||||||
|
protected:
|
||||||
friend class RootLayer;
|
friend class RootLayer;
|
||||||
friend class WinBorder;
|
friend class WinBorder;
|
||||||
friend class ServerWindow;
|
friend class ServerWindow;
|
||||||
@@ -157,56 +194,57 @@ protected:
|
|||||||
void move_layer(float x, float y);
|
void move_layer(float x, float y);
|
||||||
void resize_layer(float x, float y);
|
void resize_layer(float x, float y);
|
||||||
|
|
||||||
void FullInvalidate(const BRect &rect);
|
void FullInvalidate(const BRect& rect);
|
||||||
void FullInvalidate(const BRegion ®ion);
|
void FullInvalidate(const BRegion& region);
|
||||||
void Invalidate(const BRegion ®ion);
|
void Invalidate(const BRegion& region);
|
||||||
|
|
||||||
BRect fFrame;
|
BRect fFrame;
|
||||||
BPoint fBoundsLeftTop;
|
// BPoint fBoundsLeftTop;
|
||||||
WinBorder *fOwner;
|
WinBorder* fOwner;
|
||||||
Layer *fParent;
|
Layer* fParent;
|
||||||
Layer *fUpperSibling;
|
Layer* fUpperSibling;
|
||||||
Layer *fLowerSibling;
|
Layer* fLowerSibling;
|
||||||
Layer *fTopChild;
|
Layer* fTopChild;
|
||||||
Layer *fBottomChild;
|
Layer* fBottomChild;
|
||||||
|
|
||||||
mutable Layer *fCurrent;
|
mutable Layer* fCurrent;
|
||||||
|
|
||||||
BRegion fVisible;
|
BRegion fVisible;
|
||||||
BRegion fFullVisible;
|
BRegion fFullVisible;
|
||||||
BRegion fFull;
|
BRegion fFull;
|
||||||
BRegion *fClipReg;
|
|
||||||
|
|
||||||
BRegion *clipToPicture;
|
|
||||||
bool clipToPictureInverse;
|
|
||||||
|
|
||||||
ServerWindow *fServerWin;
|
|
||||||
BString *fName;
|
|
||||||
int32 fViewToken;
|
|
||||||
uint32 fFlags;
|
|
||||||
uint32 fResizeMode;
|
|
||||||
uint32 fEventMask;
|
|
||||||
uint32 fEventOptions;
|
|
||||||
bool fHidden;
|
|
||||||
bool fIsTopLayer;
|
|
||||||
uint16 fAdFlags;
|
|
||||||
int8 fClassID;
|
|
||||||
int8 fFrameAction;
|
|
||||||
|
|
||||||
DisplayDriver *fDriver;
|
|
||||||
LayerData *fLayerData;
|
|
||||||
//RGBColor fBackColor;
|
|
||||||
|
|
||||||
RootLayer *fRootLayer;
|
|
||||||
|
|
||||||
private:
|
BRegion* fClipReg;
|
||||||
void RequestDraw(const BRegion ®, Layer *startFrom);
|
|
||||||
ServerWindow *SearchForServerWindow(void);
|
BRegion* clipToPicture;
|
||||||
|
bool clipToPictureInverse;
|
||||||
|
|
||||||
|
ServerWindow* fServerWin;
|
||||||
|
BString* fName;
|
||||||
|
int32 fViewToken;
|
||||||
|
uint32 fFlags;
|
||||||
|
uint32 fResizeMode;
|
||||||
|
uint32 fEventMask;
|
||||||
|
uint32 fEventOptions;
|
||||||
|
bool fHidden;
|
||||||
|
bool fIsTopLayer;
|
||||||
|
uint16 fAdFlags;
|
||||||
|
int8 fClassID;
|
||||||
|
int8 fFrameAction;
|
||||||
|
|
||||||
|
DisplayDriver* fDriver;
|
||||||
|
LayerData* fLayerData;
|
||||||
|
|
||||||
|
RootLayer* fRootLayer;
|
||||||
|
|
||||||
void SendUpdateMsg(BRegion ®);
|
private:
|
||||||
void SendViewMovedMsg(void);
|
void RequestDraw(const BRegion& reg,
|
||||||
void SendViewResizedMsg(void);
|
Layer* startFrom);
|
||||||
|
ServerWindow* SearchForServerWindow();
|
||||||
|
|
||||||
|
void SendUpdateMsg(BRegion& reg);
|
||||||
|
void SendViewMovedMsg();
|
||||||
|
void SendViewResizedMsg();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // _LAYER_H_
|
||||||
|
|||||||
@@ -121,6 +121,13 @@ DrawData::SetOrigin(const BPoint& origin)
|
|||||||
fOrigin = origin;
|
fOrigin = origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OffsetOrigin
|
||||||
|
void
|
||||||
|
DrawData::OffsetOrigin(const BPoint& offset)
|
||||||
|
{
|
||||||
|
fOrigin += offset;
|
||||||
|
}
|
||||||
|
|
||||||
// SetScale
|
// SetScale
|
||||||
void
|
void
|
||||||
DrawData::SetScale(float scale)
|
DrawData::SetScale(float scale)
|
||||||
|
|||||||
@@ -520,21 +520,45 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AS_LAYER_SCROLL:
|
||||||
|
{
|
||||||
|
printf("AS_LAYER_SCROLL\n");
|
||||||
|
float dh;
|
||||||
|
float dv;
|
||||||
|
|
||||||
|
link.Read<float>(&dh);
|
||||||
|
link.Read<float>(&dv);
|
||||||
|
|
||||||
|
// scroll visually by using the CopyBits() implementation
|
||||||
|
// this will also take care of invalidating previously invisible
|
||||||
|
// areas (areas scrolled into view)
|
||||||
|
BRect src = cl->Bounds();
|
||||||
|
BRect dst = src;
|
||||||
|
// NOTE: if we scroll down, the contents are moved *up*
|
||||||
|
dst.OffsetBy(-dh, -dv);
|
||||||
|
|
||||||
|
// TODO: Are origin and scale handled in this conversion?
|
||||||
|
src = cl->ConvertToTop(src);
|
||||||
|
dst = cl->ConvertToTop(dst);
|
||||||
|
|
||||||
|
int32 xOffset = (int32)(dst.left - src.left);
|
||||||
|
int32 yOffset = (int32)(dst.top - src.top);
|
||||||
|
|
||||||
|
// this little detail is where it differs from CopyBits()
|
||||||
|
// -> it will invalidate areas previously out of screen
|
||||||
|
dst = dst | src;
|
||||||
|
|
||||||
|
_CopyBits(myRootLayer, cl, src, dst, xOffset, yOffset);
|
||||||
|
|
||||||
|
// TODO: notify the client, no?
|
||||||
|
cl->fLayerData->OffsetOrigin(BPoint(dh, dv));
|
||||||
|
//cl->fBoundsLeftTop += BPoint(dh, dv);
|
||||||
|
//cl->fFrame.OffsetBy(BPoint(-dh, -dv));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case AS_LAYER_COPY_BITS:
|
case AS_LAYER_COPY_BITS:
|
||||||
{
|
{
|
||||||
// NOTE: The correct behaviour is this:
|
|
||||||
// * The region that is copied is the
|
|
||||||
// src rectangle, no matter if it fits
|
|
||||||
// into the dst rectangle. It is copied
|
|
||||||
// by the offset dst.LeftTop() - src.LeftTop()
|
|
||||||
// * The dst rectangle is used for invalidation:
|
|
||||||
// Any area in the dst rectangle that could
|
|
||||||
// not be copied from src (because either the
|
|
||||||
// src rectangle was not big enough, or because there
|
|
||||||
// were parts cut off by the current layer clipping),
|
|
||||||
// are triggering BView::Draw() to be called
|
|
||||||
// and for these parts only.
|
|
||||||
|
|
||||||
BRect src;
|
BRect src;
|
||||||
BRect dst;
|
BRect dst;
|
||||||
|
|
||||||
@@ -544,34 +568,11 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
// TODO: Are origin and scale handled in this conversion?
|
// TODO: Are origin and scale handled in this conversion?
|
||||||
src = cl->ConvertToTop(src);
|
src = cl->ConvertToTop(src);
|
||||||
dst = cl->ConvertToTop(dst);
|
dst = cl->ConvertToTop(dst);
|
||||||
|
|
||||||
int32 xOffset = (int32)(dst.left - src.left);
|
int32 xOffset = (int32)(dst.left - src.left);
|
||||||
int32 yOffset = (int32)(dst.top - src.top);
|
int32 yOffset = (int32)(dst.top - src.top);
|
||||||
|
|
||||||
// the region that is going to be copied
|
_CopyBits(myRootLayer, cl, src, dst, xOffset, yOffset);
|
||||||
BRegion copyRegion(src);
|
|
||||||
// apply the current clipping of the layer
|
|
||||||
copyRegion.IntersectWith(&cl->fVisible);
|
|
||||||
|
|
||||||
// offset the region to the destination
|
|
||||||
// and apply the current clipping there as well
|
|
||||||
copyRegion.OffsetBy(xOffset, yOffset);
|
|
||||||
copyRegion.IntersectWith(&cl->fVisible);
|
|
||||||
|
|
||||||
// the region at the destination that needs invalidation
|
|
||||||
BRegion invalidRegion(dst);
|
|
||||||
// exclude the region drawn by the copy operation
|
|
||||||
invalidRegion.Exclude(©Region);
|
|
||||||
// apply the current clipping as well
|
|
||||||
invalidRegion.IntersectWith(&cl->fVisible);
|
|
||||||
|
|
||||||
// move the region back for the actual operation
|
|
||||||
copyRegion.OffsetBy(-xOffset, -yOffset);
|
|
||||||
|
|
||||||
cl->fDriver->CopyRegion(©Region, xOffset, yOffset);
|
|
||||||
|
|
||||||
// trigger the redraw
|
|
||||||
myRootLayer->GoRedraw(fWinBorder, invalidRegion);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -693,7 +694,7 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
|
|
||||||
fMsgSender->Attach<float>(cl->fFrame.left);
|
fMsgSender->Attach<float>(cl->fFrame.left);
|
||||||
fMsgSender->Attach<float>(cl->fFrame.top);
|
fMsgSender->Attach<float>(cl->fFrame.top);
|
||||||
fMsgSender->Attach<BRect>(cl->fFrame.OffsetToCopy(cl->fBoundsLeftTop));
|
fMsgSender->Attach<BRect>(cl->fFrame.OffsetToCopy(cl->BoundsOrigin()));
|
||||||
|
|
||||||
fMsgSender->Flush();
|
fMsgSender->Flush();
|
||||||
|
|
||||||
@@ -728,16 +729,16 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
case AS_LAYER_GET_COORD:
|
case AS_LAYER_GET_COORD:
|
||||||
{
|
{
|
||||||
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: Layer: %s\n",fName, cl->fName->String()));
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: Layer: %s\n",fName, cl->fName->String()));
|
||||||
printf("Adi: %s\n", cl->GetName());
|
printf("AS_LAYER_GET_COORD - Layer: %s\n", cl->GetName());
|
||||||
cl->fFrame.PrintToStream();
|
cl->fFrame.PrintToStream();
|
||||||
cl->fBoundsLeftTop.PrintToStream();
|
cl->BoundsOrigin().PrintToStream();
|
||||||
fMsgSender->StartMessage(SERVER_TRUE);
|
fMsgSender->StartMessage(SERVER_TRUE);
|
||||||
BPoint pt(cl->ConvertFromParent(cl->fFrame.LeftTop()));
|
BPoint pt(cl->ConvertFromParent(cl->fFrame.LeftTop()));
|
||||||
fMsgSender->Attach<float>(pt.x);
|
fMsgSender->Attach<float>(pt.x);
|
||||||
fMsgSender->Attach<float>(pt.y);
|
fMsgSender->Attach<float>(pt.y);
|
||||||
// fMsgSender->Attach<float>(cl->fFrame.left);
|
// fMsgSender->Attach<float>(cl->fFrame.left);
|
||||||
// fMsgSender->Attach<float>(cl->fFrame.top);
|
// fMsgSender->Attach<float>(cl->fFrame.top);
|
||||||
fMsgSender->Attach<BRect>(cl->fFrame.OffsetToCopy(cl->fBoundsLeftTop));
|
fMsgSender->Attach<BRect>(cl->fFrame.OffsetToCopy(cl->BoundsOrigin()));
|
||||||
// fMsgSender->Attach<BRect>(cl->ConvertFromTop(cl->fFrame.OffsetToCopy(cl->fBoundsLeftTop)));
|
// fMsgSender->Attach<BRect>(cl->ConvertFromTop(cl->fFrame.OffsetToCopy(cl->fBoundsLeftTop)));
|
||||||
fMsgSender->Flush();
|
fMsgSender->Flush();
|
||||||
|
|
||||||
@@ -2158,6 +2159,53 @@ int32 ServerWindow::MonitorWin(void *data)
|
|||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// _CopyBits
|
||||||
|
void
|
||||||
|
ServerWindow::_CopyBits(RootLayer* rootLayer, Layer* layer,
|
||||||
|
BRect& src, BRect& dst,
|
||||||
|
int32 xOffset, int32 yOffset) const
|
||||||
|
{
|
||||||
|
// NOTE: The correct behaviour is this:
|
||||||
|
// * The region that is copied is the
|
||||||
|
// src rectangle, no matter if it fits
|
||||||
|
// into the dst rectangle. It is copied
|
||||||
|
// by the offset dst.LeftTop() - src.LeftTop()
|
||||||
|
// * The dst rectangle is used for invalidation:
|
||||||
|
// Any area in the dst rectangle that could
|
||||||
|
// not be copied from src (because either the
|
||||||
|
// src rectangle was not big enough, or because there
|
||||||
|
// were parts cut off by the current layer clipping),
|
||||||
|
// are triggering BView::Draw() to be called
|
||||||
|
// and for these parts only.
|
||||||
|
|
||||||
|
// the region that is going to be copied
|
||||||
|
BRegion copyRegion(src);
|
||||||
|
// apply the current clipping of the layer
|
||||||
|
copyRegion.IntersectWith(&layer->fVisible);
|
||||||
|
|
||||||
|
// offset the region to the destination
|
||||||
|
// and apply the current clipping there as well
|
||||||
|
copyRegion.OffsetBy(xOffset, yOffset);
|
||||||
|
copyRegion.IntersectWith(&layer->fVisible);
|
||||||
|
|
||||||
|
// the region at the destination that needs invalidation
|
||||||
|
BRegion invalidRegion(dst);
|
||||||
|
// exclude the region drawn by the copy operation
|
||||||
|
invalidRegion.Exclude(©Region);
|
||||||
|
// apply the current clipping as well
|
||||||
|
invalidRegion.IntersectWith(&layer->fVisible);
|
||||||
|
|
||||||
|
// move the region back for the actual operation
|
||||||
|
copyRegion.OffsetBy(-xOffset, -yOffset);
|
||||||
|
|
||||||
|
layer->fDriver->CopyRegion(©Region, xOffset, yOffset);
|
||||||
|
|
||||||
|
// trigger the redraw
|
||||||
|
rootLayer->GoRedraw(fWinBorder, invalidRegion);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void ServerWindow::SendMessageToClient(const BMessage* msg, int32 target, bool usePreferred) const
|
void ServerWindow::SendMessageToClient(const BMessage* msg, int32 target, bool usePreferred) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class Decorator;
|
|||||||
class BPortLink;
|
class BPortLink;
|
||||||
class WinBorder;
|
class WinBorder;
|
||||||
class Workspace;
|
class Workspace;
|
||||||
|
class RootLayer;
|
||||||
class Layer;
|
class Layer;
|
||||||
|
|
||||||
#define AS_UPDATE_DECORATOR 'asud'
|
#define AS_UPDATE_DECORATOR 'asud'
|
||||||
@@ -121,6 +122,13 @@ private:
|
|||||||
void DispatchGraphicsMessage(int32 code, LinkMsgReader &link);
|
void DispatchGraphicsMessage(int32 code, LinkMsgReader &link);
|
||||||
static int32 MonitorWin(void *data);
|
static int32 MonitorWin(void *data);
|
||||||
|
|
||||||
|
// used by CopyBits and Scrolling
|
||||||
|
void _CopyBits(RootLayer* rootLayer,
|
||||||
|
Layer* layer,
|
||||||
|
BRect& copy,
|
||||||
|
BRect& dirty,
|
||||||
|
int32 xOffset, int32 yOffset) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class ServerApp;
|
friend class ServerApp;
|
||||||
friend class WinBorder;
|
friend class WinBorder;
|
||||||
|
|||||||
Reference in New Issue
Block a user