[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 3179140 1/3: * graph/x11/grx11.c (gr_x11_device
From: |
Alexei Podtelezhnikov |
Subject: |
[freetype2-demos] master 3179140 1/3: * graph/x11/grx11.c (gr_x11_device_init): Remove one nested cycle. |
Date: |
Tue, 19 May 2020 00:51:41 -0400 (EDT) |
branch: master
commit 3179140f57cae00bdeb766ebbcae73961c000162
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>
* graph/x11/grx11.c (gr_x11_device_init): Remove one nested cycle.
---
ChangeLog | 4 +++
graph/x11/grx11.c | 101 ++++++++++++++++++++++++------------------------------
2 files changed, 48 insertions(+), 57 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5339250..4ad2665 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2020-05-18 Alexei Podtelezhnikov <address@hidden>
+
+ * graph/x11/grx11.c (gr_x11_device_init): Remove one nested cycle.
+
2020-05-01 David Turner <address@hidden>
Remove obsolete Jamfiles from the tree.
diff --git a/graph/x11/grx11.c b/graph/x11/grx11.c
index cd1ca5b..6f99a20 100644
--- a/graph/x11/grx11.c
+++ b/graph/x11/grx11.c
@@ -939,73 +939,60 @@ typedef unsigned long uint32;
x11dev.scanline_pad = BitmapPad( x11dev.display );
{
- int count;
- XDepth* format;
- XDepth* formats;
- XVisualInfo templ;
+ const grX11Format** pformat = gr_x11_formats;
+ XDepth* format;
+ XDepth* formats;
+ XVisualInfo templ;
+ XVisualInfo* visual;
+ int count, count2;
+
templ.screen = DefaultScreen( x11dev.display );
formats = XListPixmapFormats( x11dev.display, &count );
- LOG(( "available pixmap formats\n" ));
- LOG(( "depth pixbits scanpad\n" ));
-
+ /* compare to the list of supported formats first */
for ( format = formats; count > 0; count--, format++ )
{
- LOG(( " %3d %3d %3d\n",
- format->depth,
- format->bits_per_pixel,
- format->scanline_pad ));
-
- /* note, the 32-bit modes return a depth of 24, */
- /* and 32 bits per pixel */
- if ( format->depth == 32 ||
- format->depth == 24 ||
- format->depth == 16 )
+ for ( pformat = gr_x11_formats; *pformat; pformat++ )
{
- int count2;
- XVisualInfo* visual;
- XVisualInfo* visuals;
-
- templ.depth = format->depth;
- visuals = XGetVisualInfo( x11dev.display,
- VisualScreenMask | VisualDepthMask,
- &templ,
- &count2 );
-
- for ( visual = visuals; count2 > 0; count2--, visual++ )
+ if ( format->depth != (*pformat)->x_depth ||
+ format->bits_per_pixel != (*pformat)->x_bits_per_pixel )
+ continue;
+
+ LOG(( "> R:G:B %0*lx:%0*lx:%0*lx",
+ format->bits_per_pixel/4, (*pformat)->x_red_mask,
+ format->bits_per_pixel/4, (*pformat)->x_green_mask,
+ format->bits_per_pixel/4, (*pformat)->x_blue_mask ));
+
+ templ.depth = format->depth;
+ templ.red_mask = (*pformat)->x_red_mask;
+ templ.green_mask = (*pformat)->x_green_mask;
+ templ.blue_mask = (*pformat)->x_blue_mask;
+
+ visual = XGetVisualInfo( x11dev.display,
+ VisualScreenMask |
+ VisualDepthMask |
+ VisualRedMaskMask |
+ VisualGreenMaskMask |
+ VisualBlueMaskMask,
+ &templ,
+ &count2 );
+
+ if ( visual )
{
- const grX11Format** pformat = gr_x11_formats;
-
+ LOG(( ", colors %3d, bits %2d, %s\n",
+ visual->colormap_size,
+ visual->bits_per_rgb,
+ visualClass( visual->Class ) ));
- LOG(( "> R:G:B %0*lx:%0*lx:%0*lx, colors %3d, bits %2d, %s\n",
- format->bits_per_pixel/4, visual->red_mask,
- format->bits_per_pixel/4, visual->green_mask,
- format->bits_per_pixel/4, visual->blue_mask,
- visual->colormap_size,
- visual->bits_per_rgb,
- visualClass( visual->Class ) ));
+ x11dev.format = *pformat;
+ x11dev.visual = visual->visual;
- /* compare to the list of supported formats */
- for ( pformat = gr_x11_formats; *pformat; pformat++ )
- {
- if ( format->depth == (*pformat)->x_depth &&
- format->bits_per_pixel == (*pformat)->x_bits_per_pixel &&
- visual->red_mask == (*pformat)->x_red_mask &&
- visual->green_mask == (*pformat)->x_green_mask &&
- visual->blue_mask == (*pformat)->x_blue_mask )
- {
- x11dev.format = *pformat;
- x11dev.visual = visual->visual;
-
- XFree( visuals );
- XFree( formats );
- return 0;
- }
- }
- } /* for visuals */
-
- XFree( visuals );
+ XFree( visual );
+ XFree( formats );
+ return 0;
+ }
+ LOG(( "\n" ));
}
} /* for formats */
XFree( formats );
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 3179140 1/3: * graph/x11/grx11.c (gr_x11_device_init): Remove one nested cycle.,
Alexei Podtelezhnikov <=