aboutsummaryrefslogtreecommitdiff
path: root/lib/gdi
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-01-09 16:29:34 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-01-09 16:29:34 +0000
commitba02fb4aced5868d047a5bffbd2ed87583daee4d (patch)
treebcfea66b1f7fd2212539a99abc074de1424ac9a0 /lib/gdi
parent2494509cd031727d92c6556089c99711d16d8af9 (diff)
downloadenigma2-ba02fb4aced5868d047a5bffbd2ed87583daee4d.tar.gz
enigma2-ba02fb4aced5868d047a5bffbd2ed87583daee4d.zip
- add more python stuff
- fix some gui/gdi - add eslider - improve windowstyle
Diffstat (limited to 'lib/gdi')
-rw-r--r--lib/gdi/epoint.h29
-rw-r--r--lib/gdi/erect.cpp1
-rw-r--r--lib/gdi/erect.h24
-rw-r--r--lib/gdi/esize.h22
-rw-r--r--lib/gdi/font.cpp6
-rw-r--r--lib/gdi/grc.cpp23
-rw-r--r--lib/gdi/grc.h8
-rw-r--r--lib/gdi/region.cpp2
8 files changed, 66 insertions, 49 deletions
diff --git a/lib/gdi/epoint.h b/lib/gdi/epoint.h
index fc5f9836..d7cdf399 100644
--- a/lib/gdi/epoint.h
+++ b/lib/gdi/epoint.h
@@ -1,8 +1,6 @@
#ifndef EPOINT_H
#define EPOINT_H
-#include <iostream>
-
#ifndef ABS
#define ABS(x) ( x>0 ? x : -x )
#endif
@@ -35,7 +33,9 @@ public:
friend inline bool operator==( const ePoint &, const ePoint & );
friend inline bool operator!=( const ePoint &, const ePoint & );
friend inline ePoint operator+( const ePoint &, const ePoint & );
+ friend inline ePoint operator+( const ePoint &, const eSize & );
friend inline ePoint operator-( const ePoint &, const ePoint & );
+ friend inline ePoint operator-( const ePoint &, const eSize & );
friend inline ePoint operator*( const ePoint &, int );
friend inline ePoint operator*( int, const ePoint & );
friend inline ePoint operator*( const ePoint &, double );
@@ -56,25 +56,6 @@ inline int ePoint::manhattanLength() const
/*****************************************************************************
- ePoint stream functions
- *****************************************************************************/
-namespace std
-{
- inline ostream &operator<<( ostream & s, const ePoint & p )
- {
- s << p.x() << p.y();
- return s;
- }
-
- inline istream &operator>>( istream & s, ePoint & p )
- {
- s >> p.rx() >> p.ry();
- return s;
- }
-}
-
-
-/*****************************************************************************
ePoint inline functions
*****************************************************************************/
@@ -129,6 +110,12 @@ inline ePoint operator+( const ePoint &p1, const ePoint &p2 )
inline ePoint operator-( const ePoint &p1, const ePoint &p2 )
{ return ePoint(p1.xp-p2.xp, p1.yp-p2.yp); }
+inline ePoint operator+( const ePoint &p1, const eSize &p2 )
+{ return ePoint(p1.xp+p2.width(), p1.yp+p2.height()); }
+
+inline ePoint operator-( const ePoint &p1, const eSize &p2 )
+{ return ePoint(p1.xp-p2.width(), p1.yp-p2.height()); }
+
inline ePoint operator*( const ePoint &p, int c )
{ return ePoint(p.xp*c, p.yp*c); }
diff --git a/lib/gdi/erect.cpp b/lib/gdi/erect.cpp
index a3878797..43cefc53 100644
--- a/lib/gdi/erect.cpp
+++ b/lib/gdi/erect.cpp
@@ -1,5 +1,4 @@
#include <lib/gdi/erect.h>
-#include <iostream>
/*****************************************************************************
eRect member functions
diff --git a/lib/gdi/erect.h b/lib/gdi/erect.h
index a67d0fb9..65fd8d71 100644
--- a/lib/gdi/erect.h
+++ b/lib/gdi/erect.h
@@ -52,6 +52,18 @@ public:
ePoint bottomRight() const;
ePoint topRight() const;
ePoint bottomLeft() const;
+
+ /* the sole intention of these functions
+ is to allow painting frames without
+ messing around with the coordinates.
+ they point to the last pixel included
+ in the rectangle (which means that 1 is
+ subtracted from the right and bottom
+ coordinates */
+ ePoint topLeft1() const;
+ ePoint bottomRight1() const;
+ ePoint topRight1() const;
+ ePoint bottomLeft1() const;
ePoint center() const;
void rect( int *x, int *y, int *w, int *h ) const;
@@ -196,6 +208,18 @@ inline ePoint eRect::topRight() const
inline ePoint eRect::bottomLeft() const
{ return ePoint(x1, y2); }
+inline ePoint eRect::topLeft1() const
+{ return ePoint(x1, y1); }
+
+inline ePoint eRect::bottomRight1() const
+{ return ePoint(x2-1, y2-1); }
+
+inline ePoint eRect::topRight1() const
+{ return ePoint(x2-1, y1); }
+
+inline ePoint eRect::bottomLeft1() const
+{ return ePoint(x1, y2-1); }
+
inline ePoint eRect::center() const
{ return ePoint((x1+x2)/2, (y1+y2)/2); }
diff --git a/lib/gdi/esize.h b/lib/gdi/esize.h
index d4bd4afb..de0a6ecb 100644
--- a/lib/gdi/esize.h
+++ b/lib/gdi/esize.h
@@ -1,8 +1,6 @@
#ifndef ESIZE_H
#define ESIZE_H
-#include <iostream>
-
#define MIN(a,b) (a < b ? a : b)
#define MAX(a,b) (a > b ? a : b)
@@ -53,26 +51,6 @@ private:
/*****************************************************************************
- eSize stream functions
- *****************************************************************************/
-
-namespace std
-{
- inline ostream &operator<<( ostream &s, const eSize &sz )
- {
- s << sz.width() << sz.height();
- return s;
- }
-
- inline istream &operator>>( istream &s, eSize &sz )
- {
- s >> sz.rwidth() >> sz.rheight();
- return s;
- }
-}
-
-
-/*****************************************************************************
eSize inline functions
*****************************************************************************/
diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp
index ee228576..f7c62209 100644
--- a/lib/gdi/font.cpp
+++ b/lib/gdi/font.cpp
@@ -63,9 +63,9 @@ static gLookup &getColor(const gPalette &pal, const gRGB &start, const gRGB &end
eDebug("[FONT] creating new font color cache entry %02x%02x%02x%02x .. %02x%02x%02x%02x", start.a, start.r, start.g, start.b,
end.a, end.r, end.g, end.b);
n.build(16, pal, start, end);
-/* for (int i=0; i<16; i++)
+ for (int i=0; i<16; i++)
eDebugNoNewLine("%02x|%02x%02x%02x%02x ", (int)n.lookup[i], pal.data[n.lookup[i]].a, pal.data[n.lookup[i]].r, pal.data[n.lookup[i]].g, pal.data[n.lookup[i]].b);
- eDebug("");*/
+ eDebug("");
return n;
}
@@ -675,6 +675,7 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons
continue;
int rx=i->x+glyph_bitmap->left + offset.x();
int ry=i->y-glyph_bitmap->top + offset.y();
+
__u8 *d=(__u8*)(surface->data)+buffer_stride*ry+rx*surface->bypp;
__u8 *s=glyph_bitmap->buffer;
register int sx=glyph_bitmap->width;
@@ -706,6 +707,7 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons
{
register __u8 *td=d;
register int ax;
+
for (ax=0; ax<sx; ax++)
{
register int b=(*s++)>>4;
diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp
index 4597034f..cb2a6de9 100644
--- a/lib/gdi/grc.cpp
+++ b/lib/gdi/grc.cpp
@@ -164,6 +164,17 @@ void gPainter::fill(const eRect &area)
m_rc->submit(o);
}
+void gPainter::fill(const gRegion &region)
+{
+ gOpcode o;
+ o.opcode=gOpcode::fillRegion;
+
+ o.dc = m_dc.grabRef();
+ o.parm.fillRegion = new gOpcode::para::pfillRegion;
+ o.parm.fillRegion->region = region;
+ m_rc->submit(o);
+}
+
void gPainter::clear()
{
gOpcode o;
@@ -332,13 +343,13 @@ void gDC::exec(gOpcode *o)
assert(m_current_font);
para->setFont(m_current_font);
para->renderString(o->parm.renderText->text, o->parm.renderText->flags);
- para->blit(*this, m_current_offset, getRGB(m_foreground_color), getRGB(m_background_color));
+ para->blit(*this, m_current_offset, getRGB(m_background_color), getRGB(m_foreground_color));
delete o->parm.renderText;
break;
}
case gOpcode::renderPara:
{
- o->parm.renderPara->textpara->blit(*this, o->parm.renderPara->offset + m_current_offset, getRGB(m_foreground_color), getRGB(m_background_color));
+ o->parm.renderPara->textpara->blit(*this, o->parm.renderPara->offset + m_current_offset, getRGB(m_background_color), getRGB(m_foreground_color));
o->parm.renderPara->textpara->Release();
delete o->parm.renderPara;
break;
@@ -352,6 +363,14 @@ void gDC::exec(gOpcode *o)
delete o->parm.fill;
break;
}
+ case gOpcode::fillRegion:
+ {
+ o->parm.fillRegion->region.moveBy(m_current_offset);
+ gRegion clip = m_current_clip & o->parm.fillRegion->region;
+ m_pixmap->fill(clip, m_foreground_color);
+ delete o->parm.fillRegion;
+ break;
+ }
case gOpcode::clear:
m_pixmap->fill(m_current_clip, m_background_color);
delete o->parm.fill;
diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h
index a02068ae..d6a3cd70 100644
--- a/lib/gdi/grc.h
+++ b/lib/gdi/grc.h
@@ -29,7 +29,7 @@ struct gOpcode
renderPara,
setFont,
- fill, clear,
+ fill, fillRegion, clear,
blit,
setPalette,
@@ -55,6 +55,11 @@ struct gOpcode
eRect area;
} *fill;
+ struct pfillRegion
+ {
+ gRegion region;
+ } *fillRegion;
+
struct prenderText
{
eRect area;
@@ -173,6 +178,7 @@ public:
void renderPara(eTextPara *para, ePoint offset=ePoint(0, 0));
void fill(const eRect &area);
+ void fill(const gRegion &area);
void clear();
diff --git a/lib/gdi/region.cpp b/lib/gdi/region.cpp
index f79b403f..d75221fe 100644
--- a/lib/gdi/region.cpp
+++ b/lib/gdi/region.cpp
@@ -325,6 +325,8 @@ void gRegion::regionOp(const gRegion &reg1, const gRegion &reg2, int opcode, int
for (unsigned int a = 0; a<rects.size(); ++a)
extends = extends | rects[a];
+ if (!extends.valid())
+ extends = eRect::emptyRect();
}
void gRegion::intersect(const gRegion &r1, const gRegion &r2)