Ticket #368: osdsurface.diff
File osdsurface.diff, 3.0 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/osdsurface.cpp
86 86 memset(u, 127, size / 4); 87 87 memset(v, 127, size / 4); 88 88 memset(alpha, 0, size); 89 usedRegionsLock.lock(); 89 90 usedRegions = QRegion(); 91 usedRegionsLock.unlock(); 90 92 } 91 93 92 94 void OSDSurface::ClearUsed(void) 93 95 { 96 usedRegionsLock.lock(); 94 97 QMemArray<QRect> rects = usedRegions.rects(); 95 98 QMemArray<QRect>::Iterator it = rects.begin(); 96 99 QRect drawRect; … … 129 132 } 130 133 131 134 usedRegions = QRegion(); 135 usedRegionsLock.unlock(); 132 136 } 133 137 134 138 bool OSDSurface::IntersectsDrawn(QRect &newrect) 135 139 { 140 QMutexLocker lock(&usedRegionsLock); 136 141 QMemArray<QRect> rects = usedRegions.rects(); 137 142 QMemArray<QRect>::Iterator it = rects.begin(); 138 143 for (; it != rects.end(); ++it) … … 143 148 144 149 void OSDSurface::AddRect(QRect &newrect) 145 150 { 151 usedRegionsLock.lock(); 146 152 usedRegions = usedRegions.unite(newrect); 153 usedRegionsLock.unlock(); 147 154 } 148 155 149 156 /////////////////////////////////////////////////////////////////////////// … … 551 558 */ 552 559 void OSDSurface::BlendToYV12(unsigned char *yuvptr) const 553 560 { 561 usedRegionsLock.lock(); 554 562 const OSDSurface *surface = this; 555 563 blendtoyv12_8_fun blender = blendtoyv12_8_init(surface); 556 564 … … 649 657 } 650 658 } 651 659 } 660 usedRegionsLock.unlock(); 652 661 } 653 662 654 663 static void BlendToBlack(unsigned char *argbptr, uint width, uint outheight) … … 686 695 uint outheight, bool blend_to_black, 687 696 uint threshold) const 688 697 { 698 usedRegionsLock.lock(); 689 699 const OSDSurface *surface = this; 690 700 blendtoargb_8_fun blender = blendtoargb_8_init(surface); 691 701 const unsigned char *cm = surface->cm; … … 756 766 } 757 767 if (blend_to_black) 758 768 BlendToBlack(argbptr, stride>>2, outheight); 769 770 usedRegionsLock.unlock(); 759 771 } 760 772 761 773 /** \fn OSDSurface::DitherToI44(unsigned char*,bool,uint,uint) const … … 772 784 void OSDSurface::DitherToI44(unsigned char *outbuf, bool ifirst, 773 785 uint stride, uint outheight) const 774 786 { 787 usedRegionsLock.lock(); 775 788 const OSDSurface *surface = this; 776 789 int ashift = ifirst ? 0 : 4; 777 790 int amask = ifirst ? 0x0f : 0xf0; … … 855 868 } 856 869 857 870 delete_dithertoia44_8_context(dcontext); 871 usedRegionsLock.unlock(); 858 872 } 859 873 860 874 /** \fn OSDSurface::DitherToIA44(unsigned char*,uint,uint) const -
libs/libmythtv/osdsurface.h
2 2 #define OSDSURFACE_H_ 3 3 4 4 #include <qregion.h> 5 #include <qmutex.h> 5 6 #include "blend.h" 6 7 7 8 #define MAX_NEG_CROP 1024 … … 61 62 int size; 62 63 63 64 QRegion usedRegions; 64 65 mutable QMutex usedRegionsLock; 65 66 #ifdef MMX 66 67 short int rec_lut[256]; 67 68 #else