diff options
author | fluxgen <fluxgen> | 2003-04-28 22:27:29 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-04-28 22:27:29 (GMT) |
commit | 39e05f49d0fe58b42b36495950412e8d6b7673a2 (patch) | |
tree | 4da1d5cb03cb5a8a003c91ba5691d4ca8e29f681 /src/FbTk/TextureRender.cc | |
parent | e37f631c4fa90a952e50313a4b566b5219488a63 (diff) | |
download | fluxbox-39e05f49d0fe58b42b36495950412e8d6b7673a2.zip fluxbox-39e05f49d0fe58b42b36495950412e8d6b7673a2.tar.bz2 |
render scaled pixmap
Diffstat (limited to 'src/FbTk/TextureRender.cc')
-rw-r--r-- | src/FbTk/TextureRender.cc | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc index 1ad1b16..1f7d29f 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.2 2003/01/10 01:02:02 fluxgen Exp $ | 25 | // $Id: TextureRender.cc,v 1.3 2003/04/28 22:27:29 fluxgen Exp $ |
26 | 26 | ||
27 | #include "TextureRender.hh" | 27 | #include "TextureRender.hh" |
28 | 28 | ||
@@ -97,8 +97,9 @@ TextureRender::~TextureRender() { | |||
97 | 97 | ||
98 | 98 | ||
99 | Pixmap TextureRender::render(const FbTk::Texture &texture) { | 99 | Pixmap TextureRender::render(const FbTk::Texture &texture) { |
100 | 100 | if (texture.pixmap().drawable() != 0) | |
101 | if (texture.type() & FbTk::Texture::PARENTRELATIVE) | 101 | return renderPixmap(texture); |
102 | else if (texture.type() & FbTk::Texture::PARENTRELATIVE) | ||
102 | return ParentRelative; | 103 | return ParentRelative; |
103 | else if (texture.type() & FbTk::Texture::SOLID) | 104 | else if (texture.type() & FbTk::Texture::SOLID) |
104 | return renderSolid(texture); | 105 | return renderSolid(texture); |
@@ -257,6 +258,18 @@ Pixmap TextureRender::renderGradient(const FbTk::Texture &texture) { | |||
257 | 258 | ||
258 | } | 259 | } |
259 | 260 | ||
261 | Pixmap TextureRender::renderPixmap(const FbTk::Texture &src_texture) { | ||
262 | if (width != src_texture.pixmap().width() || | ||
263 | height != src_texture.pixmap().height()) { | ||
264 | // copy src_texture's pixmap and | ||
265 | // scale to fit our size | ||
266 | FbPixmap new_pm(src_texture.pixmap()); | ||
267 | new_pm.scale(width, height); | ||
268 | return new_pm.release(); | ||
269 | } | ||
270 | // return copy of pixmap | ||
271 | return FbPixmap(src_texture.pixmap()).release(); | ||
272 | } | ||
260 | 273 | ||
261 | XImage *TextureRender::renderXImage() { | 274 | XImage *TextureRender::renderXImage() { |
262 | Display *disp = FbTk::App::instance()->display(); | 275 | Display *disp = FbTk::App::instance()->display(); |
@@ -488,12 +501,12 @@ XImage *TextureRender::renderXImage() { | |||
488 | nberr = terr; | 501 | nberr = terr; |
489 | } | 502 | } |
490 | 503 | ||
491 | delete [] rerr; | 504 | delete [] rerr; |
492 | delete [] gerr; | 505 | delete [] gerr; |
493 | delete [] berr; | 506 | delete [] berr; |
494 | delete [] nrerr; | 507 | delete [] nrerr; |
495 | delete [] ngerr; | 508 | delete [] ngerr; |
496 | delete [] nberr; | 509 | delete [] nberr; |
497 | #endif // ORDEREDPSUEDO | 510 | #endif // ORDEREDPSUEDO |
498 | 511 | ||
499 | } break; | 512 | } break; |