OSDN Git Service

increase solid/pattern fill cache to 20
authorIvailo Monev <xakepa10@gmail.com>
Sun, 9 Aug 2020 14:30:10 +0000 (17:30 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 9 Aug 2020 14:30:10 +0000 (17:30 +0300)
that way one for each standard color/brush style can be cached

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/kernel/qt_x11_p.h
src/gui/kernel/qwidget_x11.cpp
src/gui/painting/qpaintengine_x11.cpp

index 7fc6537..344bb73 100644 (file)
@@ -271,13 +271,13 @@ struct QX11Data
     Colormap colormap;
 
 #ifndef QT_NO_XRENDER
-    enum { solid_fill_count = 16 };
+    enum { solid_fill_count = 20 };
     struct SolidFills {
         XRenderColor color;
         int screen;
         Picture picture;
     } solid_fills[solid_fill_count];
-    enum { pattern_fill_count = 16 };
+    enum { pattern_fill_count = 20 };
     struct PatternFills {
         XRenderColor color;
         XRenderColor bg_color;
index 163a75d..6b7f301 100644 (file)
@@ -2871,7 +2871,7 @@ Picture QX11Data::getSolidFill(int screen, const QColor &c)
         return XNone;
 
     XRenderColor color = preMultiply(c);
-    for (int i = 0; i < qt_x11Data->solid_fill_count; ++i) {
+    for (int i = 0; i < QX11Data::solid_fill_count; ++i) {
         if (qt_x11Data->solid_fills[i].screen == screen
             && qt_x11Data->solid_fills[i].color.alpha == color.alpha
             && qt_x11Data->solid_fills[i].color.red == color.red
@@ -2880,7 +2880,7 @@ Picture QX11Data::getSolidFill(int screen, const QColor &c)
             return qt_x11Data->solid_fills[i].picture;
     }
     // none found, replace one
-    int i = qrand() % 16;
+    int i = qrand() % QX11Data::solid_fill_count;
 
     if (qt_x11Data->solid_fills[i].screen != screen && qt_x11Data->solid_fills[i].picture) {
         XRenderFreePicture (qt_x11Data->display, qt_x11Data->solid_fills[i].picture);
index e3e7535..5f74918 100644 (file)
@@ -256,7 +256,7 @@ static Picture getPatternFill(int screen, const QBrush &b)
     XRenderColor color = qt_x11Data->preMultiply(b.color());
     XRenderColor bg_color = qt_x11Data->preMultiply(QColor(0, 0, 0, 0));
 
-    for (int i = 0; i < qt_x11Data->pattern_fill_count; ++i) {
+    for (int i = 0; i < QX11Data::pattern_fill_count; ++i) {
         if (qt_x11Data->pattern_fills[i].screen == screen
             && qt_x11Data->pattern_fills[i].style == b.style()
             && qt_x11Data->pattern_fills[i].color.alpha == color.alpha
@@ -270,7 +270,7 @@ static Picture getPatternFill(int screen, const QBrush &b)
             return qt_x11Data->pattern_fills[i].picture;
     }
     // none found, replace one
-    int i = qrand() % 16;
+    int i = qrand() % QX11Data::pattern_fill_count;
 
     if (qt_x11Data->pattern_fills[i].screen != screen && qt_x11Data->pattern_fills[i].picture) {
         XRenderFreePicture (qt_x11Data->display, qt_x11Data->pattern_fills[i].picture);