aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/FbPixmap.cc24
-rw-r--r--src/FbTk/FbPixmap.hh4
-rw-r--r--src/FbTk/TextureRender.cc12
3 files changed, 34 insertions, 6 deletions
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc
index bbc8fcb..cac6cf0 100644
--- a/src/FbTk/FbPixmap.cc
+++ b/src/FbTk/FbPixmap.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbPixmap.cc,v 1.10 2004/01/11 12:48:46 fluxgen Exp $ 22// $Id: FbPixmap.cc,v 1.11 2004/07/05 23:51:57 fluxgen Exp $
23 23
24#include "FbPixmap.hh" 24#include "FbPixmap.hh"
25#include "App.hh" 25#include "App.hh"
@@ -248,6 +248,28 @@ void FbPixmap::scale(unsigned int dest_width, unsigned int dest_height) {
248 m_pm = new_pm.release(); 248 m_pm = new_pm.release();
249} 249}
250 250
251void FbPixmap::tile(unsigned int dest_width, unsigned int dest_height) {
252 if (drawable() == 0 ||
253 (dest_width == width() && dest_height == height()))
254 return;
255
256 Display *dpy = FbTk::App::instance()->display();
257
258 FbPixmap new_pm(drawable(), width(), height(), depth());
259
260 new_pm.copy(m_pm);
261
262 resize(dest_width,dest_height);
263
264 GC gc = XCreateGC(dpy, drawable(), 0, NULL);
265
266 XSetTile(dpy,gc,new_pm.release());
267 XSetFillStyle(dpy, gc, FillTiled);
268 XFillRectangle(dpy,drawable(),gc, 0, 0, dest_width, dest_height);
269}
270
271
272
251void FbPixmap::resize(unsigned int width, unsigned int height) { 273void FbPixmap::resize(unsigned int width, unsigned int height) {
252 FbPixmap pm(drawable(), width, height, depth()); 274 FbPixmap pm(drawable(), width, height, depth());
253 *this = pm.release(); 275 *this = pm.release();
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh
index 3c1a4e5..77dc555 100644
--- a/src/FbTk/FbPixmap.hh
+++ b/src/FbTk/FbPixmap.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbPixmap.hh,v 1.11 2004/04/26 21:57:32 fluxgen Exp $ 22// $Id: FbPixmap.hh,v 1.12 2004/07/05 23:51:57 fluxgen Exp $
23 23
24#ifndef FBTK_FBPIXMAP_HH 24#ifndef FBTK_FBPIXMAP_HH
25#define FBTK_FBPIXMAP_HH 25#define FBTK_FBPIXMAP_HH
@@ -54,6 +54,8 @@ public:
54 /// scales the pixmap to specified size 54 /// scales the pixmap to specified size
55 void scale(unsigned int width, unsigned int height); 55 void scale(unsigned int width, unsigned int height);
56 void resize(unsigned int width, unsigned int height); 56 void resize(unsigned int width, unsigned int height);
57 /// tiles the pixmap to specified size
58 void tile(unsigned int width, unsigned int height);
57 /// drops pixmap and returns it 59 /// drops pixmap and returns it
58 Pixmap release(); 60 Pixmap release();
59 61
diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc
index 6f496d7..04fb2b3 100644
--- a/src/FbTk/TextureRender.cc
+++ b/src/FbTk/TextureRender.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: TextureRender.cc,v 1.9 2004/06/07 11:46:05 rathnor Exp $ 25// $Id: TextureRender.cc,v 1.10 2004/07/05 23:51:57 fluxgen Exp $
26 26
27#include "TextureRender.hh" 27#include "TextureRender.hh"
28 28
@@ -256,12 +256,16 @@ Pixmap TextureRender::renderGradient(const FbTk::Texture &texture) {
256Pixmap TextureRender::renderPixmap(const FbTk::Texture &src_texture) { 256Pixmap TextureRender::renderPixmap(const FbTk::Texture &src_texture) {
257 if (width != src_texture.pixmap().width() || 257 if (width != src_texture.pixmap().width() ||
258 height != src_texture.pixmap().height()) { 258 height != src_texture.pixmap().height()) {
259
259 // copy src_texture's pixmap and 260 // copy src_texture's pixmap and
260 // scale to fit our size 261 // scale/tile to fit our size
261 FbPixmap new_pm(src_texture.pixmap()); 262 FbPixmap new_pm(src_texture.pixmap());
262 // if not tiled then scale it 263
263 if (! (src_texture.type() & Texture::TILED)) 264 if ((src_texture.type() & Texture::TILED)) {
265 new_pm.tile(width,height);
266 } else {
264 new_pm.scale(width, height); 267 new_pm.scale(width, height);
268 }
265 269
266 return new_pm.release(); 270 return new_pm.release();
267 } 271 }