Fresco/GGI/src Pointer.cc,1.5,1.6 Pointer.hh,1.2,1.3
Neil John Pilgrim <[email protected]>
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/GGI/src
In directory purcel:/tmp/cvs-serv20680/GGI/src
Modified Files:
Pointer.cc Pointer.hh
Log Message:
Remove unused code, simplify cache to/from blitting, and fix clipping problem.
Original patch from redmondp (bug183), removed GGIFLAG_TIDYBUF changes into
separate patch for task140 (that ggi feature is not released yet).
Index: Pointer.cc
===================================================================
RCS file: /cvs/fresco/Fresco/GGI/src/Pointer.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Pointer.cc 2 Mar 2003 02:51:06 -0000 1.5
+++ Pointer.cc 30 Mar 2003 00:26:44 -0000 1.6
@@ -48,13 +48,6 @@
Fresco::Drawable::PixelFormat format = _screen->pixel_format();
- Pixel trans = 0;
- Pixel red = (static_cast<Pixel>(1. * (~0L)) >> format.red_shift) & format.red_mask;
- Pixel green = (static_cast<Pixel>(1. * (~0L)) >> format.green_shift) & format.green_mask;
- Pixel blue = (static_cast<Pixel>(1. * (~0L)) >> format.blue_shift) & format.blue_mask;
- Pixel black = 0;
- Pixel white = red | green | blue;
-
/*
* create the pointer image
*/
@@ -78,14 +71,18 @@
for (unsigned short d = 0; d != depth; d++)
_mask[y*depth*_size[0]+depth*x + d] = flag;
}
- _cache = new data_type[_size[0]*_size[1]*depth];
+ /*
+ * create the save and restore cache
+ */
+ _cache = new Drawable("memory", _size[0], _size[1], depth);
+
}
GGI::Pointer::~Pointer()
{
delete _dbuffer;
delete [] _image;
- delete [] _cache;
+ delete _cache;
}
Raster_ptr GGI::Pointer::raster()
@@ -117,16 +114,7 @@
PixelCoord y = _position[1] - _origin[1];
PixelCoord w = _size[0];
PixelCoord h = _size[1];
- PixelCoord r = _screen->row_length();
- PixelCoord s = _screen->vwidth() * _screen->vheight();
- PixelCoord d = _screen->pixel_format().size >> 3;
- const ggi_directbuffer *dbuf = _screen->buffer(0);
- ggiResourceAcquire(dbuf->resource, GGI_ACTYPE_READ);
- data_type *from = static_cast<char*>(dbuf->read) + y*r +x*d;
- data_type *to = _cache;
- for (PixelCoord o = 0; o != h && (y + o) * r / d + x + w < s; o++, from += r, to += d * w)
- Memory::copy(from, to, d * w);
- ggiResourceRelease(dbuf->resource);
+ _cache->blit(*_screen, x, y, w, h, 0, 0);
}
void GGI::Pointer::restore()
@@ -135,19 +123,8 @@
PixelCoord y = _position[1] - _origin[1];
PixelCoord w = _size[0];
PixelCoord h = _size[1];
- PixelCoord r = _screen->row_length();
- PixelCoord s = _screen->vwidth() * _screen->vheight();
- PixelCoord d = _screen->pixel_format().size >> 3;
- data_type *from = _cache;
- const ggi_directbuffer *dbuf = _screen->buffer(0);
- ggiResourceAcquire(dbuf->resource, GGI_ACTYPE_WRITE);
- data_type *to = static_cast<char*>(dbuf->write) + y*r + x*d;
- for (PixelCoord o = 0;
- o != h && (y + o) * r / d + x + w < s;
- o++, from += d * w, to += r)
- Memory::copy(from, to, d * w);
+ _screen->blit(*_cache, 0, 0, w, h, x, y);
_screen->flush(x, y, w, h);
- ggiResourceRelease(dbuf->resource);
}
void GGI::Pointer::draw()
@@ -164,9 +141,10 @@
const ggi_directbuffer *dbuf = _screen->buffer(0);
ggiResourceAcquire(dbuf->resource, GGI_ACTYPE_WRITE);
data_type *to = static_cast<char*>(dbuf->write) + y*r + x*d;
- for (PixelCoord i = 0; i != h && (y + i) * r / d + x + w < s; i++, to += r - w * d)
- for (PixelCoord j = 0; j != w * d; j++, from++, bits++, to++)
- *to = (*from & *bits) | (*to & ~*bits);
+ for (PixelCoord i = 0; i != h && (y+i)*r/d+x+w<s; i++, to += r - w * d)
+ for (PixelCoord j = 0; j != w * d ; j++, from++, bits++, to++)
+ if (x*d+j < r)
+ *to = (*from & *bits) | (*to & ~*bits);
_screen->flush(x, y, w, h);
ggiResourceRelease(dbuf->resource);
}
Index: Pointer.hh
===================================================================
RCS file: /cvs/fresco/Fresco/GGI/src/Pointer.hh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Pointer.hh 29 May 2002 06:49:41 -0000 1.2
+++ Pointer.hh 30 Mar 2003 00:26:44 -0000 1.3
@@ -61,7 +61,7 @@
Fresco::Raster_ptr _raster;
data_type *_image;
data_type *_mask;
- data_type *_cache;
+ Drawable *_cache;
};
}