Changeset 769 for trunk/src/gui/painting
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 30 edited
-
. (modified) (1 prop)
-
src/gui/painting/qbackingstore.cpp (modified) (2 diffs)
-
src/gui/painting/qbrush.cpp (modified) (2 diffs)
-
src/gui/painting/qcups.cpp (modified) (1 diff)
-
src/gui/painting/qdrawhelper.cpp (modified) (4 diffs)
-
src/gui/painting/qdrawhelper_mmx_p.h (modified) (4 diffs)
-
src/gui/painting/qdrawhelper_neon.cpp (modified) (7 diffs)
-
src/gui/painting/qdrawhelper_p.h (modified) (1 diff)
-
src/gui/painting/qdrawhelper_sse2.cpp (modified) (1 diff)
-
src/gui/painting/qdrawhelper_x86_p.h (modified) (1 diff)
-
src/gui/painting/qdrawutil.cpp (modified) (1 diff)
-
src/gui/painting/qgraphicssystem_raster.cpp (modified) (2 diffs)
-
src/gui/painting/qmath_p.h (modified) (2 diffs)
-
src/gui/painting/qpaintbuffer.cpp (modified) (1 diff)
-
src/gui/painting/qpaintengine_alpha.cpp (modified) (1 diff)
-
src/gui/painting/qpaintengine_raster.cpp (modified) (5 diffs)
-
src/gui/painting/qpaintengine_x11.cpp (modified) (1 diff)
-
src/gui/painting/qpaintengineex.cpp (modified) (1 diff)
-
src/gui/painting/qpainter.cpp (modified) (4 diffs)
-
src/gui/painting/qpathclipper.cpp (modified) (1 diff)
-
src/gui/painting/qpdf.cpp (modified) (5 diffs)
-
src/gui/painting/qprintengine_ps.cpp (modified) (3 diffs)
-
src/gui/painting/qprintengine_win.cpp (modified) (1 diff)
-
src/gui/painting/qregion.cpp (modified) (1 diff)
-
src/gui/painting/qstroker.cpp (modified) (1 diff)
-
src/gui/painting/qtransform.h (modified) (3 diffs)
-
src/gui/painting/qwindowsurface_qws.cpp (modified) (2 diffs)
-
src/gui/painting/qwindowsurface_qws_p.h (modified) (1 diff)
-
src/gui/painting/qwindowsurface_raster.cpp (modified) (1 diff)
-
src/gui/painting/qwindowsurface_s60.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/painting/qbackingstore.cpp
r651 r769 353 353 dirtyOnScreen += toClean; 354 354 355 #ifdef Q_WS_QWS 356 toClean.translate(tlwOffset); 357 #endif 358 355 359 #ifdef QT_NO_PAINT_DEBUG 356 360 windowSurface->beginPaint(toClean); … … 767 771 return; 768 772 769 windowSurface->beginPaint(decorationRegion); 773 //### The QWS decorations do not always paint the pixels they promise to paint. 774 // This causes painting problems with QWSMemorySurface. Since none of the other 775 // window surfaces actually use the region, passing an empty region is a safe 776 // workaround. 777 778 windowSurface->beginPaint(QRegion()); 770 779 771 780 QPaintEngine *engine = windowSurface->paintDevice()->paintEngine(); -
trunk/src/gui/painting/qbrush.cpp
r651 r769 161 161 } 162 162 163 Q_GUI_EXPORT 164 QImage qt_imageForBrush(int brushStyle, bool invert) 163 Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert) 165 164 { 166 165 return qt_brushPatternImageCache()->getImage(brushStyle, invert); … … 990 989 "RadialGradientPattern", 991 990 "ConicalGradientPattern", 992 "TexturePattern" 991 0, 0, 0, 0, 0, 0, 992 "TexturePattern" // 24 993 993 }; 994 994 -
trunk/src/gui/painting/qcups.cpp
r651 r769 378 378 return false; 379 379 const char *ppdFile = _cupsGetPPD(printerName); 380 if (ppdFile != 0) 381 unlink(ppdFile); 382 return ppdFile != 0; 380 unlink(ppdFile); 381 return (ppdFile != 0); 383 382 } 384 383 -
trunk/src/gui/painting/qdrawhelper.cpp
r651 r769 1268 1268 d = d * cia 1269 1269 */ 1270 #define comp_func_Clear_impl(dest, length, const_alpha)\ 1271 {\ 1272 if (const_alpha == 255) {\ 1273 QT_MEMFILL_UINT(dest, length, 0);\ 1274 } else {\ 1275 int ialpha = 255 - const_alpha;\ 1276 PRELOAD_INIT(dest)\ 1277 for (int i = 0; i < length; ++i) {\ 1278 PRELOAD_COND(dest)\ 1279 dest[i] = BYTE_MUL(dest[i], ialpha);\ 1280 }\ 1281 }\ 1282 } 1283 1270 1284 static void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha) 1271 1285 { 1272 if (const_alpha == 255) { 1273 QT_MEMFILL_UINT(dest, length, 0); 1274 } else { 1275 int ialpha = 255 - const_alpha; 1276 PRELOAD_INIT(dest) 1277 for (int i = 0; i < length; ++i) { 1278 PRELOAD_COND(dest) 1279 dest[i] = BYTE_MUL(dest[i], ialpha); 1280 } 1281 } 1286 comp_func_Clear_impl(dest, length, const_alpha); 1282 1287 } 1283 1288 1284 1289 static void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha) 1285 1290 { 1286 if (const_alpha == 255) { 1287 QT_MEMFILL_UINT(dest, length, 0); 1288 } else { 1289 int ialpha = 255 - const_alpha; 1290 PRELOAD_INIT(dest) 1291 for (int i = 0; i < length; ++i) { 1292 PRELOAD_COND(dest) 1293 dest[i] = BYTE_MUL(dest[i], ialpha); 1294 } 1295 } 1291 comp_func_Clear_impl(dest, length, const_alpha); 1296 1292 } 1297 1293 … … 2409 2405 return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; 2410 2406 else { 2407 # ifdef Q_CC_RVCT // needed to avoid compiler crash in RVCT 2.2 2408 return (dst * sa * 255 + da * (src2 - sa) * (qIntSqrtInt(dst_np * 255) - dst_np) + temp) / 65025; 2409 # else 2411 2410 return (dst * sa * 255 + da * (src2 - sa) * (int(sqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; 2411 # endif 2412 2412 } 2413 2413 } … … 7175 7175 7176 7176 int a = qGray(coverage); 7177 sr = qt_div_255( sr* a);7178 sg = qt_div_255( sg* a);7179 sb = qt_div_255( sb* a);7177 sr = qt_div_255(qt_pow_rgb_invgamma[sr] * a); 7178 sg = qt_div_255(qt_pow_rgb_invgamma[sg] * a); 7179 sb = qt_div_255(qt_pow_rgb_invgamma[sb] * a); 7180 7180 7181 7181 int ia = 255 - a; … … 8093 8093 } 8094 8094 #endif // 3DNOW 8095 extern void qt_blend_rgb32_on_rgb32_sse(uchar *destPixels, int dbpl, 8096 const uchar *srcPixels, int sbpl, 8097 int w, int h, 8098 int const_alpha); 8099 extern void qt_blend_argb32_on_argb32_sse(uchar *destPixels, int dbpl, 8100 const uchar *srcPixels, int sbpl, 8101 int w, int h, 8102 int const_alpha); 8103 8104 qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse; 8105 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse; 8106 qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse; 8107 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse; 8108 } 8095 8096 8097 #ifdef QT_HAVE_SSE2 8098 if (features & SSE2) { 8099 extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, 8100 const uchar *srcPixels, int sbpl, 8101 int w, int h, 8102 int const_alpha); 8103 extern void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, 8104 const uchar *srcPixels, int sbpl, 8105 int w, int h, 8106 int const_alpha); 8107 8108 8109 qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; 8110 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2; 8111 qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; 8112 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2; 8113 } else 8114 #endif 8115 { 8116 extern void qt_blend_rgb32_on_rgb32_sse(uchar *destPixels, int dbpl, 8117 const uchar *srcPixels, int sbpl, 8118 int w, int h, 8119 int const_alpha); 8120 extern void qt_blend_argb32_on_argb32_sse(uchar *destPixels, int dbpl, 8121 const uchar *srcPixels, int sbpl, 8122 int w, int h, 8123 int const_alpha); 8124 8125 8126 qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse; 8127 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse; 8128 qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse; 8129 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse; 8130 } 8131 } 8109 8132 #endif // SSE 8110 8133 -
trunk/src/gui/painting/qdrawhelper_mmx_p.h
r651 r769 147 147 d = d * cia 148 148 */ 149 #define comp_func_Clear_impl(dest, length, const_alpha)\ 150 {\ 151 if (const_alpha == 255) {\ 152 qt_memfill(static_cast<quint32*>(dest), quint32(0), length);\ 153 } else {\ 154 C_FF; C_80; C_00;\ 155 m64 ia = MM::negate(MM::load_alpha(const_alpha));\ 156 for (int i = 0; i < length; ++i) {\ 157 dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), ia));\ 158 }\ 159 MM::end();\ 160 }\ 161 } 162 149 163 template <class MM> 150 164 static void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha) 151 165 { 152 if (!length) 153 return; 154 155 if (const_alpha == 255) { 156 qt_memfill(static_cast<quint32*>(dest), quint32(0), length); 157 } else { 158 C_FF; C_80; C_00; 159 m64 ia = MM::negate(MM::load_alpha(const_alpha)); 160 for (int i = 0; i < length; ++i) { 161 dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), ia)); 162 } 163 } 164 MM::end(); 166 comp_func_Clear_impl(dest, length, const_alpha); 165 167 } 166 168 … … 168 170 static void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha) 169 171 { 170 if (const_alpha == 255) { 171 qt_memfill(static_cast<quint32*>(dest), quint32(0), length); 172 } else { 173 C_FF; C_80; C_00; 174 m64 ia = MM::negate(MM::load_alpha(const_alpha)); 175 for (int i = 0; i < length; ++i) 176 dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), ia)); 177 } 178 MM::end(); 172 comp_func_Clear_impl(dest, length, const_alpha); 179 173 } 180 174 … … 247 241 if (const_alpha == 255) { 248 242 for (int i = 0; i < length; ++i) { 249 if ((0xff000000 & src[i]) == 0xff000000) { 243 const uint alphaMaskedSource = 0xff000000 & src[i]; 244 if (alphaMaskedSource == 0) 245 continue; 246 if (alphaMaskedSource == 0xff000000) { 250 247 dest[i] = src[i]; 251 248 } else { … … 258 255 m64 ca = MM::load_alpha(const_alpha); 259 256 for (int i = 0; i < length; ++i) { 257 if ((0xff000000 & src[i]) == 0) 258 continue; 260 259 m64 s = MM::byte_mul(MM::load(src[i]), ca); 261 260 m64 ia = MM::negate(MM::alpha(s)); -
trunk/src/gui/painting/qdrawhelper_neon.cpp
r651 r769 49 49 QT_BEGIN_NAMESPACE 50 50 51 static inline int16x8_t qvdiv_255_s16(int16x8_t x,int16x8_t half)51 static inline uint16x8_t qvdiv_255_u16(uint16x8_t x, uint16x8_t half) 52 52 { 53 53 // result = (x + (x >> 8) + 0x80) >> 8 54 54 55 const int16x8_t temp = vshrq_n_s16(x, 8); // x >> 856 const int16x8_t sum_part = vaddq_s16(x, half); // x + 0x8057 const int16x8_t sum = vaddq_s16(temp, sum_part);58 59 return v reinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(sum), 8));60 } 61 62 static inline int16x8_t qvbyte_mul_s16(int16x8_t x, int16x8_t alpha,int16x8_t half)55 const uint16x8_t temp = vshrq_n_u16(x, 8); // x >> 8 56 const uint16x8_t sum_part = vaddq_u16(x, half); // x + 0x80 57 const uint16x8_t sum = vaddq_u16(temp, sum_part); 58 59 return vshrq_n_u16(sum, 8); 60 } 61 62 static inline uint16x8_t qvbyte_mul_u16(uint16x8_t x, uint16x8_t alpha, uint16x8_t half) 63 63 { 64 64 // t = qRound(x * alpha / 255.0) 65 65 66 const int16x8_t t = vmulq_s16(x, alpha); // t67 return qvdiv_255_ s16(t, half);68 } 69 70 static inline int16x8_t qvinterpolate_pixel_255(int16x8_t x, int16x8_t a, int16x8_t y, int16x8_t b,int16x8_t half)66 const uint16x8_t t = vmulq_u16(x, alpha); // t 67 return qvdiv_255_u16(t, half); 68 } 69 70 static inline uint16x8_t qvinterpolate_pixel_255(uint16x8_t x, uint16x8_t a, uint16x8_t y, uint16x8_t b, uint16x8_t half) 71 71 { 72 72 // t = x * a + y * b 73 73 74 const int16x8_t ta = vmulq_s16(x, a);75 const int16x8_t tb = vmulq_s16(y, b);76 77 return qvdiv_255_ s16(vaddq_s16(ta, tb), half);78 } 79 80 static inline int16x8_t qvsource_over_s16(int16x8_t src16, int16x8_t dst16, int16x8_t half,int16x8_t full)81 { 82 const int16x4_t alpha16_high = vdup_lane_s16(vget_high_s16(src16), 3);83 const int16x4_t alpha16_low = vdup_lane_s16(vget_low_s16(src16), 3);84 85 const int16x8_t alpha16 = vsubq_s16(full, vcombine_s16(alpha16_low, alpha16_high));86 87 return vaddq_ s16(src16, qvbyte_mul_s16(dst16, alpha16, half));74 const uint16x8_t ta = vmulq_u16(x, a); 75 const uint16x8_t tb = vmulq_u16(y, b); 76 77 return qvdiv_255_u16(vaddq_u16(ta, tb), half); 78 } 79 80 static inline uint16x8_t qvsource_over_u16(uint16x8_t src16, uint16x8_t dst16, uint16x8_t half, uint16x8_t full) 81 { 82 const uint16x4_t alpha16_high = vdup_lane_u16(vget_high_u16(src16), 3); 83 const uint16x4_t alpha16_low = vdup_lane_u16(vget_low_u16(src16), 3); 84 85 const uint16x8_t alpha16 = vsubq_u16(full, vcombine_u16(alpha16_low, alpha16_high)); 86 87 return vaddq_u16(src16, qvbyte_mul_u16(dst16, alpha16, half)); 88 88 } 89 89 … … 95 95 const uint *src = (const uint *) srcPixels; 96 96 uint *dst = (uint *) destPixels; 97 int16x8_t half = vdupq_n_s16(0x80);98 int16x8_t full = vdupq_n_s16(0xff);97 uint16x8_t half = vdupq_n_u16(0x80); 98 uint16x8_t full = vdupq_n_u16(0xff); 99 99 if (const_alpha == 256) { 100 100 for (int y = 0; y < h; ++y) { 101 101 int x = 0; 102 102 for (; x < w-3; x += 4) { 103 int32x4_t src32 = vld1q_s32((int32_t *)&src[x]);103 uint32x4_t src32 = vld1q_u32((uint32_t *)&src[x]); 104 104 if ((src[x] & src[x+1] & src[x+2] & src[x+3]) >= 0xff000000) { 105 105 // all opaque 106 vst1q_ s32((int32_t *)&dst[x], src32);106 vst1q_u32((uint32_t *)&dst[x], src32); 107 107 } else if (src[x] | src[x+1] | src[x+2] | src[x+3]) { 108 int32x4_t dst32 = vld1q_s32((int32_t *)&dst[x]);109 110 const uint8x16_t src8 = vreinterpretq_u8_ s32(src32);111 const uint8x16_t dst8 = vreinterpretq_u8_ s32(dst32);108 uint32x4_t dst32 = vld1q_u32((uint32_t *)&dst[x]); 109 110 const uint8x16_t src8 = vreinterpretq_u8_u32(src32); 111 const uint8x16_t dst8 = vreinterpretq_u8_u32(dst32); 112 112 113 113 const uint8x8_t src8_low = vget_low_u8(src8); … … 117 117 const uint8x8_t dst8_high = vget_high_u8(dst8); 118 118 119 const int16x8_t src16_low = vreinterpretq_s16_u16(vmovl_u8(src8_low));120 const int16x8_t dst16_low = vreinterpretq_s16_u16(vmovl_u8(dst8_low));121 122 const int16x8_t src16_high = vreinterpretq_s16_u16(vmovl_u8(src8_high));123 const int16x8_t dst16_high = vreinterpretq_s16_u16(vmovl_u8(dst8_high));124 125 const int16x8_t result16_low = qvsource_over_s16(src16_low, dst16_low, half, full);126 const int16x8_t result16_high = qvsource_over_s16(src16_high, dst16_high, half, full);127 128 const int32x2_t result32_low = vreinterpret_s32_s8(vmovn_s16(result16_low));129 const int32x2_t result32_high = vreinterpret_s32_s8(vmovn_s16(result16_high));130 131 vst1q_ s32((int32_t *)&dst[x], vcombine_s32(result32_low, result32_high));119 const uint16x8_t src16_low = vmovl_u8(src8_low); 120 const uint16x8_t dst16_low = vmovl_u8(dst8_low); 121 122 const uint16x8_t src16_high = vmovl_u8(src8_high); 123 const uint16x8_t dst16_high = vmovl_u8(dst8_high); 124 125 const uint16x8_t result16_low = qvsource_over_u16(src16_low, dst16_low, half, full); 126 const uint16x8_t result16_high = qvsource_over_u16(src16_high, dst16_high, half, full); 127 128 const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result16_low)); 129 const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result16_high)); 130 131 vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high)); 132 132 } 133 133 } … … 144 144 } else if (const_alpha != 0) { 145 145 const_alpha = (const_alpha * 255) >> 8; 146 int16x8_t const_alpha16 = vdupq_n_s16(const_alpha);146 uint16x8_t const_alpha16 = vdupq_n_u16(const_alpha); 147 147 for (int y = 0; y < h; ++y) { 148 148 int x = 0; 149 149 for (; x < w-3; x += 4) { 150 150 if (src[x] | src[x+1] | src[x+2] | src[x+3]) { 151 int32x4_t src32 = vld1q_s32((int32_t *)&src[x]);152 int32x4_t dst32 = vld1q_s32((int32_t *)&dst[x]);153 154 const uint8x16_t src8 = vreinterpretq_u8_ s32(src32);155 const uint8x16_t dst8 = vreinterpretq_u8_ s32(dst32);151 uint32x4_t src32 = vld1q_u32((uint32_t *)&src[x]); 152 uint32x4_t dst32 = vld1q_u32((uint32_t *)&dst[x]); 153 154 const uint8x16_t src8 = vreinterpretq_u8_u32(src32); 155 const uint8x16_t dst8 = vreinterpretq_u8_u32(dst32); 156 156 157 157 const uint8x8_t src8_low = vget_low_u8(src8); … … 161 161 const uint8x8_t dst8_high = vget_high_u8(dst8); 162 162 163 const int16x8_t src16_low = vreinterpretq_s16_u16(vmovl_u8(src8_low));164 const int16x8_t dst16_low = vreinterpretq_s16_u16(vmovl_u8(dst8_low));165 166 const int16x8_t src16_high = vreinterpretq_s16_u16(vmovl_u8(src8_high));167 const int16x8_t dst16_high = vreinterpretq_s16_u16(vmovl_u8(dst8_high));168 169 const int16x8_t srcalpha16_low = qvbyte_mul_s16(src16_low, const_alpha16, half);170 const int16x8_t srcalpha16_high = qvbyte_mul_s16(src16_high, const_alpha16, half);171 172 const int16x8_t result16_low = qvsource_over_s16(srcalpha16_low, dst16_low, half, full);173 const int16x8_t result16_high = qvsource_over_s16(srcalpha16_high, dst16_high, half, full);174 175 const int32x2_t result32_low = vreinterpret_s32_s8(vmovn_s16(result16_low));176 const int32x2_t result32_high = vreinterpret_s32_s8(vmovn_s16(result16_high));177 178 vst1q_ s32((int32_t *)&dst[x], vcombine_s32(result32_low, result32_high));163 const uint16x8_t src16_low = vmovl_u8(src8_low); 164 const uint16x8_t dst16_low = vmovl_u8(dst8_low); 165 166 const uint16x8_t src16_high = vmovl_u8(src8_high); 167 const uint16x8_t dst16_high = vmovl_u8(dst8_high); 168 169 const uint16x8_t srcalpha16_low = qvbyte_mul_u16(src16_low, const_alpha16, half); 170 const uint16x8_t srcalpha16_high = qvbyte_mul_u16(src16_high, const_alpha16, half); 171 172 const uint16x8_t result16_low = qvsource_over_u16(srcalpha16_low, dst16_low, half, full); 173 const uint16x8_t result16_high = qvsource_over_u16(srcalpha16_high, dst16_high, half, full); 174 175 const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result16_low)); 176 const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result16_high)); 177 178 vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high)); 179 179 } 180 180 } … … 207 207 const uint *src = (const uint *) srcPixels; 208 208 uint *dst = (uint *) destPixels; 209 int16x8_t half = vdupq_n_s16(0x80);209 uint16x8_t half = vdupq_n_u16(0x80); 210 210 const_alpha = (const_alpha * 255) >> 8; 211 211 int one_minus_const_alpha = 255 - const_alpha; 212 int16x8_t const_alpha16 = vdupq_n_s16(const_alpha);213 int16x8_t one_minus_const_alpha16 = vdupq_n_s16(255 - const_alpha);212 uint16x8_t const_alpha16 = vdupq_n_u16(const_alpha); 213 uint16x8_t one_minus_const_alpha16 = vdupq_n_u16(255 - const_alpha); 214 214 for (int y = 0; y < h; ++y) { 215 215 int x = 0; 216 216 for (; x < w-3; x += 4) { 217 int32x4_t src32 = vld1q_s32((int32_t *)&src[x]);218 int32x4_t dst32 = vld1q_s32((int32_t *)&dst[x]);219 220 const uint8x16_t src8 = vreinterpretq_u8_ s32(src32);221 const uint8x16_t dst8 = vreinterpretq_u8_ s32(dst32);217 uint32x4_t src32 = vld1q_u32((uint32_t *)&src[x]); 218 uint32x4_t dst32 = vld1q_u32((uint32_t *)&dst[x]); 219 220 const uint8x16_t src8 = vreinterpretq_u8_u32(src32); 221 const uint8x16_t dst8 = vreinterpretq_u8_u32(dst32); 222 222 223 223 const uint8x8_t src8_low = vget_low_u8(src8); … … 227 227 const uint8x8_t dst8_high = vget_high_u8(dst8); 228 228 229 const int16x8_t src16_low = vreinterpretq_s16_u16(vmovl_u8(src8_low));230 const int16x8_t dst16_low = vreinterpretq_s16_u16(vmovl_u8(dst8_low));231 232 const int16x8_t src16_high = vreinterpretq_s16_u16(vmovl_u8(src8_high));233 const int16x8_t dst16_high = vreinterpretq_s16_u16(vmovl_u8(dst8_high));234 235 const int16x8_t result16_low = qvinterpolate_pixel_255(src16_low, const_alpha16, dst16_low, one_minus_const_alpha16, half);236 const int16x8_t result16_high = qvinterpolate_pixel_255(src16_high, const_alpha16, dst16_high, one_minus_const_alpha16, half);237 238 const int32x2_t result32_low = vreinterpret_s32_s8(vmovn_s16(result16_low));239 const int32x2_t result32_high = vreinterpret_s32_s8(vmovn_s16(result16_high));240 241 vst1q_ s32((int32_t *)&dst[x], vcombine_s32(result32_low, result32_high));229 const uint16x8_t src16_low = vmovl_u8(src8_low); 230 const uint16x8_t dst16_low = vmovl_u8(dst8_low); 231 232 const uint16x8_t src16_high = vmovl_u8(src8_high); 233 const uint16x8_t dst16_high = vmovl_u8(dst8_high); 234 235 const uint16x8_t result16_low = qvinterpolate_pixel_255(src16_low, const_alpha16, dst16_low, one_minus_const_alpha16, half); 236 const uint16x8_t result16_high = qvinterpolate_pixel_255(src16_high, const_alpha16, dst16_high, one_minus_const_alpha16, half); 237 238 const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result16_low)); 239 const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result16_high)); 240 241 vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high)); 242 242 } 243 243 for (; x<w; ++x) { -
trunk/src/gui/painting/qdrawhelper_p.h
r651 r769 1550 1550 inline void qt_memfill(T *dest, T value, int count) 1551 1551 { 1552 if (!count) 1553 return; 1554 1552 1555 int n = (count + 7) / 8; 1553 1556 switch (count & 0x07) -
trunk/src/gui/painting/qdrawhelper_sse2.cpp
r651 r769 57 57 58 58 QT_BEGIN_NAMESPACE 59 60 /* 61 * Multiply the components of pixelVector by alphaChannel 62 * Each 32bits components of alphaChannel must be in the form 0x00AA00AA 63 * colorMask must have 0x00ff00ff on each 32 bits component 64 * half must have the value 128 (0x80) for each 32 bits compnent 65 */ 66 #define BYTE_MUL_SSE2(result, pixelVector, alphaChannel, colorMask, half) \ 67 { \ 68 /* 1. separate the colors in 2 vectors so each color is on 16 bits \ 69 (in order to be multiplied by the alpha \ 70 each 32 bit of dstVectorAG are in the form 0x00AA00GG \ 71 each 32 bit of dstVectorRB are in the form 0x00RR00BB */\ 72 __m128i pixelVectorAG = _mm_srli_epi16(pixelVector, 8); \ 73 __m128i pixelVectorRB = _mm_and_si128(pixelVector, colorMask); \ 74 \ 75 /* 2. multiply the vectors by the alpha channel */\ 76 pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, alphaChannel); \ 77 pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, alphaChannel); \ 78 \ 79 /* 3. devide by 255, that's the tricky part. \ 80 we do it like for BYTE_MUL(), with bit shift: X/255 ~= (X + X/256 + rounding)/256 */ \ 81 /** so first (X + X/256 + rounding) */\ 82 pixelVectorRB = _mm_add_epi16(pixelVectorRB, _mm_srli_epi16(pixelVectorRB, 8)); \ 83 pixelVectorRB = _mm_add_epi16(pixelVectorRB, half); \ 84 pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); \ 85 pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); \ 86 \ 87 /** second devide by 256 */\ 88 pixelVectorRB = _mm_srli_epi16(pixelVectorRB, 8); \ 89 /** for AG, we could >> 8 to divide followed by << 8 to put the \ 90 bytes in the correct position. By masking instead, we execute \ 91 only one instruction */\ 92 pixelVectorAG = _mm_andnot_si128(colorMask, pixelVectorAG); \ 93 \ 94 /* 4. combine the 2 pairs of colors */ \ 95 result = _mm_or_si128(pixelVectorAG, pixelVectorRB); \ 96 } 97 98 /* 99 * Each 32bits components of alphaChannel must be in the form 0x00AA00AA 100 * oneMinusAlphaChannel must be 255 - alpha for each 32 bits component 101 * colorMask must have 0x00ff00ff on each 32 bits component 102 * half must have the value 128 (0x80) for each 32 bits compnent 103 */ 104 #define INTERPOLATE_PIXEL_255_SSE2(result, srcVector, dstVector, alphaChannel, oneMinusAlphaChannel, colorMask, half) { \ 105 /* interpolate AG */\ 106 __m128i srcVectorAG = _mm_srli_epi16(srcVector, 8); \ 107 __m128i dstVectorAG = _mm_srli_epi16(dstVector, 8); \ 108 __m128i srcVectorAGalpha = _mm_mullo_epi16(srcVectorAG, alphaChannel); \ 109 __m128i dstVectorAGoneMinusAlphalpha = _mm_mullo_epi16(dstVectorAG, oneMinusAlphaChannel); \ 110 __m128i finalAG = _mm_add_epi16(srcVectorAGalpha, dstVectorAGoneMinusAlphalpha); \ 111 finalAG = _mm_add_epi16(finalAG, _mm_srli_epi16(finalAG, 8)); \ 112 finalAG = _mm_add_epi16(finalAG, half); \ 113 finalAG = _mm_andnot_si128(colorMask, finalAG); \ 114 \ 115 /* interpolate RB */\ 116 __m128i srcVectorRB = _mm_and_si128(srcVector, colorMask); \ 117 __m128i dstVectorRB = _mm_and_si128(dstVector, colorMask); \ 118 __m128i srcVectorRBalpha = _mm_mullo_epi16(srcVectorRB, alphaChannel); \ 119 __m128i dstVectorRBoneMinusAlphalpha = _mm_mullo_epi16(dstVectorRB, oneMinusAlphaChannel); \ 120 __m128i finalRB = _mm_add_epi16(srcVectorRBalpha, dstVectorRBoneMinusAlphalpha); \ 121 finalRB = _mm_add_epi16(finalRB, _mm_srli_epi16(finalRB, 8)); \ 122 finalRB = _mm_add_epi16(finalRB, half); \ 123 finalRB = _mm_srli_epi16(finalRB, 8); \ 124 \ 125 /* combine */\ 126 result = _mm_or_si128(finalAG, finalRB); \ 127 } 128 129 void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, 130 const uchar *srcPixels, int sbpl, 131 int w, int h, 132 int const_alpha) 133 { 134 const quint32 *src = (const quint32 *) srcPixels; 135 quint32 *dst = (uint *) destPixels; 136 if (const_alpha == 256) { 137 const __m128i alphaMask = _mm_set1_epi32(0xff000000); 138 const __m128i nullVector = _mm_set1_epi32(0); 139 const __m128i half = _mm_set1_epi16(0x80); 140 const __m128i one = _mm_set1_epi16(0xff); 141 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); 142 for (int y = 0; y < h; ++y) { 143 int x = 0; 144 for (; x < w-3; x += 4) { 145 const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); 146 const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); 147 if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { 148 // all opaque 149 _mm_storeu_si128((__m128i *)&dst[x], srcVector); 150 } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { 151 // not fully transparent 152 // result = s + d * (1-alpha) 153 154 // extract the alpha channel on 2 x 16 bits 155 // so we have room for the multiplication 156 // each 32 bits will be in the form 0x00AA00AA 157 // with A being the 1 - alpha 158 __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); 159 alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); 160 alphaChannel = _mm_sub_epi16(one, alphaChannel); 161 162 const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); 163 __m128i destMultipliedByOneMinusAlpha; 164 BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); 165 166 // result = s + d * (1-alpha) 167 const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); 168 _mm_storeu_si128((__m128i *)&dst[x], result); 169 } 170 } 171 for (; x<w; ++x) { 172 uint s = src[x]; 173 if (s >= 0xff000000) 174 dst[x] = s; 175 else if (s != 0) 176 dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); 177 } 178 dst = (quint32 *)(((uchar *) dst) + dbpl); 179 src = (const quint32 *)(((const uchar *) src) + sbpl); 180 } 181 } else if (const_alpha != 0) { 182 // dest = (s + d * sia) * ca + d * cia 183 // = s * ca + d * (sia * ca + cia) 184 // = s * ca + d * (1 - sa*ca) 185 const_alpha = (const_alpha * 255) >> 8; 186 const __m128i nullVector = _mm_set1_epi32(0); 187 const __m128i half = _mm_set1_epi16(0x80); 188 const __m128i one = _mm_set1_epi16(0xff); 189 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); 190 const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); 191 for (int y = 0; y < h; ++y) { 192 int x = 0; 193 for (; x < w-3; x += 4) { 194 __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); 195 if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { 196 BYTE_MUL_SSE2(srcVector, srcVector, constAlphaVector, colorMask, half); 197 198 __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); 199 alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); 200 alphaChannel = _mm_sub_epi16(one, alphaChannel); 201 202 const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); 203 __m128i destMultipliedByOneMinusAlpha; 204 BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); 205 206 const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); 207 _mm_storeu_si128((__m128i *)&dst[x], result); 208 } 209 } 210 for (; x<w; ++x) { 211 quint32 s = src[x]; 212 if (s != 0) { 213 s = BYTE_MUL(s, const_alpha); 214 dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); 215 } 216 } 217 dst = (quint32 *)(((uchar *) dst) + dbpl); 218 src = (const quint32 *)(((const uchar *) src) + sbpl); 219 } 220 } 221 } 222 223 // qblendfunctions.cpp 224 void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl, 225 const uchar *srcPixels, int sbpl, 226 int w, int h, 227 int const_alpha); 228 229 void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, 230 const uchar *srcPixels, int sbpl, 231 int w, int h, 232 int const_alpha) 233 { 234 const quint32 *src = (const quint32 *) srcPixels; 235 quint32 *dst = (uint *) destPixels; 236 if (const_alpha != 256) { 237 if (const_alpha != 0) { 238 const __m128i nullVector = _mm_set1_epi32(0); 239 const __m128i half = _mm_set1_epi16(0x80); 240 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); 241 242 const_alpha = (const_alpha * 255) >> 8; 243 int one_minus_const_alpha = 255 - const_alpha; 244 const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); 245 const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha); 246 for (int y = 0; y < h; ++y) { 247 int x = 0; 248 for (; x < w-3; x += 4) { 249 __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); 250 if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { 251 const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); 252 __m128i result; 253 INTERPOLATE_PIXEL_255_SSE2(result, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half); 254 _mm_storeu_si128((__m128i *)&dst[x], result); 255 } 256 } 257 for (; x<w; ++x) { 258 quint32 s = src[x]; 259 s = BYTE_MUL(s, const_alpha); 260 dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha); 261 } 262 dst = (quint32 *)(((uchar *) dst) + dbpl); 263 src = (const quint32 *)(((const uchar *) src) + sbpl); 264 } 265 } 266 } else { 267 qt_blend_rgb32_on_rgb32(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); 268 } 269 } 59 270 60 271 void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) -
trunk/src/gui/painting/qdrawhelper_x86_p.h
r651 r769 115 115 quint32 color, 116 116 const uchar *src, int width, int height, int stride); 117 void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, 118 const uchar *srcPixels, int sbpl, 119 int w, int h, 120 int const_alpha); 121 void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, 122 const uchar *srcPixels, int sbpl, 123 int w, int h, 124 int const_alpha); 117 125 #endif // QT_HAVE_SSE2 118 126 -
trunk/src/gui/painting/qdrawutil.cpp
r651 r769 1362 1362 for (int i = 0; i < dataCount; ++i) { 1363 1363 QTransform transform = oldTransform; 1364 transform.translate(drawingData[i].point.x(), drawingData[i].point.y()); 1365 transform.rotate(drawingData[i].rotation); 1364 qreal xOffset = 0; 1365 qreal yOffset = 0; 1366 if (drawingData[i].rotation == 0) { 1367 xOffset = drawingData[i].point.x(); 1368 yOffset = drawingData[i].point.y(); 1369 } else { 1370 transform.translate(drawingData[i].point.x(), drawingData[i].point.y()); 1371 transform.rotate(drawingData[i].rotation); 1372 } 1373 painter->setTransform(transform); 1366 1374 painter->setOpacity(oldOpacity * drawingData[i].opacity); 1367 painter->setTransform(transform);1368 1375 1369 1376 qreal w = drawingData[i].scaleX * drawingData[i].source.width(); 1370 1377 qreal h = drawingData[i].scaleY * drawingData[i].source.height(); 1371 painter->drawPixmap(QRectF(-0.5 * w , -0.5 * h, w, h), pixmap, drawingData[i].source);1378 painter->drawPixmap(QRectF(-0.5 * w + xOffset, -0.5 * h + yOffset, w, h), pixmap, drawingData[i].source); 1372 1379 } 1373 1380 -
trunk/src/gui/painting/qgraphicssystem_raster.cpp
r651 r769 42 42 #include "qgraphicssystem_raster_p.h" 43 43 44 #ifdef Q_OS_SYMBIAN 45 #include "private/qpixmap_s60_p.h" 46 #include "private/qwindowsurface_s60_p.h" 47 #else 44 48 #include "private/qpixmap_raster_p.h" 45 49 #include "private/qwindowsurface_raster_p.h" 50 #endif 46 51 47 52 QT_BEGIN_NAMESPACE … … 49 54 QPixmapData *QRasterGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const 50 55 { 56 #ifdef Q_OS_SYMBIAN 57 return new QS60PixmapData(type); 58 #else 51 59 return new QRasterPixmapData(type); 60 #endif 52 61 } 53 62 54 63 QWindowSurface *QRasterGraphicsSystem::createWindowSurface(QWidget *widget) const 55 64 { 65 #ifdef Q_OS_SYMBIAN 66 return new QS60WindowSurface(widget); 67 #else 56 68 return new QRasterWindowSurface(widget); 69 #endif 57 70 } 58 71 -
trunk/src/gui/painting/qmath_p.h
r651 r769 55 55 56 56 #include <math.h> 57 #include <qmath.h> 57 58 58 59 QT_BEGIN_NAMESPACE … … 62 63 static const qreal Q_PI2 = qreal(1.57079632679489661923); // pi/2 63 64 65 inline int qIntSqrtInt(int v) 66 { 67 return static_cast<int>(qSqrt(static_cast<qreal>(v))); 68 } 69 64 70 QT_END_NAMESPACE 65 71 -
trunk/src/gui/painting/qpaintbuffer.cpp
r651 r769 53 53 QT_BEGIN_NAMESPACE 54 54 55 extern int qt_defaultDpiX();56 extern int qt_defaultDpiY();55 Q_GUI_EXPORT extern int qt_defaultDpiX(); 56 Q_GUI_EXPORT extern int qt_defaultDpiY(); 57 57 extern void qt_format_text(const QFont &font, 58 58 const QRectF &_r, int tf, const QTextOption *option, const QString& str, QRectF *brect, -
trunk/src/gui/painting/qpaintengine_alpha.cpp
r651 r769 94 94 } 95 95 96 extern int qt_defaultDpiX();97 extern int qt_defaultDpiY();96 Q_GUI_EXPORT extern int qt_defaultDpiX(); 97 Q_GUI_EXPORT extern int qt_defaultDpiY(); 98 98 99 99 bool QAlphaPaintEngine::end() -
trunk/src/gui/painting/qpaintengine_raster.cpp
r651 r769 101 101 #include <limits.h> 102 102 103 #if defined(QT_NO_FPU) || (_MSC_VER >= 1300 && _MSC_VER < 1400)104 # define FLOATING_POINT_BUGGY_OR_NO_FPU105 #endif106 107 103 QT_BEGIN_NAMESPACE 108 104 109 extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp105 Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp 110 106 111 107 #define qreal_to_fixed_26_6(f) (int(f * 64)) … … 3680 3676 || (qpen_style(s->lastPen) == Qt::NoPen && !s->flags.antialiased)) 3681 3677 && qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT 3682 #ifdef FLOATING_POINT_BUGGY_OR_NO_FPU3683 && qMax(rect.width(), rect.height()) < 128 // integer math breakdown3684 #endif3685 3678 && s->matrix.type() <= QTransform::TxScale) // no shear 3686 3679 { … … 4985 4978 } 4986 4979 4987 extern QImage qt_imageForBrush(int brushStyle, bool invert);4980 Q_GUI_EXPORT extern QImage qt_imageForBrush(int brushStyle, bool invert); 4988 4981 4989 4982 void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode) … … 6055 6048 QSpanData *pen_data, QSpanData *brush_data) 6056 6049 { 6057 #ifdef FLOATING_POINT_BUGGY_OR_NO_FPU // no fpu, so use fixed point6058 const QFixed a = QFixed(rect.width()) >> 1;6059 const QFixed b = QFixed(rect.height()) >> 1;6060 QFixed d = b*b - (a*a*b) + ((a*a) >> 2);6061 #else6062 6050 const qreal a = qreal(rect.width()) / 2; 6063 6051 const qreal b = qreal(rect.height()) / 2; 6064 6052 qreal d = b*b - (a*a*b) + 0.25*a*a; 6065 #endif6066 6053 6067 6054 int x = 0; … … 6086 6073 6087 6074 // region 2 6088 #ifdef FLOATING_POINT_BUGGY_OR_NO_FPU6089 d = b*b*(x + (QFixed(1) >> 1))*(x + (QFixed(1) >> 1))6090 + a*a*((y - 1)*(y - 1) - b*b);6091 #else6092 6075 d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b); 6093 #endif6094 6076 const int miny = rect.height() & 0x1; 6095 6077 while (y > miny) { -
trunk/src/gui/painting/qpaintengine_x11.cpp
r651 r769 1990 1990 XFillRectangle(d->dpy, d->hd, d->gc, x, y, sw, sh); 1991 1991 restore_clip = true; 1992 } else if (mono_dst && !mono_src) { 1993 QBitmap bitmap(pixmap); 1994 XCopyArea(d->dpy, bitmap.handle(), d->hd, d->gc, sx, sy, sw, sh, x, y); 1992 1995 } else { 1993 1996 XCopyArea(d->dpy, pixmap.handle(), d->hd, d->gc, sx, sy, sw, sh, x, y); -
trunk/src/gui/painting/qpaintengineex.cpp
r651 r769 381 381 } 382 382 383 extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp383 Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp 384 384 385 385 void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) -
trunk/src/gui/painting/qpainter.cpp
r651 r769 709 709 if (penBrush.style() == Qt::TexturePattern) 710 710 penTextureAlpha = qHasPixmapTexture(penBrush) 711 ? penBrush.texture().hasAlpha()711 ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha() 712 712 : penBrush.textureImage().hasAlphaChannel(); 713 713 bool brushTextureAlpha = false; 714 if (s->brush.style() == Qt::TexturePattern) 714 if (s->brush.style() == Qt::TexturePattern) { 715 715 brushTextureAlpha = qHasPixmapTexture(s->brush) 716 ? s->brush.texture().hasAlpha()716 ? (s->brush.texture().depth() > 1) && s->brush.texture().hasAlpha() 717 717 : s->brush.textureImage().hasAlphaChannel(); 718 } 718 719 if (((penBrush.style() == Qt::TexturePattern && penTextureAlpha) 719 720 || (s->brush.style() == Qt::TexturePattern && brushTextureAlpha)) … … 1987 1988 1988 1989 Note that only the states the underlying paint engine changes will be reset 1989 to their respective default states. If, for example, the OpenGL polygon 1990 mode is changed by the user inside a beginNativePaint()/endNativePainting() 1991 block, it will not be reset to the default state by endNativePainting(). 1992 1993 Here is an example that shows intermixing of painter commands 1994 and raw OpenGL commands: 1990 to their respective default states. The states we reset may change from 1991 release to release. The following states are currently reset in the OpenGL 1992 2 engine: 1993 1994 \list 1995 \i blending is disabled 1996 \i the depth, stencil and scissor tests are disabled 1997 \i the active texture unit is reset to 0 1998 \i the depth mask, depth function and the clear depth are reset to their 1999 default values 2000 \i the stencil mask, stencil operation and stencil function are reset to 2001 their default values 2002 \i the current color is reset to solid white 2003 \endlist 2004 2005 If, for example, the OpenGL polygon mode is changed by the user inside a 2006 beginNativePaint()/endNativePainting() block, it will not be reset to the 2007 default state by endNativePainting(). Here is an example that shows 2008 intermixing of painter commands and raw OpenGL commands: 1995 2009 1996 2010 \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 21 … … 5760 5774 gf.chars = engine.layoutData->string.unicode() + si.position; 5761 5775 gf.num_chars = engine.length(item); 5762 gf.width = si.width; 5776 if (engine.forceJustification) { 5777 for (int j=0; j<gf.glyphs.numGlyphs; ++j) 5778 gf.width += gf.glyphs.effectiveAdvance(j); 5779 } else { 5780 gf.width = si.width; 5781 } 5763 5782 gf.logClusters = engine.logClusters(&si); 5764 5783 5765 5784 drawTextItem(QPointF(x.toReal(), p.y()), gf); 5766 5785 5767 x += si.width;5786 x += gf.width; 5768 5787 } 5769 5788 } … … 7788 7807 QTextLine line = textLayout.lineAt(i); 7789 7808 7809 qreal advance = textLayout.engine()->lines[i].textAdvance.toReal(); 7790 7810 if (tf & Qt::AlignRight) 7791 xoff = r.width() - line.naturalTextWidth();7811 xoff = r.width() - advance; 7792 7812 else if (tf & Qt::AlignHCenter) 7793 xoff = (r.width() - line.naturalTextWidth())/2;7813 xoff = (r.width() - advance)/2; 7794 7814 7795 7815 line.draw(painter, QPointF(r.x() + xoff + line.x(), r.y() + yoff)); -
trunk/src/gui/painting/qpathclipper.cpp
r651 r769 1692 1692 1693 1693 if (rect) 1694 *rect = QRectF(QPointF(x1, y1), QPointF(x2, y2));1694 rect->setCoords(x1, y1, x2, y2); 1695 1695 1696 1696 return true; -
trunk/src/gui/painting/qpdf.cpp
r651 r769 55 55 QT_BEGIN_NAMESPACE 56 56 57 extern int qt_defaultDpi();57 Q_GUI_EXPORT extern int qt_defaultDpi(); 58 58 59 59 #ifndef QT_NO_PRINTER … … 972 972 return; 973 973 974 Q_D(QPdfBaseEngine); 974 975 QPainterPath p; 975 976 for (int i=0; i!=pointCount;++i) { … … 977 978 p.lineTo(points[i] + QPointF(0, 0.001)); 978 979 } 980 981 bool hadBrush = d->hasBrush; 982 d->hasBrush = false; 979 983 drawPath(p); 984 d->hasBrush = hadBrush; 980 985 } 981 986 … … 985 990 return; 986 991 992 Q_D(QPdfBaseEngine); 987 993 QPainterPath p; 988 994 for (int i=0; i!=lineCount;++i) { … … 990 996 p.lineTo(lines[i].p2()); 991 997 } 998 bool hadBrush = d->hasBrush; 999 d->hasBrush = false; 992 1000 drawPath(p); 1001 d->hasBrush = hadBrush; 993 1002 } 994 1003 -
trunk/src/gui/painting/qprintengine_ps.cpp
r651 r769 486 486 QByteArray header; 487 487 QPdf::ByteStream s(&header); 488 s << "%!PS-Adobe-1.0";489 488 490 489 qreal scale = 72. / ((qreal) q->metric(QPaintDevice::PdmDpiY)); … … 498 497 int height = pageRect.height(); 499 498 if (finished && pageCount == 1 && copies == 1 && 500 ((fullPage && qt_gen_epsf) || (outputFileName.endsWith(QLatin1String(".eps")))) 501 ) { 499 ((fullPage && qt_gen_epsf) || (outputFileName.endsWith(QLatin1String(".eps"))))) 500 { 501 // According to the EPSF 3.0 spec it is required that the PS 502 // version is PS-Adobe-3.0 503 s << "%!PS-Adobe-3.0"; 502 504 if (!boundingBox.isValid()) 503 505 boundingBox.setRect(0, 0, width, height); … … 506 508 boundingBox.translate(-mleft, -mtop); 507 509 s << " EPSF-3.0\n%%BoundingBox: " 508 << (int)(printer->height() - boundingBox.bottom())*scale// llx509 << (int)(printer->width() - boundingBox.right())*scale - 1// lly510 << (int)(printer->height() - boundingBox.top())*scale + 1// urx511 << (int)(printer->width() - boundingBox.left())*scale; // ury510 << int((printer->height() - boundingBox.bottom())*scale) // llx 511 << int((printer->width() - boundingBox.right())*scale - 1) // lly 512 << int((printer->height() - boundingBox.top())*scale + 1) // urx 513 << int((printer->width() - boundingBox.left())*scale); // ury 512 514 } else { 513 515 if (!fullPage) 514 516 boundingBox.translate(mleft, -mtop); 515 517 s << " EPSF-3.0\n%%BoundingBox: " 516 << (int)(boundingBox.left())*scale517 << (int)(printer->height() - boundingBox.bottom())*scale - 1518 << (int)(boundingBox.right())*scale + 1519 << (int)(printer->height() - boundingBox.top())*scale;518 << int((boundingBox.left())*scale) 519 << int((printer->height() - boundingBox.bottom())*scale - 1) 520 << int((boundingBox.right())*scale + 1) 521 << int((printer->height() - boundingBox.top())*scale); 520 522 } 521 523 } else { 524 s << "%!PS-Adobe-1.0"; 522 525 int w = width + (fullPage ? 0 : mleft + mright); 523 526 int h = height + (fullPage ? 0 : mtop + mbottom); -
trunk/src/gui/painting/qprintengine_win.cpp
r651 r769 965 965 966 966 QStringList info = output.split(QLatin1Char(',')); 967 if (info.size() > 0) { 967 int infoSize = info.size(); 968 if (infoSize > 0) { 968 969 if (name.isEmpty()) 969 970 name = info.at(0); 970 if (program.isEmpty() )971 if (program.isEmpty() && infoSize > 1) 971 972 program = info.at(1); 972 if (port.isEmpty() )973 if (port.isEmpty() && infoSize > 2) 973 974 port = info.at(2); 974 975 } -
trunk/src/gui/painting/qregion.cpp
r651 r769 3146 3146 /* $XFree86: xc/lib/X11/PolyReg.c,v 1.1.1.2.8.2 1998/10/04 15:22:49 hohndel Exp $ */ 3147 3147 3148 #define LARGE_COORDINATE 10000003149 #define SMALL_COORDINATE -LARGE_COORDINATE3148 #define LARGE_COORDINATE INT_MAX 3149 #define SMALL_COORDINATE INT_MIN 3150 3150 3151 3151 /* -
trunk/src/gui/painting/qstroker.cpp
r651 r769 826 826 } 827 827 828 void qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length,828 Q_GUI_EXPORT void qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length, 829 829 QPointF* startPoint, QPointF *endPoint); 830 830 -
trunk/src/gui/painting/qtransform.h
r651 r769 294 294 affine._dy *= num; 295 295 m_33 *= num; 296 m_dirty |= TxScale; 296 if (m_dirty < TxScale) 297 m_dirty = TxScale; 297 298 return *this; 298 299 } … … 317 318 affine._dy += num; 318 319 m_33 += num; 319 m_dirty |= TxProject;320 m_dirty = TxProject; 320 321 return *this; 321 322 } … … 333 334 affine._dy -= num; 334 335 m_33 -= num; 335 m_dirty |= TxProject;336 m_dirty = TxProject; 336 337 return *this; 337 338 } -
trunk/src/gui/painting/qwindowsurface_qws.cpp
r651 r769 81 81 inline bool isWidgetOpaque(const QWidget *w) 82 82 { 83 return w->d_func()->isOpaque ;83 return w->d_func()->isOpaque && !w->testAttribute(Qt::WA_TranslucentBackground); 84 84 } 85 85 … … 874 874 } 875 875 876 // ### copied from qwindowsurface_raster.cpp -- should be cross-platform 877 void QWSMemorySurface::beginPaint(const QRegion &rgn) 878 { 879 if (!isWidgetOpaque(window())) { 880 QPainter p(&img); 881 p.setCompositionMode(QPainter::CompositionMode_Source); 882 const QVector<QRect> rects = rgn.rects(); 883 const QColor blank = Qt::transparent; 884 for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { 885 p.fillRect(*it, blank); 886 } 887 } 888 QWSWindowSurface::beginPaint(rgn); 889 } 890 876 891 // from qwindowsurface.cpp 877 892 extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); -
trunk/src/gui/painting/qwindowsurface_qws_p.h
r651 r769 177 177 QPoint painterOffset() const; 178 178 179 void beginPaint(const QRegion &rgn); 180 179 181 bool lock(int timeout = -1); 180 182 void unlock(); -
trunk/src/gui/painting/qwindowsurface_raster.cpp
r758 r769 560 560 #ifndef QT_MAC_USE_COCOA 561 561 QDEndCGContext(port, &context); 562 #else 563 CGContextFlush(context); 564 #endif 565 #endif 562 #endif 563 #endif // Q_WS_MAC 566 564 567 565 #ifdef Q_OS_SYMBIAN -
trunk/src/gui/painting/qwindowsurface_s60.cpp
r651 r769 71 71 CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new 72 72 qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); 73 73 74 74 QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType); 75 75 if (data) { … … 77 77 d_ptr->device = QPixmap(data); 78 78 } 79 79 80 80 setStaticContentsSupport(true); 81 81 } … … 90 90 QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data()); 91 91 pixmapData->beginDataAccess(); 92 QImage &image = pixmapData->image;93 QRgb *data = reinterpret_cast<QRgb *>(image.bits());94 const int row_stride = image.bytesPerLine() / 4;95 92 93 QPainter p(&pixmapData->image); 94 p.setCompositionMode(QPainter::CompositionMode_Source); 96 95 const QVector<QRect> rects = rgn.rects(); 96 const QColor blank = Qt::transparent; 97 97 for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { 98 const int x_start = it->x();99 const int width = it->width();98 p.fillRect(*it, blank); 99 } 100 100 101 const int y_start = it->y();102 const int height = it->height();103 104 QRgb *row = data + row_stride * y_start;105 for (int y = 0; y < height; ++y) {106 qt_memfill(row + x_start, 0U, width);107 row += row_stride;108 }109 }110 101 pixmapData->endDataAccess(); 111 102 } … … 129 120 const QPoint off = offset(widget); 130 121 QImage *img = &(static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data())->image); 131 122 132 123 QRect rect(off, widget->size()); 133 124 rect &= QRect(QPoint(), img->size()); … … 150 141 QTLWExtra *topExtra = window->d_func()->maybeTopData(); 151 142 Q_ASSERT(topExtra); 143 QRect qr = region.boundingRect(); 152 144 if (!topExtra->inExpose) { 153 145 topExtra->inExpose = true; // Prevent DrawNow() from calling syncBackingStore() again 154 TRect tr = qt_QRect2TRect( region.boundingRect());146 TRect tr = qt_QRect2TRect(qr); 155 147 widget->winId()->DrawNow(tr); 156 148 topExtra->inExpose = false; 149 } else { 150 // This handles the case when syncBackingStore updates content outside of the 151 // original drawing rectangle. This might happen if there are pending update() 152 // events at the same time as we get a Draw() from Symbian. 153 QRect drawRect = qt_TRect2QRect(widget->winId()->DrawableWindow()->GetDrawRect()); 154 if (!drawRect.contains(qr)) 155 widget->winId()->DrawDeferred(); 157 156 } 158 157 }
Note:
See TracChangeset
for help on using the changeset viewer.
