Major overhaul of the DisplayDriver API

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6336 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2004-01-27 00:39:41 +00:00
parent b4fe4d74fe
commit f9de45c608
2 changed files with 193 additions and 194 deletions
+71 -87
View File
@@ -1,3 +1,30 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: LayerData.h
// Author: DarkWyrm <[email protected]>
// Adi Oanca <[email protected]>
// Description: Data classes for working with BView states and draw parameters
//
//------------------------------------------------------------------------------
#ifndef LAYERDATA_H_
#define LAYERDATA_H_
@@ -14,102 +41,59 @@
class ServerBitmap;
class ServerFont;
class ServerPicture;
class Layer;
class LayerData
class DrawData
{
public:
LayerData(void)
{
penlocation.Set(0,0);
pensize = 1.0;
highcolor.SetColor(0, 0, 0, 255);
lowcolor.SetColor(255, 255, 255, 255);
viewcolor.SetColor(255, 255, 255, 255);
patt = pat_solidhigh;
draw_mode = B_OP_COPY;
coordOrigin.Set(0.0, 0.0);
lineCap = B_BUTT_CAP;
lineJoin = B_BEVEL_JOIN;
miterLimit = B_DEFAULT_MITER_LIMIT;
DrawData(void);
DrawData(const DrawData &data);
~DrawData(void);
DrawData &operator=(const DrawData &from);
BPoint penlocation;
alphaSrcMode = B_PIXEL_ALPHA;
alphaFncMode = B_ALPHA_OVERLAY;
scale = 1.0;
fontAliasing = true;
if(fontserver)
font = *(fontserver->GetSystemPlain());
clippReg = NULL;
// NOTE: read below!
//background = NULL;
//overlay = NULL;
image = NULL;
isOverlay = false;
RGBColor highcolor,
lowcolor;
edelta.space = 0;
edelta.nonspace = 0;
prevState = NULL;
}
~LayerData(void)
{
if (clippReg)
delete clippReg;
if (image){
/* NOTE: I don't know yet how bitmap allocation/deallocation
is managed by server. I tend to think it's a reference
count type, so a 'delete' it's NOT good here.
Maybe a image.Release()?
TODO: tell 'image' we're finished with it! :-)
*/
}
if (prevState){
delete prevState;
prevState = NULL;
}
}
// BView related
BPoint penlocation;
float pensize;
RGBColor highcolor,
lowcolor,
viewcolor;
Pattern patt;
drawing_mode draw_mode;
BPoint coordOrigin;
float pensize;
Pattern patt;
drawing_mode draw_mode;
cap_mode lineCap;
join_mode lineJoin;
float miterLimit;
cap_mode lineCap;
join_mode lineJoin;
float miterLimit;
source_alpha alphaSrcMode;
alpha_function alphaFncMode;
float scale;
bool fontAliasing;
ServerFont font;
source_alpha alphaSrcMode;
alpha_function alphaFncMode;
float scale;
bool fontAliasing;
ServerFont font;
BRegion *clippReg;
BRegion *clippReg;
escapement_delta edelta;
};
// server related
// NOTE: only one image is needed. It's a bitmap OR an overlay!
ServerBitmap *image;
bool isOverlay;
//ServerBitmap *background;
//ServerBitmap *overlay;
escapement_delta edelta;
class LayerData : public DrawData
{
public:
LayerData(void);
LayerData(const Layer *layer);
LayerData(const LayerData &data);
LayerData &operator=(const LayerData &from);
~LayerData(void);
// used for the state stack
LayerData *prevState;
BPoint coordOrigin;
RGBColor viewcolor;
// We have both because we are not going to suffer from the limitation that R5
// places on us. We can have both. :)
ServerBitmap *background;
ServerBitmap *overlay;
// used for the state stack
LayerData *prevState;
};
#endif
/*
@log
* modified 'font' member from '*font' to 'font'. '*font' was getting the pointer to system's plain font, and worse, it modified it. Now, it's all OK.
*/