• R/O
  • SSH
  • HTTPS

qtmclock: コミット


コミットメタ情報

リビジョン297 (tree)
日時2014-03-03 18:54:51
作者satofumi

ログメッセージ

remove QRegion code

変更サマリ

差分

--- qtmclock_src/qtmclock/ThemeClockWidget.cpp (revision 296)
+++ qtmclock_src/qtmclock/ThemeClockWidget.cpp (revision 297)
@@ -228,6 +228,7 @@
228228 SetWindowLong(winId(), GWL_EXSTYLE, WS_EX_TOOLWINDOW);
229229 #endif
230230 resize(pimpl->draw_widget_->size());
231+ setAttribute(Qt::WA_TranslucentBackground, true);
231232
232233 // フォームの初期化
233234 pimpl->initializeForm(this);
--- qtmclock_src/qtmclock/ClockPartsDraw.cpp (revision 296)
+++ qtmclock_src/qtmclock/ClockPartsDraw.cpp (revision 297)
@@ -68,8 +68,7 @@
6868
6969
7070 // 画像の描画
71- void drawPixmap(QRegion& region,
72- const ThemeResource& resource,
71+ void drawPixmap(const ThemeResource& resource,
7372 const string& tag_name,
7473 const QRect& offset,
7574 size_t scaling_percent,
@@ -164,27 +163,22 @@
164163 QRect(x, y, w, fixed_h),
165164 QRect(0, 0, w, fixed_h)));
166165 is_drawn_ = false;
167-
168- // 描画領域の更新
169- QRegion parts_region = converted_pixmap->mask();
170- parts_region.translate(x, y);
171- region += parts_region;
172166 }
173167
174168
175169 // アナログ部分の再描画
176- void updateAnalog(QRegion& region, const ThemeResource& resource,
170+ void updateAnalog(const ThemeResource& resource,
177171 int hour, int minute, int second, size_t scaling_percent)
178172 {
179173 // 針の角度を再計算
180174 qreal analog_h_degree = (360.0 * (hour / 12.0)) + (30.0 * (minute / 60.0));
181175 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,
183177 scaling_percent, analog_h_degree, CenterPosition);
184178
185179 qreal analog_m_degree = 360.0 * minute / 60.0;
186180 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,
188182 scaling_percent, analog_m_degree, CenterPosition);
189183
190184 if (! resource.option.value("analog/sec", "").compare("on")) {
@@ -191,7 +185,7 @@
191185 // 秒針は、指定があるときのみ描画する
192186 qreal analog_s_degree = 360.0 * second / 60.0;
193187 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,
195189 scaling_percent, analog_s_degree, CenterPosition);
196190 }
197191 }
@@ -198,8 +192,7 @@
198192
199193
200194 // デジタル部分の再描画
201- void updateDigital(QRegion& region,
202- const ThemeResource& resource,
195+ void updateDigital(const ThemeResource& resource,
203196 const QVector<QPoint>& digital_positions,
204197 int hour, int minute, int second, size_t scaling_percent)
205198 {
@@ -245,7 +238,7 @@
245238 QSize size = parts->size();
246239 int x = digital_positions[i].x();
247240 int y = digital_positions[i].y();
248- drawPixmap(region, resource, digital_char,
241+ drawPixmap(resource, digital_char,
249242 QRect(x, y, size.width(), size.height()), scaling_percent);
250243 }
251244 }
@@ -252,7 +245,7 @@
252245
253246
254247 // カレンダー部品の描画
255- void updateCalendar(QRegion& region, const ThemeResource& resource,
248+ void updateCalendar(const ThemeResource& resource,
256249 const QVector<QPoint>& calendar_positions,
257250 int month, int day, int day_of_week,
258251 size_t scaling_percent)
@@ -302,7 +295,7 @@
302295 QSize size = parts->size();
303296 int x = calendar_positions[4 + i].x();
304297 int y = calendar_positions[4 + i].y();
305- drawPixmap(region, resource, tag,
298+ drawPixmap(resource, tag,
306299 QRect(x, y, size.width(), size.height()), scaling_percent);
307300 }
308301
@@ -317,7 +310,7 @@
317310 QSize size = parts->size();
318311 int x = calendar_positions[6].x();
319312 int y = calendar_positions[6].y();
320- drawPixmap(region, resource, tag,
313+ drawPixmap(resource, tag,
321314 QRect(x, y, size.width(), size.height()), scaling_percent);
322315 }
323316
@@ -334,7 +327,7 @@
334327 QSize size = parts->size();
335328 int x = calendar_positions[i].x();
336329 int y = calendar_positions[i].y();
337- drawPixmap(region, resource, number_char,
330+ drawPixmap(resource, number_char,
338331 QRect(x, y, size.width(), size.height()), scaling_percent);
339332 }
340333 }
@@ -341,17 +334,17 @@
341334
342335
343336 // 追加部品の描画
344- void updateAdditional(QRegion& region, const ThemeResource& resource,
337+ void updateAdditional(const ThemeResource& resource,
345338 size_t scaling_percent)
346339 {
347340 QRect additional_offset = getPosition(resource, "additional/near");
348- drawPixmap(region, resource, "additional/near",
341+ drawPixmap(resource, "additional/near",
349342 additional_offset, scaling_percent);
350343 }
351344
352345
353346 // アニメーションセルの描画
354- void updateAnimationCell(QRegion& region, const ThemeResource& resource,
347+ void updateAnimationCell(const ThemeResource& resource,
355348 size_t cell_index, size_t scaling_percent)
356349 {
357350 if (last_cell_index_ == ClockPartsDraw::NoAnimationCell) {
@@ -360,7 +353,7 @@
360353
361354 AnimationCellTag cell_tags(cell_index);
362355 QRect cell_offset = getPosition(resource, cell_tags.cell_tag);
363- drawPixmap(region, resource, cell_tags.cell_tag,
356+ drawPixmap(resource, cell_tags.cell_tag,
364357 cell_offset, scaling_percent, 0.0, false, true);
365358 }
366359 }
@@ -367,8 +360,7 @@
367360
368361
369362 // 再描画
370-void ClockPartsDraw::updatePixmaps(QRegion& region,
371- const ThemeResource& resource,
363+void ClockPartsDraw::updatePixmaps(const ThemeResource& resource,
372364 const QVector<QPoint>& digital_positions,
373365 const QVector<QPoint>& calendar_positions,
374366 size_t scaling_percent, int sec_offset,
@@ -379,7 +371,7 @@
379371
380372 // ベース画像の描画
381373 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);
383375
384376 // 部品画像の描画
385377 QTime current_time = QTime::currentTime();
@@ -393,7 +385,7 @@
393385 if (cell_index >= 0) {
394386 last_cell_index_ = cell_index;
395387 }
396- updateAnimationCell(region, resource, last_cell_index_, scaling_percent);
388+ updateAnimationCell(resource, last_cell_index_, scaling_percent);
397389
398390 } else {
399391 // 何も描画させない
@@ -405,18 +397,18 @@
405397 ! resource.option.value("digital/above", "off").compare("on");
406398
407399 if (! digital_above) {
408- updateCalendar(region, resource, calendar_positions,
400+ updateCalendar(resource, calendar_positions,
409401 date.month(), date.day(), date.dayOfWeek(), scaling_percent);
410- updateDigital(region, resource, digital_positions,
402+ updateDigital(resource, digital_positions,
411403 time.hour(), time.minute(), time.second(), scaling_percent);
412404 }
413- updateAnalog(region, resource,
405+ updateAnalog(resource,
414406 time.hour(), time.minute(), time.second(), scaling_percent);
415- updateAdditional(region, resource, scaling_percent);
407+ updateAdditional(resource, scaling_percent);
416408 if (digital_above) {
417- updateCalendar(region, resource, calendar_positions,
409+ updateCalendar(resource, calendar_positions,
418410 date.month(), date.day(), date.dayOfWeek(), scaling_percent);
419- updateDigital(region, resource, digital_positions,
411+ updateDigital(resource, digital_positions,
420412 time.hour(), time.minute(), time.second(), scaling_percent);
421413 }
422414 }
--- qtmclock_src/qtmclock/ThemeClockDraw.cpp (revision 296)
+++ qtmclock_src/qtmclock/ThemeClockDraw.cpp (revision 297)
@@ -21,7 +21,6 @@
2121 #include "split.h"
2222 #include <QLabel>
2323 #include <QVBoxLayout>
24-#include <QRegion>
2524 #include <QBitmap>
2625 #include <QCloseEvent>
2726 #include <QPainter>
@@ -71,6 +70,7 @@
7170 vector<AnimationPattern> patterns_;
7271 QTimer animation_cycle_timer_;
7372
73+
7474 pImpl(ThemeClockDraw* parent)
7575 : message_label_(NULL), theme_loaded_(false), parent_widget_(NULL),
7676 scaling_percent_(100), no_animation_(false), sec_offset_(0),
@@ -492,10 +492,6 @@
492492 // オプション設定の更新
493493 theme_resource_.option = option;
494494
495- // アニメーション情報の読み出し
496- // !!! loadAnimations(theme_resource_, tags, rrda_encoder);
497- // !!!
498-
499495 theme_loaded_ = true;
500496
501497 return true;
@@ -582,21 +578,13 @@
582578 if (pimpl->theme_loaded_) {
583579
584580 // 描画する pixmap を評価し、mask を生成する
585- QRegion region;
586- ClockPartsDraw::updatePixmaps(region,
587- pimpl->theme_resource_,
581+ ClockPartsDraw::updatePixmaps(pimpl->theme_resource_,
588582 pimpl->digital_positions_,
589583 pimpl->calendar_positions_,
590584 pimpl->scaling_percent_,
591585 sec_offset, cell_index);
592586
593- // mask を適用する。mask によっては、この時点で paintEvent() が呼ばれる
594- if (parent) {
595- parent->setMask(region);
596- }
597-
598587 // paintEvent() が呼ばれなかったとき用
599- // もし、setMask() 時に paintEvent() が呼ばれていた場合、処理はすぐに戻る
600588 update();
601589 }
602590 }
--- qtmclock_src/qtmclock/ClockPartsDraw.h (revision 296)
+++ qtmclock_src/qtmclock/ClockPartsDraw.h (revision 297)
@@ -14,7 +14,6 @@
1414
1515 class QPainter;
1616 class QPoint;
17-class QRegion;
1817 class ThemeResource;
1918
2019
@@ -28,7 +27,6 @@
2827 /*!
2928 \brief テーマ時計の再描画を行う
3029
31- \param[out] region 描画 Pixel マスク領域の和
3230 \param[in] resource 描画リソース
3331 \param[in] digital_positions デジタル部品の描画位置
3432 \param[in] calendar_positions カレンダー部品の表示位置
@@ -35,8 +33,7 @@
3533 \param[in] scaling_percent 拡大率 [%]
3634 \param[in] sec_offset 描画時の秒オフセット [sec]
3735 */
38- extern void updatePixmaps(QRegion& region,
39- const ThemeResource& resource,
36+ extern void updatePixmaps(const ThemeResource& resource,
4037 const QVector<QPoint>& digital_positions,
4138 const QVector<QPoint>& calendar_positions,
4239 size_t scaling_percent = 100, int sec_offset = 0,
旧リポジトリブラウザで表示