Ticket #667: osd_scale-r7892.2.patch
File osd_scale-r7892.2.patch, 10.4 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
412 412 if (osd) 413 413 { 414 414 QRect visible, total; 415 videoOutput->GetOSDBounds(total, visible); 416 osd->Reinit(total.width(), total.height(), frame_interval, 415 float aspect; 416 videoOutput->GetOSDBounds(total, visible, aspect); 417 osd->Reinit(total.width(), total.height(), 418 aspect, frame_interval, 417 419 visible.left(), visible.top(), 418 420 visible.width(), visible.height()); 419 421 } … … 2056 2058 if (!using_null_videoout) 2057 2059 { 2058 2060 QRect visible, total; 2059 videoOutput->GetOSDBounds(total, visible); 2060 osd = new OSD(total.width(), total.height(), frame_interval, 2061 float aspect; 2062 videoOutput->GetOSDBounds(total, visible, aspect); 2063 osd = new OSD(total.width(), total.height(), 2064 aspect, frame_interval, 2061 2065 visible.left(), visible.top(), 2062 2066 visible.width(), visible.height()); 2063 2067 -
libs/libmythtv/osd.h
42 42 { 43 43 Q_OBJECT 44 44 public: 45 OSD(int width, int height, int framerate,45 OSD(int width, int height, float aspect, int framerate, 46 46 int dispx, int dispy, int dispw, int disph); 47 47 ~OSD(void); 48 48 … … 108 108 109 109 int getTimeType(void) { return timeType; } 110 110 111 void Reinit(int width, int height, int frint, int dispx, int dispy, 111 void Reinit(int width, int height, float aspect, int frint, 112 int dispx, int dispy, 112 113 int dispw, int disph); 113 114 114 115 void SetFrameInterval(int frint); … … 152 153 153 154 int vid_width; 154 155 int vid_height; 156 float vid_aspect; 157 float wscale; 155 158 int frameint; 156 159 157 160 QString themepath; -
libs/libmythtv/videooutbase.cpp
501 501 height = imgh; 502 502 } 503 503 504 void VideoOutput::GetOSDBounds(QRect &total, QRect &visible ) const504 void VideoOutput::GetOSDBounds(QRect &total, QRect &visible, float &aspect) const 505 505 { 506 506 total = GetTotalOSDBounds(); 507 507 visible = GetVisibleOSDBounds(); 508 aspect = XJ_aspect; 509 switch (letterbox) 510 { 511 case kLetterbox_16_9_Zoom: 512 aspect = 4.0/3; 513 break; 514 515 default: 516 break; 517 } 508 518 } 509 519 510 520 /** -
libs/libmythtv/videooutbase.h
146 146 virtual void Zoom(int direction); 147 147 148 148 virtual void GetDrawSize(int &xoff, int &yoff, int &width, int &height); 149 virtual void GetOSDBounds(QRect &visible, QRect &total ) const;149 virtual void GetOSDBounds(QRect &visible, QRect &total, float &aspect) const; 150 150 151 151 virtual int GetRefreshRate(void) = 0; 152 152 -
libs/libmythtv/ttfont.cpp
525 525 glyphs.clear(); 526 526 } 527 527 528 TTFFont::TTFFont(char *file, int size, int video_width, int video_height,528 TTFFont::TTFFont(char *file, int size, float wscale, 529 529 float hmult) 530 530 { 531 531 FT_Error error; … … 559 559 fontsize = size; 560 560 library = the_library; 561 561 562 vid_width = video_width; 563 vid_height = video_height; 562 m_wscale = wscale; 564 563 m_file = file; 565 564 m_hmult = hmult; 566 565 … … 609 608 } 610 609 611 610 loadedfontsize = (int)(fontsize * m_hmult); 611 xdpi = (int)(xdpi * m_wscale); 612 612 613 if (vid_width != vid_height * 4 / 3)614 {615 xdpi = (int)(xdpi *616 (float)(vid_width / (float)(vid_height * 4 / 3)));617 }618 619 613 FT_Set_Char_Size(face, 0, loadedfontsize * 64, xdpi, ydpi); 620 614 621 615 n = face->num_charmaps; … … 650 644 spacewidth = twidth - (mwidth * 2); 651 645 } 652 646 653 void TTFFont::Reinit( int width, int height, float hmult)647 void TTFFont::Reinit(float wscale, float hmult) 654 648 { 655 vid_width = width; 656 vid_height = height; 649 m_wscale = wscale; 657 650 m_hmult = hmult; 658 651 659 652 KillFace(); -
libs/libmythtv/osd.cpp
27 27 28 28 #include "osdlistbtntype.h" 29 29 30 OSD::OSD(int width, int height, int frint,30 OSD::OSD(int width, int height, float aspect, int frint, 31 31 int dispx, int dispy, int dispw, int disph) 32 32 : QObject() 33 33 { 34 34 changed = false; 35 35 vid_width = width; 36 36 vid_height = height; 37 vid_aspect = aspect; 37 38 frameint = frint; 38 39 39 40 editarrowleft = editarrowright = NULL; … … 45 46 yoffset = dispy; 46 47 displaywidth = dispw; 47 48 displayheight = disph; 49 wscale = (float)displaywidth/(vid_aspect*displayheight); 48 50 49 51 timeType = 0; 50 52 totalfadetime = 0; … … 143 145 frameint); 144 146 AddSet(container, name); 145 147 146 OSDTypeCC *ccpage = new OSDTypeCC(name, ccfont, xoffset, yoffset, 147 displaywidth, displayheight); 148 int sub_xoff, sub_yoff, sub_dispw, sub_disph; 149 if (vid_aspect > 4.0f/3.0f) 150 { 151 // widescreen -- need to "pillarbox" captions 152 sub_dispw = (int)(wscale * 4.0f*displayheight/3.0f); 153 sub_disph = displayheight; 154 sub_xoff = xoffset + (displaywidth-sub_dispw)/2; 155 sub_yoff = yoffset; 156 } 157 else 158 { 159 sub_dispw = displaywidth; 160 sub_disph = displayheight; 161 sub_xoff = xoffset; 162 sub_yoff = yoffset; 163 } 164 165 OSDTypeCC *ccpage = new OSDTypeCC(name, ccfont, sub_xoff, sub_yoff, 166 sub_dispw, sub_disph); 148 167 container->AddType(ccpage); 149 168 } 150 169 … … 209 228 } 210 229 } 211 230 212 void OSD::Reinit(int width, int height, int frint, int dispx, int dispy, 231 void OSD::Reinit(int width, int height, float aspect, int frint, 232 int dispx, int dispy, 213 233 int dispw, int disph) 214 234 { 215 235 osdlock.lock(); 216 236 217 237 vid_width = width; 218 238 vid_height = height; 239 vid_aspect = aspect; 219 240 if (frint != -1) 220 241 frameint = frint; 221 242 … … 226 247 yoffset = dispy; 227 248 displaywidth = dispw; 228 249 displayheight = disph; 250 wscale = (float)displaywidth/(vid_aspect*displayheight); 229 251 230 252 QMap<QString, TTFFont *>::iterator fonts = fontMap.begin(); 231 253 for (; fonts != fontMap.end(); ++fonts) 232 254 { 233 255 TTFFont *font = (*fonts); 234 256 if (font) 235 font->Reinit( dispw, disph, hmult);257 font->Reinit(wscale, hmult); 236 258 } 237 259 238 260 QMap<QString, OSDSet *>::iterator sets = setMap.begin(); … … 240 262 { 241 263 OSDSet *set = (*sets); 242 264 if (set) 243 set->Reinit(vid_width, vid_height, dispx, dispy, dispw, disph, 265 { 266 int sub_xoff, sub_yoff, sub_dispw, sub_disph; 267 if (set->GetName() == "cc_page" && vid_aspect > 4.0f/3.0f) 268 { 269 // widescreen -- need to "pillarbox" captions 270 sub_dispw = (int)(wscale * 4.0f*displayheight/3.0f); 271 sub_disph = displayheight; 272 sub_xoff = xoffset + (displaywidth-sub_dispw)/2; 273 sub_yoff = yoffset; 274 } 275 else 276 { 277 sub_dispw = displaywidth; 278 sub_disph = displayheight; 279 sub_xoff = xoffset; 280 sub_yoff = yoffset; 281 } 282 set->Reinit(vid_width, vid_height, sub_xoff, sub_yoff, sub_dispw, sub_disph, 244 283 wmult, hmult, frameint); 284 } 245 285 } 246 286 247 287 delete drawSurface; … … 274 314 TTFFont *OSD::LoadFont(QString name, int size) 275 315 { 276 316 QString fullname = MythContext::GetConfDir() + "/" + name; 277 TTFFont *font = new TTFFont((char *)fullname.ascii(), size, vid_width,278 vid_height,hmult);317 TTFFont *font = new TTFFont((char *)fullname.ascii(), size, wscale, 318 hmult); 279 319 280 320 if (font->isValid()) 281 321 return font; … … 283 323 delete font; 284 324 fullname = gContext->GetShareDir() + name; 285 325 286 font = new TTFFont((char *)fullname.ascii(), size, vid_width,287 vid_height,hmult);326 font = new TTFFont((char *)fullname.ascii(), size, wscale, 327 hmult); 288 328 289 329 if (font->isValid()) 290 330 return font; … … 293 333 if (themepath != "") 294 334 { 295 335 fullname = themepath + "/" + name; 296 font = new TTFFont((char *)fullname.ascii(), size, vid_width,297 vid_height,hmult);336 font = new TTFFont((char *)fullname.ascii(), size, wscale, 337 hmult); 298 338 if (font->isValid()) 299 339 return font; 300 340 } … … 302 342 delete font; 303 343 304 344 fullname = name; 305 font = new TTFFont((char *)fullname.ascii(), size, vid_width, vid_height,345 font = new TTFFont((char *)fullname.ascii(), size, wscale, 306 346 hmult); 307 347 308 348 if (font->isValid()) -
libs/libmythtv/ttfont.h
27 27 class TTFFont 28 28 { 29 29 public: 30 TTFFont(char *file, int size, int video_width, int video_height,30 TTFFont(char *file, int size, float wscale, 31 31 float hmult); 32 32 ~TTFFont(); 33 33 … … 46 46 void CalcWidth(const QString &text, int *width_return); 47 47 48 48 int SpaceWidth() { return spacewidth; } 49 int Size() { return m_size; }49 int Size() { return loadedfontsize; } 50 50 51 void Reinit( int width, int height, float hmult);51 void Reinit(float wscale, float hmult); 52 52 53 53 private: 54 54 void KillFace(void); … … 100 100 QString m_file; 101 101 102 102 int loadedfontsize; 103 float m_wscale; 103 104 float m_hmult; 104 105 }; 105 106