added convenience functions to PatternHandler and refactored the setting of the DrawingMode in Painter

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12408 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-04-15 10:20:53 +00:00
parent 3d16cf4bce
commit 4da1508aa9
3 changed files with 67 additions and 47 deletions
+5 -2
View File
@@ -26,7 +26,8 @@ class ServerFont;
// * most all functions should take a DrawData* context parameter instead
// of the current pattern argument, that way, each function can
// decide for itself, which pieces of information in DrawData it
// needs
// needs -> well I'm not so sure about this, there could also
// be a DrawData member in Painter fGraphicsState or something...
// * Painter itself should be made thread safe. Because no
// ServerWindow is supposed to draw outside of its clipping region,
// there is actually no reason to lock the DisplayDriver. Multiple
@@ -66,6 +67,8 @@ class Painter {
void SetDrawingMode(drawing_mode mode);
void SetBlendingMode(source_alpha alphaSrcMode,
alpha_function alphaFncMode);
void SetPattern(const pattern& p);
void SetPenLocation(const BPoint& location);
void SetFont(const BFont& font);
void SetFont(const ServerFont& font);
@@ -220,6 +223,7 @@ class Painter {
void _UpdateFont();
void _UpdateLineWidth();
void _UpdateDrawingMode();
// drawing functions stroke/fill
BRect _DrawTriangle( BPoint pt1,
@@ -258,7 +262,6 @@ class Painter {
template<class VertexSource>
BRect _FillPath(VertexSource& path) const;
void _SetPattern(const pattern& p) const;
void _SetRendererColor(const rgb_color& color) const;
agg::rendering_buffer* fBuffer;
@@ -66,6 +66,10 @@ class Pattern {
Pattern& operator=(const pattern &from)
{ memcpy(&fPattern.type64, &from, sizeof(pattern)); return *this; }
bool operator==(const Pattern& other) const
{ return fPattern.type64 == other.fPattern.type64; }
private:
typedef union
@@ -128,6 +132,8 @@ class PatternHandler {
const pattern* GetR5Pattern(void) const
{ return (const pattern*)fPattern.GetInt8(); }
const Pattern& GetPattern(void) const
{ return fPattern; }
private:
Pattern fPattern;
RGBColor fHighColor;