aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/TextureRender.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2006-03-26 04:02:30 (GMT)
committersimonb <simonb>2006-03-26 04:02:30 (GMT)
commitaf74a2284551c8511b66d77112c7bf32831c1522 (patch)
tree35a8830352f5facc1fc9c58b82c0c6dce8fc921e /src/FbTk/TextureRender.cc
parent872f6a0e1e4230f702ad69fa2d7e10a2fa78b7a3 (diff)
downloadfluxbox-af74a2284551c8511b66d77112c7bf32831c1522.zip
fluxbox-af74a2284551c8511b66d77112c7bf32831c1522.tar.bz2
rotated fonts, buttons, containers. Used for tabs for now
Diffstat (limited to 'src/FbTk/TextureRender.cc')
-rw-r--r--src/FbTk/TextureRender.cc26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc
index f2fa35d..7af8f08 100644
--- a/src/FbTk/TextureRender.cc
+++ b/src/FbTk/TextureRender.cc
@@ -52,6 +52,7 @@ namespace FbTk {
52 52
53TextureRender::TextureRender(ImageControl &imgctrl, 53TextureRender::TextureRender(ImageControl &imgctrl,
54 unsigned int w, unsigned int h, 54 unsigned int w, unsigned int h,
55 FbTk::Orientation orient,
55 XColor *_colors, size_t num_colors): 56 XColor *_colors, size_t num_colors):
56 control(imgctrl), 57 control(imgctrl),
57 colors(_colors), 58 colors(_colors),
@@ -59,6 +60,7 @@ TextureRender::TextureRender(ImageControl &imgctrl,
59 cpc(imgctrl.colorsPerChannel()), 60 cpc(imgctrl.colorsPerChannel()),
60 cpccpc(cpc * cpc), 61 cpccpc(cpc * cpc),
61 red(0), green(0), blue(0), 62 red(0), green(0), blue(0),
63 orientation(orient),
62 width(static_cast<signed>((w > 0 ? w : 1))), height(static_cast<signed>(h > 0 ? h : 1)), 64 width(static_cast<signed>((w > 0 ? w : 1))), height(static_cast<signed>(h > 0 ? h : 1)),
63 xtable(0), ytable(0) { 65 xtable(0), ytable(0) {
64 66
@@ -231,6 +233,9 @@ Pixmap TextureRender::renderGradient(const FbTk::Texture &texture) {
231 233
232 bool inverted = false; 234 bool inverted = false;
233 235
236 // invert our width and height if necessary
237 translateSize(orientation, width, height);
238
234 using namespace FbTk; 239 using namespace FbTk;
235 240
236 interlaced = texture.type() & Texture::INTERLACED; 241 interlaced = texture.type() & Texture::INTERLACED;
@@ -281,23 +286,30 @@ Pixmap TextureRender::renderGradient(const FbTk::Texture &texture) {
281} 286}
282 287
283Pixmap TextureRender::renderPixmap(const FbTk::Texture &src_texture) { 288Pixmap TextureRender::renderPixmap(const FbTk::Texture &src_texture) {
284 if (width != src_texture.pixmap().width() || 289 unsigned int tmpw = width, tmph = height;
285 height != src_texture.pixmap().height()) { 290 // we are given width and height in rotated form, we
291 // unrotate it here to render it
292 translateSize(orientation, tmpw, tmph);
293 if (tmpw != src_texture.pixmap().width() ||
294 tmph != src_texture.pixmap().height()) {
286 295
287 // copy src_texture's pixmap and 296 // copy src_texture's pixmap and
288 // scale/tile to fit our size 297 // scale/tile to fit our size
289 FbPixmap new_pm(src_texture.pixmap()); 298 FbPixmap new_pm(src_texture.pixmap());
290 299
291 if ((src_texture.type() & Texture::TILED)) { 300 if ((src_texture.type() & Texture::TILED)) {
292 new_pm.tile(width,height); 301 new_pm.tile(tmpw,tmph);
293 } else { 302 } else {
294 new_pm.scale(width, height); 303 new_pm.scale(tmpw, tmph);
295 } 304 }
296 305 new_pm.rotate(orientation);
297 return new_pm.release(); 306 return new_pm.release();
298 } 307 }
299 // return copy of pixmap 308 // return copy of pixmap
300 return FbPixmap(src_texture.pixmap()).release(); 309 FbPixmap pm_copy = FbPixmap(src_texture.pixmap());
310 pm_copy.rotate(orientation);
311
312 return pm_copy.release();
301} 313}
302 314
303XImage *TextureRender::renderXImage() { 315XImage *TextureRender::renderXImage() {
@@ -728,6 +740,8 @@ Pixmap TextureRender::renderPixmap() {
728 740
729 XDestroyImage(image); 741 XDestroyImage(image);
730 742
743 pixmap.rotate(orientation);
744
731 return pixmap.release(); 745 return pixmap.release();
732} 746}
733 747