diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2011-02-21 19:49:10 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2011-02-21 19:49:10 (GMT) |
commit | 92deeba2a099ff93c0a766b2aa46454d62b19d8e (patch) | |
tree | 72eb7fd4e58411b6be116304091e33f8a6034b54 | |
parent | 3f30cbb2aec9a35eaa06e2b9bb9bf25d889c60de (diff) | |
download | fluxbox_paul-92deeba2a099ff93c0a766b2aa46454d62b19d8e.zip fluxbox_paul-92deeba2a099ff93c0a766b2aa46454d62b19d8e.tar.bz2 |
Render rectangles instead of squares to test TextureRender.cc
-rw-r--r-- | src/tests/texturetest.cc | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/tests/texturetest.cc b/src/tests/texturetest.cc index a9ac615..3fa6704 100644 --- a/src/tests/texturetest.cc +++ b/src/tests/texturetest.cc | |||
@@ -32,12 +32,12 @@ public: | |||
32 | class Application: public FbTk::FbWindow, public FbTk::EventHandler { | 32 | class Application: public FbTk::FbWindow, public FbTk::EventHandler { |
33 | public: | 33 | public: |
34 | Application(int box_size, int num): | 34 | Application(int box_size, int num): |
35 | FbWindow(0, 0, 0, 640, box_size*num/8 - 3*5, ExposureMask | KeyPressMask), | 35 | FbWindow(0, 0, 0, 640, ((5+box_size)*num)/9 + 5, ExposureMask | KeyPressMask), |
36 | m_box_size(box_size), | 36 | m_box_size(box_size), |
37 | m_num(num), | 37 | m_num(num), |
38 | m_font("fixed"), | 38 | m_font("fixed"), |
39 | m_imgctrl(screenNumber()), | 39 | m_imgctrl(screenNumber()), |
40 | m_background(*this, 640, 480, depth()), | 40 | m_background(*this, width(), height(), depth()), |
41 | m_gc(m_background) { | 41 | m_gc(m_background) { |
42 | setName("Texture Test"); | 42 | setName("Texture Test"); |
43 | setBackgroundPixmap(m_background.drawable()); | 43 | setBackgroundPixmap(m_background.drawable()); |
@@ -58,13 +58,13 @@ public: | |||
58 | private: | 58 | private: |
59 | 59 | ||
60 | void renderPixmap(const Texture &text, int x, int y) { | 60 | void renderPixmap(const Texture &text, int x, int y) { |
61 | Pixmap pm = m_imgctrl.renderImage(m_box_size, m_box_size, | 61 | Pixmap pm = m_imgctrl.renderImage(2*m_box_size, m_box_size, |
62 | text); | 62 | text); |
63 | 63 | ||
64 | m_background.copyArea(pm, m_gc.gc(), | 64 | m_background.copyArea(pm, m_gc.gc(), |
65 | 0, 0, | 65 | 0, 0, |
66 | x, y, | 66 | x, y, |
67 | m_box_size, m_box_size); | 67 | 2*m_box_size, m_box_size); |
68 | m_imgctrl.removeImage(pm); | 68 | m_imgctrl.removeImage(pm); |
69 | } | 69 | } |
70 | 70 | ||
@@ -87,17 +87,13 @@ private: | |||
87 | char value[18]; | 87 | char value[18]; |
88 | for (int i=0; i<m_num; ++i) { | 88 | for (int i=0; i<m_num; ++i) { |
89 | sprintf(value, "%d", i); | 89 | sprintf(value, "%d", i); |
90 | text.reset(new ThemeItem<Texture> | 90 | text.reset(new ThemeItem<Texture> (tm, string("texture") + value, string("Texture") + value)); |
91 | (tm, | ||
92 | string("texture") + value, | ||
93 | string("Texture") + value)); | ||
94 | // load new style | ||
95 | ThemeManager::instance().load("test.theme", ""); | ||
96 | 91 | ||
92 | ThemeManager::instance().load("test.theme", ""); | ||
97 | renderPixmap(**text.get(), next_x, next_y); | 93 | renderPixmap(**text.get(), next_x, next_y); |
98 | 94 | ||
99 | next_x += step_size; | 95 | next_x += (step_size + m_box_size); |
100 | if (next_x + m_box_size > width()) { | 96 | if (next_x + 2*m_box_size > width()) { |
101 | m_font.drawText(m_background, | 97 | m_font.drawText(m_background, |
102 | screenNumber(), | 98 | screenNumber(), |
103 | m_gc.gc(), | 99 | m_gc.gc(), |
@@ -122,7 +118,7 @@ private: | |||
122 | }; | 118 | }; |
123 | 119 | ||
124 | int main(int argc, char **argv) { | 120 | int main(int argc, char **argv) { |
125 | int boxsize= 60; | 121 | int boxsize= 30; |
126 | int num = 63; | 122 | int num = 63; |
127 | for (int i=1; i<argc; ++i) { | 123 | for (int i=1; i<argc; ++i) { |
128 | if (strcmp(argv[i], "-boxsize") == 0 && i + 1 < argc) | 124 | if (strcmp(argv[i], "-boxsize") == 0 && i + 1 < argc) |