remove QRegion code
@@ -228,6 +228,7 @@ | ||
228 | 228 | SetWindowLong(winId(), GWL_EXSTYLE, WS_EX_TOOLWINDOW); |
229 | 229 | #endif |
230 | 230 | resize(pimpl->draw_widget_->size()); |
231 | + setAttribute(Qt::WA_TranslucentBackground, true); | |
231 | 232 | |
232 | 233 | // フォームの初期化 |
233 | 234 | pimpl->initializeForm(this); |
@@ -68,8 +68,7 @@ | ||
68 | 68 | |
69 | 69 | |
70 | 70 | // 画像の描画 |
71 | - void drawPixmap(QRegion& region, | |
72 | - const ThemeResource& resource, | |
71 | + void drawPixmap(const ThemeResource& resource, | |
73 | 72 | const string& tag_name, |
74 | 73 | const QRect& offset, |
75 | 74 | size_t scaling_percent, |
@@ -164,27 +163,22 @@ | ||
164 | 163 | QRect(x, y, w, fixed_h), |
165 | 164 | QRect(0, 0, w, fixed_h))); |
166 | 165 | is_drawn_ = false; |
167 | - | |
168 | - // 描画領域の更新 | |
169 | - QRegion parts_region = converted_pixmap->mask(); | |
170 | - parts_region.translate(x, y); | |
171 | - region += parts_region; | |
172 | 166 | } |
173 | 167 | |
174 | 168 | |
175 | 169 | // アナログ部分の再描画 |
176 | - void updateAnalog(QRegion& region, const ThemeResource& resource, | |
170 | + void updateAnalog(const ThemeResource& resource, | |
177 | 171 | int hour, int minute, int second, size_t scaling_percent) |
178 | 172 | { |
179 | 173 | // 針の角度を再計算 |
180 | 174 | qreal analog_h_degree = (360.0 * (hour / 12.0)) + (30.0 * (minute / 60.0)); |
181 | 175 | QRect analog_h_offset = getPosition(resource, "analog/hari_h"); |
182 | - drawPixmap(region, resource, "analog/hari_h", analog_h_offset, | |
176 | + drawPixmap(resource, "analog/hari_h", analog_h_offset, | |
183 | 177 | scaling_percent, analog_h_degree, CenterPosition); |
184 | 178 | |
185 | 179 | qreal analog_m_degree = 360.0 * minute / 60.0; |
186 | 180 | QRect analog_m_offset = getPosition(resource, "analog/hari_m"); |
187 | - drawPixmap(region, resource, "analog/hari_m", analog_m_offset, | |
181 | + drawPixmap(resource, "analog/hari_m", analog_m_offset, | |
188 | 182 | scaling_percent, analog_m_degree, CenterPosition); |
189 | 183 | |
190 | 184 | if (! resource.option.value("analog/sec", "").compare("on")) { |
@@ -191,7 +185,7 @@ | ||
191 | 185 | // 秒針は、指定があるときのみ描画する |
192 | 186 | qreal analog_s_degree = 360.0 * second / 60.0; |
193 | 187 | QRect analog_s_offset = getPosition(resource, "analog/hari_s"); |
194 | - drawPixmap(region, resource, "analog/hari_s", analog_s_offset, | |
188 | + drawPixmap(resource, "analog/hari_s", analog_s_offset, | |
195 | 189 | scaling_percent, analog_s_degree, CenterPosition); |
196 | 190 | } |
197 | 191 | } |
@@ -198,8 +192,7 @@ | ||
198 | 192 | |
199 | 193 | |
200 | 194 | // デジタル部分の再描画 |
201 | - void updateDigital(QRegion& region, | |
202 | - const ThemeResource& resource, | |
195 | + void updateDigital(const ThemeResource& resource, | |
203 | 196 | const QVector<QPoint>& digital_positions, |
204 | 197 | int hour, int minute, int second, size_t scaling_percent) |
205 | 198 | { |
@@ -245,7 +238,7 @@ | ||
245 | 238 | QSize size = parts->size(); |
246 | 239 | int x = digital_positions[i].x(); |
247 | 240 | int y = digital_positions[i].y(); |
248 | - drawPixmap(region, resource, digital_char, | |
241 | + drawPixmap(resource, digital_char, | |
249 | 242 | QRect(x, y, size.width(), size.height()), scaling_percent); |
250 | 243 | } |
251 | 244 | } |
@@ -252,7 +245,7 @@ | ||
252 | 245 | |
253 | 246 | |
254 | 247 | // カレンダー部品の描画 |
255 | - void updateCalendar(QRegion& region, const ThemeResource& resource, | |
248 | + void updateCalendar(const ThemeResource& resource, | |
256 | 249 | const QVector<QPoint>& calendar_positions, |
257 | 250 | int month, int day, int day_of_week, |
258 | 251 | size_t scaling_percent) |
@@ -302,7 +295,7 @@ | ||
302 | 295 | QSize size = parts->size(); |
303 | 296 | int x = calendar_positions[4 + i].x(); |
304 | 297 | int y = calendar_positions[4 + i].y(); |
305 | - drawPixmap(region, resource, tag, | |
298 | + drawPixmap(resource, tag, | |
306 | 299 | QRect(x, y, size.width(), size.height()), scaling_percent); |
307 | 300 | } |
308 | 301 |
@@ -317,7 +310,7 @@ | ||
317 | 310 | QSize size = parts->size(); |
318 | 311 | int x = calendar_positions[6].x(); |
319 | 312 | int y = calendar_positions[6].y(); |
320 | - drawPixmap(region, resource, tag, | |
313 | + drawPixmap(resource, tag, | |
321 | 314 | QRect(x, y, size.width(), size.height()), scaling_percent); |
322 | 315 | } |
323 | 316 |
@@ -334,7 +327,7 @@ | ||
334 | 327 | QSize size = parts->size(); |
335 | 328 | int x = calendar_positions[i].x(); |
336 | 329 | int y = calendar_positions[i].y(); |
337 | - drawPixmap(region, resource, number_char, | |
330 | + drawPixmap(resource, number_char, | |
338 | 331 | QRect(x, y, size.width(), size.height()), scaling_percent); |
339 | 332 | } |
340 | 333 | } |
@@ -341,17 +334,17 @@ | ||
341 | 334 | |
342 | 335 | |
343 | 336 | // 追加部品の描画 |
344 | - void updateAdditional(QRegion& region, const ThemeResource& resource, | |
337 | + void updateAdditional(const ThemeResource& resource, | |
345 | 338 | size_t scaling_percent) |
346 | 339 | { |
347 | 340 | QRect additional_offset = getPosition(resource, "additional/near"); |
348 | - drawPixmap(region, resource, "additional/near", | |
341 | + drawPixmap(resource, "additional/near", | |
349 | 342 | additional_offset, scaling_percent); |
350 | 343 | } |
351 | 344 | |
352 | 345 | |
353 | 346 | // アニメーションセルの描画 |
354 | - void updateAnimationCell(QRegion& region, const ThemeResource& resource, | |
347 | + void updateAnimationCell(const ThemeResource& resource, | |
355 | 348 | size_t cell_index, size_t scaling_percent) |
356 | 349 | { |
357 | 350 | if (last_cell_index_ == ClockPartsDraw::NoAnimationCell) { |
@@ -360,7 +353,7 @@ | ||
360 | 353 | |
361 | 354 | AnimationCellTag cell_tags(cell_index); |
362 | 355 | QRect cell_offset = getPosition(resource, cell_tags.cell_tag); |
363 | - drawPixmap(region, resource, cell_tags.cell_tag, | |
356 | + drawPixmap(resource, cell_tags.cell_tag, | |
364 | 357 | cell_offset, scaling_percent, 0.0, false, true); |
365 | 358 | } |
366 | 359 | } |
@@ -367,8 +360,7 @@ | ||
367 | 360 | |
368 | 361 | |
369 | 362 | // 再描画 |
370 | -void ClockPartsDraw::updatePixmaps(QRegion& region, | |
371 | - const ThemeResource& resource, | |
363 | +void ClockPartsDraw::updatePixmaps(const ThemeResource& resource, | |
372 | 364 | const QVector<QPoint>& digital_positions, |
373 | 365 | const QVector<QPoint>& calendar_positions, |
374 | 366 | size_t scaling_percent, int sec_offset, |
@@ -379,7 +371,7 @@ | ||
379 | 371 | |
380 | 372 | // ベース画像の描画 |
381 | 373 | QRect offset = getPosition(resource, "base/base_org"); |
382 | - drawPixmap(region, resource, "base/base_org", offset, scaling_percent); | |
374 | + drawPixmap(resource, "base/base_org", offset, scaling_percent); | |
383 | 375 | |
384 | 376 | // 部品画像の描画 |
385 | 377 | QTime current_time = QTime::currentTime(); |
@@ -393,7 +385,7 @@ | ||
393 | 385 | if (cell_index >= 0) { |
394 | 386 | last_cell_index_ = cell_index; |
395 | 387 | } |
396 | - updateAnimationCell(region, resource, last_cell_index_, scaling_percent); | |
388 | + updateAnimationCell(resource, last_cell_index_, scaling_percent); | |
397 | 389 | |
398 | 390 | } else { |
399 | 391 | // 何も描画させない |
@@ -405,18 +397,18 @@ | ||
405 | 397 | ! resource.option.value("digital/above", "off").compare("on"); |
406 | 398 | |
407 | 399 | if (! digital_above) { |
408 | - updateCalendar(region, resource, calendar_positions, | |
400 | + updateCalendar(resource, calendar_positions, | |
409 | 401 | date.month(), date.day(), date.dayOfWeek(), scaling_percent); |
410 | - updateDigital(region, resource, digital_positions, | |
402 | + updateDigital(resource, digital_positions, | |
411 | 403 | time.hour(), time.minute(), time.second(), scaling_percent); |
412 | 404 | } |
413 | - updateAnalog(region, resource, | |
405 | + updateAnalog(resource, | |
414 | 406 | time.hour(), time.minute(), time.second(), scaling_percent); |
415 | - updateAdditional(region, resource, scaling_percent); | |
407 | + updateAdditional(resource, scaling_percent); | |
416 | 408 | if (digital_above) { |
417 | - updateCalendar(region, resource, calendar_positions, | |
409 | + updateCalendar(resource, calendar_positions, | |
418 | 410 | date.month(), date.day(), date.dayOfWeek(), scaling_percent); |
419 | - updateDigital(region, resource, digital_positions, | |
411 | + updateDigital(resource, digital_positions, | |
420 | 412 | time.hour(), time.minute(), time.second(), scaling_percent); |
421 | 413 | } |
422 | 414 | } |
@@ -21,7 +21,6 @@ | ||
21 | 21 | #include "split.h" |
22 | 22 | #include <QLabel> |
23 | 23 | #include <QVBoxLayout> |
24 | -#include <QRegion> | |
25 | 24 | #include <QBitmap> |
26 | 25 | #include <QCloseEvent> |
27 | 26 | #include <QPainter> |
@@ -71,6 +70,7 @@ | ||
71 | 70 | vector<AnimationPattern> patterns_; |
72 | 71 | QTimer animation_cycle_timer_; |
73 | 72 | |
73 | + | |
74 | 74 | pImpl(ThemeClockDraw* parent) |
75 | 75 | : message_label_(NULL), theme_loaded_(false), parent_widget_(NULL), |
76 | 76 | scaling_percent_(100), no_animation_(false), sec_offset_(0), |
@@ -492,10 +492,6 @@ | ||
492 | 492 | // オプション設定の更新 |
493 | 493 | theme_resource_.option = option; |
494 | 494 | |
495 | - // アニメーション情報の読み出し | |
496 | - // !!! loadAnimations(theme_resource_, tags, rrda_encoder); | |
497 | - // !!! | |
498 | - | |
499 | 495 | theme_loaded_ = true; |
500 | 496 | |
501 | 497 | return true; |
@@ -582,21 +578,13 @@ | ||
582 | 578 | if (pimpl->theme_loaded_) { |
583 | 579 | |
584 | 580 | // 描画する pixmap を評価し、mask を生成する |
585 | - QRegion region; | |
586 | - ClockPartsDraw::updatePixmaps(region, | |
587 | - pimpl->theme_resource_, | |
581 | + ClockPartsDraw::updatePixmaps(pimpl->theme_resource_, | |
588 | 582 | pimpl->digital_positions_, |
589 | 583 | pimpl->calendar_positions_, |
590 | 584 | pimpl->scaling_percent_, |
591 | 585 | sec_offset, cell_index); |
592 | 586 | |
593 | - // mask を適用する。mask によっては、この時点で paintEvent() が呼ばれる | |
594 | - if (parent) { | |
595 | - parent->setMask(region); | |
596 | - } | |
597 | - | |
598 | 587 | // paintEvent() が呼ばれなかったとき用 |
599 | - // もし、setMask() 時に paintEvent() が呼ばれていた場合、処理はすぐに戻る | |
600 | 588 | update(); |
601 | 589 | } |
602 | 590 | } |
@@ -14,7 +14,6 @@ | ||
14 | 14 | |
15 | 15 | class QPainter; |
16 | 16 | class QPoint; |
17 | -class QRegion; | |
18 | 17 | class ThemeResource; |
19 | 18 | |
20 | 19 |
@@ -28,7 +27,6 @@ | ||
28 | 27 | /*! |
29 | 28 | \brief テーマ時計の再描画を行う |
30 | 29 | |
31 | - \param[out] region 描画 Pixel マスク領域の和 | |
32 | 30 | \param[in] resource 描画リソース |
33 | 31 | \param[in] digital_positions デジタル部品の描画位置 |
34 | 32 | \param[in] calendar_positions カレンダー部品の表示位置 |
@@ -35,8 +33,7 @@ | ||
35 | 33 | \param[in] scaling_percent 拡大率 [%] |
36 | 34 | \param[in] sec_offset 描画時の秒オフセット [sec] |
37 | 35 | */ |
38 | - extern void updatePixmaps(QRegion& region, | |
39 | - const ThemeResource& resource, | |
36 | + extern void updatePixmaps(const ThemeResource& resource, | |
40 | 37 | const QVector<QPoint>& digital_positions, |
41 | 38 | const QVector<QPoint>& calendar_positions, |
42 | 39 | size_t scaling_percent = 100, int sec_offset = 0, |