| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qtextureglyphcache.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | QTextureGlyphCache::~QTextureGlyphCache() | - | ||||||||||||||||||
| 9 | { | - | ||||||||||||||||||
| 10 | } | - | ||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | int QTextureGlyphCache::calculateSubPixelPositionCount(glyph_t glyph) const | - | ||||||||||||||||||
| 13 | { | - | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | const int NumSubpixelPositions = 12; | - | ||||||||||||||||||
| 18 | - | |||||||||||||||||||
| 19 | QImage images[NumSubpixelPositions]; | - | ||||||||||||||||||
| 20 | int numImages = 0; | - | ||||||||||||||||||
| 21 | for (int i = 0; i < NumSubpixelPositions
| 0 | ||||||||||||||||||
| 22 | QImage img = textureMapForGlyph(glyph, QFixed::fromReal(i / 12.0)); | - | ||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | if (numImages == 0
| 0 | ||||||||||||||||||
| 25 | QPainterPath path; | - | ||||||||||||||||||
| 26 | QFixedPoint point; | - | ||||||||||||||||||
| 27 | m_current_fontengine->addGlyphsToPath(&glyph, &point, 1, &path, QTextItem::RenderFlags()); | - | ||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | - | |||||||||||||||||||
| 30 | if (path.isEmpty()
| 0 | ||||||||||||||||||
| 31 | break; never executed: break; | 0 | ||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | images[numImages++] = std::move(img); | - | ||||||||||||||||||
| 34 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 35 | bool found = false; | - | ||||||||||||||||||
| 36 | for (int j = 0; j < numImages
| 0 | ||||||||||||||||||
| 37 | if (images[j] == img
| 0 | ||||||||||||||||||
| 38 | found = true; | - | ||||||||||||||||||
| 39 | break; never executed: break; | 0 | ||||||||||||||||||
| 40 | } | - | ||||||||||||||||||
| 41 | } never executed: end of block | 0 | ||||||||||||||||||
| 42 | if (!found
| 0 | ||||||||||||||||||
| 43 | images[numImages++] = std::move(img); never executed: images[numImages++] = std::move(img); | 0 | ||||||||||||||||||
| 44 | } never executed: end of block | 0 | ||||||||||||||||||
| 45 | } | - | ||||||||||||||||||
| 46 | - | |||||||||||||||||||
| 47 | return never executed: numImages;return numImages;never executed: return numImages; | 0 | ||||||||||||||||||
| 48 | } | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, | - | ||||||||||||||||||
| 51 | const QFixedPoint *positions) | - | ||||||||||||||||||
| 52 | { | - | ||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | - | |||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | m_current_fontengine = fontEngine; | - | ||||||||||||||||||
| 59 | const int padding = glyphPadding(); | - | ||||||||||||||||||
| 60 | const int paddingDoubled = padding * 2; | - | ||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | bool supportsSubPixelPositions = fontEngine->supportsSubPixelPositions(); | - | ||||||||||||||||||
| 63 | if (fontEngine->m_subPixelPositionCount == 0
| 0 | ||||||||||||||||||
| 64 | if (!supportsSubPixelPositions
| 0 | ||||||||||||||||||
| 65 | fontEngine->m_subPixelPositionCount = 1; | - | ||||||||||||||||||
| 66 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 67 | int i = 0; | - | ||||||||||||||||||
| 68 | while (fontEngine->m_subPixelPositionCount == 0
| 0 | ||||||||||||||||||
| 69 | fontEngine->m_subPixelPositionCount = calculateSubPixelPositionCount(glyphs[i++]); never executed: fontEngine->m_subPixelPositionCount = calculateSubPixelPositionCount(glyphs[i++]); | 0 | ||||||||||||||||||
| 70 | } never executed: end of block | 0 | ||||||||||||||||||
| 71 | } | - | ||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | if (m_cx == 0
| 0 | ||||||||||||||||||
| 74 | m_cx = padding; | - | ||||||||||||||||||
| 75 | m_cy = padding; | - | ||||||||||||||||||
| 76 | } never executed: end of block | 0 | ||||||||||||||||||
| 77 | - | |||||||||||||||||||
| 78 | QHash<GlyphAndSubPixelPosition, Coord> listItemCoordinates; | - | ||||||||||||||||||
| 79 | int rowHeight = 0; | - | ||||||||||||||||||
| 80 | - | |||||||||||||||||||
| 81 | - | |||||||||||||||||||
| 82 | for (int i=0; i < numGlyphs
| 0 | ||||||||||||||||||
| 83 | const glyph_t glyph = glyphs[i]; | - | ||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | QFixed subPixelPosition; | - | ||||||||||||||||||
| 86 | if (supportsSubPixelPositions
| 0 | ||||||||||||||||||
| 87 | QFixed x = positions != 0
| 0 | ||||||||||||||||||
| 88 | subPixelPosition = fontEngine->subPixelPositionForX(x); | - | ||||||||||||||||||
| 89 | } never executed: end of block | 0 | ||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | if (coords.contains(GlyphAndSubPixelPosition(glyph, subPixelPosition))
| 0 | ||||||||||||||||||
| 92 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 93 | if (listItemCoordinates.contains(GlyphAndSubPixelPosition(glyph, subPixelPosition))
| 0 | ||||||||||||||||||
| 94 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 95 | - | |||||||||||||||||||
| 96 | glyph_metrics_t metrics = fontEngine->alphaMapBoundingBox(glyph, subPixelPosition, m_transform, m_format); | - | ||||||||||||||||||
| 97 | GlyphAndSubPixelPosition key(glyph, subPixelPosition); | - | ||||||||||||||||||
| 98 | int glyph_width = metrics.width.ceil().toInt(); | - | ||||||||||||||||||
| 99 | int glyph_height = metrics.height.ceil().toInt(); | - | ||||||||||||||||||
| 100 | if (glyph_height == 0
| 0 | ||||||||||||||||||
| 101 | - | |||||||||||||||||||
| 102 | Coord c = { 0, 0, 0, 0, 0, 0 }; | - | ||||||||||||||||||
| 103 | coords.insert(key, c); | - | ||||||||||||||||||
| 104 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 105 | } | - | ||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | if (m_format == QFontEngine::Format_Mono
| 0 | ||||||||||||||||||
| 108 | glyph_width = (glyph_width+7)&~7; never executed: glyph_width = (glyph_width+7)&~7; | 0 | ||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | Coord c = { 0, 0, | - | ||||||||||||||||||
| 111 | glyph_width, | - | ||||||||||||||||||
| 112 | glyph_height, | - | ||||||||||||||||||
| 113 | metrics.x.truncate(), | - | ||||||||||||||||||
| 114 | -metrics.y.truncate() }; | - | ||||||||||||||||||
| 115 | - | |||||||||||||||||||
| 116 | listItemCoordinates.insert(key, c); | - | ||||||||||||||||||
| 117 | rowHeight = qMax(rowHeight, glyph_height); | - | ||||||||||||||||||
| 118 | } never executed: end of block | 0 | ||||||||||||||||||
| 119 | if (listItemCoordinates.isEmpty()
| 0 | ||||||||||||||||||
| 120 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 121 | - | |||||||||||||||||||
| 122 | rowHeight += paddingDoubled; | - | ||||||||||||||||||
| 123 | - | |||||||||||||||||||
| 124 | if (m_w == 0
| 0 | ||||||||||||||||||
| 125 | if (fontEngine->maxCharWidth() <= 256
| 0 | ||||||||||||||||||
| 126 | m_w = 256; never executed: m_w = 256; | 0 | ||||||||||||||||||
| 127 | else | - | ||||||||||||||||||
| 128 | m_w = qNextPowerOfTwo(qCeil(fontEngine->maxCharWidth()) - 1); never executed: m_w = qNextPowerOfTwo(qCeil(fontEngine->maxCharWidth()) - 1); | 0 | ||||||||||||||||||
| 129 | } | - | ||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | QHash<GlyphAndSubPixelPosition, Coord>::iterator iter = listItemCoordinates.begin(); | - | ||||||||||||||||||
| 133 | int requiredWidth = m_w; | - | ||||||||||||||||||
| 134 | while (iter != listItemCoordinates.end()
| 0 | ||||||||||||||||||
| 135 | Coord c = iter.value(); | - | ||||||||||||||||||
| 136 | - | |||||||||||||||||||
| 137 | m_currentRowHeight = qMax(m_currentRowHeight, c.h); | - | ||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | if (m_cx + c.w + padding > requiredWidth
| 0 | ||||||||||||||||||
| 140 | int new_width = requiredWidth*2; | - | ||||||||||||||||||
| 141 | while (new_width < m_cx + c.w + padding
| 0 | ||||||||||||||||||
| 142 | new_width *= 2; never executed: new_width *= 2; | 0 | ||||||||||||||||||
| 143 | if (new_width <= maxTextureWidth()
| 0 | ||||||||||||||||||
| 144 | requiredWidth = new_width; | - | ||||||||||||||||||
| 145 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 146 | - | |||||||||||||||||||
| 147 | m_cx = padding; | - | ||||||||||||||||||
| 148 | m_cy += m_currentRowHeight + paddingDoubled; | - | ||||||||||||||||||
| 149 | m_currentRowHeight = c.h; | - | ||||||||||||||||||
| 150 | } never executed: end of block | 0 | ||||||||||||||||||
| 151 | } | - | ||||||||||||||||||
| 152 | - | |||||||||||||||||||
| 153 | if (maxTextureHeight() > 0
| 0 | ||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 156 | } | - | ||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | c.x = m_cx; | - | ||||||||||||||||||
| 159 | c.y = m_cy; | - | ||||||||||||||||||
| 160 | - | |||||||||||||||||||
| 161 | coords.insert(iter.key(), c); | - | ||||||||||||||||||
| 162 | m_pendingGlyphs.insert(iter.key(), c); | - | ||||||||||||||||||
| 163 | - | |||||||||||||||||||
| 164 | m_cx += c.w + paddingDoubled; | - | ||||||||||||||||||
| 165 | ++iter; | - | ||||||||||||||||||
| 166 | } never executed: end of block | 0 | ||||||||||||||||||
| 167 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | } | - | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | void QTextureGlyphCache::fillInPendingGlyphs() | - | ||||||||||||||||||
| 172 | { | - | ||||||||||||||||||
| 173 | if (!hasPendingGlyphs()
| 0 | ||||||||||||||||||
| 174 | return; never executed: return; | 0 | ||||||||||||||||||
| 175 | - | |||||||||||||||||||
| 176 | int requiredHeight = m_h; | - | ||||||||||||||||||
| 177 | int requiredWidth = m_w; | - | ||||||||||||||||||
| 178 | { | - | ||||||||||||||||||
| 179 | QHash<GlyphAndSubPixelPosition, Coord>::iterator iter = m_pendingGlyphs.begin(); | - | ||||||||||||||||||
| 180 | while (iter != m_pendingGlyphs.end()
| 0 | ||||||||||||||||||
| 181 | Coord c = iter.value(); | - | ||||||||||||||||||
| 182 | requiredHeight = qMax(requiredHeight, c.y + c.h); | - | ||||||||||||||||||
| 183 | requiredWidth = qMax(requiredWidth, c.x + c.w); | - | ||||||||||||||||||
| 184 | ++iter; | - | ||||||||||||||||||
| 185 | } never executed: end of block | 0 | ||||||||||||||||||
| 186 | } | - | ||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | if (isNull()
| 0 | ||||||||||||||||||
| 189 | if (isNull()
| 0 | ||||||||||||||||||
| 190 | createCache(qNextPowerOfTwo(requiredWidth - 1), qNextPowerOfTwo(requiredHeight - 1)); never executed: createCache(qNextPowerOfTwo(requiredWidth - 1), qNextPowerOfTwo(requiredHeight - 1)); | 0 | ||||||||||||||||||
| 191 | else | - | ||||||||||||||||||
| 192 | resizeCache(qNextPowerOfTwo(requiredWidth - 1), qNextPowerOfTwo(requiredHeight - 1)); never executed: resizeCache(qNextPowerOfTwo(requiredWidth - 1), qNextPowerOfTwo(requiredHeight - 1)); | 0 | ||||||||||||||||||
| 193 | } | - | ||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | { | - | ||||||||||||||||||
| 196 | QHash<GlyphAndSubPixelPosition, Coord>::iterator iter = m_pendingGlyphs.begin(); | - | ||||||||||||||||||
| 197 | while (iter != m_pendingGlyphs.end()
| 0 | ||||||||||||||||||
| 198 | GlyphAndSubPixelPosition key = iter.key(); | - | ||||||||||||||||||
| 199 | fillTexture(iter.value(), key.glyph, key.subPixelPosition); | - | ||||||||||||||||||
| 200 | - | |||||||||||||||||||
| 201 | ++iter; | - | ||||||||||||||||||
| 202 | } never executed: end of block | 0 | ||||||||||||||||||
| 203 | } | - | ||||||||||||||||||
| 204 | - | |||||||||||||||||||
| 205 | m_pendingGlyphs.clear(); | - | ||||||||||||||||||
| 206 | } never executed: end of block | 0 | ||||||||||||||||||
| 207 | - | |||||||||||||||||||
| 208 | QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const | - | ||||||||||||||||||
| 209 | { | - | ||||||||||||||||||
| 210 | switch (m_format) { | - | ||||||||||||||||||
| 211 | case never executed: QFontEngine::Format_A32:case QFontEngine::Format_A32:never executed: case QFontEngine::Format_A32: | 0 | ||||||||||||||||||
| 212 | return never executed: m_current_fontengine->alphaRGBMapForGlyph(g, subPixelPosition, m_transform);return m_current_fontengine->alphaRGBMapForGlyph(g, subPixelPosition, m_transform);never executed: return m_current_fontengine->alphaRGBMapForGlyph(g, subPixelPosition, m_transform); | 0 | ||||||||||||||||||
| 213 | case never executed: QFontEngine::Format_ARGB:case QFontEngine::Format_ARGB:never executed: case QFontEngine::Format_ARGB: | 0 | ||||||||||||||||||
| 214 | return never executed: m_current_fontengine->bitmapForGlyph(g, subPixelPosition, m_transform);return m_current_fontengine->bitmapForGlyph(g, subPixelPosition, m_transform);never executed: return m_current_fontengine->bitmapForGlyph(g, subPixelPosition, m_transform); | 0 | ||||||||||||||||||
| 215 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 216 | return never executed: m_current_fontengine->alphaMapForGlyph(g, subPixelPosition, m_transform);return m_current_fontengine->alphaMapForGlyph(g, subPixelPosition, m_transform);never executed: return m_current_fontengine->alphaMapForGlyph(g, subPixelPosition, m_transform); | 0 | ||||||||||||||||||
| 217 | } | - | ||||||||||||||||||
| 218 | } | - | ||||||||||||||||||
| 219 | - | |||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | - | |||||||||||||||||||
| 224 | - | |||||||||||||||||||
| 225 | QImageTextureGlyphCache::~QImageTextureGlyphCache() | - | ||||||||||||||||||
| 226 | { | - | ||||||||||||||||||
| 227 | } | - | ||||||||||||||||||
| 228 | - | |||||||||||||||||||
| 229 | void QImageTextureGlyphCache::resizeTextureData(int width, int height) | - | ||||||||||||||||||
| 230 | { | - | ||||||||||||||||||
| 231 | m_image = m_image.copy(0, 0, width, height); | - | ||||||||||||||||||
| 232 | } never executed: end of block | 0 | ||||||||||||||||||
| 233 | - | |||||||||||||||||||
| 234 | void QImageTextureGlyphCache::createTextureData(int width, int height) | - | ||||||||||||||||||
| 235 | { | - | ||||||||||||||||||
| 236 | switch (m_format) { | - | ||||||||||||||||||
| 237 | case never executed: QFontEngine::Format_Mono:case QFontEngine::Format_Mono:never executed: case QFontEngine::Format_Mono: | 0 | ||||||||||||||||||
| 238 | m_image = QImage(width, height, QImage::Format_Mono); | - | ||||||||||||||||||
| 239 | break; never executed: break; | 0 | ||||||||||||||||||
| 240 | case never executed: QFontEngine::Format_A8:case QFontEngine::Format_A8:never executed: case QFontEngine::Format_A8: | 0 | ||||||||||||||||||
| 241 | m_image = QImage(width, height, QImage::Format_Alpha8); | - | ||||||||||||||||||
| 242 | break; never executed: break; | 0 | ||||||||||||||||||
| 243 | case never executed: QFontEngine::Format_A32:case QFontEngine::Format_A32:never executed: case QFontEngine::Format_A32: | 0 | ||||||||||||||||||
| 244 | m_image = QImage(width, height, QImage::Format_RGB32); | - | ||||||||||||||||||
| 245 | break; never executed: break; | 0 | ||||||||||||||||||
| 246 | case never executed: QFontEngine::Format_ARGB:case QFontEngine::Format_ARGB:never executed: case QFontEngine::Format_ARGB: | 0 | ||||||||||||||||||
| 247 | m_image = QImage(width, height, QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||
| 248 | break; never executed: break; | 0 | ||||||||||||||||||
| 249 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 250 | do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,305) : qt_noop()); __builtin_unreachable(); } while (0); | - | ||||||||||||||||||
| 251 | } never executed: end of block | 0 | ||||||||||||||||||
| 252 | } | - | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subPixelPosition) | - | ||||||||||||||||||
| 255 | { | - | ||||||||||||||||||
| 256 | QImage mask = textureMapForGlyph(g, subPixelPosition); | - | ||||||||||||||||||
| 257 | if (m_format == QFontEngine::Format_A32
| 0 | ||||||||||||||||||
| 258 | || m_format == QFontEngine::Format_ARGB
| 0 | ||||||||||||||||||
| 259 | QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()), | - | ||||||||||||||||||
| 260 | qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(), | - | ||||||||||||||||||
| 261 | m_image.format()); | - | ||||||||||||||||||
| 262 | QPainter p(&ref); | - | ||||||||||||||||||
| 263 | p.setCompositionMode(QPainter::CompositionMode_Source); | - | ||||||||||||||||||
| 264 | p.fillRect(0, 0, c.w, c.h, QColor(0,0,0,0)); | - | ||||||||||||||||||
| 265 | p.drawImage(0, 0, mask); | - | ||||||||||||||||||
| 266 | p.end(); | - | ||||||||||||||||||
| 267 | } never executed: else if (m_format == QFontEngine::Format_Monoend of block
| 0 | ||||||||||||||||||
| 268 | if (mask.depth() > 1
| 0 | ||||||||||||||||||
| 269 | - | |||||||||||||||||||
| 270 | mask = mask.alphaChannel(); | - | ||||||||||||||||||
| 271 | mask.invertPixels(); | - | ||||||||||||||||||
| 272 | mask = mask.convertToFormat(QImage::Format_Mono); | - | ||||||||||||||||||
| 273 | } never executed: end of block | 0 | ||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | int mw = qMin(mask.width(), c.w); | - | ||||||||||||||||||
| 276 | int mh = qMin(mask.height(), c.h); | - | ||||||||||||||||||
| 277 | uchar *d = m_image.bits(); | - | ||||||||||||||||||
| 278 | int dbpl = m_image.bytesPerLine(); | - | ||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | for (int y = 0; y < c.h
| 0 | ||||||||||||||||||
| 281 | uchar *dest = d + (c.y + y) *dbpl + c.x/8; | - | ||||||||||||||||||
| 282 | - | |||||||||||||||||||
| 283 | if (y < mh
| 0 | ||||||||||||||||||
| 284 | const uchar *src = mask.constScanLine(y); | - | ||||||||||||||||||
| 285 | for (int x = 0; x < c.w/8
| 0 | ||||||||||||||||||
| 286 | if (x < (mw+7)/8
| 0 | ||||||||||||||||||
| 287 | dest[x] = src[x]; never executed: dest[x] = src[x]; | 0 | ||||||||||||||||||
| 288 | else | - | ||||||||||||||||||
| 289 | dest[x] = 0; never executed: dest[x] = 0; | 0 | ||||||||||||||||||
| 290 | } | - | ||||||||||||||||||
| 291 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 292 | for (int x = 0; x < c.w/8
| 0 | ||||||||||||||||||
| 293 | dest[x] = 0; never executed: dest[x] = 0; | 0 | ||||||||||||||||||
| 294 | } never executed: end of block | 0 | ||||||||||||||||||
| 295 | } | - | ||||||||||||||||||
| 296 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 297 | int mw = qMin(mask.width(), c.w); | - | ||||||||||||||||||
| 298 | int mh = qMin(mask.height(), c.h); | - | ||||||||||||||||||
| 299 | uchar *d = m_image.bits(); | - | ||||||||||||||||||
| 300 | int dbpl = m_image.bytesPerLine(); | - | ||||||||||||||||||
| 301 | - | |||||||||||||||||||
| 302 | if (mask.depth() == 1
| 0 | ||||||||||||||||||
| 303 | for (int y = 0; y < c.h
| 0 | ||||||||||||||||||
| 304 | uchar *dest = d + (c.y + y) *dbpl + c.x; | - | ||||||||||||||||||
| 305 | if (y < mh
| 0 | ||||||||||||||||||
| 306 | const uchar *src = mask.constScanLine(y); | - | ||||||||||||||||||
| 307 | for (int x = 0; x < c.w
| 0 | ||||||||||||||||||
| 308 | if (x < mw
| 0 | ||||||||||||||||||
| 309 | dest[x] = (
never executed: dest[x] = (src[x >> 3] & (1 << (7 - (x & 7)))) > 0 ? 255 : 0; | 0 | ||||||||||||||||||
| 310 | } never executed: end of block | 0 | ||||||||||||||||||
| 311 | } never executed: end of block | 0 | ||||||||||||||||||
| 312 | } never executed: end of block | 0 | ||||||||||||||||||
| 313 | } never executed: else if (mask.depth() == 8end of block
| 0 | ||||||||||||||||||
| 314 | for (int y = 0; y < c.h
| 0 | ||||||||||||||||||
| 315 | uchar *dest = d + (c.y + y) *dbpl + c.x; | - | ||||||||||||||||||
| 316 | if (y < mh
| 0 | ||||||||||||||||||
| 317 | const uchar *src = mask.constScanLine(y); | - | ||||||||||||||||||
| 318 | for (int x = 0; x < c.w
| 0 | ||||||||||||||||||
| 319 | if (x < mw
| 0 | ||||||||||||||||||
| 320 | dest[x] = src[x]; never executed: dest[x] = src[x]; | 0 | ||||||||||||||||||
| 321 | } never executed: end of block | 0 | ||||||||||||||||||
| 322 | } never executed: end of block | 0 | ||||||||||||||||||
| 323 | } never executed: end of block | 0 | ||||||||||||||||||
| 324 | } never executed: end of block | 0 | ||||||||||||||||||
| 325 | } never executed: end of block | 0 | ||||||||||||||||||
| 326 | } | - | ||||||||||||||||||
| 327 | - | |||||||||||||||||||
| 328 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |