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 | |
parent | e37f631c4fa90a952e50313a4b566b5219488a63 (diff) | |
download | fluxbox-39e05f49d0fe58b42b36495950412e8d6b7673a2.zip fluxbox-39e05f49d0fe58b42b36495950412e8d6b7673a2.tar.bz2 |
render scaled pixmap
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/TextureRender.cc | 31 | ||||
-rw-r--r-- | src/FbTk/TextureRender.hh | 5 |
2 files changed, 25 insertions, 11 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; |
diff --git a/src/FbTk/TextureRender.hh b/src/FbTk/TextureRender.hh index 5b77753..f07a5c7 100644 --- a/src/FbTk/TextureRender.hh +++ b/src/FbTk/TextureRender.hh | |||
@@ -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.hh,v 1.1 2003/01/09 21:09:49 fluxgen Exp $ | 25 | // $Id: TextureRender.hh,v 1.2 2003/04/28 22:27:29 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef FBTK_TEXTURRENDER_HH | 27 | #ifndef FBTK_TEXTURRENDER_HH |
28 | #define FBTK_TEXTURRENDER_HH | 28 | #define FBTK_TEXTURRENDER_HH |
@@ -51,7 +51,8 @@ public: | |||
51 | Pixmap renderSolid(const FbTk::Texture &src_texture); | 51 | Pixmap renderSolid(const FbTk::Texture &src_texture); |
52 | /// render gradient texture to pixmap | 52 | /// render gradient texture to pixmap |
53 | Pixmap renderGradient(const FbTk::Texture &src_texture); | 53 | Pixmap renderGradient(const FbTk::Texture &src_texture); |
54 | 54 | /// scales and renders a pixmap | |
55 | Pixmap renderPixmap(const FbTk::Texture &src_texture); | ||
55 | private: | 56 | private: |
56 | /** | 57 | /** |
57 | Render to pixmap | 58 | Render to pixmap |