Ticket #944: 944.patch
File 944.patch, 38.2 KB (added by , 20 years ago) |
---|
-
libs/libmythtv/osdlistbtntype.h
66 66 const QRect &levelsize, int levelspacing, 67 67 float wmult, float hmult); 68 68 69 void Reinit(float w change, float hchange, float wmult, float hmult);69 void Reinit(float wmult, float hmult); 70 70 void SetGroupCheckState(QString group, int newState = 0); 71 71 72 72 void SetFontActive(TTFFont *font); … … 116 116 uint m_itemRegAlpha; 117 117 uint m_itemSelAlpha; 118 118 119 int m_spacing; 120 int m_margin; 119 int m_spacing; 120 int m_margin; 121 QRect m_totalarea; 122 QRect m_levelsize; 121 123 122 QRect m_totalarea; 123 QRect m_levelsize; 124 float m_unbiasedspacing; 125 float m_unbiasedmargin; 126 QRect m_unbiasedarea; 127 QRect m_unbiasedsize; 128 124 129 int m_levelspacing; 125 130 126 131 float m_wmult; … … 139 144 bool showScrollArrows = false); 140 145 ~OSDListBtnType(); 141 146 142 void Reinit(float w change, float hchange, float wmult, float hmult);147 void Reinit(float wmult, float hmult); 143 148 void SetGroupCheckState(QString group, int newState = 0); 144 149 145 150 void SetFontActive(TTFFont *font); … … 180 185 void RemoveItem(OSDListBtnTypeItem *item); 181 186 182 187 int m_order; 183 QRect m_rect;184 188 QRect m_contentsRect; 185 189 QRect m_arrowsRect; 186 190 187 191 float m_wmult; 188 192 float m_hmult; 189 193 194 QRect m_rect; 195 QRect m_unbiasedRect; 196 190 197 int m_itemHeight; 191 198 int m_itemSpacing; 192 199 int m_itemMargin; 200 float m_itemUnbiasedHeight; 201 float m_itemUnbiasedSpacing; 202 float m_itemUnbiasedMargin; 203 193 204 uint m_itemsVisible; 194 205 195 206 bool m_active; … … 265 276 void setGroup(QString group) { m_group = group; }; 266 277 QString getGroup(void) { return m_group; } 267 278 268 void Reinit(float w change, float hchange, float wmult, float hmult);279 void Reinit(float wmult, float hmult); 269 280 270 281 void paint(OSDSurface *surface, TTFFont *font, int fade, int maxfade, 271 282 int x, int y); … … 285 296 QRect m_textRect; 286 297 QRect m_arrowRect; 287 298 299 QRect m_unbiasedCheckRect; 300 QRect m_unbiasedPixmapRect; 301 QRect m_unbiasedTextRect; 302 QRect m_unbiasedArrowRect; 303 288 304 bool m_showArrow; 289 305 290 306 friend class OSDListBtnType; -
libs/libmythtv/NuppelVideoPlayer.cpp
4972 4972 QImage scaledImage = qImage.smoothScale(rect->w, rect->h); 4973 4973 4974 4974 OSDTypeImage* image = new OSDTypeImage(); 4975 image->SetPosition(QPoint(rect->x, rect->y) );4975 image->SetPosition(QPoint(rect->x, rect->y), hmult, vmult); 4976 4976 image->LoadFromQImage(scaledImage); 4977 4977 4978 4978 subtitleOSD->AddType(image); -
libs/libmythtv/osdlistbtntype.cpp
66 66 m_hmult = hmult; 67 67 68 68 m_totalarea = area; 69 m_unbiasedarea = 70 QRect((int)round(m_totalarea.x() / wmult), 71 (int)round(m_totalarea.y() / hmult), 72 (int)ceil( m_totalarea.width() / wmult), 73 (int)ceil( m_totalarea.height() / hmult)); 74 69 75 m_levelsize = levelsize; 76 m_unbiasedsize = 77 QRect((int)round(m_levelsize.x() / wmult), 78 (int)round(m_levelsize.y() / hmult), 79 (int)ceil( m_levelsize.width() / wmult), 80 (int)ceil( m_levelsize.height() / hmult)); 81 70 82 m_levelspacing = levelspacing; 71 83 72 84 if (gContext->GetNumSetting("UseArrowAccels", 1)) … … 94 106 m_margin = 0; 95 107 } 96 108 97 void OSDListTreeType::Reinit(float wchange, float hchange, float wmult, 98 float hmult) 109 void OSDListTreeType::Reinit(float wmult, float hmult) 99 110 { 100 111 m_wmult = wmult; 101 112 m_hmult = hmult; 102 113 103 m_spacing = (int)(m_ spacing * wchange);104 m_margin = (int)(m_margin * wchange);114 m_spacing = (int)(m_unbiasedspacing * wmult); 115 m_margin = (int)(m_unbiasedmargin * wmult); 105 116 106 int width = (int)(m_totalarea.width() * wchange); 107 int height = (int)(m_totalarea.height() * hchange); 108 int x = (int)(m_totalarea.x() * wchange); 109 int y = (int)(m_totalarea.y() * hchange); 117 m_totalarea = 118 QRect((int)round(m_unbiasedarea.x() * wmult), 119 (int)round(m_unbiasedarea.y() * hmult), 120 (int)ceil( m_unbiasedarea.width() * wmult), 121 (int)ceil( m_unbiasedarea.height() * hmult)); 110 122 111 m_totalarea = QRect(x, y, width, height); 123 m_levelsize = 124 QRect((int)round(m_unbiasedsize.x() * wmult), 125 (int)round(m_unbiasedsize.y() * hmult), 126 (int)ceil( m_unbiasedsize.width() * wmult), 127 (int)ceil( m_unbiasedsize.height() * hmult)); 112 128 113 width = (int)(m_levelsize.width() * wchange);114 height = (int)(m_levelsize.height() * hchange);115 x = (int)(m_levelsize.x() * wchange);116 y = (int)(m_levelsize.y() * hchange);117 118 m_levelsize = QRect(x, y, width, height);119 120 129 QPtrListIterator<OSDListBtnType> it(listLevels); 121 130 OSDListBtnType *child; 122 131 123 132 while ((child = it.current()) != 0) 124 133 { 125 child->Reinit(w change, hchange, wmult, hmult);134 child->Reinit(wmult, hmult); 126 135 ++it; 127 136 } 128 137 } … … 166 175 167 176 void OSDListTreeType::SetSpacing(int spacing) 168 177 { 169 m_spacing = spacing; 178 m_spacing = spacing; 179 m_unbiasedspacing = spacing / m_wmult; 170 180 } 171 181 172 182 void OSDListTreeType::SetMargin(int margin) 173 183 { 174 m_margin = margin; 184 m_margin = margin; 185 m_unbiasedspacing = margin / m_wmult; 175 186 } 176 187 177 188 void OSDListTreeType::SetAsTree(OSDGenericTree *toplevel) … … 423 434 : OSDType(name) 424 435 { 425 436 m_rect = area; 437 m_unbiasedRect = 438 QRect((int)round(area.x() / wmult), 439 (int)round(area.y() / hmult), 440 (int)ceil( area.width() / wmult), 441 (int)ceil( area.height() / hmult)); 426 442 443 VERBOSE(VB_IMPORTANT, 444 "OSDListBtnType("<<name<<") " 445 " rect: "<<m_rect.x()<<"x"<<m_rect.y()<<" (" 446 <<m_rect.width()<<", "<<m_rect.height()<<")" 447 " unbias: "<<m_unbiasedRect.x()<<"x"<<m_unbiasedRect.y()<<" (" 448 <<m_unbiasedRect.width()<<", "<<m_unbiasedRect.height()<<")"); 449 427 450 m_wmult = wmult; 428 451 m_hmult = hmult; 429 452 … … 457 480 Reset(); 458 481 } 459 482 460 void OSDListBtnType::Reinit(float wchange, float hchange, float wmult, 461 float hmult) 483 void OSDListBtnType::Reinit(float wmult, float hmult) 462 484 { 463 485 m_wmult = wmult; 464 486 m_hmult = hmult; 465 487 466 m_itemHeight = (int)(m_itemHeight * hchange);467 m_itemSpacing = (int)(m_item Spacing * wchange);468 m_itemMargin = (int)(m_itemMargin * wchange);488 m_itemHeight = (int)(m_itemUnbiasedHeight * hmult) & ~0x1; 489 m_itemSpacing = (int)(m_itemUnbiasedSpacing * wmult); 490 m_itemMargin = (int)(m_itemUnbiasedMargin * wmult); 469 491 470 int width = (int)(m_rect.width() * wchange); 471 int height = (int)(m_rect.height() * hchange); 472 int x = (int)(m_rect.x() * wchange); 473 int y = (int)(m_rect.y() * hchange); 492 m_rect = 493 QRect((int)round(m_unbiasedRect.x() * wmult), 494 (int)round(m_unbiasedRect.y() * hmult), 495 (int)ceil( m_unbiasedRect.width() * wmult), 496 (int)ceil( m_unbiasedRect.height() * hmult)); 474 497 475 m_rect = QRect(x, y, width, height);476 477 498 Init(); 478 499 479 500 OSDListBtnTypeItem* item = 0; 480 for (item = m_itemList.first(); item; item = m_itemList.next()) { 481 item->Reinit(wchange, hchange, wmult, hmult); 482 } 483 501 for (item = m_itemList.first(); item; item = m_itemList.next()) 502 item->Reinit(wmult, hmult); 484 503 } 485 504 486 505 void OSDListBtnType::SetGroupCheckState(QString group, int newState) … … 520 539 521 540 void OSDListBtnType::SetSpacing(int spacing) 522 541 { 523 m_itemSpacing = spacing; 542 m_itemSpacing = spacing; 543 m_itemUnbiasedSpacing = spacing / m_wmult; 524 544 } 525 545 526 546 void OSDListBtnType::SetMargin(int margin) 527 547 { 528 m_itemMargin = margin; 548 m_itemMargin = margin; 549 m_itemUnbiasedMargin = margin / m_wmult; 529 550 } 530 551 531 552 void OSDListBtnType::SetActive(bool active) … … 797 818 int sz1 = m_fontActive->Size() * 3 / 2; 798 819 int sz2 = m_fontInactive->Size() * 3 / 2; 799 820 m_itemHeight = QMAX(sz1, sz2) + (int)(2 * m_itemMargin); 821 m_itemUnbiasedHeight = m_itemHeight / m_hmult; 822 m_itemHeight = m_itemHeight & ~0x1; 800 823 801 m_itemHeight = (m_itemHeight / 2) * 2;802 803 824 if (m_showScrollArrows) 804 825 { 805 826 LoadPixmap(m_upArrowRegPix, "uparrow-reg"); … … 948 969 (m_pixmap ? m_pixmapRect.width() + margin : 0), 949 970 height); 950 971 972 float wmult = m_parent->m_wmult; 973 float hmult = m_parent->m_hmult; 974 975 m_unbiasedCheckRect = 976 QRect((int)(m_checkRect.x() / wmult), 977 (int)(m_checkRect.y() / hmult), 978 (int)(m_checkRect.width() / wmult), 979 (int)(m_checkRect.height() / hmult)); 980 981 m_unbiasedPixmapRect = 982 QRect((int)(m_pixmapRect.x() / wmult), 983 (int)(m_pixmapRect.y() / hmult), 984 (int)(m_pixmapRect.width() / wmult), 985 (int)(m_pixmapRect.height() / hmult)); 986 987 m_unbiasedTextRect = 988 QRect((int)(m_textRect.x() / wmult), 989 (int)(m_textRect.y() / hmult), 990 (int)(m_textRect.width() / wmult), 991 (int)(m_textRect.height() / hmult)); 992 993 m_unbiasedArrowRect = 994 QRect((int)(m_arrowRect.x() / wmult), 995 (int)(m_arrowRect.y() / hmult), 996 (int)(m_arrowRect.width() / wmult), 997 (int)(m_arrowRect.height() / hmult)); 998 951 999 m_parent->InsertItem(this); 952 1000 } 953 1001 … … 1050 1098 font->DrawString(surface, tr.x(), tr.y(), m_text, tr.right(), tr.bottom()); 1051 1099 } 1052 1100 1053 void OSDListBtnTypeItem::Reinit(float wchange, float hchange, 1054 float wmult, float hmult) 1101 void OSDListBtnTypeItem::Reinit(float wmult, float hmult) 1055 1102 { 1056 (void)wmult; 1057 (void)hmult; 1103 m_checkRect = 1104 QRect((int)(m_unbiasedCheckRect.x() * wmult), 1105 (int)(m_unbiasedCheckRect.y() * hmult), 1106 (int)(m_unbiasedCheckRect.width() * wmult), 1107 (int)(m_unbiasedCheckRect.height() * hmult)); 1058 1108 1059 int width = (int)(m_checkRect.width() * wchange); 1060 int height = (int)(m_checkRect.height() * hchange); 1061 int x = (int)(m_checkRect.x() * wchange); 1062 int y = (int)(m_checkRect.y() * hchange); 1109 m_pixmapRect = 1110 QRect((int)(m_unbiasedPixmapRect.x() * wmult), 1111 (int)(m_unbiasedPixmapRect.y() * hmult), 1112 (int)(m_unbiasedPixmapRect.width() * wmult), 1113 (int)(m_unbiasedPixmapRect.height() * hmult)); 1063 1114 1064 m_checkRect = QRect(x, y, width, height); 1115 m_textRect = 1116 QRect((int)(m_unbiasedTextRect.x() * wmult), 1117 (int)(m_unbiasedTextRect.y() * hmult), 1118 (int)(m_unbiasedTextRect.width() * wmult), 1119 (int)(m_unbiasedTextRect.height() * hmult)); 1065 1120 1066 width = (int)(m_pixmapRect.width() * wchange); 1067 height = (int)(m_pixmapRect.height() * hchange); 1068 x = (int)(m_pixmapRect.x() * wchange); 1069 y = (int)(m_pixmapRect.y() * hchange); 1070 1071 m_pixmapRect = QRect(x, y, width, height); 1072 1073 width = (int)(m_textRect.width() * wchange); 1074 height = (int)(m_textRect.height() * hchange); 1075 x = (int)(m_textRect.x() * wchange); 1076 y = (int)(m_textRect.y() * hchange); 1077 1078 m_textRect = QRect(x, y, width, height); 1079 1080 width = (int)(m_arrowRect.width() * wchange); 1081 height = (int)(m_arrowRect.height() * hchange); 1082 x = (int)(m_arrowRect.x() * wchange); 1083 y = (int)(m_arrowRect.y() * hchange); 1084 1085 m_arrowRect = QRect(x, y, width, height); 1121 m_arrowRect = 1122 QRect((int)(m_unbiasedArrowRect.x() * wmult), 1123 (int)(m_unbiasedArrowRect.y() * hmult), 1124 (int)(m_unbiasedArrowRect.width() * wmult), 1125 (int)(m_unbiasedArrowRect.height() * hmult)); 1086 1126 } 1087 1127 -
libs/libmythtv/osdtypes.cpp
160 160 int displaywidth, int displayheight, 161 161 float wmult, float hmult, int frint) 162 162 { 163 float wchange = wmult / m_wmult;164 float hchange = hmult / m_hmult;165 166 163 m_frameint = frint; 167 164 168 165 m_screenwidth = screenwidth; … … 175 172 vector<OSDType *>::iterator iter = allTypes->begin(); 176 173 for (;iter != allTypes->end(); iter++) 177 174 { 178 OSDType *type = (*iter); 179 if (OSDTypeText *item = dynamic_cast<OSDTypeText*>(type)) 180 { 181 item->Reinit(wchange, hchange); 182 } 183 else if (OSDTypePositionImage *item = 184 dynamic_cast<OSDTypePositionImage*>(type)) 185 { 186 item->Reinit(wchange, hchange, wmult, hmult); 187 } 188 else if (OSDTypePosSlider *item = dynamic_cast<OSDTypePosSlider*>(type)) 189 { 190 item->Reinit(wchange, hchange, wmult, hmult); 191 } 192 else if (OSDTypeFillSlider *item = 193 dynamic_cast<OSDTypeFillSlider*>(type)) 194 { 195 item->Reinit(wchange, hchange, wmult, hmult); 196 } 197 else if (OSDTypeEditSlider *item = 198 dynamic_cast<OSDTypeEditSlider*>(type)) 199 { 200 item->Reinit(wchange, hchange, wmult, hmult); 201 } 202 else if (OSDTypeImage *item = dynamic_cast<OSDTypeImage*>(type)) 203 { 204 item->Reinit(wchange, hchange, wmult, hmult); 205 } 206 else if (OSDTypeBox *item = dynamic_cast<OSDTypeBox*>(type)) 207 { 208 item->Reinit(wchange, hchange); 209 } 210 else if (OSDTypePositionRectangle *item = 211 dynamic_cast<OSDTypePositionRectangle*>(type)) 212 { 213 item->Reinit(wchange, hchange); 214 } 215 else if (OSDTypeCC *item = dynamic_cast<OSDTypeCC*>(type)) 216 { 217 item->Reinit(xoff, yoff, displaywidth, displayheight); 218 } 219 else if (OSDListTreeType *item = dynamic_cast<OSDListTreeType*>(type)) 220 { 221 item->Reinit(wchange, hchange, wmult, hmult); 222 } 175 if (OSDTypeCC *cc608 = dynamic_cast<OSDTypeCC*>(*iter)) 176 cc608->Reinit(xoff, yoff, displaywidth, displayheight, 177 wmult, hmult); 223 178 else 224 { 225 cerr << "Unknown conversion\n"; 226 } 179 (*iter)->Reinit(wmult, hmult); 227 180 } 228 229 181 } 230 182 231 183 OSDType *OSDSet::GetType(const QString &name) … … 443 395 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 444 396 445 397 OSDTypeText::OSDTypeText(const QString &name, TTFFont *font, 446 const QString &text, QRect displayrect) 398 const QString &text, QRect displayrect, 399 float wmult, float hmult) 447 400 : OSDType(name) 448 401 { 449 402 m_message = text; … … 464 417 m_scrollinit = false; 465 418 466 419 m_linespacing = 1.5; 420 421 m_unbiasedsize = 422 QRect((int)round(m_screensize.x() / wmult), 423 (int)round(m_screensize.y() / hmult), 424 (int)ceil( m_screensize.width() / wmult), 425 (int)ceil( m_screensize.height() / hmult)); 467 426 } 468 427 469 428 OSDTypeText::OSDTypeText(const OSDTypeText &other) … … 507 466 m_scrollinit = false; 508 467 } 509 468 510 void OSDTypeText::Reinit(float w change, float hchange)469 void OSDTypeText::Reinit(float wmult, float hmult) 511 470 { 512 int width = (int)(m_screensize.width() * wchange); 513 int height = (int)(m_screensize.height() * hchange); 514 int x = (int)(m_screensize.x() * wchange); 515 int y = (int)(m_screensize.y() * hchange); 516 517 m_displaysize = m_screensize = QRect(x, y, width, height); 471 m_displaysize = m_screensize = 472 QRect((int)round(m_unbiasedsize.x() * wmult), 473 (int)round(m_unbiasedsize.y() * hmult), 474 (int)ceil( m_unbiasedsize.width() * wmult), 475 (int)ceil( m_unbiasedsize.height() * hmult)); 518 476 } 519 477 520 478 void OSDTypeText::Draw(OSDSurface *surface, int fade, int maxfade, int xoff, … … 708 666 m_onlyusefirst = false; 709 667 710 668 m_filename = filename; 711 m_displaypos = displaypos;669 SetPosition(displaypos, wmult, hmult); 712 670 713 671 m_yuv = m_alpha = NULL; 714 672 m_isvalid = false; … … 760 718 m_onlyusefirst = false; 761 719 762 720 m_displaypos = QPoint(0, 0); 721 m_unbiasedpos = QPoint(0, 0); 763 722 764 723 m_yuv = NULL; 765 724 m_alpha = NULL; … … 778 737 m_onlyusefirst = false; 779 738 780 739 m_displaypos = QPoint(0, 0); 740 m_unbiasedpos = QPoint(0, 0); 781 741 782 742 m_yuv = NULL; 783 743 m_alpha = NULL; … … 801 761 m_name = name; 802 762 } 803 763 804 void OSDTypeImage:: Reinit(float wchange, float hchange, float wmult, float hmult)764 void OSDTypeImage::SetPosition(QPoint pos, float wmult, float hmult) 805 765 { 806 int x = (int)(m_displaypos.x() * wchange); 807 int y = (int)(m_displaypos.y() * hchange); 766 m_displaypos = pos; 767 m_unbiasedpos = 768 QPoint((int)round(pos.x() / wmult), 769 (int)round(pos.y() / hmult)); 770 } 808 771 809 m_displaypos.setX(x); 810 m_displaypos.setY(y); 772 void OSDTypeImage::Reinit(float wmult, float hmult) 773 { 774 m_displaypos = 775 QPoint((int)round(m_unbiasedpos.x() * wmult), 776 (int)round(m_unbiasedpos.y() * hmult)); 811 777 812 778 LoadImage(m_filename, wmult, hmult, m_scalew, m_scaleh); 813 779 } … … 1043 1009 m_maxval = 1000; 1044 1010 m_curval = 0; 1045 1011 m_displayrect = displayrect; 1012 m_unbiasedrect = 1013 QRect((int)round(m_displayrect.x() / wmult), 1014 (int)round(m_displayrect.y() / hmult), 1015 (int)ceil( m_displayrect.width() / wmult), 1016 (int)ceil( m_displayrect.height() / hmult)); 1046 1017 } 1047 1018 1048 1019 OSDTypePosSlider::~OSDTypePosSlider() 1049 1020 { 1050 1021 } 1051 1022 1052 void OSDTypePosSlider::Reinit(float wchange, float hchange, float wmult, 1053 float hmult) 1023 void OSDTypePosSlider::Reinit(float wmult, float hmult) 1054 1024 { 1055 int width = (int)(m_displayrect.width() * wchange); 1056 int height = (int)(m_displayrect.height() * hchange); 1057 int x = (int)(m_displayrect.x() * wchange); 1058 int y = (int)(m_displayrect.y() * hchange); 1059 1060 m_displayrect = QRect(x, y, width, height); 1061 1062 OSDTypeImage::Reinit(wchange, hchange, wmult, hmult); 1025 m_displayrect = 1026 QRect((int)round(m_unbiasedrect.x() * wmult), 1027 (int)round(m_unbiasedrect.y() * hmult), 1028 (int)ceil( m_unbiasedrect.width() * wmult), 1029 (int)ceil( m_unbiasedrect.height() * hmult)); 1030 OSDTypeImage::Reinit(wmult, hmult); 1063 1031 } 1064 1032 1065 1033 void OSDTypePosSlider::SetPosition(int pos) … … 1092 1060 m_drawwidth = 0; 1093 1061 m_onlyusefirst = true; 1094 1062 m_displayrect = displayrect; 1063 m_unbiasedrect = 1064 QRect((int)round(m_displayrect.x() / wmult), 1065 (int)round(m_displayrect.y() / hmult), 1066 (int)ceil( m_displayrect.width() / wmult), 1067 (int)ceil( m_displayrect.height() / hmult)); 1095 1068 } 1096 1069 1097 1070 OSDTypeFillSlider::~OSDTypeFillSlider() 1098 1071 { 1099 1072 } 1100 1073 1101 void OSDTypeFillSlider::Reinit(float wchange, float hchange, float wmult, 1102 float hmult) 1074 void OSDTypeFillSlider::Reinit(float wmult, float hmult) 1103 1075 { 1104 int width = (int)(m_displayrect.width() * wchange); 1105 int height = (int)(m_displayrect.height() * hchange); 1106 int x = (int)(m_displayrect.x() * wchange); 1107 int y = (int)(m_displayrect.y() * hchange); 1108 1109 m_displayrect = QRect(x, y, width, height); 1110 1111 OSDTypeImage::Reinit(wchange, hchange, wmult, hmult); 1076 m_displayrect = 1077 QRect((int)round(m_unbiasedrect.x() * wmult), 1078 (int)round(m_unbiasedrect.y() * hmult), 1079 (int)ceil( m_unbiasedrect.width() * wmult), 1080 (int)ceil( m_unbiasedrect.height() * hmult)); 1081 OSDTypeImage::Reinit(wmult, hmult); 1112 1082 } 1113 1083 1114 1084 void OSDTypeFillSlider::SetPosition(int pos) … … 1143 1113 m_maxval = 1000; 1144 1114 m_curval = 0; 1145 1115 m_displayrect = displayrect; 1116 m_unbiasedrect = 1117 QRect((int)round(m_displayrect.x() / wmult), 1118 (int)round(m_displayrect.y() / hmult), 1119 (int)ceil( m_displayrect.width() / wmult), 1120 (int)ceil( m_displayrect.height() / hmult)); 1146 1121 m_drawwidth = displayrect.width(); 1147 1122 1148 1123 m_drawMap = new unsigned char[m_drawwidth + 1]; … … 1191 1166 delete [] m_ralpha; 1192 1167 } 1193 1168 1194 void OSDTypeEditSlider::Reinit(float wchange, float hchange, float wmult, 1195 float hmult) 1169 void OSDTypeEditSlider::Reinit(float wmult, float hmult) 1196 1170 { 1197 int width = (int)(m_displayrect.width() * wchange); 1198 int height = (int)(m_displayrect.height() * hchange); 1199 int x = (int)(m_displayrect.x() * wchange); 1200 int y = (int)(m_displayrect.y() * hchange); 1171 m_displayrect = 1172 QRect((int)round(m_unbiasedrect.x() * wmult), 1173 (int)round(m_unbiasedrect.y() * hmult), 1174 (int)ceil( m_unbiasedrect.width() * wmult), 1175 (int)ceil( m_unbiasedrect.height() * hmult)); 1201 1176 1202 m_displayrect = QRect(x, y, width, height);1203 1177 m_drawwidth = m_displayrect.width(); 1204 1178 1205 1179 delete [] m_drawMap; … … 1360 1334 1361 1335 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1362 1336 1363 OSDTypeBox::OSDTypeBox(const QString &name, QRect displayrect) 1364 : OSDType(name) 1337 OSDTypeBox::OSDTypeBox(const QString &name, QRect displayrect, 1338 float wmult, float hmult) 1339 : OSDType(name) 1365 1340 { 1366 1341 size = displayrect; 1342 m_unbiasedsize = 1343 QRect((int)round(size.x() / wmult), 1344 (int)round(size.y() / hmult), 1345 (int)ceil( size.width() / wmult), 1346 (int)ceil( size.height() / hmult)); 1367 1347 } 1368 1348 1349 void OSDTypeBox::SetRect(QRect newrect, float wmult, float hmult) 1350 { 1351 size = newrect; 1352 m_unbiasedsize = 1353 QRect((int)round(size.x() / wmult), 1354 (int)round(size.y() / hmult), 1355 (int)ceil( size.width() / wmult), 1356 (int)ceil( size.height() / hmult)); 1357 } 1358 1369 1359 OSDTypeBox::OSDTypeBox(const OSDTypeBox &other) 1370 1360 : OSDType(other.m_name) 1371 1361 { 1372 1362 size = other.size; 1363 m_unbiasedsize = other.m_unbiasedsize; 1373 1364 } 1374 1365 1375 1366 OSDTypeBox::~OSDTypeBox() 1376 1367 { 1377 1368 } 1378 1369 1379 void OSDTypeBox::Reinit(float w change, float hchange)1370 void OSDTypeBox::Reinit(float wmult, float hmult) 1380 1371 { 1381 int width = (int)(size.width() * wchange); 1382 int height = (int)(size.height() * hchange); 1383 int x = (int)(size.x() * wchange); 1384 int y = (int)(size.y() * hchange); 1385 1386 size = QRect(x, y, width, height); 1372 size = 1373 QRect((int)round(m_unbiasedsize.x() * wmult), 1374 (int)round(m_unbiasedsize.y() * hmult), 1375 (int)ceil( m_unbiasedsize.width() * wmult), 1376 (int)ceil( m_unbiasedsize.height() * hmult)); 1387 1377 } 1388 1378 1389 1379 void OSDTypeBox::Draw(OSDSurface *surface, int fade, int maxfade, int xoff, … … 1498 1488 } 1499 1489 1500 1490 OSDTypePositionRectangle::OSDTypePositionRectangle( 1501 1502 1491 const OSDTypePositionRectangle &other) 1492 : OSDType(other.m_name), OSDTypePositionIndicator(other) 1503 1493 { 1504 1494 for (int i = 0; i < m_numpositions; i++) 1505 1495 { 1506 1496 QRect tmp = other.positions[i]; 1507 1497 positions.push_back(tmp); 1508 1498 } 1499 for (int i = 0; i < m_numpositions; i++) 1500 { 1501 QRect tmp = other.unbiasedpos[i]; 1502 unbiasedpos.push_back(tmp); 1503 } 1509 1504 } 1510 1505 1511 1506 OSDTypePositionRectangle::~OSDTypePositionRectangle() 1512 1507 { 1513 1508 } 1514 1509 1515 void OSDTypePositionRectangle::Reinit(float w change, float hchange)1510 void OSDTypePositionRectangle::Reinit(float wmult, float hmult) 1516 1511 { 1517 1512 for (int i = 0; i < m_numpositions; i++) 1518 1513 { 1519 QRect tmp = positions[i]; 1520 1521 int width = (int)(tmp.width() * wchange); 1522 int height = (int)(tmp.height() * hchange); 1523 int x = (int)(tmp.x() * wchange); 1524 int y = (int)(tmp.y() * hchange); 1525 1526 tmp = QRect(x, y, width, height); 1527 positions[i] = tmp; 1514 QRect tmp = unbiasedpos[i]; 1515 positions[i] = 1516 QRect((int)round(tmp.x() * wmult), 1517 (int)round(tmp.y() * hmult), 1518 (int)ceil( tmp.width() * wmult), 1519 (int)ceil( tmp.height() * hmult)); 1528 1520 } 1529 1521 } 1530 1522 1531 void OSDTypePositionRectangle::AddPosition(QRect rect) 1523 void OSDTypePositionRectangle::AddPosition( 1524 QRect rect, float wmult, float hmult) 1532 1525 { 1533 1526 positions.push_back(rect); 1527 unbiasedpos.push_back( 1528 QRect((int)round(rect.x() / wmult), 1529 (int)round(rect.y() / hmult), 1530 (int)ceil( rect.width() / wmult), 1531 (int)ceil( rect.height() / hmult))); 1534 1532 m_numpositions++; 1535 1533 } 1536 1534 1537 void OSDTypePositionRectangle::Draw( OSDSurface *surface, int fade, int maxfade,1538 1535 void OSDTypePositionRectangle::Draw( 1536 OSDSurface *surface, int fade, int maxfade, int xoff, int yoff) 1539 1537 { 1540 1538 fade = fade; 1541 1539 maxfade = maxfade; … … 1618 1616 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1619 1617 1620 1618 OSDTypePositionImage::OSDTypePositionImage(const QString &name) 1621 : OSDTypeImage(name), OSDTypePositionIndicator() 1619 : OSDTypeImage(name), OSDTypePositionIndicator(), 1620 m_wmult(0.0f), m_hmult(0.0f) 1622 1621 { 1623 1622 } 1624 1623 1625 1624 OSDTypePositionImage::OSDTypePositionImage(const OSDTypePositionImage &other) 1626 1625 : OSDTypeImage(other), OSDTypePositionIndicator(other) 1627 1626 { 1627 m_wmult = other.m_wmult; 1628 m_hmult = other.m_hmult; 1629 1628 1630 for (int i = 0; i < m_numpositions; i++) 1629 1631 { 1630 QPoint tmp = other.positions[i];1631 positions.push_back(tmp);1632 positions.push_back(other.positions[i]); 1633 unbiasedpos.push_back(other.unbiasedpos[i]); 1632 1634 } 1633 1635 } 1634 1636 … … 1636 1638 { 1637 1639 } 1638 1640 1639 void OSDTypePositionImage::Reinit(float wchange, float hchange, float wmult, 1640 float hmult) 1641 void OSDTypePositionImage::Reinit(float wmult, float hmult) 1641 1642 { 1642 OSDTypeImage::Reinit(wchange, hchange, wmult, hmult); 1643 m_wmult = wmult; 1644 m_hmult = hmult; 1645 1646 OSDTypeImage::Reinit(wmult, hmult); 1643 1647 1644 1648 for (int i = 0; i < m_numpositions; i++) 1645 1649 { 1646 QPoint tmp = positions[i]; 1647 1648 int x = (int)(tmp.x() * wchange); 1649 int y = (int)(tmp.y() * hchange); 1650 1651 positions[i].setX(x); 1652 positions[i].setY(y); 1650 positions[i] = 1651 QPoint((int)round(unbiasedpos[i].x() * wmult), 1652 (int)round(unbiasedpos[i].y() * hmult)); 1653 1653 } 1654 1654 } 1655 1655 1656 void OSDTypePositionImage::AddPosition(QPoint pos )1656 void OSDTypePositionImage::AddPosition(QPoint pos, float wmult, float hmult) 1657 1657 { 1658 if (m_wmult == 0.0f || m_hmult == 0.0f) 1659 { 1660 m_wmult = wmult; 1661 m_hmult = hmult; 1662 } 1658 1663 positions.push_back(pos); 1664 unbiasedpos.push_back( 1665 QPoint((int)round(pos.x() / wmult), 1666 (int)round(pos.y() / hmult))); 1667 1668 VERBOSE(VB_IMPORTANT, 1669 "OSDTypePositionImage::AddPosition["<<m_numpositions<<"](" 1670 <<pos.x()<<"x"<<pos.y() 1671 <<" "<<wmult<<", "<<hmult<<")"); 1672 1659 1673 m_numpositions++; 1660 1674 } 1661 1675 1662 1676 void OSDTypePositionImage::Draw(OSDSurface *surface, int fade, int maxfade, 1663 1677 int xoff, int yoff) 1664 1678 { 1679 VERBOSE(VB_IMPORTANT, 1680 "OSDTypePositionImage::Draw["<<m_curposition<<"](" 1681 <<m_wmult<<", "<<m_hmult<<")"); 1682 1665 1683 if (m_curposition < 0 || m_curposition >= m_numpositions) 1666 1684 return; 1667 1685 1668 1686 QPoint pos = positions[m_curposition]; 1669 1687 1670 OSDTypeImage::SetPosition(pos );1688 OSDTypeImage::SetPosition(pos, m_wmult, m_hmult); 1671 1689 OSDTypeImage::Draw(surface, fade, maxfade, xoff, yoff); 1672 1690 } 1673 1691 1674 1692 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1675 1693 1676 1694 OSDTypeCC::OSDTypeCC(const QString &name, TTFFont *font, int xoff, int yoff, 1677 int dispw, int disph )1695 int dispw, int disph, float wmult, float hmult) 1678 1696 : OSDType(name) 1679 1697 { 1680 1698 m_font = font; … … 1683 1701 yoffset = yoff; 1684 1702 displaywidth = dispw; 1685 1703 displayheight = disph; 1704 m_wmult = wmult; 1705 m_hmult = hmult; 1686 1706 1687 1707 QRect rect = QRect(0, 0, 0, 0); 1688 m_box = new OSDTypeBox("cc_background", rect );1708 m_box = new OSDTypeBox("cc_background", rect, wmult, hmult); 1689 1709 m_ccbackground = gContext->GetNumSetting("CCBackground", 0); 1690 1710 } 1691 1711 … … 1695 1715 delete m_box; 1696 1716 } 1697 1717 1698 void OSDTypeCC::Reinit( int x, int y, int dispw, int disph)1718 void OSDTypeCC::Reinit(float wmult, float hmult) 1699 1719 { 1720 (void) wmult; 1721 (void) hmult; 1722 VERBOSE(VB_IMPORTANT, "Programmer error: " 1723 "Call to OSDTypeCC::Reinit(float,float)"); 1724 } 1725 1726 void OSDTypeCC::Reinit(int x, int y, int dispw, int disph, 1727 float wmult, float hmult) 1728 { 1700 1729 xoffset = x; 1701 1730 yoffset = y; 1702 1731 displaywidth = dispw; 1703 1732 displayheight = disph; 1733 m_wmult = wmult; 1734 m_hmult = hmult; 1704 1735 } 1705 1736 1706 1737 void OSDTypeCC::AddCCText(const QString &text, int x, int y, int color, … … 1875 1906 { 1876 1907 QRect rect = QRect(0, 0, textlength + 4, 1877 1908 (m_font->Size() * 3 / 2) + 3); 1878 m_box->SetRect(rect );1909 m_box->SetRect(rect, m_wmult, m_hmult); 1879 1910 m_box->Draw(surface, 0, 0, x - 2, y - 2); 1880 1911 } 1881 1912 -
libs/libmythtv/osdtypes.h
137 137 138 138 QString Name() { return m_name; } 139 139 140 virtual void Reinit(float wmult, float hmult) = 0; 141 140 142 virtual void Draw(OSDSurface *surface, int fade, int maxfade, int xoff, 141 143 int yoff) = 0; 142 144 … … 150 152 { 151 153 public: 152 154 OSDTypeText(const QString &name, TTFFont *font, const QString &text, 153 QRect displayrect );155 QRect displayrect, float wmult, float hmult); 154 156 OSDTypeText(const OSDTypeText &text); 155 157 ~OSDTypeText(); 156 158 157 void Reinit(float w change, float hchange);159 void Reinit(float wmult, float hmult); 158 160 159 161 void SetAltFont(TTFFont *font); 160 162 void SetUseAlt(bool usealt) { m_usingalt = usealt; } … … 190 192 191 193 QRect m_displaysize; 192 194 QRect m_screensize; 195 QRect m_unbiasedsize; 193 196 QString m_message; 194 197 QString m_default_msg; 195 198 … … 231 234 virtual ~OSDTypeImage(); 232 235 233 236 void SetName(const QString &name); 234 void Reinit(float w change, float hchange, float wmult, float hmult);237 void Reinit(float wmult, float hmult); 235 238 236 239 void LoadImage(const QString &filename, float wmult, float hmult, 237 240 int scalew = -1, int scaleh = -1); … … 239 242 240 243 void SetStaticSize(int scalew, int scaleh) { m_scalew = scalew; 241 244 m_scaleh = scaleh; } 245 void SetPosition(QPoint pos, float wmult, float hmult); 242 246 243 QPoint DisplayPos() { return m_displaypos; } 244 void SetPosition(QPoint pos) { m_displaypos = pos; } 247 QPoint DisplayPos() const { return m_displaypos; } 248 QRect ImageSize() const { return m_imagesize; } 249 int width() const { return m_imagesize.width(); } 250 int height() const { return m_imagesize.height(); } 245 251 246 QRect ImageSize() { return m_imagesize; }247 248 int width() { return m_imagesize.width(); }249 int height() { return m_imagesize.height(); }250 251 252 virtual void Draw(OSDSurface *surface, int fade, int maxfade, int xoff, 252 253 int yoff); 253 254 254 255 protected: 255 256 QRect m_imagesize; 256 257 QPoint m_displaypos; 258 QPoint m_unbiasedpos; 257 259 258 260 QString m_filename; 259 261 … … 280 282 int scalew = -1, int scaleh = -1); 281 283 ~OSDTypePosSlider(); 282 284 283 void Reinit(float w change, float hchange, float wmult, float hmult);285 void Reinit(float wmult, float hmult); 284 286 285 287 void SetRectangle(QRect rect) { m_displayrect = rect; } 286 288 QRect ImageSize() { return m_imagesize; } … … 290 292 291 293 private: 292 294 QRect m_displayrect; 295 QRect m_unbiasedrect; 293 296 int m_maxval; 294 297 int m_curval; 295 298 }; … … 302 305 int scalew = -1, int scaleh = -1); 303 306 ~OSDTypeFillSlider(); 304 307 305 void Reinit(float w change, float hchange, float wmult, float hmult);308 void Reinit(float wmult, float hmult); 306 309 307 310 void SetRectangle(QRect rect) { m_displayrect = rect; } 308 311 QRect ImageSize() { return m_imagesize; } … … 314 317 315 318 private: 316 319 QRect m_displayrect; 320 QRect m_unbiasedrect; 317 321 int m_maxval; 318 322 int m_curval; 319 323 }; … … 327 331 int scalew = -1, int scaleh = -1); 328 332 ~OSDTypeEditSlider(); 329 333 330 void Reinit(float w change, float hchange, float wmult, float hmult);334 void Reinit(float wmult, float hmult); 331 335 332 336 void SetRectangle(QRect rect) { m_displayrect = rect; } 333 337 QRect ImageSize() { return m_imagesize; } … … 339 343 340 344 private: 341 345 QRect m_displayrect; 346 QRect m_unbiasedrect; 342 347 int m_maxval; 343 348 int m_curval; 344 349 … … 360 365 class OSDTypeBox : public OSDType 361 366 { 362 367 public: 363 OSDTypeBox(const QString &name, QRect displayrect); 368 OSDTypeBox(const QString &name, QRect displayrect, 369 float wmult, float hmult); 364 370 OSDTypeBox(const OSDTypeBox &other); 365 371 ~OSDTypeBox(); 366 372 367 void Reinit(float w change, float hchange);368 void SetRect(QRect newrect ) { size = newrect; }373 void Reinit(float wmult, float hmult); 374 void SetRect(QRect newrect, float wmult, float hmult); 369 375 370 376 void Draw(OSDSurface *surface, int fade, int maxfade, int xoff, int yoff); 371 377 372 378 private: 373 379 QRect size; 380 QRect m_unbiasedsize; 374 381 }; 375 382 376 383 class OSDTypePositionIndicator … … 403 410 OSDTypePositionRectangle(const OSDTypePositionRectangle &other); 404 411 ~OSDTypePositionRectangle(); 405 412 406 void AddPosition(QRect rect );413 void AddPosition(QRect rect, float wmult, float hmult); 407 414 408 void Reinit(float w change, float hchange);415 void Reinit(float wmult, float hmult); 409 416 410 417 void Draw(OSDSurface *surface, int fade, int maxfade, int xoff, int yoff); 411 418 412 419 private: 413 vector<QRect> positions; 420 vector<QRect> positions; 421 vector<QRect> unbiasedpos; 414 422 }; 415 423 416 424 class OSDTypePositionImage : public virtual OSDTypeImage, … … 421 429 OSDTypePositionImage(const OSDTypePositionImage &other); 422 430 ~OSDTypePositionImage(); 423 431 424 void Reinit(float w change, float hchange, float wmult, float hmult);432 void Reinit(float wmult, float hmult); 425 433 426 void AddPosition(QPoint pos );434 void AddPosition(QPoint pos, float wmult, float hmult); 427 435 428 436 void Draw(OSDSurface *surface, int fade, int maxfade, int xoff, int yoff); 429 437 430 438 private: 431 439 vector<QPoint> positions; 440 vector<QPoint> unbiasedpos; 441 float m_wmult; 442 float m_hmult; 432 443 }; 433 444 434 445 class ccText … … 445 456 { 446 457 public: 447 458 OSDTypeCC(const QString &name, TTFFont *font, int xoff, int yoff, 448 int dispw, int disph );459 int dispw, int disph, float wmult, float hmult); 449 460 ~OSDTypeCC(); 450 461 451 void Reinit( int xoff, int yoff, int dispw, int disph);462 void Reinit(float wmult, float hmult); 452 463 464 void Reinit(int xoff, int yoff, 465 int dispw, int disph, 466 float wmult, float hmult); 467 453 468 void AddCCText(const QString &text, int x, int y, int color, 454 469 bool teletextmode = false); 455 470 void ClearAllCCText(); … … 464 479 vector<ccText *> *m_textlist; 465 480 OSDTypeBox *m_box; 466 481 int m_ccbackground; 467 482 float m_wmult, m_hmult; 468 483 int xoffset, yoffset, displaywidth, displayheight; 469 484 }; 470 485 -
libs/libmythtv/osd.cpp
154 154 } 155 155 156 156 OSDTypeCC *ccpage = new OSDTypeCC(name, ccfont, sub_xoff, sub_yoff, 157 sub_dispw, sub_disph); 157 sub_dispw, sub_disph, 158 wmult, hmult); 158 159 container->AddType(ccpage); 159 160 } 160 161 … … 517 518 } 518 519 } 519 520 520 OSDTypeBox *box = new OSDTypeBox(name, area );521 OSDTypeBox *box = new OSDTypeBox(name, area, wmult, hmult); 521 522 container->AddType(box); 522 523 } 523 524 … … 658 659 return; 659 660 } 660 661 661 OSDTypeText *text = new OSDTypeText(name, ttffont, "", area );662 OSDTypeText *text = new OSDTypeText(name, ttffont, "", area, wmult, hmult); 662 663 container->AddType(text); 663 664 664 665 text->SetMultiLine(multiline); … … 875 876 QRect area = parseRect(getFirstText(info)); 876 877 normalizeRect(area); 877 878 878 rects->AddPosition(area );879 rects->AddPosition(area, wmult, hmult); 879 880 } 880 881 else 881 882 { … … 919 920 pos.setX((int)(pos.x() * wmult + xoffset)); 920 921 pos.setY((int)(pos.y() * hmult + yoffset)); 921 922 922 image->AddPosition(pos );923 image->AddPosition(pos, wmult, hmult); 923 924 } 924 925 else if (info.tagName() == "staticsize") 925 926 { … … 1897 1898 sprintf(name, "%lld-%d", number, type); 1898 1899 1899 1900 int xpos = (int)((editarrowRect.width() * 1.0 / totalframes) * number); 1900 xpos = ( editarrowRect.left() + xpos) * wmult;1901 int ypos = editarrowRect.top() * hmult;1901 xpos = (int)((editarrowRect.left() + xpos) * wmult); 1902 int ypos = (int) (editarrowRect.top() * hmult); 1902 1903 1903 1904 osdlock.lock(); 1904 1905 … … 1925 1926 image = new OSDTypeImage(*editarrowright); 1926 1927 } 1927 1928 1928 image->SetPosition(QPoint(xpos, ypos) );1929 image->SetPosition(QPoint(xpos, ypos), wmult, hmult); 1929 1930 1930 1931 set->AddType(image); 1931 1932 set->Display();