@@ -191,15 +191,13 @@ void ValidateQuotePaintCache(
191
191
const auto icon = st.icon .empty () ? nullptr : &st.icon ;
192
192
if (!cache.corners .isNull ()
193
193
&& cache.bgCached == cache.bg
194
- && cache.outline1Cached == cache.outline1
195
- && cache.outline2Cached == cache.outline2
194
+ && cache.outlines == cache.outlines
196
195
&& (!st.header || cache.headerCached == cache.header )
197
196
&& (!icon || cache.iconCached == cache.icon )) {
198
197
return ;
199
198
}
200
199
cache.bgCached = cache.bg ;
201
- cache.outline1Cached = cache.outline1 ;
202
- cache.outline2Cached = cache.outline2 ;
200
+ cache.outlinesCached = cache.outlines ;
203
201
if (st.header ) {
204
202
cache.headerCached = cache.header ;
205
203
}
@@ -220,25 +218,35 @@ void ValidateQuotePaintCache(
220
218
const auto full = QSize (side, side);
221
219
const auto ratio = style::DevicePixelRatio ();
222
220
223
- if (cache.outline1 == cache. outline2 ) {
221
+ if (! cache.outlines [ 1 ]. alpha () ) {
224
222
cache.outline = QImage ();
225
223
} else if (const auto outline = st.outline ) {
226
- const auto size = QSize (outline , outline * 6 );
224
+ const auto third = (cache.outlines [2 ].alpha () != 0 );
225
+ const auto size = QSize (outline , outline * (third ? 6 : 4 ));
227
226
cache.outline = QImage (
228
227
size * ratio,
229
228
QImage::Format_ARGB32_Premultiplied);
230
- cache.outline .fill (cache.outline1 );
229
+ cache.outline .fill (cache.outlines [ 0 ] );
231
230
cache.outline .setDevicePixelRatio (ratio);
232
231
auto p = QPainter (&cache.outline );
233
232
p.setCompositionMode (QPainter::CompositionMode_Source);
234
233
auto hq = PainterHighQualityEnabler (p);
235
234
auto path = QPainterPath ();
236
235
path.moveTo (outline , outline );
237
- path.lineTo (outline , outline * 4 );
238
- path.lineTo (0 , outline * 5 );
236
+ path.lineTo (outline , outline * (third ? 4 : 3 ) );
237
+ path.lineTo (0 , outline * (third ? 5 : 4 ) );
239
238
path.lineTo (0 , outline * 2 );
240
239
path.lineTo (outline , outline );
241
- p.fillPath (path, cache.outline2 );
240
+ p.fillPath (path, cache.outlines [third ? 2 : 1 ]);
241
+ if (third) {
242
+ auto path = QPainterPath ();
243
+ path.moveTo (outline , outline * 3 );
244
+ path.lineTo (outline , outline * 5 );
245
+ path.lineTo (0 , outline * 6 );
246
+ path.lineTo (0 , outline * 4 );
247
+ path.lineTo (outline , outline * 3 );
248
+ p.fillPath (path, cache.outlines [1 ]);
249
+ }
242
250
}
243
251
244
252
auto image = QImage (full * ratio, QImage::Format_ARGB32_Premultiplied);
@@ -256,11 +264,14 @@ void ValidateQuotePaintCache(
256
264
if (outline ) {
257
265
const auto rect = QRect (0 , 0 , outline + radius * 2 , side);
258
266
if (!cache.outline .isNull ()) {
267
+ const auto shift = QPoint (0 , st.outlineShift );
268
+ p.translate (shift);
259
269
p.setBrush (cache.outline );
260
- p.setClipRect (0 , 0 , outline , side);
261
- p.drawRoundedRect (rect, radius, radius);
270
+ p.setClipRect (QRect (-shift, QSize (outline , side)));
271
+ p.drawRoundedRect (rect.translated (-shift), radius, radius);
272
+ p.translate (-shift);
262
273
} else {
263
- p.setBrush (cache.outline1 );
274
+ p.setBrush (cache.outlines [ 0 ] );
264
275
p.setClipRect (0 , 0 , outline , side);
265
276
p.drawRoundedRect (rect, radius, radius);
266
277
}
@@ -380,9 +391,9 @@ void FillQuotePaint(
380
391
radius);
381
392
}
382
393
auto q = QPainter (&cache.bottomCorner );
383
- const auto skipped = ihalf
384
- + int (parts.skippedTop )
385
- + (height - bottom) ;
394
+ const auto skipped = (height - bottom)
395
+ + (parts. skippedTop ? int (parts.skippedTop ) : ihalf )
396
+ - st. outlineShift ;
386
397
q.translate (0 , -skipped);
387
398
q.fillRect (0 , skipped, skip, bottom, cache.outline );
388
399
q.setCompositionMode (QPainter::CompositionMode_DestinationIn);
@@ -402,13 +413,14 @@ void FillQuotePaint(
402
413
}
403
414
if (outline ) {
404
415
if (!cache.outline .isNull ()) {
405
- const auto skipped = ihalf + int (parts.skippedTop );
406
- const auto top = y - skipped;
416
+ const auto skipped = st.outlineShift
417
+ - (parts.skippedTop ? int (parts.skippedTop ) : ihalf);
418
+ const auto top = y + skipped;
407
419
p.translate (x, top);
408
- p.fillRect (0 , skipped, outline , height, cache.outline );
420
+ p.fillRect (0 , - skipped, outline , height, cache.outline );
409
421
p.translate (-x, -top);
410
422
} else {
411
- p.fillRect (x, y, outline , height, cache.outline1 );
423
+ p.fillRect (x, y, outline , height, cache.outlines [ 0 ] );
412
424
}
413
425
}
414
426
p.fillRect (x + outline , y, width - outline , height, cache.bg );
0 commit comments