Bye-bye old clipping codesvn update Some cleanup to follow.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14760 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
64c51217b2
commit
2c8cfe2dfc
File diff suppressed because it is too large
Load Diff
@ -103,25 +103,6 @@ class Layer {
|
||||
inline uint32 Flags() const
|
||||
{ return fFlags; }
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
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 EmptyGlobals();
|
||||
|
||||
#endif
|
||||
void Redraw(const BRegion& reg,
|
||||
Layer* startFrom = NULL);
|
||||
|
||||
@ -240,11 +221,7 @@ class Layer {
|
||||
|
||||
void CopyBits(BRect& src, BRect& dst,
|
||||
int32 xOffset, int32 yOffset);
|
||||
#ifndef NEW_CLIPPING
|
||||
inline const BRegion& VisibleRegion() const { return fVisible; }
|
||||
inline const BRegion& FullVisible() const { return fFullVisible; }
|
||||
|
||||
#else
|
||||
inline const BRegion& VisibleRegion() const { return fVisible2; }
|
||||
inline const BRegion& FullVisible() const { return fFullVisible2; }
|
||||
|
||||
@ -294,8 +271,6 @@ class Layer {
|
||||
void rezize_layer_redraw_more(BRegion ®, float dx, float dy);
|
||||
void resize_layer_full_update_on_resize(BRegion ®, float dx, float dy);
|
||||
|
||||
#endif
|
||||
private:
|
||||
void do_CopyBits(BRect& src, BRect& dst,
|
||||
int32 xOffset, int32 yOffset);
|
||||
|
||||
@ -303,18 +278,6 @@ class Layer {
|
||||
friend class RootLayer;
|
||||
friend class WinBorder;
|
||||
friend class ServerWindow;
|
||||
#ifndef NEW_CLIPPING
|
||||
friend class OffscreenWinBorder;
|
||||
#endif
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
void move_layer(float x, float y);
|
||||
void resize_layer(float x, float y);
|
||||
|
||||
void FullInvalidate(const BRect& rect);
|
||||
void FullInvalidate(const BRegion& region);
|
||||
void Invalidate(const BRegion& region);
|
||||
#endif
|
||||
|
||||
BRect fFrame;
|
||||
// TODO: should be removed or reused in a similar fashion
|
||||
@ -332,18 +295,12 @@ class Layer {
|
||||
|
||||
mutable Layer* fCurrent;
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
BRegion fVisible;
|
||||
BRegion fFullVisible;
|
||||
BRegion fFull;
|
||||
int8 fFrameAction;
|
||||
#else
|
||||
private:
|
||||
BRegion fVisible2;
|
||||
BRegion fFullVisible2;
|
||||
BRegion fDirtyForRebuild;
|
||||
protected:
|
||||
#endif
|
||||
|
||||
BRegion* fClipReg;
|
||||
|
||||
ServerWindow* fServerWin;
|
||||
|
@ -32,10 +32,6 @@ OffscreenWinBorder::OffscreenWinBorder(ServerBitmap* bitmap,
|
||||
fDriver->SetHWInterface(fHWInterface);
|
||||
fDriver->Initialize();
|
||||
fDriver->Update();
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
fFull.Set(fFrame);
|
||||
#endif
|
||||
}
|
||||
|
||||
// destructor
|
||||
@ -73,11 +69,5 @@ void
|
||||
OffscreenWinBorder::SetTopLayer(Layer* layer)
|
||||
{
|
||||
WinBorder::SetTopLayer(layer);
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
fTopLayer->fFull.Set(fFrame.OffsetToCopy(0.0, 0.0));
|
||||
fTopLayer->fHidden = false;
|
||||
fTopLayer->fVisible = fTopLayer->fFull;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Authors:
|
||||
* Gabe Yoder <gyoder@stny.rr.com>
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Adrian Oanca <adioanca@cotty.iren.ro>
|
||||
* Adrian Oanca <adioanca@gmail.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
@ -197,10 +197,7 @@ RootLayer::WorkingThread(void *data)
|
||||
|
||||
// first make sure we are actualy visible
|
||||
oneRootLayer->Lock();
|
||||
#ifndef NEW_CLIPPING
|
||||
oneRootLayer->RebuildFullRegion();
|
||||
oneRootLayer->GoInvalidate(oneRootLayer, oneRootLayer->Bounds());
|
||||
#else
|
||||
|
||||
// RootLayer starts with valid visible regions
|
||||
oneRootLayer->fFullVisible2.Set(oneRootLayer->Bounds());
|
||||
oneRootLayer->fVisible2.Set(oneRootLayer->Bounds());
|
||||
@ -210,7 +207,7 @@ RootLayer::WorkingThread(void *data)
|
||||
|
||||
oneRootLayer->TriggerRebuild();
|
||||
oneRootLayer->TriggerRedraw();
|
||||
#endif
|
||||
|
||||
oneRootLayer->Unlock();
|
||||
|
||||
STRACE(("info: RootLayer(%s)::WorkingThread listening on port %ld.\n", oneRootLayer->Name(), oneRootLayer->fListenPort));
|
||||
@ -798,11 +795,7 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
|
||||
redraw = true;
|
||||
}
|
||||
if (redraw) {
|
||||
#ifndef NEW_CLIPPING
|
||||
fRedrawReg.Include(&dirtyRegion);
|
||||
#else
|
||||
MarkForRedraw(dirtyRegion);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -836,11 +829,8 @@ RootLayer::RevealNewWMState(Workspace::State &oldWMState)
|
||||
if (!stillPresent) {
|
||||
MarkForRebuild(layer->FullVisible());
|
||||
MarkForRedraw(layer->FullVisible());
|
||||
#ifndef NEW_CLIPPING
|
||||
empty_visible_regions(layer);
|
||||
#else
|
||||
|
||||
layer->clear_visible_regions();
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
oldStrippedList.AddItem(layer);
|
||||
@ -899,20 +889,12 @@ GetDrawingEngine()->ConstrainClippingRegion(NULL);
|
||||
// redraw of focus change is automaticaly done
|
||||
redraw = false;
|
||||
// trigger region rebuilding and redraw
|
||||
#ifndef NEW_CLIPPING
|
||||
GoInvalidate(this, fFull);
|
||||
#else
|
||||
TriggerRebuild();
|
||||
TriggerRedraw();
|
||||
#endif
|
||||
}
|
||||
else if (redraw) {
|
||||
#ifndef NEW_CLIPPING
|
||||
GoInvalidate(this, dirtyRegion);
|
||||
#else
|
||||
MarkForRedraw(dirtyRegion);
|
||||
TriggerRedraw();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1221,12 +1203,10 @@ RootLayer::KeyboardEventHandler(BMessage *msg)
|
||||
SetActiveWorkspace(scancode - 2);
|
||||
#ifdef APPSERVER_ROOTLAYER_SHOW_WORKSPACE_NUMBER
|
||||
// to draw the current Workspace index on screen.
|
||||
#ifndef NEW_CLIPPING
|
||||
BRegion reg(fVisible);
|
||||
BRegion reg(VisibleRegion());
|
||||
fDriver->ConstrainClippingRegion(®);
|
||||
Draw(reg.Frame());
|
||||
fDriver->ConstrainClippingRegion(NULL);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -1581,23 +1561,6 @@ RootLayer::change_winBorder_feel(WinBorder *winBorder, int32 newFeel)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
void
|
||||
RootLayer::empty_visible_regions(Layer *layer)
|
||||
{
|
||||
// TODO: optimize by avoiding recursion?
|
||||
// NOTE: first 'layer' must be a WinBorder
|
||||
layer->fFullVisible.MakeEmpty();
|
||||
layer->fVisible.MakeEmpty();
|
||||
|
||||
Layer* child = layer->LastChild();
|
||||
while (child) {
|
||||
empty_visible_regions(child);
|
||||
child = layer->PreviousChild();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
RootLayer::Draw(const BRect &r)
|
||||
{
|
||||
|
@ -1,31 +1,17 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2005, Haiku, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: RootLayer.h
|
||||
// Author: Gabe Yoder <gyoder@stny.rr.com>
|
||||
// DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Stephan Aßmus <superstippi@gmx.de>
|
||||
// Description: Class used for the top layer of each workspace's Layer tree
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Gabe Yoder <gyoder@stny.rr.com>
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Adrian Oanca <adioanca@gmail.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
/** Class used for the top layer of each workspace's Layer tree */
|
||||
|
||||
#ifndef _ROOTLAYER_H_
|
||||
#define _ROOTLAYER_H_
|
||||
|
||||
@ -160,9 +146,6 @@ friend class WinBorder; // temporarily, I need invalidate_layer()
|
||||
|
||||
void change_winBorder_feel(WinBorder *winBorder, int32 newFeel);
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
void empty_visible_regions(Layer *layer);
|
||||
#endif
|
||||
// Input related methods
|
||||
void MouseEventHandler(BMessage *msg);
|
||||
void KeyboardEventHandler(BMessage *msg);
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Adrian Oanca <adioanca@cotty.iren.ro>
|
||||
* Adrian Oanca <adioanca@gmail.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
* Stefano Ceccherini (burton666@libero.it)
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
@ -442,7 +442,7 @@ ServerWindow::SetLayerState(Layer *layer, BPrivate::LinkReceiver &link)
|
||||
// NOTE: no need to check for a lock. This is a private method.
|
||||
|
||||
layer->CurrentState()->ReadFromLink(link);
|
||||
// TODO: Rebuild clipping here?
|
||||
// TODO: Rebuild clipping here!
|
||||
}
|
||||
|
||||
|
||||
@ -508,11 +508,7 @@ ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
|
||||
// TODO: rework the clipping stuff to remove RootLayer dependency and then
|
||||
// remove this hack:
|
||||
if (fWinBorder->IsOffscreenWindow()) {
|
||||
#ifndef NEW_CLIPPING
|
||||
newLayer->fVisible.Set(newLayer->fFrame);
|
||||
#else
|
||||
newLayer->fVisible2.Set(newLayer->fFrame);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (_parent) {
|
||||
@ -555,32 +551,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
|
||||
link.Read<float>(&dh);
|
||||
link.Read<float>(&dv);
|
||||
#ifndef NEW_CLIPPING
|
||||
// scroll visually by using the CopyBits() implementation
|
||||
// this will also take care of invalidating previously invisible
|
||||
// areas (areas scrolled into view)
|
||||
BRect src = fCurrentLayer->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 = fCurrentLayer->ConvertToTop(src);
|
||||
dst = fCurrentLayer->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;
|
||||
|
||||
fCurrentLayer->CurrentState()->OffsetOrigin(BPoint(dh, dv));
|
||||
|
||||
fCurrentLayer->CopyBits(src, dst, xOffset, yOffset);
|
||||
#else
|
||||
fCurrentLayer->ScrollBy(dh, dv);
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
@ -647,11 +618,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
if (parent != NULL)
|
||||
parent->AddChild(newLayer, this);
|
||||
|
||||
if (myRootLayer && !newLayer->IsHidden() && parent)
|
||||
#ifndef NEW_CLIPPING
|
||||
myRootLayer->GoInvalidate(newLayer, newLayer->fFull);
|
||||
#else
|
||||
{
|
||||
if (myRootLayer && !newLayer->IsHidden() && parent) {
|
||||
BRegion invalidRegion;
|
||||
newLayer->GetWantedRegion(invalidRegion);
|
||||
parent->MarkForRebuild(invalidRegion);
|
||||
@ -660,9 +627,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
myRootLayer->MarkForRedraw(newLayer->VisibleRegion());
|
||||
myRootLayer->TriggerRedraw();
|
||||
}
|
||||
// myRootLayer->GoInvalidate(newLayer, invalidRegion);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_DELETE:
|
||||
@ -678,17 +643,10 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
// BRegion *invalidRegion = NULL;
|
||||
|
||||
if (!fCurrentLayer->IsHidden() && parent && myRootLayer) {
|
||||
#ifndef NEW_CLIPPING
|
||||
if (fCurrentLayer->fFullVisible.CountRects() > 0)
|
||||
invalidRegion = new BRegion(fCurrentLayer->fFullVisible);
|
||||
#else
|
||||
if (fCurrentLayer->FullVisible().Frame().IsValid()) {
|
||||
parent->MarkForRebuild(fCurrentLayer->FullVisible());
|
||||
myRootLayer->MarkForRedraw(fCurrentLayer->FullVisible());
|
||||
|
||||
// invalidRegion = new BRegion(fCurrentLayer->FullVisible());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// here we remove current layer from list.
|
||||
@ -716,23 +674,15 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
case AS_LAYER_SET_STATE:
|
||||
{
|
||||
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
||||
// SetLayerState(fCurrentLayer);
|
||||
SetLayerState(fCurrentLayer, link);
|
||||
// TODO: should this be moved into SetLayerState?
|
||||
// If it _always_ needs to be done afterwards, then yes!
|
||||
#ifndef NEW_CLIPPING
|
||||
fCurrentLayer->RebuildFullRegion();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_SET_FONT_STATE:
|
||||
{
|
||||
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
||||
// SetLayerFontState(fCurrentLayer);
|
||||
SetLayerFontState(fCurrentLayer, link);
|
||||
#ifndef NEW_CLIPPING
|
||||
fCurrentLayer->RebuildFullRegion();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_GET_STATE:
|
||||
@ -912,9 +862,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
DTRACE(("ServerWindow %s: Message AS_LAYER_PUSH_STATE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
||||
|
||||
fCurrentLayer->PushState();
|
||||
#ifndef NEW_CLIPPING
|
||||
fCurrentLayer->RebuildFullRegion();
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_POP_STATE:
|
||||
@ -922,9 +870,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
DTRACE(("ServerWindow %s: Message AS_LAYER_POP_STATE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
||||
|
||||
fCurrentLayer->PopState();
|
||||
#ifndef NEW_CLIPPING
|
||||
fCurrentLayer->RebuildFullRegion();
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_SET_SCALE:
|
||||
@ -993,18 +939,10 @@ if (myRootLayer)
|
||||
myRootLayer->Lock();
|
||||
fCurrentLayer->SetViewColor(RGBColor(c));
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
if (myRootLayer)
|
||||
myRootLayer->GoRedraw(fCurrentLayer, fCurrentLayer->fVisible);
|
||||
#else
|
||||
if (myRootLayer) {
|
||||
myRootLayer->MarkForRedraw(fCurrentLayer->VisibleRegion());
|
||||
myRootLayer->TriggerRedraw();
|
||||
}
|
||||
|
||||
// if (myRootLayer)
|
||||
// myRootLayer->GoRedraw(fCurrentLayer, fCurrentLayer->VisibleRegion());
|
||||
#endif
|
||||
if (myRootLayer)
|
||||
myRootLayer->Unlock();
|
||||
break;
|
||||
@ -1117,14 +1055,7 @@ if (myRootLayer)
|
||||
|
||||
fCurrentLayer->CurrentState()->SetClippingRegion(region);
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
fCurrentLayer->RebuildFullRegion();
|
||||
#endif
|
||||
if (myRootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate())
|
||||
#ifndef NEW_CLIPPING
|
||||
myRootLayer->GoInvalidate(fCurrentLayer, fCurrentLayer->fFull);
|
||||
#else
|
||||
{
|
||||
if (myRootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate()) {
|
||||
BRegion invalidRegion;
|
||||
fCurrentLayer->GetWantedRegion(invalidRegion);
|
||||
|
||||
@ -1134,10 +1065,7 @@ if (myRootLayer)
|
||||
fCurrentLayer->fParent->TriggerRebuild();
|
||||
myRootLayer->MarkForRedraw(invalidRegion);
|
||||
myRootLayer->TriggerRedraw();
|
||||
|
||||
// myRootLayer->GoInvalidate(fCurrentLayer, invalidRegion);
|
||||
}
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1153,21 +1081,13 @@ if (myRootLayer)
|
||||
fLink.Flush();
|
||||
} else {
|
||||
// TODO: Watch out for the coordinate system in AS_LAYER_GET_CLIP_REGION
|
||||
#ifndef NEW_CLIPPING
|
||||
int32 rectCount = fCurrentLayer->fVisible.CountRects();
|
||||
#else
|
||||
int32 rectCount = fCurrentLayer->fVisible2.CountRects();
|
||||
#endif
|
||||
|
||||
fLink.StartMessage(SERVER_TRUE);
|
||||
fLink.Attach<int32>(rectCount);
|
||||
|
||||
for (int32 i = 0; i < rectCount; i++)
|
||||
#ifndef NEW_CLIPPING
|
||||
fLink.Attach<BRect>(fCurrentLayer->ConvertFromTop(fCurrentLayer->fVisible.RectAt(i)));
|
||||
#else
|
||||
fLink.Attach<BRect>(fCurrentLayer->ConvertFromTop(fCurrentLayer->fVisible2.RectAt(i)));
|
||||
#endif
|
||||
|
||||
fLink.Flush();
|
||||
}
|
||||
@ -1194,20 +1114,9 @@ if (myRootLayer)
|
||||
// restored too. "AS_LAYER_SET_CLIP_REGION" is irritating, as I think it should be
|
||||
// "AS_LAYER_CONSTRAIN_CLIP_REGION", since it means to "add" to the current clipping, not "set" it.
|
||||
// fCurrentLayer->CurrentState()->SetClippingRegion(region);
|
||||
#ifndef NEW_CLIPPING
|
||||
// TODO: set the clipping
|
||||
// fCurrentLayer->fVisible.IntersectWith(®ion);
|
||||
#endif
|
||||
/*
|
||||
#ifndef NEW_CLIPPING
|
||||
fCurrentLayer->RebuildFullRegion();
|
||||
if (myRootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate())
|
||||
myRootLayer->GoInvalidate(fCurrentLayer, fCurrentLayer->fFull);
|
||||
#else
|
||||
if (myRootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate())
|
||||
myRootLayer->GoInvalidate(fCurrentLayer, fCurrentLayer->Frame());
|
||||
#endif
|
||||
*/
|
||||
|
||||
// TODO: rebuild clipping and redraw
|
||||
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_INVAL_RECT:
|
||||
@ -1223,12 +1132,9 @@ if (myRootLayer)
|
||||
BRect converted(fCurrentLayer->ConvertToTop(invalRect.LeftTop()),
|
||||
fCurrentLayer->ConvertToTop(invalRect.RightBottom()));
|
||||
BRegion invalidRegion(converted);
|
||||
#ifdef NEW_CLIPPING
|
||||
invalidRegion.IntersectWith(&fCurrentLayer->fVisible2);
|
||||
#endif
|
||||
invalidRegion.IntersectWith(&fCurrentLayer->VisibleRegion());
|
||||
myRootLayer->MarkForRedraw(invalidRegion);
|
||||
myRootLayer->TriggerRedraw();
|
||||
// myRootLayer->GoRedraw(fWinBorder, invalidRegion);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1717,11 +1623,7 @@ ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
// NOTE: fCurrentLayer and fCurrentLayer->fLayerData cannot be NULL,
|
||||
// _DispatchGraphicsMessage() is called from _DispatchMessage() which
|
||||
// checks both these conditions
|
||||
#ifndef NEW_CLIPPING
|
||||
BRegion rreg(fCurrentLayer->fVisible);
|
||||
#else
|
||||
BRegion rreg(fCurrentLayer->fVisible2);
|
||||
#endif
|
||||
BRegion rreg(fCurrentLayer->VisibleRegion());
|
||||
|
||||
if (fWinBorder->InUpdate())
|
||||
rreg.IntersectWith(&fWinBorder->RegionToBeUpdated());
|
||||
@ -2159,72 +2061,6 @@ ServerWindow::_MessageLooper()
|
||||
// does not return
|
||||
}
|
||||
|
||||
/*
|
||||
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.
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
|
||||
// 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->GetDrawingEngine()->CopyRegion(©Region, xOffset, yOffset);
|
||||
|
||||
// trigger the redraw
|
||||
if (rootLayer) {
|
||||
// the following code solves a "concurrency" problem:
|
||||
// since the scrolling might happen more often
|
||||
// than redrawing, we need to keep track of the region
|
||||
// pending for redraw that might fall into the area
|
||||
// that is scrolled.
|
||||
BRegion scrolledInvalid(fWinBorder->CulmulatedUpdateRegion());
|
||||
scrolledInvalid.IntersectWith(&layer->fVisible);
|
||||
if (scrolledInvalid.Frame().IsValid()) {
|
||||
//printf("the layer has pending updates that will be scrolled\n");
|
||||
scrolledInvalid.OffsetBy(xOffset, yOffset);
|
||||
invalidRegion.Include(&scrolledInvalid);
|
||||
}
|
||||
|
||||
rootLayer->GoRedraw(fWinBorder, invalidRegion);
|
||||
}
|
||||
|
||||
#endif
|
||||
}*/
|
||||
|
||||
|
||||
status_t
|
||||
ServerWindow::SendMessageToClient(const BMessage* msg, int32 target, bool usePreferred) const
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Adrian Oanca <adioanca@cotty.iren.ro>
|
||||
* Adrian Oanca <adioanca@gmail.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
* Stefano Ceccherini (burton666@libero.it)
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Adi Oanca <adioanca@cotty.iren.ro>
|
||||
* Adi Oanca <adioanca@gmail.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
|
||||
@ -74,6 +74,9 @@ WinBorder::WinBorder(const BRect &frame,
|
||||
fCumulativeRegion(),
|
||||
fInUpdateRegion(),
|
||||
|
||||
fDecRegion(),
|
||||
fRebuildDecRegion(true),
|
||||
|
||||
fMouseButtons(0),
|
||||
fLastMousePosition(-1.0, -1.0),
|
||||
|
||||
@ -105,9 +108,7 @@ WinBorder::WinBorder(const BRect &frame,
|
||||
fServerWin = window;
|
||||
fAdFlags = fAdFlags | B_LAYER_CHILDREN_DEPENDANT;
|
||||
fFlags = B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE;
|
||||
#ifdef NEW_CLIPPING
|
||||
fRebuildDecRegion = true;
|
||||
#endif
|
||||
|
||||
QuietlySetFeel(feel);
|
||||
|
||||
if (fFeel != B_NO_BORDER_WINDOW_LOOK) {
|
||||
@ -136,10 +137,6 @@ WinBorder::WinBorder(const BRect &frame,
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
RebuildFullRegion();
|
||||
#endif
|
||||
|
||||
STRACE(("WinBorder %p, %s:\n", this, Name()));
|
||||
STRACE(("\tFrame: (%.1f, %.1f, %.1f, %.1f)\n", fFrame.left, fFrame.top,
|
||||
fFrame.right, fFrame.bottom));
|
||||
@ -179,58 +176,7 @@ WinBorder::Draw(const BRect &r)
|
||||
void
|
||||
WinBorder::MoveBy(float x, float y)
|
||||
{
|
||||
#ifndef NEW_CLIPPING
|
||||
|
||||
x = (float)int32(x);
|
||||
y = (float)int32(y);
|
||||
|
||||
if (x == 0.0 && y == 0.0)
|
||||
return;
|
||||
|
||||
STRACE(("WinBorder(%s)::MoveBy(%.1f, %.1f) fDecorator: %p\n", Name(), x, y, fDecorator));
|
||||
if (fDecorator)
|
||||
fDecorator->MoveBy(x,y);
|
||||
|
||||
// NOTE: I moved this here from Layer::move_layer()
|
||||
// Should this have any bad consequences I'm not aware of?
|
||||
fCumulativeRegion.OffsetBy(x, y);
|
||||
fInUpdateRegion.OffsetBy(x, y);
|
||||
|
||||
if (IsHidden()) {
|
||||
// TODO: This is a work around for a design issue:
|
||||
// The actual movement of a layer is done during
|
||||
// the region rebuild. The mechanism is somewhat
|
||||
// complicated and scheduled for refractoring...
|
||||
// The problem here for hidden layers is that
|
||||
// they seem *not* to be part of the layer tree.
|
||||
// I don't think this is wrong as such, but of
|
||||
// course the rebuilding of regions does not take
|
||||
// place then. I don't understand yet the consequences
|
||||
// for normal views, but this here fixes at least
|
||||
// BWindows being MoveTo()ed before they are Show()n.
|
||||
// In Layer::move_to, StartRebuildRegions() is called
|
||||
// on fParent. But the rest of the this layers tree
|
||||
// has not been added to fParent apperantly. So now
|
||||
// you ask why fParent is even valid? Me too.
|
||||
fFrame.OffsetBy(x, y);
|
||||
fFull.OffsetBy(x, y);
|
||||
fTopLayer->move_layer(x, y);
|
||||
// ...and here we get really hacky...
|
||||
fTopLayer->fFrame.OffsetTo(0.0, 0.0);
|
||||
} else {
|
||||
Layer::move_layer(x, y);
|
||||
}
|
||||
|
||||
if (Window()) {
|
||||
// dispatch a message to the client informing about the changed size
|
||||
BMessage msg(B_WINDOW_MOVED);
|
||||
msg.AddPoint("where", fFrame.LeftTop());
|
||||
Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
|
||||
}
|
||||
|
||||
#else
|
||||
Layer::MoveBy(x, y);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -241,20 +187,6 @@ WinBorder::ResizeBy(float x, float y)
|
||||
|
||||
if (!_ResizeBy(x, y))
|
||||
return;
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
if (Window()) {
|
||||
// send a message to the client informing about the changed size
|
||||
BMessage msg(B_WINDOW_RESIZED);
|
||||
msg.AddInt64("when", system_time());
|
||||
|
||||
BRect frame(fTopLayer->Frame());
|
||||
msg.AddInt32("width", frame.IntegerWidth());
|
||||
msg.AddInt32("height", frame.IntegerHeight());
|
||||
|
||||
Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -282,23 +214,7 @@ WinBorder::_ResizeBy(float x, float y)
|
||||
if (x == 0.0 && y == 0.0)
|
||||
return false;
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
if (fDecorator)
|
||||
fDecorator->ResizeBy(x, y);
|
||||
|
||||
if (IsHidden()) {
|
||||
// TODO: See large comment in MoveBy()
|
||||
fFrame.right += x;
|
||||
fFrame.bottom += y;
|
||||
|
||||
if (fTopLayer)
|
||||
fTopLayer->resize_layer(x, y);
|
||||
} else {
|
||||
resize_layer(x, y);
|
||||
}
|
||||
#else
|
||||
Layer::ResizeBy(x, y);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -312,9 +228,10 @@ WinBorder::SetName(const char* name)
|
||||
// rebuild the clipping for the title area
|
||||
// and redraw it.
|
||||
|
||||
// TODO: Adi, please have a look at this,
|
||||
// it doesn't work yet.
|
||||
if (fDecorator) {
|
||||
|
||||
// TODO: Make sure this works!!
|
||||
|
||||
// before the change
|
||||
BRegion invalid(fDecorator->GetTabRect());
|
||||
|
||||
@ -323,12 +240,8 @@ WinBorder::SetName(const char* name)
|
||||
// after the change
|
||||
invalid.Include(fDecorator->GetTabRect());
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
RebuildFullRegion();
|
||||
fRootLayer->GoRedraw(this, invalid);
|
||||
#else
|
||||
// TODO: ...
|
||||
#endif
|
||||
GetRootLayer()->MarkForRedraw(invalid);
|
||||
GetRootLayer()->TriggerRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,23 +274,6 @@ WinBorder::UpdateEnd()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
|
||||
//! Rebuilds the WinBorder's "fully-visible" region based on info from the decorator
|
||||
void
|
||||
WinBorder::RebuildFullRegion()
|
||||
{
|
||||
STRACE(("WinBorder(%s)::RebuildFullRegion()\n", Name()));
|
||||
|
||||
fFull.MakeEmpty();
|
||||
|
||||
// Winborder holds Decorator's full regions. if any...
|
||||
if (fDecorator)
|
||||
fDecorator->GetFootprint(&fFull);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//! Sets the minimum and maximum sizes of the window
|
||||
void
|
||||
WinBorder::SetSizeLimits(float minWidth, float maxWidth,
|
||||
@ -792,24 +688,12 @@ WinBorder::_ActionFor(const BMessage *msg) const
|
||||
msg->FindInt32("buttons", &buttons);
|
||||
msg->FindInt32("modifiers", &modifiers);
|
||||
|
||||
#ifndef NEW_INPUT_HANDING
|
||||
#ifndef NEW_CLIPPING
|
||||
if (fTopLayer->fFullVisible.Contains(where))
|
||||
return DEC_NONE;
|
||||
else
|
||||
#else
|
||||
if (fTopLayer->fFullVisible2.Contains(where))
|
||||
return DEC_NONE;
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
if (fDecorator)
|
||||
return fDecorator->Clicked(where, buttons, modifiers);
|
||||
else
|
||||
return DEC_NONE;
|
||||
}
|
||||
|
||||
#ifdef NEW_CLIPPING
|
||||
void WinBorder::MovedByHook(float dx, float dy)
|
||||
{
|
||||
STRACE(("WinBorder(%s)::MovedByHook(%.1f, %.1f) fDecorator: %p\n", Name(), x, y, fDecorator));
|
||||
@ -905,13 +789,10 @@ if (cnt != 1)
|
||||
|
||||
BMessage msg;
|
||||
msg.what = _UPDATE_;
|
||||
#ifndef NEW_CLIPPING
|
||||
msg.AddRect("_rect", ConvertFromTop(fInUpdateRegion.Frame()));
|
||||
#else
|
||||
|
||||
BRect rect(fInUpdateRegion.Frame());
|
||||
ConvertFromScreen2(&rect);
|
||||
msg.AddRect("_rect", rect );
|
||||
#endif
|
||||
msg.AddRect("debug_rect", fInUpdateRegion.Frame());
|
||||
|
||||
if (Window()->SendMessageToClient(&msg) == B_OK) {
|
||||
@ -924,7 +805,6 @@ if (cnt != 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// SetTopLayer
|
||||
void
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Adi Oanca <adioanca@cotty.iren.ro>
|
||||
* Adi Oanca <adioanca@gmail.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
#ifndef _WINBORDER_H_
|
||||
@ -58,11 +58,8 @@ class WinBorder : public Layer {
|
||||
virtual bool IsOffscreenWindow() const
|
||||
{ return false; }
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
virtual void RebuildFullRegion();
|
||||
#else
|
||||
virtual void GetWantedRegion(BRegion ®);
|
||||
#endif
|
||||
|
||||
void UpdateStart();
|
||||
void UpdateEnd();
|
||||
inline bool InUpdate() const
|
||||
@ -122,27 +119,19 @@ class WinBorder : public Layer {
|
||||
|
||||
SubWindowList fSubWindowList;
|
||||
|
||||
#ifdef NEW_CLIPPING
|
||||
public:
|
||||
virtual void MovedByHook(float dx, float dy);
|
||||
virtual void ResizedByHook(float dx, float dy, bool automatic);
|
||||
|
||||
void RequestClientRedraw(const BRegion &invalid);
|
||||
|
||||
private:
|
||||
void set_decorator_region(BRect frame);
|
||||
virtual void _ReserveRegions(BRegion ®);
|
||||
|
||||
BRegion fDecRegion;
|
||||
bool fRebuildDecRegion;
|
||||
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual void SetTopLayer(Layer* layer);
|
||||
inline Layer* TopLayer() const
|
||||
{ return fTopLayer; }
|
||||
|
||||
private:
|
||||
void set_decorator_region(BRect frame);
|
||||
virtual void _ReserveRegions(BRegion ®);
|
||||
|
||||
protected:
|
||||
friend class Layer;
|
||||
friend class RootLayer;
|
||||
@ -156,6 +145,9 @@ class WinBorder : public Layer {
|
||||
BRegion fCumulativeRegion;
|
||||
BRegion fInUpdateRegion;
|
||||
|
||||
BRegion fDecRegion;
|
||||
bool fRebuildDecRegion;
|
||||
|
||||
int32 fMouseButtons;
|
||||
BPoint fLastMousePosition;
|
||||
BPoint fResizingClickOffset;
|
||||
|
@ -163,11 +163,8 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
|
||||
|
||||
// draw windows
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
BRegion backgroundRegion = fVisible;
|
||||
#else
|
||||
BRegion backgroundRegion = VisibleRegion();
|
||||
#endif
|
||||
|
||||
// ToDo: would be nice to get the real update region here
|
||||
|
||||
if (workspace != NULL) {
|
||||
@ -195,12 +192,8 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
|
||||
fDriver->FillRect(rect, color);
|
||||
|
||||
// TODO: ConstrainClippingRegion() should accept a const parameter !!
|
||||
#ifndef NEW_CLIPPING
|
||||
fDriver->ConstrainClippingRegion(&fVisible);
|
||||
#else
|
||||
BRegion cRegion(VisibleRegion());
|
||||
fDriver->ConstrainClippingRegion(&cRegion);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user