diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/doc/images/qcolor-saturation.png | bin | 2150 -> 1116 bytes | |||
-rw-r--r-- | src/gui/doc/images/qcolor-saturation.svg | 78 | ||||
-rw-r--r-- | src/gui/doc/images/qcolor-value.png | bin | 1241 -> 909 bytes | |||
-rw-r--r-- | src/gui/doc/images/qcolor-value.svg | 78 | ||||
-rw-r--r-- | src/gui/image/qpixmap_blitter_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qblittable_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qcolor_p.cpp | 36 | ||||
-rw-r--r-- | src/gui/painting/qdatabuffer_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qgrayraster.c | 4 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_blitter_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qrasterizer.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 9 |
15 files changed, 205 insertions, 32 deletions
diff --git a/src/gui/doc/images/qcolor-saturation.png b/src/gui/doc/images/qcolor-saturation.png Binary files differindex f28776aff5..9c104f7389 100644 --- a/src/gui/doc/images/qcolor-saturation.png +++ b/src/gui/doc/images/qcolor-saturation.png diff --git a/src/gui/doc/images/qcolor-saturation.svg b/src/gui/doc/images/qcolor-saturation.svg new file mode 100644 index 0000000000..608c2555e8 --- /dev/null +++ b/src/gui/doc/images/qcolor-saturation.svg @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="1.1" + id="svg2" + viewBox="0 0 186.82259 45.046909" + height="12.713239mm" + width="52.725487mm"> + <defs + id="defs4"> + <linearGradient + id="linearGradient3346"> + <stop + id="stop3348" + offset="0" + style="stop-color:#808080;stop-opacity:1" /> + <stop + id="stop3350" + offset="1" + style="stop-color:#0000ff;stop-opacity:1" /> + </linearGradient> + <linearGradient + gradientTransform="translate(109.31384,222.16879)" + gradientUnits="userSpaceOnUse" + y2="16.118341" + x2="200.35715" + y1="16.118341" + x1="3.7246187" + id="linearGradient3352" + xlink:href="#linearGradient3346" /> + </defs> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + transform="translate(-109.31384,-222.16879)" + id="layer1"> + <rect + y="225.7121" + x="112.85714" + height="25.221529" + width="179.73599" + id="rect3336" + style="opacity:1;fill:url(#linearGradient3352);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <text + id="text3338" + y="263.53079" + x="113.03048" + style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + y="263.53079" + x="113.03048" + id="tspan3340">0</tspan></text> + <text + id="text3342" + y="263.53079" + x="271.76645" + style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + y="263.53079" + x="271.76645" + id="tspan3344">255</tspan></text> + </g> +</svg> diff --git a/src/gui/doc/images/qcolor-value.png b/src/gui/doc/images/qcolor-value.png Binary files differindex 0e069123a9..add9b7f83d 100644 --- a/src/gui/doc/images/qcolor-value.png +++ b/src/gui/doc/images/qcolor-value.png diff --git a/src/gui/doc/images/qcolor-value.svg b/src/gui/doc/images/qcolor-value.svg new file mode 100644 index 0000000000..51c2de0338 --- /dev/null +++ b/src/gui/doc/images/qcolor-value.svg @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + width="52.725487mm" + height="12.713239mm" + viewBox="0 0 186.82259 45.046909" + id="svg2" + version="1.1"> + <defs + id="defs4"> + <linearGradient + id="linearGradient3346"> + <stop + style="stop-color:#000000;stop-opacity:1" + offset="0" + id="stop3348" /> + <stop + style="stop-color:#ffffff;stop-opacity:1" + offset="1" + id="stop3350" /> + </linearGradient> + <linearGradient + xlink:href="#linearGradient3346" + id="linearGradient3352" + x1="3.7246187" + y1="16.118341" + x2="183.57143" + y2="15.761199" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(109.31384,222.16879)" /> + </defs> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + id="layer1" + transform="translate(-109.31384,-222.16879)"> + <rect + style="opacity:1;fill:url(#linearGradient3352);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3336" + width="179.73599" + height="25.221529" + x="112.85714" + y="225.7121" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="113.03048" + y="263.53079" + id="text3338"><tspan + id="tspan3340" + x="113.03048" + y="263.53079">0</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="271.76645" + y="263.53079" + id="text3342"><tspan + id="tspan3344" + x="271.76645" + y="263.53079">255</tspan></text> + </g> +</svg> diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 546e2fef79..9889cfb8ec 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QBlittablePlatformPixmap : public QPlatformPixmap { -// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap); +// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap) public: QBlittablePlatformPixmap(); ~QBlittablePlatformPixmap(); diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index e7b1f9e073..51857602d7 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -225,9 +225,9 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni code point of the character; for example, 'A' gives the same key sequence as Qt::Key_A. - \b{Note:} On OS X, references to "Ctrl", Qt::CTRL, Qt::Control + \note On OS X, references to "Ctrl", Qt::CTRL, Qt::Key_Control and Qt::ControlModifier correspond to the \uicontrol Command keys on the - Macintosh keyboard, and references to "Meta", Qt::META, Qt::Meta and + Macintosh keyboard, and references to "Meta", Qt::META, Qt::Key_Meta and Qt::MetaModifier correspond to the \uicontrol Control keys. Developers on OS X can use the same shortcut descriptions across all platforms, and their applications will automatically work as expected on OS X. diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h index d5e2e22799..24440c3c61 100644 --- a/src/gui/painting/qblittable_p.h +++ b/src/gui/painting/qblittable_p.h @@ -64,7 +64,7 @@ class QBlittablePrivate; class Q_GUI_EXPORT QBlittable { - Q_DECLARE_PRIVATE(QBlittable); + Q_DECLARE_PRIVATE(QBlittable) public: enum Capability { diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp index 84874bb75f..773e4096ee 100644 --- a/src/gui/painting/qcolor_p.cpp +++ b/src/gui/painting/qcolor_p.cpp @@ -40,31 +40,37 @@ #include "qglobal.h" #include "qrgb.h" #include "qstringlist.h" +#include "private/qtools_p.h" #include <algorithm> QT_BEGIN_NAMESPACE -static inline int h2i(char hex) -{ - if (hex >= '0' && hex <= '9') - return hex - '0'; - if (hex >= 'a' && hex <= 'f') - return hex - 'a' + 10; - if (hex >= 'A' && hex <= 'F') - return hex - 'A' + 10; - return -1; -} - +/*! + \internal + If s[0..1] is a valid hex number, returns its integer value, + otherwise returns -1. + */ static inline int hex2int(const char *s) { - return (h2i(s[0]) << 4) | h2i(s[1]); + const int hi = QtMiscUtils::fromHex(s[0]); + if (hi < 0) + return -1; + const int lo = QtMiscUtils::fromHex(s[1]); + if (lo < 0) + return -1; + return (hi << 4) | lo; } +/*! + \internal + If s is a valid hex digit, returns its integer value, + multiplied by 0x11, otherwise returns -1. + */ static inline int hex2int(char s) { - int h = h2i(s); - return (h << 4) | h; + const int h = QtMiscUtils::fromHex(s); + return h < 0 ? h : (h << 4) | h; } bool qt_get_hex_rgb(const char *name, QRgb *rgb) @@ -130,7 +136,7 @@ bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb) #define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b) static const struct RGBData { - const char *name; + const char name[21]; uint value; } rgbTbl[] = { { "aliceblue", rgb(240, 248, 255) }, diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h index 631584989a..77b5be0c4c 100644 --- a/src/gui/painting/qdatabuffer_p.h +++ b/src/gui/painting/qdatabuffer_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE template <typename Type> class QDataBuffer { - Q_DISABLE_COPY(QDataBuffer); + Q_DISABLE_COPY(QDataBuffer) public: QDataBuffer(int res) { diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index f0d0ac0283..4812cee9bb 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2897,10 +2897,16 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co sbuf2[i * 2 + 1] = ((const uint*)s2)[x2]; fx += fdx; } + int fastLen; + if (fdx > 0) + fastLen = qMin(len, int((image_x2 - (fx >> 16)) / data->m11)); + else + fastLen = qMin(len, int((image_x1 - (fx >> 16)) / data->m11)); + fastLen -= 3; const __m128i v_fdx = _mm_set1_epi32(fdx*4); __m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx); - for (; i < len-3; i+=4) { + for (; i < fastLen; i += 4) { int offset = _mm_extract_epi16(v_fx, 1); sbuf1[i * 2 + 0] = ((const uint*)s1)[offset]; sbuf1[i * 2 + 1] = ((const uint*)s1)[offset + 1]; diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 2b850cfb2a..db3453898f 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -208,13 +208,13 @@ #define ONE_PIXEL ( 1L << PIXEL_BITS ) #define PIXEL_MASK ( -1L << PIXEL_BITS ) #define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) ) -#define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS ) +#define SUBPIXELS( x ) ( (TPos)(x) * ( 1 << PIXEL_BITS ) ) #define FLOOR( x ) ( (x) & -ONE_PIXEL ) #define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL ) #define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL ) #if PIXEL_BITS >= 6 -#define UPSCALE( x ) ( (x) << ( PIXEL_BITS - 6 ) ) +#define UPSCALE( x ) ( (x) * ( 1 << ( PIXEL_BITS - 6 ) ) ) #define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) ) #else #define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) ) diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index 0aa2901b88..40f5347b26 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -63,7 +63,7 @@ class QBlittable; class Q_GUI_EXPORT QBlitterPaintEngine : public QRasterPaintEngine { - Q_DECLARE_PRIVATE(QBlitterPaintEngine); + Q_DECLARE_PRIVATE(QBlitterPaintEngine) public: QBlitterPaintEngine(QBlittablePlatformPixmap *p); diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index eca1cb590c..52501880e4 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE typedef int Q16Dot16; #define Q16Dot16ToFloat(i) ((i)/65536.) #define FloatToQ16Dot16(i) (int)((i) * 65536.) -#define IntToQ16Dot16(i) ((i) << 16) +#define IntToQ16Dot16(i) ((i) * (1 << 16)) #define Q16Dot16ToInt(i) ((i) >> 16) #define Q16Dot16Factor 65536 @@ -612,7 +612,7 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b) int iBottom = qMin(m_bottom, int((b.y - 32 - rounding) >> 6)); if (iTop <= iBottom) { - Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x << 10) - rounding; + Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x * (1 << 10)) - rounding; if (b.x == a.x) { Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding }; @@ -624,7 +624,7 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b) Q16Dot16 xFP = aFP + Q16Dot16Multiply(slopeFP, IntToQ16Dot16(iTop) - + Q16Dot16Factor/2 - (a.y << 10)); + + Q16Dot16Factor/2 - (a.y * (1 << 10))); if (clip(xFP, iTop, iBottom, slopeFP, m_leftFP, winding)) return; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 51b1418bc3..75e30b9552 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1827,7 +1827,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEngine::GlyphFormat glyphFormat) { - if (glyph == Q_NULLPTR) + if (glyph == Q_NULLPTR || glyph->height == 0 || glyph->width == 0) return QImage(); QImage::Format format = QImage::Format_Invalid; @@ -1875,11 +1875,15 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat); + const bool glyphHasGeometry = glyph != Q_NULLPTR && glyph->height != 0 && glyph->width != 0; if (!cacheEnabled && glyph != &emptyGlyph) { currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy(); delete glyph; } + if (!glyphHasGeometry) + return Q_NULLPTR; + if (currentlyLockedAlphaMap.isNull()) return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index d11f8c34b1..cad30b0c77 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1567,12 +1567,13 @@ void QTextEngine::validate() const layoutData = new LayoutData(); if (block.docHandle()) { layoutData->string = block.text(); - if (block.next().isValid()) { - if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) - layoutData->string += QChar(0xb6); - } else if (option.flags() & QTextOption::ShowDocumentTerminator) { + const bool nextBlockValid = block.next().isValid(); + if (!nextBlockValid && option.flags() & QTextOption::ShowDocumentTerminator) { layoutData->string += QChar(0xA7); + } else if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) { + layoutData->string += QLatin1Char(nextBlockValid ? 0xb6 : 0x20); } + } else { layoutData->string = text; } |