2005-06-23 21:40:35 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2005, Haiku.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
* Adrian Oanca <adioanca@cotty.iren.ro>
|
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
|
|
* Stefano Ceccherini (burton666@libero.it)
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
|
|
|
|
2005-07-24 21:13:02 +04:00
|
|
|
/*!
|
|
|
|
\class ServerWindow
|
|
|
|
\brief Shadow BWindow class
|
|
|
|
|
|
|
|
A ServerWindow handles all the intraserver tasks required of it by its BWindow. There are
|
|
|
|
too many tasks to list as being done by them, but they include handling View transactions,
|
|
|
|
coordinating and linking a window's WinBorder half with its messaging half, dispatching
|
|
|
|
mouse and key events from the server to its window, and other such things.
|
|
|
|
*/
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
#include <new>
|
2005-07-01 10:44:39 +04:00
|
|
|
|
2003-02-07 15:53:57 +03:00
|
|
|
#include <AppDefs.h>
|
2005-10-11 09:25:52 +04:00
|
|
|
#include <DirectWindow.h>
|
2003-09-09 01:18:39 +04:00
|
|
|
#include <GraphicsDefs.h>
|
2005-06-24 03:46:17 +04:00
|
|
|
#include <Message.h>
|
2003-07-11 00:22:07 +04:00
|
|
|
#include <PortLink.h>
|
2005-06-24 03:46:17 +04:00
|
|
|
#include <Rect.h>
|
|
|
|
#include <View.h>
|
2004-10-16 06:02:27 +04:00
|
|
|
#include <ViewAux.h>
|
2005-06-28 05:14:39 +04:00
|
|
|
#include <Autolock.h>
|
2005-07-05 22:14:24 +04:00
|
|
|
#include <TokenSpace.h>
|
|
|
|
#include <WindowInfo.h>
|
2005-07-06 00:28:40 +04:00
|
|
|
#include <WindowPrivate.h>
|
2005-06-24 03:46:17 +04:00
|
|
|
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "AppServer.h"
|
2004-10-16 06:02:27 +04:00
|
|
|
#include "BGet++.h"
|
2005-05-26 03:59:23 +04:00
|
|
|
#include "DebugInfoManager.h"
|
2004-10-16 06:02:27 +04:00
|
|
|
#include "Desktop.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
#include "DisplayDriver.h"
|
|
|
|
#include "HWInterface.h"
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "Layer.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
#include "MessagePrivate.h"
|
2004-10-16 06:02:27 +04:00
|
|
|
#include "RAMLinkMsgReader.h"
|
2005-10-12 01:37:47 +04:00
|
|
|
#include "RenderingBuffer.h"
|
2003-08-31 21:38:34 +04:00
|
|
|
#include "RootLayer.h"
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "ServerApp.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
#include "ServerBitmap.h"
|
2005-06-03 18:20:10 +04:00
|
|
|
#include "ServerPicture.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
#include "ServerProtocol.h"
|
2003-02-12 04:11:55 +03:00
|
|
|
#include "TokenHandler.h"
|
2003-06-24 17:55:18 +04:00
|
|
|
#include "Utils.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
#include "WinBorder.h"
|
2004-01-13 03:56:36 +03:00
|
|
|
#include "Workspace.h"
|
2005-07-01 10:53:07 +04:00
|
|
|
#include "WorkspacesLayer.h"
|
2005-06-24 03:46:17 +04:00
|
|
|
|
|
|
|
#include "ServerWindow.h"
|
2003-02-12 04:11:55 +03:00
|
|
|
|
2005-10-12 01:37:47 +04:00
|
|
|
#include "clipping.h"
|
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
//#define DEBUG_SERVERWINDOW
|
|
|
|
//#define DEBUG_SERVERWINDOW_GRAPHICS
|
2003-03-23 23:52:37 +03:00
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_SERVERWINDOW
|
2003-09-09 01:18:39 +04:00
|
|
|
# include <stdio.h>
|
|
|
|
# define STRACE(x) printf x
|
|
|
|
#else
|
|
|
|
# define STRACE(x) ;
|
|
|
|
#endif
|
|
|
|
|
2005-01-19 18:12:35 +03:00
|
|
|
#ifdef DEBUG_SERVERWINDOW_GRAPHICS
|
|
|
|
# include <stdio.h>
|
|
|
|
# define DTRACE(x) printf x
|
|
|
|
#else
|
|
|
|
# define DTRACE(x) ;
|
|
|
|
#endif
|
|
|
|
|
2005-10-11 09:25:52 +04:00
|
|
|
struct dw_data {
|
|
|
|
sem_id direct_sem;
|
|
|
|
sem_id direct_sem_ack;
|
|
|
|
area_id direct_area;
|
|
|
|
direct_buffer_info *direct_info;
|
|
|
|
|
|
|
|
dw_data() :
|
|
|
|
direct_sem(-1),
|
|
|
|
direct_sem_ack(-1),
|
2005-10-12 01:37:47 +04:00
|
|
|
direct_area(-1),
|
|
|
|
direct_info(NULL)
|
2005-10-11 09:25:52 +04:00
|
|
|
{
|
|
|
|
direct_area = create_area("direct area", (void **)&direct_info,
|
|
|
|
B_ANY_ADDRESS, B_PAGE_SIZE, B_NO_LOCK, B_READ_WRITE);
|
|
|
|
|
|
|
|
direct_sem = create_sem(1, "direct sem");
|
|
|
|
direct_sem_ack = create_sem(1, "direct sem ack");
|
|
|
|
}
|
|
|
|
|
|
|
|
~dw_data()
|
|
|
|
{
|
|
|
|
if (direct_area >= 0)
|
|
|
|
delete_area(direct_area);
|
|
|
|
if (direct_sem >= 0)
|
|
|
|
delete_sem(direct_sem);
|
|
|
|
if (direct_sem_ack >= 0)
|
|
|
|
delete_sem(direct_sem_ack);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsValid() const
|
|
|
|
{
|
2005-10-12 01:37:47 +04:00
|
|
|
return (direct_area >= 0) && (direct_sem >= 0)
|
|
|
|
&& (direct_sem_ack >= 0) && (direct_info != NULL);
|
2005-10-11 09:25:52 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Copied from DirectWindow.cpp: Move to a common header
|
|
|
|
struct dw_sync_data {
|
|
|
|
area_id area;
|
|
|
|
sem_id disableSem;
|
|
|
|
sem_id disableSemAck;
|
|
|
|
};
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2003-02-12 04:11:55 +03:00
|
|
|
/*!
|
2005-05-26 19:04:45 +04:00
|
|
|
\brief Constructor
|
2003-02-12 04:11:55 +03:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
Does a lot of stuff to set up for the window - new decorator, new winborder, spawn a
|
|
|
|
monitor thread.
|
2003-02-12 04:11:55 +03:00
|
|
|
*/
|
2005-06-23 22:48:10 +04:00
|
|
|
ServerWindow::ServerWindow(const char *title, ServerApp *app,
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
port_id clientPort, port_id looperPort, int32 handlerID)
|
2005-07-23 22:30:48 +04:00
|
|
|
: MessageLooper(title && *title ? title : "Unnamed Window"),
|
2005-11-01 04:11:26 +03:00
|
|
|
fTitle(strdup(title && *title ? title : "Unnamed Window")),
|
2005-10-31 14:05:52 +03:00
|
|
|
fDesktop(app->GetDesktop()),
|
2005-06-23 21:40:35 +04:00
|
|
|
fServerApp(app),
|
2005-06-24 02:43:11 +04:00
|
|
|
fWinBorder(NULL),
|
|
|
|
fClientTeam(app->ClientTeam()),
|
|
|
|
fMessagePort(-1),
|
2005-06-23 21:40:35 +04:00
|
|
|
fClientReplyPort(clientPort),
|
2005-04-16 17:30:49 +04:00
|
|
|
fClientLooperPort(looperPort),
|
2005-05-18 16:16:15 +04:00
|
|
|
fClientViewsWithInvalidCoords(B_VIEW_RESIZED),
|
2005-06-24 02:43:11 +04:00
|
|
|
fHandlerToken(handlerID),
|
2005-10-11 09:25:52 +04:00
|
|
|
fCurrentLayer(NULL),
|
|
|
|
fDirectWindowData(NULL)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow(%s)::ServerWindow()\n", title));
|
2005-07-05 22:14:24 +04:00
|
|
|
|
|
|
|
fServerToken = BPrivate::gDefaultTokens.NewToken(B_SERVER_TOKEN, this);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
|
2004-06-19 17:04:50 +04:00
|
|
|
//!Tears down all connections the main app_server objects, and deletes some internals.
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::~ServerWindow()
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-07-18 13:24:08 +04:00
|
|
|
STRACE(("*ServerWindow(%s@%p):~ServerWindow()\n", fTitle, this));
|
2005-02-28 23:23:51 +03:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (!fWinBorder->IsOffscreenWindow())
|
2005-10-31 14:05:52 +03:00
|
|
|
fDesktop->RemoveWinBorder(fWinBorder);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
delete fWinBorder;
|
2005-07-07 02:39:15 +04:00
|
|
|
|
2005-11-01 04:11:26 +03:00
|
|
|
free(fTitle);
|
2005-07-07 02:39:15 +04:00
|
|
|
delete_port(fMessagePort);
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2005-07-05 22:14:24 +04:00
|
|
|
BPrivate::gDefaultTokens.RemoveToken(fServerToken);
|
|
|
|
|
2005-10-11 09:25:52 +04:00
|
|
|
delete fDirectWindowData;
|
2005-07-18 13:24:08 +04:00
|
|
|
STRACE(("#ServerWindow(%p) will exit NOW\n", this));
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
|
|
|
|
status_t
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
ServerWindow::Init(BRect frame, uint32 look, uint32 feel, uint32 flags, uint32 workspace)
|
2005-06-24 02:43:11 +04:00
|
|
|
{
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// fMessagePort is the port to which the app sends messages for the server
|
|
|
|
fMessagePort = create_port(100, fTitle);
|
2005-06-24 02:43:11 +04:00
|
|
|
if (fMessagePort < B_OK)
|
|
|
|
return fMessagePort;
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
fLink.SetSenderPort(fClientReplyPort);
|
|
|
|
fLink.SetReceiverPort(fMessagePort);
|
|
|
|
|
|
|
|
// We cannot call MakeWinBorder in the constructor, since it
|
|
|
|
fWinBorder = MakeWinBorder(frame, fTitle, look, feel, flags, workspace);
|
|
|
|
if (!fWinBorder)
|
|
|
|
return B_NO_MEMORY;
|
|
|
|
|
|
|
|
if (!fWinBorder->IsOffscreenWindow())
|
2005-10-31 14:05:52 +03:00
|
|
|
fDesktop->AddWinBorder(fWinBorder);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
return B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
ServerWindow::Run()
|
|
|
|
{
|
2005-07-23 22:30:48 +04:00
|
|
|
if (!MessageLooper::Run())
|
2005-06-24 02:43:11 +04:00
|
|
|
return false;
|
|
|
|
|
2005-06-28 05:14:39 +04:00
|
|
|
// Send a reply to our window - it is expecting fMessagePort
|
|
|
|
// port and some other info
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<port_id>(fMessagePort);
|
2005-06-28 05:14:39 +04:00
|
|
|
|
|
|
|
float minWidth, maxWidth, minHeight, maxHeight;
|
|
|
|
fWinBorder->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
|
|
|
|
|
|
|
fLink.Attach<BRect>(fWinBorder->Frame());
|
|
|
|
fLink.Attach<float>(minWidth);
|
|
|
|
fLink.Attach<float>(maxWidth);
|
|
|
|
fLink.Attach<float>(minHeight);
|
|
|
|
fLink.Attach<float>(maxHeight);
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-07-24 21:13:02 +04:00
|
|
|
ServerWindow::_PrepareQuit()
|
2003-02-12 04:11:55 +03:00
|
|
|
{
|
2005-06-24 02:43:11 +04:00
|
|
|
if (fThread == find_thread(NULL)) {
|
2005-07-07 02:39:15 +04:00
|
|
|
// make sure we're hidden
|
|
|
|
Hide();
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
App()->RemoveWindow(this);
|
2005-07-24 21:13:02 +04:00
|
|
|
} else if (fThread >= B_OK)
|
2005-06-24 03:21:10 +04:00
|
|
|
PostMessage(AS_HIDE_WINDOW);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-07-23 22:30:48 +04:00
|
|
|
ServerWindow::_GetLooperName(char* name, size_t length)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-07-23 22:30:48 +04:00
|
|
|
snprintf(name, length, "w:%ld:%s", ClientTeam(), Title());
|
2005-06-24 02:43:11 +04:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
|
|
|
|
//! Forces the window border to update its decorator
|
|
|
|
void
|
|
|
|
ServerWindow::ReplaceDecorator()
|
|
|
|
{
|
|
|
|
if (!IsLocked())
|
|
|
|
debugger("you must lock a ServerWindow object before calling ::ReplaceDecorator()\n");
|
|
|
|
|
|
|
|
STRACE(("ServerWindow %s: Replace Decorator\n", fTitle));
|
|
|
|
fWinBorder->UpdateDecorator();
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-10-12 18:41:02 +04:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Shows the window's WinBorder
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::Show()
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Show\n", Title()));
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2005-06-24 03:21:10 +04:00
|
|
|
if (fQuitting || !fWinBorder->IsHidden())
|
2004-01-14 18:55:10 +03:00
|
|
|
return;
|
|
|
|
|
2005-07-07 02:39:15 +04:00
|
|
|
RootLayer* rootLayer = fWinBorder->GetRootLayer();
|
2005-07-07 03:24:03 +04:00
|
|
|
if (rootLayer && rootLayer->Lock()) {
|
|
|
|
rootLayer->ShowWinBorder(fWinBorder);
|
|
|
|
rootLayer->Unlock();
|
|
|
|
}
|
2005-10-11 09:25:52 +04:00
|
|
|
|
2005-10-12 18:41:02 +04:00
|
|
|
// TODO: This doesn't work: Here we aren't shown yet as RootLayer::ShowWinBorder()
|
|
|
|
// does its work asynchronously. As we lock the rootlayer, I think it could be synchronous.
|
|
|
|
// Otherwise, we need a "Shown()" hook or something like that.
|
2005-10-11 09:25:52 +04:00
|
|
|
if (fDirectWindowData != NULL)
|
|
|
|
_HandleDirectConnection(B_DIRECT_START);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-10-12 18:41:02 +04:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Hides the window's WinBorder
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::Hide()
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Hide\n", Title()));
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
if (fWinBorder->IsHidden())
|
2004-01-14 18:55:10 +03:00
|
|
|
return;
|
|
|
|
|
2005-10-12 01:37:47 +04:00
|
|
|
if (fDirectWindowData != NULL)
|
|
|
|
_HandleDirectConnection(B_DIRECT_STOP);
|
|
|
|
|
2005-07-07 02:39:15 +04:00
|
|
|
RootLayer* rootLayer = fWinBorder->GetRootLayer();
|
2005-07-07 03:24:03 +04:00
|
|
|
if (rootLayer && rootLayer->Lock()) {
|
|
|
|
rootLayer->HideWinBorder(fWinBorder);
|
|
|
|
rootLayer->Unlock();
|
|
|
|
}
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
|
2005-07-05 23:20:19 +04:00
|
|
|
void
|
|
|
|
ServerWindow::SetTitle(const char* newTitle)
|
|
|
|
{
|
2005-11-01 04:11:26 +03:00
|
|
|
char *title = strdup(newTitle && *newTitle ? newTitle : "Unnamed Window");
|
|
|
|
if (!title)
|
2005-07-05 23:20:19 +04:00
|
|
|
return;
|
2005-11-01 04:11:26 +03:00
|
|
|
|
|
|
|
free(fTitle);
|
|
|
|
fTitle = title;
|
2005-07-05 23:20:19 +04:00
|
|
|
|
|
|
|
if (Thread() >= B_OK) {
|
|
|
|
char name[B_OS_NAME_LENGTH];
|
|
|
|
snprintf(name, sizeof(name), "w:%ld:%s", ClientTeam(), fTitle);
|
|
|
|
rename_thread(Thread(), name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fWinBorder != NULL)
|
|
|
|
fWinBorder->SetName(newTitle);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
//! Requests that the ServerWindow's BWindow quit
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::NotifyQuitRequested()
|
|
|
|
{
|
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
|
|
|
STRACE(("ServerWindow %s: Quit\n", fTitle));
|
|
|
|
|
|
|
|
BMessage msg(B_QUIT_REQUESTED);
|
|
|
|
SendMessageToClient(&msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
ServerWindow::NotifyMinimize(bool minimize)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
2004-06-15 00:32:21 +04:00
|
|
|
// This function doesn't need much -- check to make sure that we should and
|
|
|
|
// send the message to the client. According to the BeBook, the BWindow hook function
|
|
|
|
// does all the heavy lifting for us. :)
|
2004-06-11 18:47:36 +04:00
|
|
|
bool sendMessages = false;
|
2003-11-15 03:28:40 +03:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
if (minimize) {
|
2005-05-26 19:04:45 +04:00
|
|
|
if (!fWinBorder->IsHidden()) {
|
2003-11-15 03:28:40 +03:00
|
|
|
Hide();
|
2004-06-11 18:47:36 +04:00
|
|
|
sendMessages = true;
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
} else {
|
|
|
|
if (fWinBorder->IsHidden()) {
|
2003-11-15 03:28:40 +03:00
|
|
|
Show();
|
2004-06-11 18:47:36 +04:00
|
|
|
sendMessages = true;
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
if (sendMessages) {
|
2005-06-24 02:43:11 +04:00
|
|
|
BMessage msg(B_MINIMIZE);
|
2003-11-15 03:28:40 +03:00
|
|
|
msg.AddInt64("when", real_time_clock_usecs());
|
2005-06-24 02:43:11 +04:00
|
|
|
msg.AddBool("minimize", minimize);
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
//! Sends a message to the client to perform a Zoom
|
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::NotifyZoom()
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
2005-05-26 19:04:45 +04:00
|
|
|
BMessage msg(B_ZOOM);
|
2004-06-11 06:46:48 +04:00
|
|
|
SendMessageToClient(&msg);
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Notifies window of a change in screen resolution
|
|
|
|
\param frame Size of the new resolution
|
|
|
|
\param color_space Color space of the new screen mode
|
|
|
|
*/
|
2005-05-26 19:04:45 +04:00
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::NotifyScreenModeChanged(const BRect frame, const color_space colorSpace)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: ScreenModeChanged\n", fTitle));
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
BMessage msg(B_SCREEN_CHANGED);
|
2003-09-25 16:31:11 +04:00
|
|
|
msg.AddRect("frame", frame);
|
2005-05-26 19:04:45 +04:00
|
|
|
msg.AddInt32("mode", (int32)colorSpace);
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-07-05 22:14:24 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
ServerWindow::GetInfo(window_info& info)
|
|
|
|
{
|
|
|
|
info.team = ClientTeam();
|
|
|
|
info.server_token = ServerToken();
|
|
|
|
|
|
|
|
info.thread = Thread();
|
|
|
|
info.client_token = ClientToken();
|
|
|
|
info.client_port = fClientLooperPort;
|
|
|
|
info.workspaces = fWinBorder->Workspaces();
|
|
|
|
|
|
|
|
info.layer = 0; // ToDo: what is this???
|
2005-07-06 00:28:40 +04:00
|
|
|
info.feel = fWinBorder->Feel();
|
2005-07-05 22:14:24 +04:00
|
|
|
info.flags = fWinBorder->WindowFlags();
|
|
|
|
info.window_left = (int)floor(fWinBorder->Frame().left);
|
|
|
|
info.window_top = (int)floor(fWinBorder->Frame().top);
|
|
|
|
info.window_right = (int)floor(fWinBorder->Frame().right);
|
|
|
|
info.window_bottom = (int)floor(fWinBorder->Frame().bottom);
|
|
|
|
|
|
|
|
info.show_hide_level = fWinBorder->IsHidden() ? 1 : -1; // ???
|
|
|
|
info.is_mini = fWinBorder->IsHidden();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
/*!
|
|
|
|
\brief Sets the font state for a layer
|
|
|
|
\param layer The layer to set the font
|
|
|
|
*/
|
2005-06-03 23:50:30 +04:00
|
|
|
inline void
|
2005-06-15 01:28:56 +04:00
|
|
|
ServerWindow::SetLayerFontState(Layer *layer, BPrivate::LinkReceiver &link)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2005-02-23 04:45:48 +03:00
|
|
|
STRACE(("ServerWindow %s: SetLayerFontStateMessage for layer %s\n",
|
2005-06-23 22:48:10 +04:00
|
|
|
fTitle, layer->Name()));
|
2004-06-19 14:23:14 +04:00
|
|
|
// NOTE: no need to check for a lock. This is a private method.
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2005-04-19 04:42:42 +04:00
|
|
|
layer->fLayerData->ReadFontFromLink(link);
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
inline void
|
2005-06-15 01:28:56 +04:00
|
|
|
ServerWindow::SetLayerState(Layer *layer, BPrivate::LinkReceiver &link)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: SetLayerState for layer %s\n", Title(),
|
|
|
|
layer->Name()));
|
2004-06-19 14:23:14 +04:00
|
|
|
// NOTE: no need to check for a lock. This is a private method.
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2005-04-19 04:42:42 +04:00
|
|
|
layer->fLayerData->ReadFromLink(link);
|
|
|
|
// TODO: Rebuild clipping here?
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
inline Layer*
|
2005-06-16 04:46:02 +04:00
|
|
|
ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
// NOTE: no need to check for a lock. This is a private method.
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
int32 token;
|
|
|
|
BRect frame;
|
|
|
|
uint32 resizeMask;
|
2005-03-21 23:29:24 +03:00
|
|
|
uint32 eventMask;
|
|
|
|
uint32 eventOptions;
|
2004-06-11 18:47:36 +04:00
|
|
|
uint32 flags;
|
|
|
|
bool hidden;
|
2005-06-16 04:46:02 +04:00
|
|
|
int32 parentToken;
|
2004-07-30 19:16:59 +04:00
|
|
|
char *name = NULL;
|
2005-06-10 20:20:38 +04:00
|
|
|
rgb_color viewColor;
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&token);
|
|
|
|
link.ReadString(&name);
|
|
|
|
link.Read<BRect>(&frame);
|
|
|
|
link.Read<uint32>(&resizeMask);
|
2005-03-21 23:29:24 +03:00
|
|
|
link.Read<uint32>(&eventMask);
|
|
|
|
link.Read<uint32>(&eventOptions);
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<uint32>(&flags);
|
|
|
|
link.Read<bool>(&hidden);
|
2005-06-16 04:46:02 +04:00
|
|
|
link.Read<rgb_color>(&viewColor);
|
|
|
|
link.Read<int32>(&parentToken);
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-06-16 04:46:02 +04:00
|
|
|
STRACE(("ServerWindow(%s)::CreateLayerTree()-> layer %s, token %ld\n",
|
2005-06-23 22:48:10 +04:00
|
|
|
fTitle, name, token));
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2005-07-01 10:53:07 +04:00
|
|
|
Layer *newLayer;
|
|
|
|
|
|
|
|
if (link.Code() == AS_LAYER_CREATE_ROOT
|
2005-07-06 00:28:40 +04:00
|
|
|
&& (fWinBorder->WindowFlags() & kWorkspacesWindowFlag) != 0) {
|
2005-07-01 10:53:07 +04:00
|
|
|
// this is a workspaces window!
|
|
|
|
newLayer = new WorkspacesLayer(frame, name, token, resizeMask,
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
flags, fWinBorder->GetDisplayDriver());
|
2005-07-01 10:53:07 +04:00
|
|
|
} else {
|
|
|
|
newLayer = new Layer(frame, name, token, resizeMask,
|
2005-10-31 14:05:52 +03:00
|
|
|
flags, fDesktop->GetDisplayDriver());
|
2005-07-01 10:53:07 +04:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
free(name);
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// there is no way of setting this, other than manually :-)
|
2005-06-10 20:20:38 +04:00
|
|
|
newLayer->fViewColor = viewColor;
|
2005-05-26 19:04:45 +04:00
|
|
|
newLayer->fHidden = hidden;
|
|
|
|
newLayer->fEventMask = eventMask;
|
|
|
|
newLayer->fEventOptions = eventOptions;
|
|
|
|
newLayer->fOwner = fWinBorder;
|
2004-03-28 19:00:31 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2005-06-16 04:46:02 +04:00
|
|
|
if (_parent) {
|
|
|
|
Layer *parent = fWinBorder->FindLayer(parentToken);
|
|
|
|
if (parent == NULL)
|
|
|
|
CRITICAL("View token not found!\n");
|
|
|
|
|
|
|
|
*_parent = parent;
|
|
|
|
}
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2004-04-03 19:05:49 +04:00
|
|
|
return newLayer;
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
2003-02-24 18:47:06 +03:00
|
|
|
{
|
2005-06-16 04:46:02 +04:00
|
|
|
if (fCurrentLayer == NULL && code != AS_LAYER_CREATE_ROOT && code != AS_LAYER_CREATE) {
|
2005-06-23 22:48:10 +04:00
|
|
|
printf("ServerWindow %s received unexpected code - message offset %ld before top_view attached.\n", Title(), code - SERVER_TRUE);
|
2004-07-30 19:16:59 +04:00
|
|
|
return;
|
|
|
|
}
|
2005-01-22 23:51:12 +03:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
RootLayer *myRootLayer = fWinBorder->GetRootLayer();
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// NOTE: is NULL when fWinBorder is offscreen!
|
|
|
|
if (myRootLayer)
|
|
|
|
myRootLayer->Lock();
|
2005-01-22 23:51:12 +03:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
switch (code) {
|
2003-12-07 08:40:51 +03:00
|
|
|
//--------- BView Messages -----------------
|
2005-04-27 21:26:57 +04:00
|
|
|
case AS_LAYER_SCROLL:
|
2005-03-27 09:25:59 +04:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SCROLL: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-04-27 21:26:57 +04:00
|
|
|
float dh;
|
|
|
|
float dv;
|
2005-04-19 22:55:46 +04:00
|
|
|
|
2005-04-27 21:26:57 +04:00
|
|
|
link.Read<float>(&dh);
|
|
|
|
link.Read<float>(&dv);
|
2005-06-28 16:25:32 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-04-27 21:26:57 +04:00
|
|
|
// scroll visually by using the CopyBits() implementation
|
|
|
|
// this will also take care of invalidating previously invisible
|
|
|
|
// areas (areas scrolled into view)
|
2005-05-26 17:56:42 +04:00
|
|
|
BRect src = fCurrentLayer->Bounds();
|
2005-04-27 21:26:57 +04:00
|
|
|
BRect dst = src;
|
|
|
|
// NOTE: if we scroll down, the contents are moved *up*
|
|
|
|
dst.OffsetBy(-dh, -dv);
|
2005-04-26 17:50:34 +04:00
|
|
|
|
|
|
|
// TODO: Are origin and scale handled in this conversion?
|
2005-05-26 17:56:42 +04:00
|
|
|
src = fCurrentLayer->ConvertToTop(src);
|
|
|
|
dst = fCurrentLayer->ConvertToTop(dst);
|
2005-04-26 17:50:34 +04:00
|
|
|
|
|
|
|
int32 xOffset = (int32)(dst.left - src.left);
|
|
|
|
int32 yOffset = (int32)(dst.top - src.top);
|
|
|
|
|
2005-04-27 21:26:57 +04:00
|
|
|
// this little detail is where it differs from CopyBits()
|
|
|
|
// -> it will invalidate areas previously out of screen
|
|
|
|
dst = dst | src;
|
2005-04-26 17:50:34 +04:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
fCurrentLayer->fLayerData->OffsetOrigin(BPoint(dh, dv));
|
|
|
|
|
2005-06-28 19:34:54 +04:00
|
|
|
fCurrentLayer->CopyBits(src, dst, xOffset, yOffset);
|
2005-06-28 16:25:32 +04:00
|
|
|
#else
|
|
|
|
fCurrentLayer->ScrollBy(dh, dv);
|
|
|
|
#endif
|
2005-04-26 17:50:34 +04:00
|
|
|
|
2005-04-27 21:26:57 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_COPY_BITS:
|
|
|
|
{
|
|
|
|
BRect src;
|
|
|
|
BRect dst;
|
2005-04-26 17:50:34 +04:00
|
|
|
|
2005-04-27 21:26:57 +04:00
|
|
|
link.Read<BRect>(&src);
|
|
|
|
link.Read<BRect>(&dst);
|
2005-04-26 17:50:34 +04:00
|
|
|
|
2005-04-27 21:26:57 +04:00
|
|
|
// TODO: Are origin and scale handled in this conversion?
|
2005-05-26 17:56:42 +04:00
|
|
|
src = fCurrentLayer->ConvertToTop(src);
|
|
|
|
dst = fCurrentLayer->ConvertToTop(dst);
|
2005-04-27 21:26:57 +04:00
|
|
|
|
|
|
|
int32 xOffset = (int32)(dst.left - src.left);
|
|
|
|
int32 yOffset = (int32)(dst.top - src.top);
|
|
|
|
|
2005-06-28 19:34:54 +04:00
|
|
|
fCurrentLayer->CopyBits(src, dst, xOffset, yOffset);
|
2005-04-19 22:55:46 +04:00
|
|
|
|
2005-03-27 09:25:59 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
case AS_SET_CURRENT_LAYER:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
int32 token;
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&token);
|
2005-06-16 04:46:02 +04:00
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
Layer *current = fWinBorder->FindLayer(token);
|
2005-06-16 04:46:02 +04:00
|
|
|
if (current) {
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: %s, token %ld\n", fTitle, current->Name(), token));
|
2005-06-16 04:46:02 +04:00
|
|
|
} else {
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: layer not found, token %ld\n", fTitle, token));
|
2005-02-23 04:45:48 +03:00
|
|
|
}
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
if (current)
|
2005-06-16 04:46:02 +04:00
|
|
|
fCurrentLayer = current;
|
2003-09-09 01:18:39 +04:00
|
|
|
else // hope this NEVER happens! :-)
|
2005-05-26 03:59:23 +04:00
|
|
|
CRITICAL("Server PANIC: window cannot find Layer with ID\n");
|
2005-06-16 04:46:02 +04:00
|
|
|
// ToDo: if this happens, we probably want to kill the app and clean up
|
2003-09-09 01:18:39 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-07-30 19:16:59 +04:00
|
|
|
|
|
|
|
case AS_LAYER_CREATE_ROOT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CREATE_ROOT\n", fTitle));
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
// Start receiving top_view data -- pass NULL as the parent view.
|
|
|
|
// This should be the *only* place where this happens.
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer != NULL)
|
2004-07-30 19:16:59 +04:00
|
|
|
break;
|
2005-06-16 04:46:02 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
fWinBorder->SetTopLayer(CreateLayerTree(link, NULL));
|
|
|
|
fCurrentLayer = fWinBorder->TopLayer();
|
2004-07-30 19:16:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
case AS_LAYER_CREATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CREATE: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-06-16 04:46:02 +04:00
|
|
|
Layer* parent = NULL;
|
|
|
|
Layer* newLayer = CreateLayerTree(link, &parent);
|
|
|
|
if (parent != NULL)
|
|
|
|
parent->AddChild(newLayer, this);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer && !newLayer->IsHidden() && parent)
|
2005-06-16 23:44:55 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-06-22 00:11:44 +04:00
|
|
|
myRootLayer->GoInvalidate(newLayer, newLayer->fFull);
|
2005-06-16 23:44:55 +04:00
|
|
|
#else
|
2005-06-28 18:57:16 +04:00
|
|
|
{
|
|
|
|
BRegion invalidRegion;
|
|
|
|
newLayer->GetWantedRegion(invalidRegion);
|
|
|
|
myRootLayer->GoInvalidate(newLayer, invalidRegion);
|
|
|
|
}
|
2005-06-16 23:44:55 +04:00
|
|
|
#endif
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
case AS_LAYER_DELETE:
|
|
|
|
{
|
|
|
|
// Received when a view is detached from a window. This is definitely
|
|
|
|
// the less taxing operation - we call PruneTree() on the removed
|
|
|
|
// layer, detach the layer itself, delete it, and invalidate the
|
|
|
|
// area assuming that the view was visible when removed
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: AS_LAYER_DELETE(self)...\n", fTitle));
|
2005-07-05 22:46:59 +04:00
|
|
|
|
2005-06-28 18:57:16 +04:00
|
|
|
Layer *parent = fCurrentLayer->fParent;
|
|
|
|
BRegion *invalidRegion = NULL;
|
|
|
|
|
|
|
|
if (!fCurrentLayer->IsHidden() && parent) {
|
|
|
|
#ifndef NEW_CLIPPING
|
|
|
|
if (fCurrentLayer->fFullVisible.CountRects() > 0)
|
|
|
|
invalidRegion = new BRegion(fCurrentLayer->fFullVisible);
|
|
|
|
#else
|
|
|
|
if (fCurrentLayer->FullVisible().Frame().IsValid())
|
|
|
|
invalidRegion = new BRegion(fCurrentLayer->FullVisible());
|
|
|
|
#endif
|
|
|
|
}
|
2005-06-22 22:14:13 +04:00
|
|
|
|
2004-01-20 05:02:01 +03:00
|
|
|
// here we remove current layer from list.
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->RemoveSelf();
|
|
|
|
fCurrentLayer->PruneTree();
|
2005-06-22 22:14:13 +04:00
|
|
|
|
2005-07-07 18:04:29 +04:00
|
|
|
if (myRootLayer) {
|
|
|
|
|
|
|
|
myRootLayer->LayerRemoved(fCurrentLayer);
|
|
|
|
|
|
|
|
// trigger update
|
|
|
|
if (invalidRegion) {
|
|
|
|
myRootLayer->GoInvalidate(parent, *invalidRegion);
|
|
|
|
delete invalidRegion;
|
|
|
|
}
|
2005-06-28 18:57:16 +04:00
|
|
|
}
|
2005-06-24 03:46:17 +04:00
|
|
|
|
2004-08-08 00:30:58 +04:00
|
|
|
#ifdef DEBUG_SERVERWINDOW
|
2003-09-15 23:14:45 +04:00
|
|
|
parent->PrintTree();
|
2004-08-08 00:30:58 +04:00
|
|
|
#endif
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("DONE: ServerWindow %s: Message AS_DELETE_LAYER: Parent: %s Layer: %s\n", fTitle, parent->Name(), fCurrentLayer->Name()));
|
2003-06-24 17:55:18 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
delete fCurrentLayer;
|
2005-07-07 18:04:29 +04:00
|
|
|
// TODO: It is necessary to do this, but I find it very obscure.
|
2005-06-16 04:46:02 +04:00
|
|
|
fCurrentLayer = parent;
|
2003-06-24 17:55:18 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
case AS_LAYER_SET_STATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
// SetLayerState(fCurrentLayer);
|
|
|
|
SetLayerState(fCurrentLayer, link);
|
2005-04-19 04:42:42 +04:00
|
|
|
// TODO: should this be moved into SetLayerState?
|
|
|
|
// If it _always_ needs to be done afterwards, then yes!
|
2005-06-16 22:58:14 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->RebuildFullRegion();
|
2005-06-16 22:58:14 +04:00
|
|
|
#endif
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_FONT_STATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
// SetLayerFontState(fCurrentLayer);
|
|
|
|
SetLayerFontState(fCurrentLayer, link);
|
2005-06-16 22:58:14 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->RebuildFullRegion();
|
2005-06-16 22:58:14 +04:00
|
|
|
#endif
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_STATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_STATE: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-04-19 04:42:42 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-04-19 04:42:42 +04:00
|
|
|
|
|
|
|
// attach state data
|
2005-06-24 02:43:11 +04:00
|
|
|
fCurrentLayer->fLayerData->WriteToLink(fLink.Sender());
|
|
|
|
fLink.Flush();
|
2003-09-09 01:18:39 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-09-03 21:55:16 +04:00
|
|
|
case AS_LAYER_SET_EVENT_MASK:
|
2005-05-23 21:23:20 +04:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_MOUSE_EVENT_MASK: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-23 21:23:20 +04:00
|
|
|
|
|
|
|
uint32 mask;
|
|
|
|
uint32 options;
|
|
|
|
|
|
|
|
link.Read<uint32>(&mask);
|
|
|
|
link.Read<uint32>(&options);
|
|
|
|
|
2005-09-08 20:53:42 +04:00
|
|
|
fCurrentLayer->QuietlySetEventMask(mask);
|
|
|
|
fCurrentLayer->QuietlySetEventOptions(options);
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer)
|
2005-09-05 22:55:32 +04:00
|
|
|
myRootLayer->AddToInputNotificationLists(fCurrentLayer, mask, options);
|
2005-09-03 21:55:16 +04:00
|
|
|
}
|
|
|
|
case AS_LAYER_SET_MOUSE_EVENT_MASK:
|
|
|
|
{
|
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_MOUSE_EVENT_MASK: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
|
|
|
|
|
|
|
uint32 mask;
|
|
|
|
uint32 options;
|
|
|
|
|
|
|
|
link.Read<uint32>(&mask);
|
|
|
|
link.Read<uint32>(&options);
|
|
|
|
|
|
|
|
if (myRootLayer)
|
2005-09-05 22:55:32 +04:00
|
|
|
myRootLayer->SetNotifyLayer(fCurrentLayer, mask, options);
|
2005-05-23 21:23:20 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-06-28 22:56:55 +04:00
|
|
|
case AS_LAYER_MOVE_TO:
|
2003-09-25 16:31:11 +04:00
|
|
|
{
|
2005-06-28 22:56:55 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_MOVE_TO: Layer name: %s\n",
|
|
|
|
fTitle, fCurrentLayer->Name()));
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
float x, y;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x);
|
|
|
|
link.Read<float>(&y);
|
2005-04-28 13:44:29 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
float offsetX = x - fCurrentLayer->fFrame.left;
|
|
|
|
float offsetY = y - fCurrentLayer->fFrame.top;
|
2005-04-28 13:44:29 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->MoveBy(offsetX, offsetY);
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-06-28 22:56:55 +04:00
|
|
|
case AS_LAYER_RESIZE_TO:
|
2003-09-25 16:31:11 +04:00
|
|
|
{
|
2005-06-28 22:56:55 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_TO: Layer name: %s\n",
|
|
|
|
fTitle, fCurrentLayer->Name()));
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
float newWidth, newHeight;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&newWidth);
|
|
|
|
link.Read<float>(&newHeight);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
// TODO: If fCurrentLayer is a window, check for minimum size allowed.
|
2005-04-28 13:44:29 +04:00
|
|
|
// Need WinBorder::GetSizeLimits
|
2005-05-26 17:56:42 +04:00
|
|
|
float deltaWidth = newWidth - fCurrentLayer->fFrame.Width();
|
|
|
|
float deltaHeight = newHeight - fCurrentLayer->fFrame.Height();
|
2005-04-28 13:44:29 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->ResizeBy(deltaWidth, deltaHeight);
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_COORD:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-04-28 03:20:29 +04:00
|
|
|
// our offset in the parent -> will be originX and originY in BView
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Attach<float>(fCurrentLayer->fFrame.left);
|
|
|
|
fLink.Attach<float>(fCurrentLayer->fFrame.top);
|
2005-04-28 03:20:29 +04:00
|
|
|
// convert frame to bounds
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Attach<BRect>(fCurrentLayer->fFrame.OffsetToCopy(fCurrentLayer->BoundsOrigin()));
|
|
|
|
fLink.Flush();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
case AS_LAYER_SET_ORIGIN:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_ORIGIN: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
float x, y;
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x);
|
|
|
|
link.Read<float>(&y);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetOrigin(BPoint(x, y));
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_ORIGIN:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<BPoint>(fCurrentLayer->fLayerData->Origin());
|
|
|
|
fLink.Flush();
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_RESIZE_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
link.Read<uint32>(&(fCurrentLayer->fResizeMode));
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CURSOR:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: Layer: %s - NOT IMPLEMENTED\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 token;
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&token);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-01-19 21:00:05 +03:00
|
|
|
// TODO: implement; I think each Layer should have a member pointing
|
|
|
|
// to this requested cursor.
|
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_SET_FLAGS:
|
|
|
|
{
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
uint32 flags;
|
|
|
|
link.Read<uint32>(&flags);
|
|
|
|
fCurrentLayer->SetFlags(flags);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_HIDE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_HIDE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->Hide();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SHOW:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SHOW: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->Show();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_LINE_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_LINE_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int8 lineCap, lineJoin;
|
2005-04-19 04:42:42 +04:00
|
|
|
float miterLimit;
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Look into locking scheme relating to Layers and modifying redraw-related members
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int8>(&lineCap);
|
|
|
|
link.Read<int8>(&lineJoin);
|
2005-04-19 04:42:42 +04:00
|
|
|
link.Read<float>(&miterLimit);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetLineCapMode((cap_mode)lineCap);
|
|
|
|
fCurrentLayer->fLayerData->SetLineJoinMode((join_mode)lineJoin);
|
|
|
|
fCurrentLayer->fLayerData->SetMiterLimit(miterLimit);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_LINE_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_LINE_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<int8>((int8)(fCurrentLayer->fLayerData->LineCapMode()));
|
|
|
|
fLink.Attach<int8>((int8)(fCurrentLayer->fLayerData->LineJoinMode()));
|
|
|
|
fLink.Attach<float>(fCurrentLayer->fLayerData->MiterLimit());
|
|
|
|
fLink.Flush();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_PUSH_STATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_PUSH_STATE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2005-06-10 19:28:34 +04:00
|
|
|
fCurrentLayer->PushState();
|
2005-06-16 22:58:14 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->RebuildFullRegion();
|
2005-06-16 22:58:14 +04:00
|
|
|
#endif
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_POP_STATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_POP_STATE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2005-06-10 19:28:34 +04:00
|
|
|
fCurrentLayer->PopState();
|
2005-06-16 22:58:14 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->RebuildFullRegion();
|
2005-06-16 22:58:14 +04:00
|
|
|
#endif
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_SCALE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-04-19 04:42:42 +04:00
|
|
|
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
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetScale(scale);
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_SCALE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_SCALE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-05-26 17:56:42 +04:00
|
|
|
LayerData *ld = fCurrentLayer->fLayerData;
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-04-19 04:42:42 +04:00
|
|
|
// 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 = ld->Scale();
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2005-04-19 04:42:42 +04:00
|
|
|
while ((ld = ld->prevState))
|
|
|
|
scale *= ld->Scale();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<float>(scale);
|
|
|
|
fLink.Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_PEN_LOC:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_LOC: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2003-09-25 16:31:11 +04:00
|
|
|
float x, y;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x);
|
|
|
|
link.Read<float>(&y);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetPenLocation(BPoint(x, y));
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_PEN_LOC:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_LOC: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<BPoint>(fCurrentLayer->fLayerData->PenLocation());
|
|
|
|
fLink.Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_PEN_SIZE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_SIZE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-04-19 04:42:42 +04:00
|
|
|
float penSize;
|
|
|
|
link.Read<float>(&penSize);
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetPenSize(penSize);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_PEN_SIZE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<float>(fCurrentLayer->fLayerData->PenSize());
|
|
|
|
fLink.Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_VIEW_COLOR:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
rgb_color c;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(&c, sizeof(rgb_color));
|
2005-06-28 18:57:16 +04:00
|
|
|
myRootLayer->Lock();
|
2005-06-10 20:20:38 +04:00
|
|
|
fCurrentLayer->SetViewColor(RGBColor(c));
|
2005-04-19 04:42:42 +04:00
|
|
|
|
2005-06-17 00:43:53 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer)
|
|
|
|
myRootLayer->GoRedraw(fCurrentLayer, fCurrentLayer->fVisible);
|
2005-06-28 18:57:16 +04:00
|
|
|
#else
|
|
|
|
myRootLayer->GoRedraw(fCurrentLayer, fCurrentLayer->VisibleRegion());
|
2005-06-17 00:43:53 +04:00
|
|
|
#endif
|
2005-06-28 18:57:16 +04:00
|
|
|
myRootLayer->Unlock();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-06-28 22:56:55 +04:00
|
|
|
|
|
|
|
case AS_LAYER_GET_HIGH_COLOR:
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_HIGH_COLOR: Layer: %s\n",
|
|
|
|
Title(), fCurrentLayer->Name()));
|
|
|
|
|
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<rgb_color>(fCurrentLayer->fLayerData->HighColor().GetColor32());
|
|
|
|
fLink.Flush();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AS_LAYER_GET_LOW_COLOR:
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_LOW_COLOR: Layer: %s\n",
|
|
|
|
Title(), fCurrentLayer->Name()));
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-06-28 22:56:55 +04:00
|
|
|
fLink.Attach<rgb_color>(fCurrentLayer->fLayerData->LowColor().GetColor32());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2005-06-28 22:56:55 +04:00
|
|
|
break;
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-06-28 22:56:55 +04:00
|
|
|
case AS_LAYER_GET_VIEW_COLOR:
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_VIEW_COLOR: Layer: %s\n",
|
|
|
|
Title(), fCurrentLayer->Name()));
|
|
|
|
|
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<rgb_color>(fCurrentLayer->ViewColor().GetColor32());
|
|
|
|
fLink.Flush();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
2005-06-28 22:56:55 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_SET_BLEND_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_BLEND_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int8 srcAlpha, alphaFunc;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int8>(&srcAlpha);
|
|
|
|
link.Read<int8>(&alphaFunc);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetBlendingMode((source_alpha)srcAlpha,
|
2005-04-19 04:42:42 +04:00
|
|
|
(alpha_function)alphaFunc);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_BLEND_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_BLEND_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<int8>((int8)(fCurrentLayer->fLayerData->AlphaSrcMode()));
|
|
|
|
fLink.Attach<int8>((int8)(fCurrentLayer->fLayerData->AlphaFncMode()));
|
|
|
|
fLink.Flush();
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_DRAW_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_DRAW_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int8 drawingMode;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int8>(&drawingMode);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetDrawingMode((drawing_mode)drawingMode);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_DRAW_MODE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_DRAW_MODE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<int8>((int8)(fCurrentLayer->fLayerData->GetDrawingMode()));
|
|
|
|
fLink.Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_PRINT_ALIASING:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_PRINT_ALIASING: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-04-19 04:42:42 +04:00
|
|
|
bool fontAliasing;
|
|
|
|
link.Read<bool>(&fontAliasing);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
fCurrentLayer->fLayerData->SetForceFontAliasing(fontAliasing);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CLIP_TO_PICTURE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-03-19 21:58:47 +03:00
|
|
|
// TODO: you are not allowed to use Layer regions here!!!
|
|
|
|
// If there is no other way, then first lock RootLayer object first.
|
2005-06-03 18:20:10 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 pictureToken;
|
|
|
|
BPoint where;
|
2005-06-03 18:20:10 +04:00
|
|
|
bool inverse = false;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&pictureToken);
|
|
|
|
link.Read<BPoint>(&where);
|
2005-06-03 18:20:10 +04:00
|
|
|
link.Read<bool>(&inverse);
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// search for a picture with the specified token.
|
2005-06-03 18:20:10 +04:00
|
|
|
ServerPicture *picture = fServerApp->FindPicture(pictureToken);
|
2005-05-14 17:22:26 +04:00
|
|
|
// TODO: Increase that picture's reference count.(~ allocate a picture)
|
2005-06-03 18:20:10 +04:00
|
|
|
if (picture == NULL)
|
2005-05-14 17:22:26 +04:00
|
|
|
break;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-06-03 18:20:10 +04:00
|
|
|
BRegion region;
|
|
|
|
// TODO: I think we also need the BView's token
|
|
|
|
// I think PictureToRegion would fit better into the Layer class (?)
|
|
|
|
if (PictureToRegion(picture, region, inverse, where) < B_OK)
|
2005-05-14 17:22:26 +04:00
|
|
|
break;
|
2005-06-25 19:45:58 +04:00
|
|
|
|
2005-06-03 18:20:10 +04:00
|
|
|
fCurrentLayer->fLayerData->SetClippingRegion(region);
|
|
|
|
|
2005-06-16 22:58:14 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-06-03 18:20:10 +04:00
|
|
|
fCurrentLayer->RebuildFullRegion();
|
2005-06-16 22:58:14 +04:00
|
|
|
#endif
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate())
|
2005-06-16 23:44:55 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-06-22 00:11:44 +04:00
|
|
|
myRootLayer->GoInvalidate(fCurrentLayer, fCurrentLayer->fFull);
|
2005-06-16 23:44:55 +04:00
|
|
|
#else
|
2005-06-28 18:57:16 +04:00
|
|
|
{
|
|
|
|
BRegion invalidRegion;
|
|
|
|
fCurrentLayer->GetWantedRegion(invalidRegion);
|
|
|
|
myRootLayer->GoInvalidate(fCurrentLayer, invalidRegion);
|
|
|
|
}
|
2005-06-16 23:44:55 +04:00
|
|
|
#endif
|
2005-06-03 18:20:10 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-06-03 18:20:10 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_GET_CLIP_REGION:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_CLIP_REGION: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2004-06-16 10:40:26 +04:00
|
|
|
// if this Layer is hidden, it is clear that its visible region is void.
|
2005-07-05 05:19:01 +04:00
|
|
|
if (fCurrentLayer->IsHidden()) {
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<int32>(0L);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
fLink.Flush();
|
2005-07-05 05:19:01 +04:00
|
|
|
} else {
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Watch out for the coordinate system in AS_LAYER_GET_CLIP_REGION
|
2005-07-11 01:16:43 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-07-08 12:48:24 +04:00
|
|
|
int32 rectCount = fCurrentLayer->fVisible.CountRects();
|
2005-07-11 01:16:43 +04:00
|
|
|
#else
|
|
|
|
int32 rectCount = fCurrentLayer->fVisible2.CountRects();
|
|
|
|
#endif
|
2005-07-05 05:19:01 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-07-05 05:19:01 +04:00
|
|
|
fLink.Attach<int32>(rectCount);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-07-05 05:19:01 +04:00
|
|
|
for (int32 i = 0; i < rectCount; i++)
|
2005-07-11 01:16:43 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-07-08 12:48:24 +04:00
|
|
|
fLink.Attach<BRect>(fCurrentLayer->ConvertFromTop(fCurrentLayer->fVisible.RectAt(i)));
|
2005-07-11 01:16:43 +04:00
|
|
|
#else
|
|
|
|
fLink.Attach<BRect>(fCurrentLayer->ConvertFromTop(fCurrentLayer->fVisible2.RectAt(i)));
|
|
|
|
#endif
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
|
|
|
fLink.Flush();
|
2004-06-16 10:40:26 +04:00
|
|
|
}
|
2005-07-05 05:19:01 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_CLIP_REGION:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_CLIP_REGION: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
|
|
|
// TODO: Watch out for the coordinate system in AS_LAYER_SET_CLIP_REGION
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 noOfRects;
|
|
|
|
BRect r;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&noOfRects);
|
2005-04-19 04:42:42 +04:00
|
|
|
|
|
|
|
BRegion region;
|
2005-06-24 02:43:11 +04:00
|
|
|
for (int i = 0; i < noOfRects; i++) {
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&r);
|
2005-07-06 22:05:56 +04:00
|
|
|
region.Include(fCurrentLayer->ConvertToTop(r));
|
2003-09-25 16:31:11 +04:00
|
|
|
}
|
2005-07-08 12:48:24 +04:00
|
|
|
// TODO: Turned off user clipping for now (will probably not harm anything but performance right now)
|
|
|
|
// We need to integrate user clipping more, in Layer::PopState, the clipping needs to be
|
|
|
|
// 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->fLayerData->SetClippingRegion(region);
|
2005-07-06 22:05:56 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-07-08 12:48:24 +04:00
|
|
|
// TODO: set the clipping
|
|
|
|
// fCurrentLayer->fVisible.IntersectWith(®ion);
|
2005-07-06 22:05:56 +04:00
|
|
|
#endif
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
/*
|
2005-06-16 22:58:14 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->RebuildFullRegion();
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate())
|
2005-06-22 00:11:44 +04:00
|
|
|
myRootLayer->GoInvalidate(fCurrentLayer, fCurrentLayer->fFull);
|
2005-06-16 23:44:55 +04:00
|
|
|
#else
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer && !(fCurrentLayer->IsHidden()) && !fWinBorder->InUpdate())
|
2005-06-22 00:11:44 +04:00
|
|
|
myRootLayer->GoInvalidate(fCurrentLayer, fCurrentLayer->Frame());
|
2005-06-16 23:44:55 +04:00
|
|
|
#endif
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
*/
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
case AS_LAYER_INVAL_RECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2005-04-15 04:31:39 +04:00
|
|
|
// TODO: handle transformation (origin and scale) prior to converting to top
|
2003-09-25 21:25:38 +04:00
|
|
|
BRect invalRect;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&invalRect);
|
2005-01-22 23:51:12 +03:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer) {
|
|
|
|
BRect converted(fCurrentLayer->ConvertToTop(invalRect.LeftTop()),
|
|
|
|
fCurrentLayer->ConvertToTop(invalRect.RightBottom()));
|
|
|
|
BRegion invalidRegion(converted);
|
|
|
|
#ifdef NEW_CLIPPING
|
|
|
|
invalidRegion.IntersectWith(&fCurrentLayer->fVisible2);
|
|
|
|
#endif
|
|
|
|
myRootLayer->GoRedraw(fWinBorder, invalidRegion);
|
|
|
|
// myRootLayer->RequestDraw(invalidRegion, fWinBorder);
|
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_INVAL_REGION:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2005-04-19 04:42:42 +04:00
|
|
|
// TODO: handle transformation (origin and scale) prior to converting to top
|
|
|
|
// TODO: Handle conversion to top
|
2004-06-11 18:47:36 +04:00
|
|
|
BRegion invalReg;
|
|
|
|
int32 noOfRects;
|
|
|
|
BRect rect;
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&noOfRects);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
for (int i = 0; i < noOfRects; i++) {
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2003-12-07 08:40:51 +03:00
|
|
|
invalReg.Include(rect);
|
2003-09-25 21:25:38 +04:00
|
|
|
}
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
|
|
|
if (myRootLayer)
|
|
|
|
myRootLayer->GoRedraw(fCurrentLayer, invalReg);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-07-06 00:37:13 +04:00
|
|
|
case AS_BEGIN_UPDATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindowo %s: AS_BEGIN_UPDATE\n", Title()));
|
2005-03-31 20:48:51 +04:00
|
|
|
fWinBorder->UpdateStart();
|
2004-07-06 00:37:13 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_END_UPDATE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindowo %s: AS_END_UPDATE\n", Title()));
|
2005-03-31 20:48:51 +04:00
|
|
|
fWinBorder->UpdateEnd();
|
2004-07-06 00:37:13 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// ********** END: BView Messages ***********
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// ********* BWindow Messages ***********
|
2003-06-24 17:55:18 +04:00
|
|
|
case AS_LAYER_DELETE_ROOT:
|
|
|
|
{
|
|
|
|
// Received when a window deletes its internal top view
|
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_LAYER_DELETE_ROOT
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Delete_Layer_Root unimplemented\n", Title()));
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SHOW_WINDOW:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_SHOW_WINDOW\n", Title()));
|
2003-02-24 18:47:06 +03:00
|
|
|
Show();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_HIDE_WINDOW:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_HIDE_WINDOW\n", Title()));
|
2003-02-24 18:47:06 +03:00
|
|
|
Hide();
|
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SEND_BEHIND:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Send_Behind unimplemented\n", Title()));
|
2005-10-30 14:33:31 +03:00
|
|
|
int32 token;
|
|
|
|
team_id teamID;
|
|
|
|
status_t status = B_NAME_NOT_FOUND;
|
|
|
|
|
|
|
|
link.Read<int32>(&token);
|
|
|
|
link.Read<team_id>(&teamID);
|
|
|
|
|
2005-10-31 14:05:52 +03:00
|
|
|
WinBorder *behindOf;
|
|
|
|
if ((behindOf = fDesktop->FindWinBorderByClientToken(token, teamID)) != NULL) {
|
2005-10-30 14:33:31 +03:00
|
|
|
fWinBorder->GetRootLayer()->Lock();
|
|
|
|
// TODO: move to back ATM. Fix this later!
|
|
|
|
fWinBorder->GetRootLayer()->SetActive(fWinBorder, false);
|
|
|
|
fWinBorder->GetRootLayer()->Unlock();
|
|
|
|
status = B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
fLink.StartMessage(status);
|
|
|
|
fLink.Flush();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_ENABLE_UPDATES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Enable_Updates unimplemented\n", Title()));
|
2005-10-30 14:33:31 +03:00
|
|
|
fWinBorder->EnableUpdateRequests();
|
|
|
|
if (fWinBorder->CulmulatedUpdateRegion().Frame().IsValid()) {
|
|
|
|
BRegion reg(fWinBorder->CulmulatedUpdateRegion());
|
|
|
|
fWinBorder->RequestDraw(reg, NULL);
|
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_DISABLE_UPDATES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Disable_Updates unimplemented\n", Title()));
|
2005-10-30 14:33:31 +03:00
|
|
|
fWinBorder->DisableUpdateRequests();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_NEEDS_UPDATE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Needs_Update unimplemented\n", Title()));
|
2005-10-30 14:33:31 +03:00
|
|
|
if (fWinBorder->CulmulatedUpdateRegion().Frame().IsValid())
|
|
|
|
fLink.StartMessage(B_OK);
|
|
|
|
else
|
|
|
|
fLink.StartMessage(B_ERROR);
|
|
|
|
fLink.Flush();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-07-05 23:20:19 +04:00
|
|
|
case AS_SET_WINDOW_TITLE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-07-01 22:29:20 +04:00
|
|
|
char* newTitle;
|
|
|
|
if (link.ReadString(&newTitle) == B_OK) {
|
2005-07-05 23:20:19 +04:00
|
|
|
SetTitle(newTitle);
|
2005-07-01 22:29:20 +04:00
|
|
|
free(newTitle);
|
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-07-01 22:29:20 +04:00
|
|
|
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_ADD_TO_SUBSET:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_ADD_TO_SUBSET\n", Title()));
|
2005-07-05 22:14:24 +04:00
|
|
|
WinBorder *windowBorder;
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 mainToken;
|
|
|
|
team_id teamID;
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&mainToken);
|
|
|
|
link.Read(&teamID, sizeof(team_id));
|
2005-06-15 01:28:56 +04:00
|
|
|
|
2005-10-31 14:05:52 +03:00
|
|
|
windowBorder = fDesktop->FindWinBorderByClientToken(mainToken, teamID);
|
2005-07-05 22:14:24 +04:00
|
|
|
if (windowBorder) {
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Flush();
|
2005-03-14 01:54:01 +03:00
|
|
|
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->Lock();
|
2005-10-31 14:05:52 +03:00
|
|
|
fDesktop->AddWinBorderToSubset(fWinBorder, windowBorder);
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->Unlock();
|
2005-06-15 01:28:56 +04:00
|
|
|
} else {
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_FALSE);
|
|
|
|
fLink.Flush();
|
2004-01-14 03:26:15 +03:00
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_REM_FROM_SUBSET:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_REM_FROM_SUBSET\n", Title()));
|
2005-07-05 22:14:24 +04:00
|
|
|
WinBorder *windowBorder;
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 mainToken;
|
|
|
|
team_id teamID;
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&mainToken);
|
|
|
|
link.Read(&teamID, sizeof(team_id));
|
2004-01-17 19:33:22 +03:00
|
|
|
|
2005-10-31 14:05:52 +03:00
|
|
|
windowBorder = fDesktop->FindWinBorderByClientToken(mainToken, teamID);
|
2005-07-05 22:14:24 +04:00
|
|
|
if (windowBorder) {
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Flush();
|
2005-06-15 01:28:56 +04:00
|
|
|
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->Lock();
|
2005-10-31 14:05:52 +03:00
|
|
|
fDesktop->RemoveWinBorderFromSubset(fWinBorder, windowBorder);
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->Unlock();
|
2005-06-15 01:28:56 +04:00
|
|
|
} else {
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_FALSE);
|
|
|
|
fLink.Flush();
|
2004-01-17 19:33:22 +03:00
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-07-01 12:50:45 +04:00
|
|
|
#if 0
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_LOOK:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_LOOK
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Look unimplemented\n", Title()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_FLAGS:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_FLAGS
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Flags unimplemented\n", Title()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_FEEL:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_SET_FEEL\n", Title()));
|
2005-06-15 01:28:56 +04:00
|
|
|
int32 newFeel;
|
2005-04-21 22:57:34 +04:00
|
|
|
link.Read<int32>(&newFeel);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->GoChangeWinBorderFeel(winBorder, newFeel);
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_ALIGNMENT:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_ALIGNMENT
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Alignment unimplemented\n", Title()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_GET_ALIGNMENT:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_GET_ALIGNMENT
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Get_Alignment unimplemented\n", Title()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-07-01 12:50:45 +04:00
|
|
|
#endif
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_GET_WORKSPACES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Get_Workspaces unimplemented\n", Title()));
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Attach<uint32>(fWinBorder->Workspaces());
|
|
|
|
fLink.Flush();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_WORKSPACES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Workspaces unimplemented\n", Title()));
|
2005-06-15 01:28:56 +04:00
|
|
|
uint32 newWorkspaces;
|
2005-04-16 17:30:49 +04:00
|
|
|
link.Read<uint32>(&newWorkspaces);
|
2005-04-10 23:04:06 +04:00
|
|
|
|
2005-10-24 20:02:23 +04:00
|
|
|
fWinBorder->GetRootLayer()->Lock();
|
|
|
|
fWinBorder->GetRootLayer()->SetWinBorderWorskpaces( fWinBorder,
|
|
|
|
fWinBorder->Workspaces(),
|
|
|
|
newWorkspaces);
|
|
|
|
fWinBorder->GetRootLayer()->Unlock();
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-04-18 23:58:43 +04:00
|
|
|
case AS_WINDOW_RESIZE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
float xResizeBy;
|
|
|
|
float yResizeBy;
|
2004-05-16 23:24:18 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&xResizeBy);
|
|
|
|
link.Read<float>(&yResizeBy);
|
2005-04-28 16:31:25 +04:00
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy));
|
2004-05-16 23:24:18 +04:00
|
|
|
|
|
|
|
fWinBorder->ResizeBy(xResizeBy, yResizeBy);
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2004-06-18 23:13:06 +04:00
|
|
|
case AS_WINDOW_MOVE:
|
|
|
|
{
|
|
|
|
float xMoveBy;
|
|
|
|
float yMoveBy;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&xMoveBy);
|
|
|
|
link.Read<float>(&yMoveBy);
|
2004-06-18 23:13:06 +04:00
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy));
|
2005-04-28 16:31:25 +04:00
|
|
|
|
2004-06-18 23:13:06 +04:00
|
|
|
fWinBorder->MoveBy(xMoveBy, yMoveBy);
|
|
|
|
break;
|
|
|
|
}
|
2004-08-08 00:30:58 +04:00
|
|
|
case AS_SET_SIZE_LIMITS:
|
|
|
|
{
|
|
|
|
// Attached Data:
|
|
|
|
// 1) float minimum width
|
|
|
|
// 2) float maximum width
|
|
|
|
// 3) float minimum height
|
|
|
|
// 4) float maximum height
|
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
float minWidth;
|
|
|
|
float maxWidth;
|
|
|
|
float minHeight;
|
|
|
|
float maxHeight;
|
2004-08-08 00:30:58 +04:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
link.Read<float>(&minWidth);
|
|
|
|
link.Read<float>(&maxWidth);
|
|
|
|
link.Read<float>(&minHeight);
|
|
|
|
link.Read<float>(&maxHeight);
|
2004-08-08 00:30:58 +04:00
|
|
|
|
2005-06-03 23:50:30 +04:00
|
|
|
fWinBorder->SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
|
|
|
|
|
|
|
|
// and now, sync the client to the limits that we were able to enforce
|
|
|
|
fWinBorder->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-07-18 13:53:37 +04:00
|
|
|
fLink.Attach<BRect>(fWinBorder->Frame());
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Attach<float>(minWidth);
|
|
|
|
fLink.Attach<float>(maxWidth);
|
|
|
|
fLink.Attach<float>(minHeight);
|
|
|
|
fLink.Attach<float>(maxHeight);
|
2005-06-03 23:50:30 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2004-08-08 00:30:58 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-10-06 14:45:46 +04:00
|
|
|
case AS_ACTIVATE_WINDOW:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2005-10-06 14:45:46 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_ACTIVATE_WINDOW: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2005-10-29 14:19:23 +04:00
|
|
|
bool activate = true;
|
|
|
|
|
|
|
|
link.Read<bool>(&activate);
|
|
|
|
|
2005-10-06 14:45:46 +04:00
|
|
|
if (myRootLayer && myRootLayer->Lock()) {
|
2005-10-29 14:19:23 +04:00
|
|
|
myRootLayer->SetActive(fWinBorder, activate);
|
2005-10-06 14:45:46 +04:00
|
|
|
myRootLayer->Unlock();
|
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2005-05-20 04:09:59 +04:00
|
|
|
// Some BView drawing messages, but which don't need clipping
|
2004-09-15 02:21:26 +04:00
|
|
|
case AS_LAYER_SET_HIGH_COLOR:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-09-15 02:21:26 +04:00
|
|
|
rgb_color c;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(&c, sizeof(rgb_color));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetHighColor(RGBColor(c));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_LOW_COLOR:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_LOW_COLOR: Layer: %s\n", Title(), fCurrentLayer->Name()));
|
2004-09-15 02:21:26 +04:00
|
|
|
rgb_color c;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(&c, sizeof(rgb_color));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetLowColor(RGBColor(c));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2005-03-27 08:08:33 +04:00
|
|
|
case AS_LAYER_SET_PATTERN:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PATTERN: Layer: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-03-27 08:08:33 +04:00
|
|
|
pattern pat;
|
|
|
|
|
|
|
|
link.Read(&pat, sizeof(pattern));
|
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetPattern(Pattern(pat));
|
2005-03-27 08:08:33 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2005-05-20 04:09:59 +04:00
|
|
|
case AS_MOVEPENTO:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_MOVEPENTO\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
|
|
|
|
float x,y;
|
|
|
|
|
|
|
|
link.Read<float>(&x);
|
|
|
|
link.Read<float>(&y);
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
|
|
|
fCurrentLayer->fLayerData->SetPenLocation(BPoint(x, y));
|
2005-05-20 04:09:59 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SETPENSIZE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SETPENSIZE\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
float size;
|
|
|
|
|
|
|
|
link.Read<float>(&size);
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
|
|
|
fCurrentLayer->fLayerData->SetPenSize(size);
|
2005-05-20 04:09:59 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_FONT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_FONT\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
// TODO: Implement AS_SET_FONT?
|
|
|
|
// Confusing!! But it works already!
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_FONT_SIZE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_FONT_SIZE\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
// TODO: Implement AS_SET_FONT_SIZE?
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_AREA_MESSAGE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_AREA_MESSAGE\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
// This occurs in only one kind of case: a message is too big to send over a port. This
|
|
|
|
// is really an edge case, so this shouldn't happen *too* often
|
|
|
|
|
|
|
|
// Attached Data:
|
|
|
|
// 1) area_id id of an area already owned by the server containing the message
|
|
|
|
// 2) size_t offset of the pointer in the area
|
|
|
|
// 3) size_t size of the message
|
|
|
|
|
|
|
|
area_id area;
|
|
|
|
size_t offset;
|
|
|
|
size_t msgsize;
|
|
|
|
area_info ai;
|
|
|
|
int8 *msgpointer;
|
|
|
|
|
|
|
|
link.Read<area_id>(&area);
|
|
|
|
link.Read<size_t>(&offset);
|
|
|
|
link.Read<size_t>(&msgsize);
|
|
|
|
|
|
|
|
// Part sanity check, part get base pointer :)
|
|
|
|
if(get_area_info(area,&ai)!=B_OK)
|
|
|
|
break;
|
2005-06-24 02:43:11 +04:00
|
|
|
|
|
|
|
msgpointer = (int8*)ai.address + offset;
|
|
|
|
|
2005-05-20 04:09:59 +04:00
|
|
|
RAMLinkMsgReader mlink(msgpointer);
|
2005-06-24 02:43:11 +04:00
|
|
|
_DispatchMessage(mlink.Code(), mlink);
|
|
|
|
|
2005-05-20 04:09:59 +04:00
|
|
|
// This is a very special case in the sense that when ServerMemIO is used for this
|
|
|
|
// purpose, it will be set to NOT automatically free the memory which it had
|
|
|
|
// requested. This is the server's job once the message has been dispatched.
|
|
|
|
fServerApp->AppAreaPool()->ReleaseBuffer(msgpointer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SYNC:
|
|
|
|
{
|
|
|
|
// TODO: AS_SYNC is a no-op for now, just to get things working
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
fLink.Flush();
|
2005-05-20 04:09:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAG_IMAGE:
|
|
|
|
{
|
|
|
|
// TODO: Implement AS_LAYER_DRAG_IMAGE
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_DRAG_IMAGE unimplemented\n", Title()));
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_DRAG_IMAGE unimplemented\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAG_RECT:
|
|
|
|
{
|
|
|
|
// TODO: Implement AS_LAYER_DRAG_RECT
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_DRAG_RECT unimplemented\n", Title()));
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_DRAG_RECT unimplemented\n", Title()));
|
2005-05-20 04:09:59 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_MOUSE_COORDS:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_GET_MOUSE_COORDS\n", fTitle));
|
2005-05-20 06:42:52 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
2005-05-20 06:42:52 +04:00
|
|
|
|
2005-05-20 04:09:59 +04:00
|
|
|
// Returns
|
|
|
|
// 1) BPoint mouse location
|
|
|
|
// 2) int32 button state
|
2005-05-20 06:42:52 +04:00
|
|
|
|
2005-10-31 14:05:52 +03:00
|
|
|
fLink.Attach<BPoint>(fDesktop->GetHWInterface()->GetCursorPosition());
|
|
|
|
fLink.Attach<int32>(fDesktop->ActiveRootLayer()->Buttons());
|
2005-05-20 06:42:52 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
fLink.Flush();
|
2005-05-20 04:09:59 +04:00
|
|
|
break;
|
|
|
|
}
|
2005-10-11 09:25:52 +04:00
|
|
|
|
|
|
|
case AS_DW_GET_SYNC_DATA:
|
|
|
|
{
|
|
|
|
// TODO: Use token or get rid of it.
|
|
|
|
int32 serverToken;
|
|
|
|
link.Read<int32>(&serverToken);
|
|
|
|
|
|
|
|
if (_EnableDirectWindowMode() == B_OK) {
|
|
|
|
fLink.StartMessage(SERVER_TRUE);
|
|
|
|
struct dw_sync_data syncData = {
|
|
|
|
fDirectWindowData->direct_area,
|
|
|
|
fDirectWindowData->direct_sem,
|
|
|
|
fDirectWindowData->direct_sem_ack
|
|
|
|
};
|
|
|
|
|
|
|
|
fLink.Attach(&syncData, sizeof(syncData));
|
|
|
|
|
|
|
|
} else
|
|
|
|
fLink.StartMessage(SERVER_FALSE);
|
|
|
|
|
|
|
|
fLink.Flush();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-05-20 04:09:59 +04:00
|
|
|
default:
|
2005-06-24 02:43:11 +04:00
|
|
|
_DispatchGraphicsMessage(code, link);
|
2005-05-20 06:42:52 +04:00
|
|
|
break;
|
2005-05-20 04:09:59 +04:00
|
|
|
}
|
2005-06-28 07:23:16 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
if (myRootLayer)
|
|
|
|
myRootLayer->Unlock();
|
2005-05-20 04:09:59 +04:00
|
|
|
}
|
2005-06-15 01:28:56 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// -------------------- Graphics messages ----------------------------------
|
2005-06-15 01:28:56 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
void
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow::_DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
|
2005-05-20 04:09:59 +04:00
|
|
|
{
|
2005-06-17 00:43:53 +04:00
|
|
|
#ifndef NEW_CLIPPING
|
2005-06-25 19:45:58 +04:00
|
|
|
BRegion rreg(fCurrentLayer->fVisible);
|
|
|
|
#else
|
|
|
|
BRegion rreg(fCurrentLayer->fVisible2);
|
2005-06-17 00:43:53 +04:00
|
|
|
#endif
|
2005-06-25 19:45:58 +04:00
|
|
|
|
2005-06-25 17:09:19 +04:00
|
|
|
if (fWinBorder->InUpdate())
|
|
|
|
rreg.IntersectWith(&fWinBorder->RegionToBeUpdated());
|
2005-05-20 04:09:59 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
DisplayDriver* driver = fWinBorder->GetDisplayDriver();
|
|
|
|
|
|
|
|
driver->ConstrainClippingRegion(&rreg);
|
2005-05-26 17:56:42 +04:00
|
|
|
// rgb_color rrr = fCurrentLayer->fLayerData->viewcolor.GetColor32();
|
2005-05-20 04:09:59 +04:00
|
|
|
// RGBColor c(rand()%255,rand()%255,rand()%255);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// driver->FillRect(BRect(0,0,639,479), c);
|
2005-05-20 04:09:59 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
switch (code) {
|
2004-09-14 04:51:51 +04:00
|
|
|
case AS_STROKE_LINE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_LINE\n", Title()));
|
2005-05-26 17:56:42 +04:00
|
|
|
|
2004-09-14 04:51:51 +04:00
|
|
|
float x1, y1, x2, y2;
|
2005-05-26 17:56:42 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x1);
|
|
|
|
link.Read<float>(&y1);
|
|
|
|
link.Read<float>(&x2);
|
|
|
|
link.Read<float>(&y2);
|
2005-05-26 17:56:42 +04:00
|
|
|
|
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData) {
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
|
2004-09-14 04:51:51 +04:00
|
|
|
BPoint p1(x1,y1);
|
|
|
|
BPoint p2(x2,y2);
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->StrokeLine(fCurrentLayer->ConvertToTop(p1),
|
|
|
|
fCurrentLayer->ConvertToTop(p2),
|
|
|
|
fCurrentLayer->fLayerData);
|
2004-10-17 02:42:08 +04:00
|
|
|
|
|
|
|
// We update the pen here because many DisplayDriver calls which do not update the
|
|
|
|
// pen position actually call StrokeLine
|
2005-04-19 04:42:42 +04:00
|
|
|
|
|
|
|
// TODO: Decide where to put this, for example, it cannot be done
|
|
|
|
// for DrawString(), also there needs to be a decision, if penlocation
|
|
|
|
// is in View coordinates (I think it should be) or in screen coordinates.
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData->SetPenLocation(p2);
|
2004-09-14 04:51:51 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-01-21 05:01:28 +03:00
|
|
|
case AS_LAYER_INVERT_RECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_INVERT_RECT\n", Title()));
|
2005-01-21 05:01:28 +03:00
|
|
|
|
|
|
|
BRect rect;
|
|
|
|
link.Read<BRect>(&rect);
|
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->InvertRect(fCurrentLayer->ConvertToTop(rect));
|
2005-01-21 05:01:28 +03:00
|
|
|
break;
|
|
|
|
}
|
2004-09-15 02:21:26 +04:00
|
|
|
case AS_STROKE_RECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_RECT\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
float left, top, right, bottom;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&left);
|
|
|
|
link.Read<float>(&top);
|
|
|
|
link.Read<float>(&right);
|
|
|
|
link.Read<float>(&bottom);
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect(left,top,right,bottom);
|
2005-01-19 18:12:35 +03:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->StrokeRect(fCurrentLayer->ConvertToTop(rect), fCurrentLayer->fLayerData);
|
2004-10-17 02:42:08 +04:00
|
|
|
break;
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
|
|
|
case AS_FILL_RECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_RECT\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->FillRect(fCurrentLayer->ConvertToTop(rect), fCurrentLayer->fLayerData);
|
2004-10-17 02:42:08 +04:00
|
|
|
break;
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
2005-05-20 04:09:59 +04:00
|
|
|
case AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-20 04:09:59 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BPoint point;
|
|
|
|
|
|
|
|
link.Read<int32>(&bitmapToken);
|
|
|
|
link.Read<BPoint>(&point);
|
|
|
|
|
|
|
|
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
|
|
|
if (sbmp) {
|
|
|
|
BRect src = sbmp->Bounds();
|
2005-06-06 02:02:25 +04:00
|
|
|
BRect dst = src.OffsetToCopy(point);
|
|
|
|
dst = fCurrentLayer->ConvertToTop(dst);
|
2005-05-20 04:09:59 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->DrawBitmap(sbmp, src, dst, fCurrentLayer->fLayerData);
|
2005-05-20 04:09:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Adi -- shouldn't AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT sync with the client?
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-20 04:09:59 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BPoint point;
|
|
|
|
|
|
|
|
link.Read<int32>(&bitmapToken);
|
|
|
|
link.Read<BPoint>(&point);
|
|
|
|
|
|
|
|
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
|
|
|
if (sbmp) {
|
|
|
|
BRect src = sbmp->Bounds();
|
2005-06-06 02:02:25 +04:00
|
|
|
BRect dst = src.OffsetToCopy(point);
|
|
|
|
dst = fCurrentLayer->ConvertToTop(dst);
|
2005-05-20 04:09:59 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->DrawBitmap(sbmp, src, dst, fCurrentLayer->fLayerData);
|
2005-05-20 04:09:59 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-20 04:09:59 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BRect srcRect, dstRect;
|
|
|
|
|
|
|
|
link.Read<int32>(&bitmapToken);
|
|
|
|
link.Read<BRect>(&dstRect);
|
|
|
|
link.Read<BRect>(&srcRect);
|
|
|
|
|
|
|
|
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
|
|
|
if (sbmp) {
|
2005-06-06 02:02:25 +04:00
|
|
|
dstRect = fCurrentLayer->ConvertToTop(dstRect);
|
2005-05-20 04:09:59 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->DrawBitmap(sbmp, srcRect, dstRect, fCurrentLayer->fLayerData);
|
2005-05-20 04:09:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Adi -- shouldn't AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT sync with the client?
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT: Layer name: %s\n", fTitle, fCurrentLayer->Name()));
|
2005-05-20 04:09:59 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BRect srcRect, dstRect;
|
|
|
|
|
|
|
|
link.Read<int32>(&bitmapToken);
|
|
|
|
link.Read<BRect>(&dstRect);
|
|
|
|
link.Read<BRect>(&srcRect);
|
|
|
|
|
|
|
|
ServerBitmap* sbmp = fServerApp->FindBitmap(bitmapToken);
|
|
|
|
if (sbmp) {
|
2005-06-06 02:02:25 +04:00
|
|
|
dstRect = fCurrentLayer->ConvertToTop(dstRect);
|
2005-05-20 04:09:59 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->DrawBitmap(sbmp, srcRect, dstRect, fCurrentLayer->fLayerData);
|
2005-05-20 04:09:59 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2004-09-15 02:21:26 +04:00
|
|
|
case AS_STROKE_ARC:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_ARC\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
float angle, span;
|
|
|
|
BRect r;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&r);
|
|
|
|
link.Read<float>(&angle);
|
|
|
|
link.Read<float>(&span);
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->StrokeArc(fCurrentLayer->ConvertToTop(r),angle,span, fCurrentLayer->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ARC:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_ARC\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
float angle, span;
|
|
|
|
BRect r;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&r);
|
|
|
|
link.Read<float>(&angle);
|
|
|
|
link.Read<float>(&span);
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->FillArc(fCurrentLayer->ConvertToTop(r),angle,span, fCurrentLayer->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_BEZIER:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_BEZIER\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BPoint *pts;
|
|
|
|
int i;
|
|
|
|
pts = new BPoint[4];
|
|
|
|
|
|
|
|
for (i=0; i<4; i++)
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&(pts[i]));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
2004-09-15 02:21:26 +04:00
|
|
|
{
|
|
|
|
for (i=0; i<4; i++)
|
2005-05-26 17:56:42 +04:00
|
|
|
pts[i]=fCurrentLayer->ConvertToTop(pts[i]);
|
2004-09-15 02:21:26 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->StrokeBezier(pts, fCurrentLayer->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
|
|
|
delete [] pts;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_BEZIER:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_BEZIER\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BPoint *pts;
|
|
|
|
int i;
|
|
|
|
pts = new BPoint[4];
|
|
|
|
|
|
|
|
for (i=0; i<4; i++)
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&(pts[i]));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
2004-09-15 02:21:26 +04:00
|
|
|
{
|
|
|
|
for (i=0; i<4; i++)
|
2005-05-26 17:56:42 +04:00
|
|
|
pts[i]=fCurrentLayer->ConvertToTop(pts[i]);
|
2004-09-15 02:21:26 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->FillBezier(pts, fCurrentLayer->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
|
|
|
delete [] pts;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ELLIPSE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_ELLIPSE\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->StrokeEllipse(fCurrentLayer->ConvertToTop(rect), fCurrentLayer->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ELLIPSE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_ELLIPSE\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->FillEllipse(fCurrentLayer->ConvertToTop(rect), fCurrentLayer->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ROUNDRECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_ROUNDRECT\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect;
|
|
|
|
float xrad,yrad;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
|
|
|
link.Read<float>(&xrad);
|
|
|
|
link.Read<float>(&yrad);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->StrokeRoundRect(fCurrentLayer->ConvertToTop(rect),xrad,yrad, fCurrentLayer->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ROUNDRECT:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_ROUNDRECT\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect;
|
|
|
|
float xrad,yrad;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
|
|
|
link.Read<float>(&xrad);
|
|
|
|
link.Read<float>(&yrad);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->FillRoundRect(fCurrentLayer->ConvertToTop(rect),xrad,yrad, fCurrentLayer->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_TRIANGLE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_TRIANGLE\n", Title()));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BPoint pts[3];
|
|
|
|
BRect rect;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&(pts[i]));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData) {
|
|
|
|
for (int i = 0;i < 3; i++)
|
|
|
|
pts[i] = fCurrentLayer->ConvertToTop(pts[i]);
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->StrokeTriangle(pts, fCurrentLayer->ConvertToTop(rect), fCurrentLayer->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_TRIANGLE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_TRIANGLE\n", Title()));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
BPoint pts[3];
|
|
|
|
BRect rect;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&(pts[i]));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData) {
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
pts[i] = fCurrentLayer->ConvertToTop(pts[i]);
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->FillTriangle(pts, fCurrentLayer->ConvertToTop(rect), fCurrentLayer->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-04-19 04:42:42 +04:00
|
|
|
// TODO: get rid of all this code duplication!!
|
2004-09-17 14:27:58 +04:00
|
|
|
case AS_STROKE_POLYGON:
|
2003-02-24 18:47:06 +03:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_POLYGON\n", Title()));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
BRect polyframe;
|
|
|
|
bool isclosed;
|
|
|
|
int32 pointcount;
|
|
|
|
BPoint *pointlist;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&polyframe);
|
|
|
|
link.Read<bool>(&isclosed);
|
|
|
|
link.Read<int32>(&pointcount);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
pointlist = new BPoint[pointcount];
|
2004-09-17 14:27:58 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(pointlist, sizeof(BPoint)*pointcount);
|
2004-09-21 02:50:02 +04:00
|
|
|
|
2005-07-01 12:50:45 +04:00
|
|
|
for (int32 i = 0; i < pointcount; i++)
|
|
|
|
pointlist[i] = fCurrentLayer->ConvertToTop(pointlist[i]);
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->StrokePolygon(pointlist,pointcount,polyframe,
|
2005-05-26 17:56:42 +04:00
|
|
|
fCurrentLayer->fLayerData,isclosed);
|
2005-06-23 22:48:10 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
delete [] pointlist;
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
case AS_FILL_POLYGON:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_POLYGON\n", Title()));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
BRect polyframe;
|
|
|
|
int32 pointcount;
|
|
|
|
BPoint *pointlist;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&polyframe);
|
|
|
|
link.Read<int32>(&pointcount);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
pointlist = new BPoint[pointcount];
|
|
|
|
|
|
|
|
link.Read(pointlist, sizeof(BPoint) * pointcount);
|
|
|
|
|
|
|
|
for (int32 i = 0; i < pointcount; i++)
|
|
|
|
pointlist[i] = fCurrentLayer->ConvertToTop(pointlist[i]);
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->FillPolygon(pointlist,pointcount,polyframe, fCurrentLayer->fLayerData);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
delete [] pointlist;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_SHAPE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_SHAPE\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
BRect shaperect;
|
|
|
|
int32 opcount;
|
|
|
|
int32 ptcount;
|
|
|
|
int32 *oplist;
|
|
|
|
BPoint *ptlist;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&shaperect);
|
|
|
|
link.Read<int32>(&opcount);
|
|
|
|
link.Read<int32>(&ptcount);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
oplist = new int32[opcount];
|
|
|
|
ptlist = new BPoint[ptcount];
|
|
|
|
|
|
|
|
link.Read(oplist, sizeof(int32) * opcount);
|
|
|
|
link.Read(ptlist, sizeof(BPoint) * ptcount);
|
|
|
|
|
|
|
|
for (int32 i = 0; i < ptcount; i++)
|
|
|
|
ptlist[i] = fCurrentLayer->ConvertToTop(ptlist[i]);
|
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->StrokeShape(shaperect, opcount, oplist, ptcount, ptlist, fCurrentLayer->fLayerData);
|
2005-07-01 12:50:45 +04:00
|
|
|
delete[] oplist;
|
|
|
|
delete[] ptlist;
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_SHAPE:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_SHAPE\n", Title()));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
BRect shaperect;
|
|
|
|
int32 opcount;
|
|
|
|
int32 ptcount;
|
|
|
|
int32 *oplist;
|
|
|
|
BPoint *ptlist;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&shaperect);
|
|
|
|
link.Read<int32>(&opcount);
|
|
|
|
link.Read<int32>(&ptcount);
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
oplist = new int32[opcount];
|
|
|
|
ptlist = new BPoint[ptcount];
|
|
|
|
|
|
|
|
link.Read(oplist, sizeof(int32) * opcount);
|
|
|
|
link.Read(ptlist, sizeof(BPoint) * ptcount);
|
|
|
|
|
|
|
|
for (int32 i = 0; i < ptcount; i++)
|
|
|
|
ptlist[i] = fCurrentLayer->ConvertToTop(ptlist[i]);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->FillShape(shaperect, opcount, oplist, ptcount, ptlist, fCurrentLayer->fLayerData);
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2005-07-01 12:50:45 +04:00
|
|
|
delete[] oplist;
|
|
|
|
delete[] ptlist;
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_REGION:
|
2003-07-09 06:28:33 +04:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_REGION\n", Title()));
|
2004-09-17 14:27:58 +04:00
|
|
|
|
2005-06-23 22:48:10 +04:00
|
|
|
int32 count;
|
|
|
|
link.Read<int32>(&count);
|
|
|
|
|
|
|
|
BRect *rects = new BRect[count];
|
|
|
|
if (link.Read(rects, sizeof(BRect) * count) != B_OK) {
|
|
|
|
delete[] rects;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
// Between the client-side conversion to BRects from clipping_rects to the overhead
|
|
|
|
// in repeatedly calling FillRect(), this is definitely in need of optimization. At
|
|
|
|
// least it works for now. :)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
BRegion region;
|
2005-06-23 22:48:10 +04:00
|
|
|
for (int32 i = 0; i < count; i++) {
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
region.Include(fCurrentLayer->ConvertToTop(rects[i]));
|
2005-06-23 22:48:10 +04:00
|
|
|
}
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->FillRegion(region, fCurrentLayer->fLayerData);
|
2005-06-23 22:48:10 +04:00
|
|
|
|
|
|
|
delete[] rects;
|
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
// TODO: create support for clipping_rect usage for faster BRegion display.
|
|
|
|
// Tweaks to DisplayDriver are necessary along with conversion routines in Layer
|
|
|
|
break;
|
2003-07-09 06:28:33 +04:00
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
case AS_STROKE_LINEARRAY:
|
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_LINEARRAY\n", Title()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
// Attached Data:
|
|
|
|
// 1) int32 Number of lines in the array
|
|
|
|
// 2) array of struct _array_data_ objects, as defined in ViewAux.h
|
|
|
|
|
|
|
|
int32 linecount;
|
|
|
|
|
|
|
|
link.Read<int32>(&linecount);
|
2005-07-01 12:50:45 +04:00
|
|
|
if (linecount > 0) {
|
2004-10-16 06:02:27 +04:00
|
|
|
LineArrayData linedata[linecount], *index;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
for (int32 i = 0; i < linecount; i++) {
|
|
|
|
index = &linedata[i];
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&(index->pt1.x));
|
|
|
|
link.Read<float>(&(index->pt1.y));
|
|
|
|
link.Read<float>(&(index->pt2.x));
|
|
|
|
link.Read<float>(&(index->pt2.y));
|
|
|
|
link.Read<rgb_color>(&(index->color));
|
2005-07-01 12:50:45 +04:00
|
|
|
|
|
|
|
index->pt1 = fCurrentLayer->ConvertToTop(index->pt1);
|
|
|
|
index->pt2 = fCurrentLayer->ConvertToTop(index->pt2);
|
|
|
|
}
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->StrokeLineArray(linecount,linedata,fCurrentLayer->fLayerData);
|
2004-10-16 06:02:27 +04:00
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-09-21 02:50:02 +04:00
|
|
|
case AS_DRAW_STRING:
|
2003-07-05 01:13:48 +04:00
|
|
|
{
|
2005-06-23 22:48:10 +04:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_DRAW_STRING\n", Title()));
|
2004-09-21 02:50:02 +04:00
|
|
|
char *string;
|
|
|
|
int32 length;
|
|
|
|
BPoint location;
|
|
|
|
escapement_delta delta;
|
|
|
|
|
2004-10-17 02:42:08 +04:00
|
|
|
link.Read<int32>(&length);
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&location);
|
|
|
|
link.Read<escapement_delta>(&delta);
|
|
|
|
link.ReadString(&string);
|
2004-09-21 02:50:02 +04:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
if (fCurrentLayer && fCurrentLayer->fLayerData)
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->DrawString(string, length,
|
|
|
|
fCurrentLayer->ConvertToTop(location),
|
2005-08-30 18:53:42 +04:00
|
|
|
fCurrentLayer->fLayerData, &delta);
|
2004-09-21 02:50:02 +04:00
|
|
|
|
|
|
|
free(string);
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
2003-07-05 01:13:48 +04:00
|
|
|
}
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
case AS_LAYER_BEGIN_PICTURE:
|
|
|
|
CRITICAL("AS_LAYER_BEGIN_PICTURE not implemented\n");
|
|
|
|
break;
|
|
|
|
case AS_LAYER_APPEND_TO_PICTURE:
|
|
|
|
CRITICAL("AS_LAYER_APPEND_TO_PICTURE not implemented\n");
|
|
|
|
break;
|
|
|
|
case AS_LAYER_END_PICTURE:
|
|
|
|
CRITICAL("AS_LAYER_END_PICTURE not implemented\n");
|
|
|
|
break;
|
2005-07-01 12:50:45 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
default:
|
2005-07-01 12:50:45 +04:00
|
|
|
printf("ServerWindow %s received unexpected code - message offset %ld\n",
|
|
|
|
Title(), code - SERVER_TRUE);
|
|
|
|
|
|
|
|
if (link.NeedsReply()) {
|
|
|
|
// the client is now blocking and waiting for a reply!
|
|
|
|
fLink.StartMessage(SERVER_FALSE);
|
|
|
|
fLink.Flush();
|
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
2005-03-31 00:06:50 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
driver->ConstrainClippingRegion(NULL);
|
2003-03-19 04:12:53 +03:00
|
|
|
}
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Message-dispatching loop for the ServerWindow
|
|
|
|
|
|
|
|
Watches the ServerWindow's message port and dispatches as necessary
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ServerWindow::_MessageLooper()
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2005-06-24 02:43:11 +04:00
|
|
|
BPrivate::LinkReceiver& receiver = fLink.Receiver();
|
2005-07-07 02:39:15 +04:00
|
|
|
bool quitLoop = false;
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-07-07 02:39:15 +04:00
|
|
|
while (!quitLoop) {
|
2005-07-18 13:24:08 +04:00
|
|
|
//STRACE(("info: ServerWindow::MonitorWin listening on port %ld.\n",
|
|
|
|
// fMessagePort));
|
2005-06-23 22:48:10 +04:00
|
|
|
|
2005-07-07 02:39:15 +04:00
|
|
|
int32 code;
|
|
|
|
status_t status = receiver.GetNextMessage(code);
|
|
|
|
if (status < B_OK) {
|
2005-06-24 02:43:11 +04:00
|
|
|
// that shouldn't happen, it's our port
|
2005-07-07 02:39:15 +04:00
|
|
|
printf("Someone deleted our message port!\n");
|
|
|
|
|
|
|
|
// try to let our client die happily
|
|
|
|
NotifyQuitRequested();
|
|
|
|
break;
|
2005-06-24 02:43:11 +04:00
|
|
|
}
|
2004-01-20 05:02:01 +03:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
Lock();
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2005-05-26 19:04:45 +04:00
|
|
|
switch (code) {
|
2004-06-19 17:04:50 +04:00
|
|
|
case AS_DELETE_WINDOW:
|
2005-07-24 21:13:02 +04:00
|
|
|
case kMsgQuitLooper:
|
2004-01-13 03:56:36 +03:00
|
|
|
// this means the client has been killed
|
2005-06-23 22:48:10 +04:00
|
|
|
STRACE(("ServerWindow %s received 'AS_DELETE_WINDOW' message code\n",
|
2005-06-24 02:43:11 +04:00
|
|
|
Title()));
|
2005-01-22 23:51:12 +03:00
|
|
|
|
2005-07-07 02:39:15 +04:00
|
|
|
quitLoop = true;
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
// ToDo: what's this?
|
2005-05-26 19:04:45 +04:00
|
|
|
//RootLayer *rootLayer = fWinBorder->GetRootLayer();
|
2005-01-22 23:51:12 +03:00
|
|
|
|
|
|
|
// we are preparing to delete a ServerWindow, RootLayer should be aware
|
|
|
|
// of that and stop for a moment.
|
|
|
|
// also we must wait a bit for the associated WinBorder to become hidden
|
2005-05-26 19:04:45 +04:00
|
|
|
//while(1) {
|
|
|
|
// myRootLayer->Lock();
|
|
|
|
// if (IsHidden())
|
|
|
|
// break;
|
|
|
|
// else
|
|
|
|
// rootLayer->Unlock();
|
|
|
|
//}
|
|
|
|
|
2004-06-19 17:04:50 +04:00
|
|
|
// ServerWindow's destructor takes care of pulling this object off the desktop.
|
2005-06-24 02:43:11 +04:00
|
|
|
if (!fWinBorder->IsHidden())
|
2005-05-26 03:59:23 +04:00
|
|
|
CRITICAL("ServerWindow: a window must be hidden before it's deleted\n");
|
2004-01-13 03:56:36 +03:00
|
|
|
break;
|
2005-07-07 02:39:15 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
case B_QUIT_REQUESTED:
|
2005-06-24 02:43:11 +04:00
|
|
|
STRACE(("ServerWindow %s received quit request\n", Title()));
|
|
|
|
NotifyQuitRequested();
|
2004-01-13 03:56:36 +03:00
|
|
|
break;
|
2005-06-24 02:43:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
default:
|
2005-06-24 02:43:11 +04:00
|
|
|
_DispatchMessage(code, receiver);
|
2004-01-13 03:56:36 +03:00
|
|
|
break;
|
2003-08-31 21:38:34 +04:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
Unlock();
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-07-07 02:39:15 +04:00
|
|
|
|
|
|
|
// we were asked to quit the message loop - either on request or because of an error
|
|
|
|
Quit();
|
|
|
|
// does not return
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2005-04-27 21:26:57 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
/*
|
|
|
|
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->GetDisplayDriver()->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
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
2005-10-24 20:21:49 +04:00
|
|
|
status_t
|
2005-05-26 19:04:45 +04:00
|
|
|
ServerWindow::SendMessageToClient(const BMessage* msg, int32 target, bool usePreferred) const
|
2004-01-20 01:18:37 +03:00
|
|
|
{
|
2005-05-04 01:42:37 +04:00
|
|
|
ssize_t size = msg->FlattenedSize();
|
|
|
|
char* buffer = new char[size];
|
2005-10-24 20:21:49 +04:00
|
|
|
status_t ret;
|
2005-05-04 01:42:37 +04:00
|
|
|
|
2005-10-24 20:21:49 +04:00
|
|
|
if ((ret = msg->Flatten(buffer, size)) == B_OK) {
|
|
|
|
ret = BMessage::Private::SendFlattenedMessage(buffer, size,
|
|
|
|
fClientLooperPort, target, usePreferred, 100000);
|
2005-05-04 01:42:37 +04:00
|
|
|
if (ret < B_OK)
|
|
|
|
fprintf(stderr, "ServerWindow::SendMessageToClient(): %s\n", strerror(ret));
|
|
|
|
} else
|
2005-06-23 22:48:10 +04:00
|
|
|
printf("PANIC: ServerWindow %s: can't flatten message in 'SendMessageToClient()'\n", fTitle);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2005-05-04 01:42:37 +04:00
|
|
|
delete[] buffer;
|
2005-10-24 20:21:49 +04:00
|
|
|
|
|
|
|
return ret;
|
2003-09-25 16:31:11 +04:00
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
// MakeWinBorder
|
|
|
|
WinBorder*
|
|
|
|
ServerWindow::MakeWinBorder(BRect frame, const char* name,
|
|
|
|
uint32 look, uint32 feel, uint32 flags,
|
|
|
|
uint32 workspace)
|
|
|
|
{
|
|
|
|
// The non-offscreen ServerWindow uses the DisplayDriver instance from the desktop.
|
|
|
|
return new(nothrow) WinBorder(frame, name, look, feel, flags,
|
2005-10-31 14:05:52 +03:00
|
|
|
workspace, this, fDesktop->GetDisplayDriver());
|
offscreen bitmaps work, tested on Haiku as well, supports all colorspaces that BBitmap::ImportBits() supports. It uses a fallback for non-B_RGB(A)32 bitmaps. Added support for B_SUB_PIXEL_PRECISION view flags, though it is a bit hacky, since I had to add it to LayerData, even though it is not a true part of stack data. Added Layer::SetFlags() to enforce code path and update fLayerData. Cleaned up DisplayDriverPainter and DisplayDriver API (changed some const BRect& rect to simply BRect rect in order to be able to reuse it in the code), moved Painter.h, the test environment only draws the changed part of the frame buffer again - this causes a lot less CPU overhead, Painter special cases stroke width of 1.0 to use square caps, which is similar to R5 implementation and removes a lot of problems with non-straight line drawing, ServerWindow uses the DisplayDriver from it's WinBorder instead of the one from the Desktop (needed for offscreen windows, which have their own DisplayDriverPainter), it also checks for GetRootLayer() == NULL, because offscreen layers are not attached to a RootLayer, there was a fix for scrolling which worked at least in the test environment, it is now defunced, because Adi moved _CopyBits to Layer... I need to reenable it later, LayerData has no more fEscapementDelta, also fixed fFontAliasing (which was thought to overriding the font flags, and now works as such again), Desktop initialises the menu_info and scroll_bar_info stuff, which makes ScrollBars work actually... hope I didn't forget something.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13448 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-05 20:17:16 +04:00
|
|
|
}
|
2005-06-03 18:20:10 +04:00
|
|
|
|
2005-10-11 09:25:52 +04:00
|
|
|
|
|
|
|
status_t
|
|
|
|
ServerWindow::_EnableDirectWindowMode()
|
|
|
|
{
|
|
|
|
if (fDirectWindowData != NULL)
|
|
|
|
return B_ERROR; // already in direct window mode
|
|
|
|
|
|
|
|
fDirectWindowData = new (nothrow) dw_data;
|
|
|
|
if (fDirectWindowData == NULL)
|
|
|
|
return B_NO_MEMORY;
|
|
|
|
|
|
|
|
if (!fDirectWindowData->IsValid()) {
|
|
|
|
delete fDirectWindowData;
|
|
|
|
fDirectWindowData = NULL;
|
|
|
|
return B_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return B_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
ServerWindow::_HandleDirectConnection(direct_buffer_state state)
|
|
|
|
{
|
|
|
|
if (fDirectWindowData == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
fDirectWindowData->direct_info->buffer_state = state;
|
|
|
|
|
|
|
|
if ((state & B_DIRECT_MODE_MASK) != B_DIRECT_STOP) {
|
2005-10-12 01:37:47 +04:00
|
|
|
// TODO: Locking ?
|
2005-10-31 14:05:52 +03:00
|
|
|
RenderingBuffer *buffer = fDesktop->GetHWInterface()->FrontBuffer();
|
2005-10-12 01:37:47 +04:00
|
|
|
fDirectWindowData->direct_info->bits = buffer->Bits();
|
|
|
|
fDirectWindowData->direct_info->pci_bits = NULL; // TODO
|
|
|
|
fDirectWindowData->direct_info->bytes_per_row = buffer->BytesPerRow();
|
|
|
|
fDirectWindowData->direct_info->bits_per_pixel = buffer->BytesPerRow() / buffer->Width() * 8;
|
|
|
|
fDirectWindowData->direct_info->pixel_format = buffer->ColorSpace();
|
|
|
|
fDirectWindowData->direct_info->layout = B_BUFFER_NONINTERLEAVED;
|
|
|
|
fDirectWindowData->direct_info->orientation = B_BUFFER_TOP_TO_BOTTOM; // TODO
|
|
|
|
|
2005-10-12 02:32:27 +04:00
|
|
|
WinBorder *border = const_cast<WinBorder *>(GetWinBorder());
|
|
|
|
fDirectWindowData->direct_info->window_bounds = to_clipping_rect(border->Frame());
|
2005-10-12 01:37:47 +04:00
|
|
|
|
|
|
|
// TODO: Review this
|
|
|
|
const int32 kMaxClipRectsCount = (B_PAGE_SIZE - sizeof(direct_buffer_info)) / sizeof(clipping_rect);
|
|
|
|
|
|
|
|
// TODO: Is this the correct region to take into account ?
|
2005-10-12 02:32:27 +04:00
|
|
|
BRegion clipRegion = const_cast<BRegion &>(border->VisibleRegion());
|
|
|
|
border->ConvertToTop(&clipRegion);
|
2005-10-12 01:37:47 +04:00
|
|
|
fDirectWindowData->direct_info->clip_list_count = min_c(clipRegion.CountRects(), kMaxClipRectsCount);
|
|
|
|
fDirectWindowData->direct_info->clip_bounds = clipRegion.FrameInt();
|
|
|
|
|
|
|
|
for (uint32 i = 0; i < fDirectWindowData->direct_info->clip_list_count; i++)
|
|
|
|
fDirectWindowData->direct_info->clip_list[i] = clipRegion.RectAtInt(i);
|
2005-10-11 09:25:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Releasing this sem causes the client to call BDirectWindow::DirectConnected()
|
|
|
|
release_sem(fDirectWindowData->direct_sem);
|
|
|
|
|
|
|
|
// TODO: Waiting 3 seconds in this thread could cause weird things: test
|
|
|
|
status_t status = acquire_sem_etc(fDirectWindowData->direct_sem_ack, 1, B_TIMEOUT, 3000000);
|
|
|
|
if (status == B_TIMED_OUT) {
|
|
|
|
// The client application didn't release the semaphore
|
|
|
|
// within the given timeout. Deleting this member should make it crash.
|
2005-10-12 01:37:47 +04:00
|
|
|
// TODO: Actually, it will not. At least, not always. Find a better way to
|
|
|
|
// crash the client application.
|
2005-10-11 09:25:52 +04:00
|
|
|
delete fDirectWindowData;
|
|
|
|
fDirectWindowData = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-03 18:20:10 +04:00
|
|
|
status_t
|
|
|
|
ServerWindow::PictureToRegion(ServerPicture *picture, BRegion ®ion,
|
|
|
|
bool inverse, BPoint where)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "ServerWindow::PictureToRegion() not implemented\n");
|
|
|
|
region.MakeEmpty();
|
|
|
|
return B_ERROR;
|
|
|
|
}
|