git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- split 2 (Screens)
[enigma2.git]
/
lib
/
gdi
/
gpixmap.cpp
diff --git
a/lib/gdi/gpixmap.cpp
b/lib/gdi/gpixmap.cpp
index 7b7b91a84e27162e735be0ac2a313f1fde7d93bb..9e8219a5e588caeae6e11b6938722a9c38895ca1 100644
(file)
--- a/
lib/gdi/gpixmap.cpp
+++ b/
lib/gdi/gpixmap.cpp
@@
-1,8
+1,6
@@
#include <lib/gdi/gpixmap.h>
#include <lib/gdi/region.h>
#include <lib/gdi/gpixmap.h>
#include <lib/gdi/region.h>
-DEFINE_REF(gFont);
-
gLookup::gLookup()
:size(0), lookup(0)
{
gLookup::gLookup()
:size(0), lookup(0)
{
@@
-107,7
+105,7
@@
void gPixmap::unlock()
void gPixmap::fill(const gRegion ®ion, const gColor &color)
{
void gPixmap::fill(const gRegion ®ion, const gColor &color)
{
- int i;
+
unsigned
int i;
for (i=0; i<region.rects.size(); ++i)
{
const eRect &area = region.rects[i];
for (i=0; i<region.rects.size(); ++i)
{
const eRect &area = region.rects[i];
@@
-139,23
+137,23
@@
void gPixmap::fill(const gRegion ®ion, const gColor &color)
void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag)
{
void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag)
{
- for (int i=0; i<clip.rects.size(); ++i)
+ for (
unsigned
int i=0; i<clip.rects.size(); ++i)
{
{
- eRect area=eRect(pos, src.
getS
ize());
+ eRect area=eRect(pos, src.
s
ize());
area&=clip.rects[i];
area&=clip.rects[i];
- area&=eRect(ePoint(0, 0),
getS
ize());
+ area&=eRect(ePoint(0, 0),
s
ize());
if ((area.width()<0) || (area.height()<0))
continue;
eRect srcarea=area;
srcarea.moveBy(-pos.x(), -pos.y());
if ((area.width()<0) || (area.height()<0))
continue;
eRect srcarea=area;
srcarea.moveBy(-pos.x(), -pos.y());
-
+
if ((surface->bpp == 8) && (src.surface->bpp==8))
{
__u8 *srcptr=(__u8*)src.surface->data;
__u8 *dstptr=(__u8*)surface->data;
if ((surface->bpp == 8) && (src.surface->bpp==8))
{
__u8 *srcptr=(__u8*)src.surface->data;
__u8 *dstptr=(__u8*)surface->data;
- srcptr+=srcarea.left()*surface->bypp+srcarea.top()*src.surface->stride;
+ srcptr+=srcarea.left()*s
rc.s
urface->bypp+srcarea.top()*src.surface->stride;
dstptr+=area.left()*surface->bypp+area.top()*surface->stride;
for (int y=0; y<area.height(); y++)
{
dstptr+=area.left()*surface->bypp+area.top()*surface->stride;
for (int y=0; y<area.height(); y++)
{
@@
-195,7
+193,7
@@
void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag
pal[i]^=0xFF000000;
}
pal[i]^=0xFF000000;
}
- srcptr+=srcarea.left()*surface->bypp+srcarea.top()*src.surface->stride;
+ srcptr+=srcarea.left()*s
rc.s
urface->bypp+srcarea.top()*src.surface->stride;
dstptr+=area.left()*surface->bypp+area.top()*surface->stride;
for (int y=0; y<area.height(); y++)
{
dstptr+=area.left()*surface->bypp+area.top()*surface->stride;
for (int y=0; y<area.height(); y++)
{
@@
-233,8
+231,10
@@
void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag
void gPixmap::mergePalette(const gPixmap &target)
{
void gPixmap::mergePalette(const gPixmap &target)
{
+ eDebug("merge palette! %p %p", surface, target.surface);
if ((!surface->clut.colors) || (!target.surface->clut.colors))
return;
if ((!surface->clut.colors) || (!target.surface->clut.colors))
return;
+#if 0
gColor *lookup=new gColor[surface->clut.colors];
for (int i=0; i<surface->clut.colors; i++)
gColor *lookup=new gColor[surface->clut.colors];
for (int i=0; i<surface->clut.colors; i++)
@@
-255,6
+255,7
@@
void gPixmap::mergePalette(const gPixmap &target)
}
delete [] lookup;
}
delete [] lookup;
+#endif
}
static inline int sgn(int a)
}
static inline int sgn(int a)
@@
-269,11
+270,27
@@
static inline int sgn(int a)
void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color)
{
void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color)
{
- __u8 *srf = (__u8*)surface->data;
+ __u8 *srf8 = 0;
+ __u32 *srf32 = 0;
int stride = surface->stride;
if (clip.rects.empty())
return;
int stride = surface->stride;
if (clip.rects.empty())
return;
+
+ __u32 col;
+ if (surface->bpp == 8)
+ {
+ srf8 = (__u8*)surface->data;
+ } else if (surface->bpp == 32)
+ {
+ srf32 = (__u32*)surface->data;
+
+ if (surface->clut.data && color < surface->clut.colors)
+ col=(surface->clut.data[color].a<<24)|(surface->clut.data[color].r<<16)|(surface->clut.data[color].g<<8)|(surface->clut.data[color].b);
+ else
+ col=0x10101*color;
+ col^=0xFF000000;
+ }
int xa = start.x(), ya = start.y(), xb = dst.x(), yb = dst.y();
int dx, dy, x, y, s1, s2, e, temp, swap, i;
int xa = start.x(), ya = start.y(), xb = dst.x(), yb = dst.y();
int dx, dy, x, y, s1, s2, e, temp, swap, i;
@@
-292,6
+309,7
@@
void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color)
} else
swap=0;
e = 2*dy-dx;
} else
swap=0;
e = 2*dy-dx;
+
int lasthit = 0;
for(i=1; i<=dx; i++)
{
int lasthit = 0;
for(i=1; i<=dx; i++)
{
@@
-328,7
+346,11
@@
void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color)
} while (!clip.rects[a].contains(x, y));
lasthit = a;
}
} while (!clip.rects[a].contains(x, y));
lasthit = a;
}
- srf[y * stride + x] = color;
+
+ if (srf8)
+ srf8[y * stride + x] = color;
+ if (srf32)
+ srf32[y * stride/4 + x] = col;
fail:
while (e>=0)
{
fail:
while (e>=0)
{
@@
-366,6
+388,8
@@
gColor gPalette::findColor(const gRGB &rgb) const
ttd+=td;
if (ttd>=difference)
continue;
ttd+=td;
if (ttd>=difference)
continue;
+ if (!ttd)
+ return t;
difference=ttd;
best_choice=t;
}
difference=ttd;
best_choice=t;
}