code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: I:/Sources/sdlgfx/SDL_rotozoom.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#nested-classes">Data Structures</a> |
<a href="#define-members">Defines</a> |
<a href="#typedef-members">Typedefs</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">I:/Sources/sdlgfx/SDL_rotozoom.c File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include <stdlib.h></code><br/>
<code>#include <string.h></code><br/>
<code>#include "<a class="el" href="_s_d_l__rotozoom_8h_source.html">SDL_rotozoom.h</a>"</code><br/>
</div>
<p><a href="_s_d_l__rotozoom_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structt_color_r_g_b_a.html">tColorRGBA</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">A 32 bit RGBA pixel. <a href="structt_color_r_g_b_a.html#details">More...</a><br/></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structt_color_y.html">tColorY</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">A 8bit Y/palette pixel. <a href="structt_color_y.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr class="memitem:afa99ec4acc4ecb2dc3c2d05da15d0e3f"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f">MAX</a>(a, b)   (((a) > (b)) ? (a) : (b))</td></tr>
<tr class="memdesc:afa99ec4acc4ecb2dc3c2d05da15d0e3f"><td class="mdescLeft"> </td><td class="mdescRight">Returns maximum of two numbers a and b. <a href="#afa99ec4acc4ecb2dc3c2d05da15d0e3f"></a><br/></td></tr>
<tr class="memitem:a05a2601b7ea2906858ccc31b45fdc6eb"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb">GUARD_ROWS</a>   (2)</td></tr>
<tr class="memdesc:a05a2601b7ea2906858ccc31b45fdc6eb"><td class="mdescLeft"> </td><td class="mdescRight">Number of guard rows added to destination surfaces. <a href="#a05a2601b7ea2906858ccc31b45fdc6eb"></a><br/></td></tr>
<tr class="memitem:a98a929bd64d660c1860c7b60b4fe5bd9"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9">VALUE_LIMIT</a>   0.001</td></tr>
<tr class="memdesc:a98a929bd64d660c1860c7b60b4fe5bd9"><td class="mdescLeft"> </td><td class="mdescRight">Lower limit of absolute zoom factor or rotation degrees. <a href="#a98a929bd64d660c1860c7b60b4fe5bd9"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ac91ff95383d3a6c0df046a42e23baf04"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structt_color_r_g_b_a.html">tColorRGBA</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#ac91ff95383d3a6c0df046a42e23baf04">tColorRGBA</a></td></tr>
<tr class="memdesc:ac91ff95383d3a6c0df046a42e23baf04"><td class="mdescLeft"> </td><td class="mdescRight">A 32 bit RGBA pixel. <a href="#ac91ff95383d3a6c0df046a42e23baf04"></a><br/></td></tr>
<tr class="memitem:a9db27e25d1a6e93c64eb768007dcf3da"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structt_color_y.html">tColorY</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#a9db27e25d1a6e93c64eb768007dcf3da">tColorY</a></td></tr>
<tr class="memdesc:a9db27e25d1a6e93c64eb768007dcf3da"><td class="mdescLeft"> </td><td class="mdescRight">A 8bit Y/palette pixel. <a href="#a9db27e25d1a6e93c64eb768007dcf3da"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:afe2a2e4dc6cc462c5fc98a2110b8e1ce"><td class="memItemLeft" align="right" valign="top">Uint32 </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce">_colorkey</a> (SDL_Surface *src)</td></tr>
<tr class="memdesc:afe2a2e4dc6cc462c5fc98a2110b8e1ce"><td class="mdescLeft"> </td><td class="mdescRight">Returns colorkey info for a surface. <a href="#afe2a2e4dc6cc462c5fc98a2110b8e1ce"></a><br/></td></tr>
<tr class="memitem:ac1bde824f44ae9a76930e9782b783512"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#ac1bde824f44ae9a76930e9782b783512">_shrinkSurfaceRGBA</a> (SDL_Surface *src, SDL_Surface *dst, int factorx, int factory)</td></tr>
<tr class="memdesc:ac1bde824f44ae9a76930e9782b783512"><td class="mdescLeft"> </td><td class="mdescRight">Internal 32 bit integer-factor averaging Shrinker. <a href="#ac1bde824f44ae9a76930e9782b783512"></a><br/></td></tr>
<tr class="memitem:aadb38a61ab6727e5fd621b63418399be"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#aadb38a61ab6727e5fd621b63418399be">_shrinkSurfaceY</a> (SDL_Surface *src, SDL_Surface *dst, int factorx, int factory)</td></tr>
<tr class="memdesc:aadb38a61ab6727e5fd621b63418399be"><td class="mdescLeft"> </td><td class="mdescRight">Internal 8 bit integer-factor averaging shrinker. <a href="#aadb38a61ab6727e5fd621b63418399be"></a><br/></td></tr>
<tr class="memitem:a9898b12bb565c4075c2da4db4891fd81"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#a9898b12bb565c4075c2da4db4891fd81">_zoomSurfaceRGBA</a> (SDL_Surface *src, SDL_Surface *dst, int flipx, int flipy, int smooth)</td></tr>
<tr class="memdesc:a9898b12bb565c4075c2da4db4891fd81"><td class="mdescLeft"> </td><td class="mdescRight">Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation. <a href="#a9898b12bb565c4075c2da4db4891fd81"></a><br/></td></tr>
<tr class="memitem:acfeb5a322cbb575f105f1762d9d21c29"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#acfeb5a322cbb575f105f1762d9d21c29">_zoomSurfaceY</a> (SDL_Surface *src, SDL_Surface *dst, int flipx, int flipy)</td></tr>
<tr class="memdesc:acfeb5a322cbb575f105f1762d9d21c29"><td class="mdescLeft"> </td><td class="mdescRight">Internal 8 bit Zoomer without smoothing. <a href="#acfeb5a322cbb575f105f1762d9d21c29"></a><br/></td></tr>
<tr class="memitem:aae634e7b5e6ec1622fec361ecbd0d1b7"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#aae634e7b5e6ec1622fec361ecbd0d1b7">_transformSurfaceRGBA</a> (SDL_Surface *src, SDL_Surface *dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)</td></tr>
<tr class="memdesc:aae634e7b5e6ec1622fec361ecbd0d1b7"><td class="mdescLeft"> </td><td class="mdescRight">Internal 32 bit rotozoomer with optional anti-aliasing. <a href="#aae634e7b5e6ec1622fec361ecbd0d1b7"></a><br/></td></tr>
<tr class="memitem:a126e3b96b22cc18e78e33cc1f8eb6c3c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#a126e3b96b22cc18e78e33cc1f8eb6c3c">transformSurfaceY</a> (SDL_Surface *src, SDL_Surface *dst, int cx, int cy, int isin, int icos, int flipx, int flipy)</td></tr>
<tr class="memdesc:a126e3b96b22cc18e78e33cc1f8eb6c3c"><td class="mdescLeft"> </td><td class="mdescRight">Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing. <a href="#a126e3b96b22cc18e78e33cc1f8eb6c3c"></a><br/></td></tr>
<tr class="memitem:a77563d68634cb2624d4f2f0bcdc19e73"><td class="memItemLeft" align="right" valign="top">SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#a77563d68634cb2624d4f2f0bcdc19e73">rotateSurface90Degrees</a> (SDL_Surface *src, int numClockwiseTurns)</td></tr>
<tr class="memdesc:a77563d68634cb2624d4f2f0bcdc19e73"><td class="mdescLeft"> </td><td class="mdescRight">Rotates a 32 bit surface in increments of 90 degrees. <a href="#a77563d68634cb2624d4f2f0bcdc19e73"></a><br/></td></tr>
<tr class="memitem:af48638a298820d4d1dd24a13896963d8"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#af48638a298820d4d1dd24a13896963d8">_rotozoomSurfaceSizeTrig</a> (int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight, double *canglezoom, double *sanglezoom)</td></tr>
<tr class="memdesc:af48638a298820d4d1dd24a13896963d8"><td class="mdescLeft"> </td><td class="mdescRight">Internal target surface sizing function for rotozooms with trig result return. <a href="#af48638a298820d4d1dd24a13896963d8"></a><br/></td></tr>
<tr class="memitem:aee64992d26c818d9975610754d5c929b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#aee64992d26c818d9975610754d5c929b">rotozoomSurfaceSizeXY</a> (int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight)</td></tr>
<tr class="memdesc:aee64992d26c818d9975610754d5c929b"><td class="mdescLeft"> </td><td class="mdescRight">Returns the size of the resulting target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#aab98b5b0da4ea468bacf47f7b85f0ee2" title="Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-...">rotozoomSurfaceXY()</a> call. <a href="#aee64992d26c818d9975610754d5c929b"></a><br/></td></tr>
<tr class="memitem:a9886c783255edfd70a4974f8f3dd5a8c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#a9886c783255edfd70a4974f8f3dd5a8c">rotozoomSurfaceSize</a> (int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)</td></tr>
<tr class="memdesc:a9886c783255edfd70a4974f8f3dd5a8c"><td class="mdescLeft"> </td><td class="mdescRight">Returns the size of the resulting target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#a5f64ed53eeee5f2667971c857698d1e5" title="Rotates and zooms a surface and optional anti-aliasing.">rotozoomSurface()</a> call. <a href="#a9886c783255edfd70a4974f8f3dd5a8c"></a><br/></td></tr>
<tr class="memitem:a5f64ed53eeee5f2667971c857698d1e5"><td class="memItemLeft" align="right" valign="top">SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#a5f64ed53eeee5f2667971c857698d1e5">rotozoomSurface</a> (SDL_Surface *src, double angle, double zoom, int smooth)</td></tr>
<tr class="memdesc:a5f64ed53eeee5f2667971c857698d1e5"><td class="mdescLeft"> </td><td class="mdescRight">Rotates and zooms a surface and optional anti-aliasing. <a href="#a5f64ed53eeee5f2667971c857698d1e5"></a><br/></td></tr>
<tr class="memitem:aab98b5b0da4ea468bacf47f7b85f0ee2"><td class="memItemLeft" align="right" valign="top">SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#aab98b5b0da4ea468bacf47f7b85f0ee2">rotozoomSurfaceXY</a> (SDL_Surface *src, double angle, double zoomx, double zoomy, int smooth)</td></tr>
<tr class="memdesc:aab98b5b0da4ea468bacf47f7b85f0ee2"><td class="mdescLeft"> </td><td class="mdescRight">Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing. <a href="#aab98b5b0da4ea468bacf47f7b85f0ee2"></a><br/></td></tr>
<tr class="memitem:a8ba40859c1a977dae87488dd8be1bf9a"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#a8ba40859c1a977dae87488dd8be1bf9a">zoomSurfaceSize</a> (int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)</td></tr>
<tr class="memdesc:a8ba40859c1a977dae87488dd8be1bf9a"><td class="mdescLeft"> </td><td class="mdescRight">Calculates the size of the target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#abdd772b2f6b1f26134e4e90cda657a21" title="Zoom a surface by independent horizontal and vertical factors with optional smoothing.">zoomSurface()</a> call. <a href="#a8ba40859c1a977dae87488dd8be1bf9a"></a><br/></td></tr>
<tr class="memitem:abdd772b2f6b1f26134e4e90cda657a21"><td class="memItemLeft" align="right" valign="top">SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#abdd772b2f6b1f26134e4e90cda657a21">zoomSurface</a> (SDL_Surface *src, double zoomx, double zoomy, int smooth)</td></tr>
<tr class="memdesc:abdd772b2f6b1f26134e4e90cda657a21"><td class="mdescLeft"> </td><td class="mdescRight">Zoom a surface by independent horizontal and vertical factors with optional smoothing. <a href="#abdd772b2f6b1f26134e4e90cda657a21"></a><br/></td></tr>
<tr class="memitem:aad3bf0cd89cc39ff874ffa778fa1495d"><td class="memItemLeft" align="right" valign="top">SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8c.html#aad3bf0cd89cc39ff874ffa778fa1495d">shrinkSurface</a> (SDL_Surface *src, int factorx, int factory)</td></tr>
<tr class="memdesc:aad3bf0cd89cc39ff874ffa778fa1495d"><td class="mdescLeft"> </td><td class="mdescRight">Shrink a surface by an integer ratio using averaging. <a href="#aad3bf0cd89cc39ff874ffa778fa1495d"></a><br/></td></tr>
</table>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="a05a2601b7ea2906858ccc31b45fdc6eb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb">GUARD_ROWS</a>   (2)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Number of guard rows added to destination surfaces. </p>
<p>This is a simple but effective workaround for observed issues. These rows allocate extra memory and are then hidden from the surface. Rows are added to the end of destination surfaces when they are allocated. This catches any potential overflows which seem to happen with just the right src image dimensions and scale/rotation and can lead to a situation where the program can segfault. </p>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00073">73</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="afa99ec4acc4ecb2dc3c2d05da15d0e3f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f">MAX</a></td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">a, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname">b </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>   (((a) > (b)) ? (a) : (b))</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns maximum of two numbers a and b. </p>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00061">61</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a98a929bd64d660c1860c7b60b4fe5bd9"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9">VALUE_LIMIT</a>   0.001</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Lower limit of absolute zoom factor or rotation degrees. </p>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00078">78</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<hr/><h2>Typedef Documentation</h2>
<a class="anchor" id="ac91ff95383d3a6c0df046a42e23baf04"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef struct <a class="el" href="structt_color_r_g_b_a.html">tColorRGBA</a> <a class="el" href="structt_color_r_g_b_a.html">tColorRGBA</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A 32 bit RGBA pixel. </p>
</div>
</div>
<a class="anchor" id="a9db27e25d1a6e93c64eb768007dcf3da"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef struct <a class="el" href="structt_color_y.html">tColorY</a> <a class="el" href="structt_color_y.html">tColorY</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A 8bit Y/palette pixel. </p>
</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="afe2a2e4dc6cc462c5fc98a2110b8e1ce"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint32 <a class="el" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce">_colorkey</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns colorkey info for a surface. </p>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00083">83</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="af48638a298820d4d1dd24a13896963d8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="_s_d_l__rotozoom_8c.html#af48638a298820d4d1dd24a13896963d8">_rotozoomSurfaceSizeTrig</a> </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>width</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>height</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>angle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstheight</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double * </td>
<td class="paramname"><em>canglezoom</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double * </td>
<td class="paramname"><em>sanglezoom</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Internal target surface sizing function for rotozooms with trig result return. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">width</td><td>The source surface width. </td></tr>
<tr><td class="paramname">height</td><td>The source surface height. </td></tr>
<tr><td class="paramname">angle</td><td>The angle to rotate in degrees. </td></tr>
<tr><td class="paramname">zoomx</td><td>The horizontal scaling factor. </td></tr>
<tr><td class="paramname">zoomy</td><td>The vertical scaling factor. </td></tr>
<tr><td class="paramname">dstwidth</td><td>The calculated width of the destination surface. </td></tr>
<tr><td class="paramname">dstheight</td><td>The calculated height of the destination surface. </td></tr>
<tr><td class="paramname">canglezoom</td><td>The sine of the angle adjusted by the zoom factor. </td></tr>
<tr><td class="paramname">sanglezoom</td><td>The cosine of the angle adjusted by the zoom factor. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00949">949</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="ac1bde824f44ae9a76930e9782b783512"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="_s_d_l__rotozoom_8c.html#ac1bde824f44ae9a76930e9782b783512">_shrinkSurfaceRGBA</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>factorx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>factory</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Internal 32 bit integer-factor averaging Shrinker. </p>
<p>Shrinks 32 bit RGBA/ABGR 'src' surface to 'dst' surface. Averages color and alpha values values of src pixels to calculate dst pixels. Assumes src and dst surfaces are of 32 bit depth. Assumes dst surface was allocated with the correct dimensions.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to shrink (input). </td></tr>
<tr><td class="paramname">dst</td><td>The shrunken surface (output). </td></tr>
<tr><td class="paramname">factorx</td><td>The horizontal shrinking ratio. </td></tr>
<tr><td class="paramname">factory</td><td>The vertical shrinking ratio.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>0 for success or -1 for error. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00113">113</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="aadb38a61ab6727e5fd621b63418399be"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="_s_d_l__rotozoom_8c.html#aadb38a61ab6727e5fd621b63418399be">_shrinkSurfaceY</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>factorx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>factory</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Internal 8 bit integer-factor averaging shrinker. </p>
<p>Shrinks 8bit Y 'src' surface to 'dst' surface. Averages color (brightness) values values of src pixels to calculate dst pixels. Assumes src and dst surfaces are of 8 bit depth. Assumes dst surface was allocated with the correct dimensions.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to shrink (input). </td></tr>
<tr><td class="paramname">dst</td><td>The shrunken surface (output). </td></tr>
<tr><td class="paramname">factorx</td><td>The horizontal shrinking ratio. </td></tr>
<tr><td class="paramname">factory</td><td>The vertical shrinking ratio.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>0 for success or -1 for error. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00202">202</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="aae634e7b5e6ec1622fec361ecbd0d1b7"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="_s_d_l__rotozoom_8c.html#aae634e7b5e6ec1622fec361ecbd0d1b7">_transformSurfaceRGBA</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>cx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>cy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>isin</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>icos</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flipx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flipy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>smooth</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Internal 32 bit rotozoomer with optional anti-aliasing. </p>
<p>Rotates and zooms 32 bit RGBA/ABGR 'src' surface to 'dst' surface based on the control parameters by scanning the destination surface and applying optionally anti-aliasing by bilinear interpolation. Assumes src and dst surfaces are of 32 bit depth. Assumes dst surface was allocated with the correct dimensions.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>Source surface. </td></tr>
<tr><td class="paramname">dst</td><td>Destination surface. </td></tr>
<tr><td class="paramname">cx</td><td>Horizontal center coordinate. </td></tr>
<tr><td class="paramname">cy</td><td>Vertical center coordinate. </td></tr>
<tr><td class="paramname">isin</td><td>Integer version of sine of angle. </td></tr>
<tr><td class="paramname">icos</td><td>Integer version of cosine of angle. </td></tr>
<tr><td class="paramname">flipx</td><td>Flag indicating horizontal mirroring should be applied. </td></tr>
<tr><td class="paramname">flipy</td><td>Flag indicating vertical mirroring should be applied. </td></tr>
<tr><td class="paramname">smooth</td><td>Flag indicating anti-aliasing should be used. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00638">638</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a9898b12bb565c4075c2da4db4891fd81"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="_s_d_l__rotozoom_8c.html#a9898b12bb565c4075c2da4db4891fd81">_zoomSurfaceRGBA</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flipx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flipy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>smooth</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation. </p>
<p>Zooms 32 bit RGBA/ABGR 'src' surface to 'dst' surface. Assumes src and dst surfaces are of 32 bit depth. Assumes dst surface was allocated with the correct dimensions.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to zoom (input). </td></tr>
<tr><td class="paramname">dst</td><td>The zoomed surface (output). </td></tr>
<tr><td class="paramname">flipx</td><td>Flag indicating if the image should be horizontally flipped. </td></tr>
<tr><td class="paramname">flipy</td><td>Flag indicating if the image should be vertically flipped. </td></tr>
<tr><td class="paramname">smooth</td><td>Antialiasing flag; set to SMOOTHING_ON to enable.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>0 for success or -1 for error. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00286">286</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="acfeb5a322cbb575f105f1762d9d21c29"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="_s_d_l__rotozoom_8c.html#acfeb5a322cbb575f105f1762d9d21c29">_zoomSurfaceY</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flipx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flipy</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Internal 8 bit Zoomer without smoothing. </p>
<p>Zooms 8bit palette/Y 'src' surface to 'dst' surface. Assumes src and dst surfaces are of 8 bit depth. Assumes dst surface was allocated with the correct dimensions.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to zoom (input). </td></tr>
<tr><td class="paramname">dst</td><td>The zoomed surface (output). </td></tr>
<tr><td class="paramname">flipx</td><td>Flag indicating if the image should be horizontally flipped. </td></tr>
<tr><td class="paramname">flipy</td><td>Flag indicating if the image should be vertically flipped.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>0 for success or -1 for error. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00519">519</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a77563d68634cb2624d4f2f0bcdc19e73"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SDL_Surface* <a class="el" href="_s_d_l__rotozoom_8h.html#ac06e9fa4fce6a1dbae45462529be581e">rotateSurface90Degrees</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>numClockwiseTurns</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Rotates a 32 bit surface in increments of 90 degrees. </p>
<p>Specialized 90 degree rotator which rotates a 'src' surface in 90 degree increments clockwise returning a new surface. Faster than rotozoomer since not scanning or interpolation takes place. Input surface must be 32 bit. (code contributed by J. Schiller, improved by C. Allport and A. Schiffler)</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>Source surface to rotate. </td></tr>
<tr><td class="paramname">numClockwiseTurns</td><td>Number of clockwise 90 degree turns to apply to the source.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The new, rotated surface; or NULL for surfaces with incorrect input format. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00814">814</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a5f64ed53eeee5f2667971c857698d1e5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SDL_Surface* <a class="el" href="_s_d_l__rotozoom_8h.html#a3cb0c11d5edc929579c807dc7612348c">rotozoomSurface</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>angle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoom</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>smooth</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Rotates and zooms a surface and optional anti-aliasing. </p>
<p>Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees and 'zoom' a scaling factor. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to rotozoom. </td></tr>
<tr><td class="paramname">angle</td><td>The angle to rotate in degrees. </td></tr>
<tr><td class="paramname">zoom</td><td>The scaling factor. </td></tr>
<tr><td class="paramname">smooth</td><td>Antialiasing flag; set to SMOOTHING_ON to enable.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The new rotozoomed surface. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01030">1030</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a9886c783255edfd70a4974f8f3dd5a8c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="_s_d_l__rotozoom_8h.html#a3ca2316375d6faf4f19b26c2f1f14bbc">rotozoomSurfaceSize</a> </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>width</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>height</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>angle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoom</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstheight</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the size of the resulting target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#a5f64ed53eeee5f2667971c857698d1e5" title="Rotates and zooms a surface and optional anti-aliasing.">rotozoomSurface()</a> call. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">width</td><td>The source surface width. </td></tr>
<tr><td class="paramname">height</td><td>The source surface height. </td></tr>
<tr><td class="paramname">angle</td><td>The angle to rotate in degrees. </td></tr>
<tr><td class="paramname">zoom</td><td>The scaling factor. </td></tr>
<tr><td class="paramname">dstwidth</td><td>The calculated width of the rotozoomed destination surface. </td></tr>
<tr><td class="paramname">dstheight</td><td>The calculated height of the rotozoomed destination surface. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01008">1008</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="aee64992d26c818d9975610754d5c929b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="_s_d_l__rotozoom_8h.html#a612334fa642f672af953f544da6245d0">rotozoomSurfaceSizeXY</a> </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>width</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>height</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>angle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstheight</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the size of the resulting target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#aab98b5b0da4ea468bacf47f7b85f0ee2" title="Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-...">rotozoomSurfaceXY()</a> call. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">width</td><td>The source surface width. </td></tr>
<tr><td class="paramname">height</td><td>The source surface height. </td></tr>
<tr><td class="paramname">angle</td><td>The angle to rotate in degrees. </td></tr>
<tr><td class="paramname">zoomx</td><td>The horizontal scaling factor. </td></tr>
<tr><td class="paramname">zoomy</td><td>The vertical scaling factor. </td></tr>
<tr><td class="paramname">dstwidth</td><td>The calculated width of the rotozoomed destination surface. </td></tr>
<tr><td class="paramname">dstheight</td><td>The calculated height of the rotozoomed destination surface. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00991">991</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="aab98b5b0da4ea468bacf47f7b85f0ee2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SDL_Surface* <a class="el" href="_s_d_l__rotozoom_8h.html#a454d4234a45eab6ec238a40cc44051d4">rotozoomSurfaceXY</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>angle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>smooth</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing. </p>
<p>Rotates and zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees, 'zoomx and 'zoomy' scaling factors. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to rotozoom. </td></tr>
<tr><td class="paramname">angle</td><td>The angle to rotate in degrees. </td></tr>
<tr><td class="paramname">zoomx</td><td>The horizontal scaling factor. </td></tr>
<tr><td class="paramname">zoomy</td><td>The vertical scaling factor. </td></tr>
<tr><td class="paramname">smooth</td><td>Antialiasing flag; set to SMOOTHING_ON to enable.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The new rotozoomed surface. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01051">1051</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="aad3bf0cd89cc39ff874ffa778fa1495d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SDL_Surface* <a class="el" href="_s_d_l__rotozoom_8h.html#a7a7ac2cc0d79d282b5a4c76143b7e7a9">shrinkSurface</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>factorx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>factory</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Shrink a surface by an integer ratio using averaging. </p>
<p>Shrinks a 32bit or 8bit 'src' surface to a newly created 'dst' surface. 'factorx' and 'factory' are the shrinking ratios (i.e. 2=1/2 the size, 3=1/3 the size, etc.) The destination surface is antialiased by averaging the source box RGBA or Y information. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. The input surface is not modified. The output surface is newly allocated.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to shrink. </td></tr>
<tr><td class="paramname">factorx</td><td>The horizontal shrinking ratio. </td></tr>
<tr><td class="paramname">factory</td><td>The vertical shrinking ratio.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The new, shrunken surface. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01548">1548</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a126e3b96b22cc18e78e33cc1f8eb6c3c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="_s_d_l__rotozoom_8c.html#a126e3b96b22cc18e78e33cc1f8eb6c3c">transformSurfaceY</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>dst</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>cx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>cy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>isin</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>icos</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flipx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flipy</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing. </p>
<p>Rotates and zooms 8 bit RGBA/ABGR 'src' surface to 'dst' surface based on the control parameters by scanning the destination surface. Assumes src and dst surfaces are of 8 bit depth. Assumes dst surface was allocated with the correct dimensions.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>Source surface. </td></tr>
<tr><td class="paramname">dst</td><td>Destination surface. </td></tr>
<tr><td class="paramname">cx</td><td>Horizontal center coordinate. </td></tr>
<tr><td class="paramname">cy</td><td>Vertical center coordinate. </td></tr>
<tr><td class="paramname">isin</td><td>Integer version of sine of angle. </td></tr>
<tr><td class="paramname">icos</td><td>Integer version of cosine of angle. </td></tr>
<tr><td class="paramname">flipx</td><td>Flag indicating horizontal mirroring should be applied. </td></tr>
<tr><td class="paramname">flipy</td><td>Flag indicating vertical mirroring should be applied. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00755">755</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="abdd772b2f6b1f26134e4e90cda657a21"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SDL_Surface* <a class="el" href="_s_d_l__rotozoom_8h.html#a06c8108f8fe8de77cf841c176ee64850">zoomSurface</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>smooth</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Zoom a surface by independent horizontal and vertical factors with optional smoothing. </p>
<p>Zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is on then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. If zoom factors are negative, the image is flipped on the axes.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to zoom. </td></tr>
<tr><td class="paramname">zoomx</td><td>The horizontal zoom factor. </td></tr>
<tr><td class="paramname">zoomy</td><td>The vertical zoom factor. </td></tr>
<tr><td class="paramname">smooth</td><td>Antialiasing flag; set to SMOOTHING_ON to enable.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The new, zoomed surface. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01392">1392</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a8ba40859c1a977dae87488dd8be1bf9a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="_s_d_l__rotozoom_8h.html#a7927e415d87ea7856794cd4cc77e0a25">zoomSurfaceSize</a> </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>width</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>height</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstheight</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Calculates the size of the target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#abdd772b2f6b1f26134e4e90cda657a21" title="Zoom a surface by independent horizontal and vertical factors with optional smoothing.">zoomSurface()</a> call. </p>
<p>The minimum size of the target surface is 1. The input factors can be positive or negative.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">width</td><td>The width of the source surface to zoom. </td></tr>
<tr><td class="paramname">height</td><td>The height of the source surface to zoom. </td></tr>
<tr><td class="paramname">zoomx</td><td>The horizontal zoom factor. </td></tr>
<tr><td class="paramname">zoomy</td><td>The vertical zoom factor. </td></tr>
<tr><td class="paramname">dstwidth</td><td>Pointer to an integer to store the calculated width of the zoomed target surface. </td></tr>
<tr><td class="paramname">dstheight</td><td>Pointer to an integer to store the calculated height of the zoomed target surface. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01342">1342</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/_s_d_l__rotozoom_8c.html | HTML | apache-2.0 | 58,886 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: I:/Sources/sdlgfx/SDL_rotozoom.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">I:/Sources/sdlgfx/SDL_rotozoom.c</div> </div>
</div><!--header-->
<div class="contents">
<a href="_s_d_l__rotozoom_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* </span>
<a name="l00002"></a>00002 <span class="comment"></span>
<a name="l00003"></a>00003 <span class="comment">SDL_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012 Andreas Schiffler</span>
<a name="l00006"></a>00006 <span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment">This software is provided 'as-is', without any express or implied</span>
<a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span>
<a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span>
<a name="l00010"></a>00010 <span class="comment"></span>
<a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span>
<a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span>
<a name="l00014"></a>00014 <span class="comment"></span>
<a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span>
<a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span>
<a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span>
<a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span>
<a name="l00019"></a>00019 <span class="comment"></span>
<a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span>
<a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span>
<a name="l00022"></a>00022 <span class="comment"></span>
<a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span>
<a name="l00024"></a>00024 <span class="comment">distribution.</span>
<a name="l00025"></a>00025 <span class="comment"></span>
<a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span>
<a name="l00027"></a>00027 <span class="comment"></span>
<a name="l00028"></a>00028 <span class="comment">*/</span>
<a name="l00029"></a>00029
<a name="l00030"></a>00030 <span class="preprocessor">#ifdef WIN32</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#include <windows.h></span>
<a name="l00032"></a>00032 <span class="preprocessor">#endif</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#include <stdlib.h></span>
<a name="l00035"></a>00035 <span class="preprocessor">#include <string.h></span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="preprocessor">#include "<a class="code" href="_s_d_l__rotozoom_8h.html">SDL_rotozoom.h</a>"</span>
<a name="l00038"></a>00038
<a name="l00039"></a>00039 <span class="comment">/* ---- Internally used structures */</span>
<a name="l00040"></a>00040
<a name="l00044"></a><a class="code" href="structt_color_r_g_b_a.html">00044</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> {
<a name="l00045"></a><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">00045</a> Uint8 <a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a>;
<a name="l00046"></a><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">00046</a> Uint8 <a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a>;
<a name="l00047"></a><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">00047</a> Uint8 <a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a>;
<a name="l00048"></a><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">00048</a> Uint8 <a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a>;
<a name="l00049"></a>00049 } <a class="code" href="_s_d_l__rotozoom_8c.html#ac91ff95383d3a6c0df046a42e23baf04" title="A 32 bit RGBA pixel.">tColorRGBA</a>;
<a name="l00050"></a>00050
<a name="l00054"></a><a class="code" href="structt_color_y.html">00054</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structt_color_y.html" title="A 8bit Y/palette pixel.">tColorY</a> {
<a name="l00055"></a><a class="code" href="structt_color_y.html#ace61c93d341a0b154df0e9923558a537">00055</a> Uint8 <a class="code" href="structt_color_y.html#ace61c93d341a0b154df0e9923558a537">y</a>;
<a name="l00056"></a>00056 } <a class="code" href="_s_d_l__rotozoom_8c.html#a9db27e25d1a6e93c64eb768007dcf3da" title="A 8bit Y/palette pixel.">tColorY</a>;
<a name="l00057"></a>00057
<a name="l00061"></a><a class="code" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f">00061</a> <span class="preprocessor">#define MAX(a,b) (((a) > (b)) ? (a) : (b))</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span>
<a name="l00073"></a><a class="code" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb">00073</a> <span class="preprocessor">#define GUARD_ROWS (2)</span>
<a name="l00074"></a>00074 <span class="preprocessor"></span>
<a name="l00078"></a><a class="code" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9">00078</a> <span class="preprocessor">#define VALUE_LIMIT 0.001</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span>
<a name="l00083"></a><a class="code" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce">00083</a> Uint32 <a class="code" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce" title="Returns colorkey info for a surface.">_colorkey</a>(SDL_Surface *src)
<a name="l00084"></a>00084 {
<a name="l00085"></a>00085 Uint32 key = 0;
<a name="l00086"></a>00086 <span class="preprocessor">#if (SDL_MINOR_VERSION == 3)</span>
<a name="l00087"></a>00087 <span class="preprocessor"></span> SDL_GetColorKey(src, &key);
<a name="l00088"></a>00088 <span class="preprocessor">#else</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span> <span class="keywordflow">if</span> (src)
<a name="l00090"></a>00090 {
<a name="l00091"></a>00091 key = src->format->colorkey;
<a name="l00092"></a>00092 }
<a name="l00093"></a>00093 <span class="preprocessor">#endif</span>
<a name="l00094"></a>00094 <span class="preprocessor"></span> <span class="keywordflow">return</span> key;
<a name="l00095"></a>00095 }
<a name="l00096"></a>00096
<a name="l00097"></a>00097
<a name="l00113"></a><a class="code" href="_s_d_l__rotozoom_8c.html#ac1bde824f44ae9a76930e9782b783512">00113</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__rotozoom_8c.html#ac1bde824f44ae9a76930e9782b783512" title="Internal 32 bit integer-factor averaging Shrinker.">_shrinkSurfaceRGBA</a>(SDL_Surface * src, SDL_Surface * dst, <span class="keywordtype">int</span> factorx, <span class="keywordtype">int</span> factory)
<a name="l00114"></a>00114 {
<a name="l00115"></a>00115 <span class="keywordtype">int</span> x, y, dx, dy, sgap, dgap, ra, ga, ba, aa;
<a name="l00116"></a>00116 <span class="keywordtype">int</span> n_average;
<a name="l00117"></a>00117 <a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *sp, *osp, *oosp;
<a name="l00118"></a>00118 <a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *dp;
<a name="l00119"></a>00119
<a name="l00120"></a>00120 <span class="comment">/*</span>
<a name="l00121"></a>00121 <span class="comment"> * Averaging integer shrink</span>
<a name="l00122"></a>00122 <span class="comment"> */</span>
<a name="l00123"></a>00123
<a name="l00124"></a>00124 <span class="comment">/* Precalculate division factor */</span>
<a name="l00125"></a>00125 n_average = factorx*factory;
<a name="l00126"></a>00126
<a name="l00127"></a>00127 <span class="comment">/*</span>
<a name="l00128"></a>00128 <span class="comment"> * Scan destination</span>
<a name="l00129"></a>00129 <span class="comment"> */</span>
<a name="l00130"></a>00130 sp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *) src->pixels;
<a name="l00131"></a>00131 sgap = src->pitch - src->w * 4;
<a name="l00132"></a>00132
<a name="l00133"></a>00133 dp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *) dst->pixels;
<a name="l00134"></a>00134 dgap = dst->pitch - dst->w * 4;
<a name="l00135"></a>00135
<a name="l00136"></a>00136 <span class="keywordflow">for</span> (y = 0; y < dst->h; y++) {
<a name="l00137"></a>00137
<a name="l00138"></a>00138 osp=sp;
<a name="l00139"></a>00139 <span class="keywordflow">for</span> (x = 0; x < dst->w; x++) {
<a name="l00140"></a>00140
<a name="l00141"></a>00141 <span class="comment">/* Trace out source box and accumulate */</span>
<a name="l00142"></a>00142 oosp=sp;
<a name="l00143"></a>00143 ra=ga=ba=aa=0;
<a name="l00144"></a>00144 <span class="keywordflow">for</span> (dy=0; dy < factory; dy++) {
<a name="l00145"></a>00145 <span class="keywordflow">for</span> (dx=0; dx < factorx; dx++) {
<a name="l00146"></a>00146 ra += sp-><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a>;
<a name="l00147"></a>00147 ga += sp-><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a>;
<a name="l00148"></a>00148 ba += sp-><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a>;
<a name="l00149"></a>00149 aa += sp-><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a>;
<a name="l00150"></a>00150
<a name="l00151"></a>00151 sp++;
<a name="l00152"></a>00152 }
<a name="l00153"></a>00153 <span class="comment">/* src dx loop */</span>
<a name="l00154"></a>00154 sp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *)((Uint8*)sp + (src->pitch - 4*factorx)); <span class="comment">// next y</span>
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156 <span class="comment">/* src dy loop */</span>
<a name="l00157"></a>00157
<a name="l00158"></a>00158 <span class="comment">/* next box-x */</span>
<a name="l00159"></a>00159 sp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *)((Uint8*)oosp + 4*factorx);
<a name="l00160"></a>00160
<a name="l00161"></a>00161 <span class="comment">/* Store result in destination */</span>
<a name="l00162"></a>00162 dp-><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a> = ra/n_average;
<a name="l00163"></a>00163 dp-><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a> = ga/n_average;
<a name="l00164"></a>00164 dp-><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a> = ba/n_average;
<a name="l00165"></a>00165 dp-><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a> = aa/n_average;
<a name="l00166"></a>00166
<a name="l00167"></a>00167 <span class="comment">/*</span>
<a name="l00168"></a>00168 <span class="comment"> * Advance destination pointer </span>
<a name="l00169"></a>00169 <span class="comment"> */</span>
<a name="l00170"></a>00170 dp++;
<a name="l00171"></a>00171 }
<a name="l00172"></a>00172 <span class="comment">/* dst x loop */</span>
<a name="l00173"></a>00173
<a name="l00174"></a>00174 <span class="comment">/* next box-y */</span>
<a name="l00175"></a>00175 sp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *)((Uint8*)osp + src->pitch*factory);
<a name="l00176"></a>00176
<a name="l00177"></a>00177 <span class="comment">/*</span>
<a name="l00178"></a>00178 <span class="comment"> * Advance destination pointers </span>
<a name="l00179"></a>00179 <span class="comment"> */</span>
<a name="l00180"></a>00180 dp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *) ((Uint8 *) dp + dgap);
<a name="l00181"></a>00181 }
<a name="l00182"></a>00182 <span class="comment">/* dst y loop */</span>
<a name="l00183"></a>00183
<a name="l00184"></a>00184 <span class="keywordflow">return</span> (0);
<a name="l00185"></a>00185 }
<a name="l00186"></a>00186
<a name="l00202"></a><a class="code" href="_s_d_l__rotozoom_8c.html#aadb38a61ab6727e5fd621b63418399be">00202</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__rotozoom_8c.html#aadb38a61ab6727e5fd621b63418399be" title="Internal 8 bit integer-factor averaging shrinker.">_shrinkSurfaceY</a>(SDL_Surface * src, SDL_Surface * dst, <span class="keywordtype">int</span> factorx, <span class="keywordtype">int</span> factory)
<a name="l00203"></a>00203 {
<a name="l00204"></a>00204 <span class="keywordtype">int</span> x, y, dx, dy, sgap, dgap, a;
<a name="l00205"></a>00205 <span class="keywordtype">int</span> n_average;
<a name="l00206"></a>00206 Uint8 *sp, *osp, *oosp;
<a name="l00207"></a>00207 Uint8 *dp;
<a name="l00208"></a>00208
<a name="l00209"></a>00209 <span class="comment">/*</span>
<a name="l00210"></a>00210 <span class="comment"> * Averaging integer shrink</span>
<a name="l00211"></a>00211 <span class="comment"> */</span>
<a name="l00212"></a>00212
<a name="l00213"></a>00213 <span class="comment">/* Precalculate division factor */</span>
<a name="l00214"></a>00214 n_average = factorx*factory;
<a name="l00215"></a>00215
<a name="l00216"></a>00216 <span class="comment">/*</span>
<a name="l00217"></a>00217 <span class="comment"> * Scan destination</span>
<a name="l00218"></a>00218 <span class="comment"> */</span>
<a name="l00219"></a>00219 sp = (Uint8 *) src->pixels;
<a name="l00220"></a>00220 sgap = src->pitch - src->w;
<a name="l00221"></a>00221
<a name="l00222"></a>00222 dp = (Uint8 *) dst->pixels;
<a name="l00223"></a>00223 dgap = dst->pitch - dst->w;
<a name="l00224"></a>00224
<a name="l00225"></a>00225 <span class="keywordflow">for</span> (y = 0; y < dst->h; y++) {
<a name="l00226"></a>00226
<a name="l00227"></a>00227 osp=sp;
<a name="l00228"></a>00228 <span class="keywordflow">for</span> (x = 0; x < dst->w; x++) {
<a name="l00229"></a>00229
<a name="l00230"></a>00230 <span class="comment">/* Trace out source box and accumulate */</span>
<a name="l00231"></a>00231 oosp=sp;
<a name="l00232"></a>00232 a=0;
<a name="l00233"></a>00233 <span class="keywordflow">for</span> (dy=0; dy < factory; dy++) {
<a name="l00234"></a>00234 <span class="keywordflow">for</span> (dx=0; dx < factorx; dx++) {
<a name="l00235"></a>00235 a += (*sp);
<a name="l00236"></a>00236 <span class="comment">/* next x */</span>
<a name="l00237"></a>00237 sp++;
<a name="l00238"></a>00238 }
<a name="l00239"></a>00239 <span class="comment">/* end src dx loop */</span>
<a name="l00240"></a>00240 <span class="comment">/* next y */</span>
<a name="l00241"></a>00241 sp = (Uint8 *)((Uint8*)sp + (src->pitch - factorx));
<a name="l00242"></a>00242 }
<a name="l00243"></a>00243 <span class="comment">/* end src dy loop */</span>
<a name="l00244"></a>00244
<a name="l00245"></a>00245 <span class="comment">/* next box-x */</span>
<a name="l00246"></a>00246 sp = (Uint8 *)((Uint8*)oosp + factorx);
<a name="l00247"></a>00247
<a name="l00248"></a>00248 <span class="comment">/* Store result in destination */</span>
<a name="l00249"></a>00249 *dp = a/n_average;
<a name="l00250"></a>00250
<a name="l00251"></a>00251 <span class="comment">/*</span>
<a name="l00252"></a>00252 <span class="comment"> * Advance destination pointer </span>
<a name="l00253"></a>00253 <span class="comment"> */</span>
<a name="l00254"></a>00254 dp++;
<a name="l00255"></a>00255 }
<a name="l00256"></a>00256 <span class="comment">/* end dst x loop */</span>
<a name="l00257"></a>00257
<a name="l00258"></a>00258 <span class="comment">/* next box-y */</span>
<a name="l00259"></a>00259 sp = (Uint8 *)((Uint8*)osp + src->pitch*factory);
<a name="l00260"></a>00260
<a name="l00261"></a>00261 <span class="comment">/*</span>
<a name="l00262"></a>00262 <span class="comment"> * Advance destination pointers </span>
<a name="l00263"></a>00263 <span class="comment"> */</span>
<a name="l00264"></a>00264 dp = (Uint8 *)((Uint8 *)dp + dgap);
<a name="l00265"></a>00265 }
<a name="l00266"></a>00266 <span class="comment">/* end dst y loop */</span>
<a name="l00267"></a>00267
<a name="l00268"></a>00268 <span class="keywordflow">return</span> (0);
<a name="l00269"></a>00269 }
<a name="l00270"></a>00270
<a name="l00286"></a><a class="code" href="_s_d_l__rotozoom_8c.html#a9898b12bb565c4075c2da4db4891fd81">00286</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__rotozoom_8c.html#a9898b12bb565c4075c2da4db4891fd81" title="Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation.">_zoomSurfaceRGBA</a>(SDL_Surface * src, SDL_Surface * dst, <span class="keywordtype">int</span> flipx, <span class="keywordtype">int</span> flipy, <span class="keywordtype">int</span> smooth)
<a name="l00287"></a>00287 {
<a name="l00288"></a>00288 <span class="keywordtype">int</span> x, y, sx, sy, ssx, ssy, *sax, *say, *csax, *csay, *salast, csx, csy, ex, ey, cx, cy, sstep, sstepx, sstepy;
<a name="l00289"></a>00289 <a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *c00, *c01, *c10, *c11;
<a name="l00290"></a>00290 <a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *sp, *csp, *dp;
<a name="l00291"></a>00291 <span class="keywordtype">int</span> spixelgap, spixelw, spixelh, dgap, t1, t2;
<a name="l00292"></a>00292
<a name="l00293"></a>00293 <span class="comment">/*</span>
<a name="l00294"></a>00294 <span class="comment"> * Allocate memory for row/column increments </span>
<a name="l00295"></a>00295 <span class="comment"> */</span>
<a name="l00296"></a>00296 <span class="keywordflow">if</span> ((sax = (<span class="keywordtype">int</span> *) malloc((dst->w + 1) * <span class="keyword">sizeof</span>(Uint32))) == NULL) {
<a name="l00297"></a>00297 <span class="keywordflow">return</span> (-1);
<a name="l00298"></a>00298 }
<a name="l00299"></a>00299 <span class="keywordflow">if</span> ((say = (<span class="keywordtype">int</span> *) malloc((dst->h + 1) * <span class="keyword">sizeof</span>(Uint32))) == NULL) {
<a name="l00300"></a>00300 free(sax);
<a name="l00301"></a>00301 <span class="keywordflow">return</span> (-1);
<a name="l00302"></a>00302 }
<a name="l00303"></a>00303
<a name="l00304"></a>00304 <span class="comment">/*</span>
<a name="l00305"></a>00305 <span class="comment"> * Precalculate row increments </span>
<a name="l00306"></a>00306 <span class="comment"> */</span>
<a name="l00307"></a>00307 spixelw = (src->w - 1);
<a name="l00308"></a>00308 spixelh = (src->h - 1);
<a name="l00309"></a>00309 <span class="keywordflow">if</span> (smooth) {
<a name="l00310"></a>00310 sx = (int) (65536.0 * (<span class="keywordtype">float</span>) spixelw / (float) (dst->w - 1));
<a name="l00311"></a>00311 sy = (int) (65536.0 * (<span class="keywordtype">float</span>) spixelh / (float) (dst->h - 1));
<a name="l00312"></a>00312 } <span class="keywordflow">else</span> {
<a name="l00313"></a>00313 sx = (int) (65536.0 * (<span class="keywordtype">float</span>) (src->w) / (<span class="keywordtype">float</span>) (dst->w));
<a name="l00314"></a>00314 sy = (int) (65536.0 * (<span class="keywordtype">float</span>) (src->h) / (<span class="keywordtype">float</span>) (dst->h));
<a name="l00315"></a>00315 }
<a name="l00316"></a>00316
<a name="l00317"></a>00317 <span class="comment">/* Maximum scaled source size */</span>
<a name="l00318"></a>00318 ssx = (src->w << 16) - 1;
<a name="l00319"></a>00319 ssy = (src->h << 16) - 1;
<a name="l00320"></a>00320
<a name="l00321"></a>00321 <span class="comment">/* Precalculate horizontal row increments */</span>
<a name="l00322"></a>00322 csx = 0;
<a name="l00323"></a>00323 csax = sax;
<a name="l00324"></a>00324 <span class="keywordflow">for</span> (x = 0; x <= dst->w; x++) {
<a name="l00325"></a>00325 *csax = csx;
<a name="l00326"></a>00326 csax++;
<a name="l00327"></a>00327 csx += sx;
<a name="l00328"></a>00328
<a name="l00329"></a>00329 <span class="comment">/* Guard from overflows */</span>
<a name="l00330"></a>00330 <span class="keywordflow">if</span> (csx > ssx) {
<a name="l00331"></a>00331 csx = ssx;
<a name="l00332"></a>00332 }
<a name="l00333"></a>00333 }
<a name="l00334"></a>00334
<a name="l00335"></a>00335 <span class="comment">/* Precalculate vertical row increments */</span>
<a name="l00336"></a>00336 csy = 0;
<a name="l00337"></a>00337 csay = say;
<a name="l00338"></a>00338 <span class="keywordflow">for</span> (y = 0; y <= dst->h; y++) {
<a name="l00339"></a>00339 *csay = csy;
<a name="l00340"></a>00340 csay++;
<a name="l00341"></a>00341 csy += sy;
<a name="l00342"></a>00342
<a name="l00343"></a>00343 <span class="comment">/* Guard from overflows */</span>
<a name="l00344"></a>00344 <span class="keywordflow">if</span> (csy > ssy) {
<a name="l00345"></a>00345 csy = ssy;
<a name="l00346"></a>00346 }
<a name="l00347"></a>00347 }
<a name="l00348"></a>00348
<a name="l00349"></a>00349 sp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *) src->pixels;
<a name="l00350"></a>00350 dp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *) dst->pixels;
<a name="l00351"></a>00351 dgap = dst->pitch - dst->w * 4;
<a name="l00352"></a>00352 spixelgap = src->pitch/4;
<a name="l00353"></a>00353
<a name="l00354"></a>00354 <span class="keywordflow">if</span> (flipx) sp += spixelw;
<a name="l00355"></a>00355 <span class="keywordflow">if</span> (flipy) sp += (spixelgap * spixelh);
<a name="l00356"></a>00356
<a name="l00357"></a>00357 <span class="comment">/*</span>
<a name="l00358"></a>00358 <span class="comment"> * Switch between interpolating and non-interpolating code </span>
<a name="l00359"></a>00359 <span class="comment"> */</span>
<a name="l00360"></a>00360 <span class="keywordflow">if</span> (smooth) {
<a name="l00361"></a>00361
<a name="l00362"></a>00362 <span class="comment">/*</span>
<a name="l00363"></a>00363 <span class="comment"> * Interpolating Zoom </span>
<a name="l00364"></a>00364 <span class="comment"> */</span>
<a name="l00365"></a>00365 csay = say;
<a name="l00366"></a>00366 <span class="keywordflow">for</span> (y = 0; y < dst->h; y++) {
<a name="l00367"></a>00367 csp = sp;
<a name="l00368"></a>00368 csax = sax;
<a name="l00369"></a>00369 <span class="keywordflow">for</span> (x = 0; x < dst->w; x++) {
<a name="l00370"></a>00370 <span class="comment">/*</span>
<a name="l00371"></a>00371 <span class="comment"> * Setup color source pointers </span>
<a name="l00372"></a>00372 <span class="comment"> */</span>
<a name="l00373"></a>00373 ex = (*csax & 0xffff);
<a name="l00374"></a>00374 ey = (*csay & 0xffff);
<a name="l00375"></a>00375 cx = (*csax >> 16);
<a name="l00376"></a>00376 cy = (*csay >> 16);
<a name="l00377"></a>00377 sstepx = cx < spixelw;
<a name="l00378"></a>00378 sstepy = cy < spixelh;
<a name="l00379"></a>00379 c00 = sp;
<a name="l00380"></a>00380 c01 = sp;
<a name="l00381"></a>00381 c10 = sp;
<a name="l00382"></a>00382 <span class="keywordflow">if</span> (sstepy) {
<a name="l00383"></a>00383 <span class="keywordflow">if</span> (flipy) {
<a name="l00384"></a>00384 c10 -= spixelgap;
<a name="l00385"></a>00385 } <span class="keywordflow">else</span> {
<a name="l00386"></a>00386 c10 += spixelgap;
<a name="l00387"></a>00387 }
<a name="l00388"></a>00388 }
<a name="l00389"></a>00389 c11 = c10;
<a name="l00390"></a>00390 <span class="keywordflow">if</span> (sstepx) {
<a name="l00391"></a>00391 <span class="keywordflow">if</span> (flipx) {
<a name="l00392"></a>00392 c01--;
<a name="l00393"></a>00393 c11--;
<a name="l00394"></a>00394 } <span class="keywordflow">else</span> {
<a name="l00395"></a>00395 c01++;
<a name="l00396"></a>00396 c11++;
<a name="l00397"></a>00397 }
<a name="l00398"></a>00398 }
<a name="l00399"></a>00399
<a name="l00400"></a>00400 <span class="comment">/*</span>
<a name="l00401"></a>00401 <span class="comment"> * Draw and interpolate colors </span>
<a name="l00402"></a>00402 <span class="comment"> */</span>
<a name="l00403"></a>00403 t1 = ((((c01-><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a> - c00-><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a>) * ex) >> 16) + c00-><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a>) & 0xff;
<a name="l00404"></a>00404 t2 = ((((c11-><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a> - c10-><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a>) * ex) >> 16) + c10-><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a>) & 0xff;
<a name="l00405"></a>00405 dp-><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a> = (((t2 - t1) * ey) >> 16) + t1;
<a name="l00406"></a>00406 t1 = ((((c01-><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a> - c00-><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a>) * ex) >> 16) + c00-><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a>) & 0xff;
<a name="l00407"></a>00407 t2 = ((((c11-><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a> - c10-><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a>) * ex) >> 16) + c10-><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a>) & 0xff;
<a name="l00408"></a>00408 dp-><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a> = (((t2 - t1) * ey) >> 16) + t1;
<a name="l00409"></a>00409 t1 = ((((c01-><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a> - c00-><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a>) * ex) >> 16) + c00-><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a>) & 0xff;
<a name="l00410"></a>00410 t2 = ((((c11-><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a> - c10-><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a>) * ex) >> 16) + c10-><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a>) & 0xff;
<a name="l00411"></a>00411 dp-><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a> = (((t2 - t1) * ey) >> 16) + t1;
<a name="l00412"></a>00412 t1 = ((((c01-><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a> - c00-><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a>) * ex) >> 16) + c00-><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a>) & 0xff;
<a name="l00413"></a>00413 t2 = ((((c11-><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a> - c10-><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a>) * ex) >> 16) + c10-><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a>) & 0xff;
<a name="l00414"></a>00414 dp-><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a> = (((t2 - t1) * ey) >> 16) + t1;
<a name="l00415"></a>00415 <span class="comment">/*</span>
<a name="l00416"></a>00416 <span class="comment"> * Advance source pointer x</span>
<a name="l00417"></a>00417 <span class="comment"> */</span>
<a name="l00418"></a>00418 salast = csax;
<a name="l00419"></a>00419 csax++;
<a name="l00420"></a>00420 sstep = (*csax >> 16) - (*salast >> 16);
<a name="l00421"></a>00421 <span class="keywordflow">if</span> (flipx) {
<a name="l00422"></a>00422 sp -= sstep;
<a name="l00423"></a>00423 } <span class="keywordflow">else</span> {
<a name="l00424"></a>00424 sp += sstep;
<a name="l00425"></a>00425 }
<a name="l00426"></a>00426
<a name="l00427"></a>00427 <span class="comment">/*</span>
<a name="l00428"></a>00428 <span class="comment"> * Advance destination pointer x</span>
<a name="l00429"></a>00429 <span class="comment"> */</span>
<a name="l00430"></a>00430 dp++;
<a name="l00431"></a>00431 }
<a name="l00432"></a>00432 <span class="comment">/*</span>
<a name="l00433"></a>00433 <span class="comment"> * Advance source pointer y</span>
<a name="l00434"></a>00434 <span class="comment"> */</span>
<a name="l00435"></a>00435 salast = csay;
<a name="l00436"></a>00436 csay++;
<a name="l00437"></a>00437 sstep = (*csay >> 16) - (*salast >> 16);
<a name="l00438"></a>00438 sstep *= spixelgap;
<a name="l00439"></a>00439 <span class="keywordflow">if</span> (flipy) {
<a name="l00440"></a>00440 sp = csp - sstep;
<a name="l00441"></a>00441 } <span class="keywordflow">else</span> {
<a name="l00442"></a>00442 sp = csp + sstep;
<a name="l00443"></a>00443 }
<a name="l00444"></a>00444
<a name="l00445"></a>00445 <span class="comment">/*</span>
<a name="l00446"></a>00446 <span class="comment"> * Advance destination pointer y</span>
<a name="l00447"></a>00447 <span class="comment"> */</span>
<a name="l00448"></a>00448 dp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *) ((Uint8 *) dp + dgap);
<a name="l00449"></a>00449 }
<a name="l00450"></a>00450 } <span class="keywordflow">else</span> {
<a name="l00451"></a>00451 <span class="comment">/*</span>
<a name="l00452"></a>00452 <span class="comment"> * Non-Interpolating Zoom </span>
<a name="l00453"></a>00453 <span class="comment"> */</span>
<a name="l00454"></a>00454 csay = say;
<a name="l00455"></a>00455 <span class="keywordflow">for</span> (y = 0; y < dst->h; y++) {
<a name="l00456"></a>00456 csp = sp;
<a name="l00457"></a>00457 csax = sax;
<a name="l00458"></a>00458 <span class="keywordflow">for</span> (x = 0; x < dst->w; x++) {
<a name="l00459"></a>00459 <span class="comment">/*</span>
<a name="l00460"></a>00460 <span class="comment"> * Draw </span>
<a name="l00461"></a>00461 <span class="comment"> */</span>
<a name="l00462"></a>00462 *dp = *sp;
<a name="l00463"></a>00463
<a name="l00464"></a>00464 <span class="comment">/*</span>
<a name="l00465"></a>00465 <span class="comment"> * Advance source pointer x</span>
<a name="l00466"></a>00466 <span class="comment"> */</span>
<a name="l00467"></a>00467 salast = csax;
<a name="l00468"></a>00468 csax++;
<a name="l00469"></a>00469 sstep = (*csax >> 16) - (*salast >> 16);
<a name="l00470"></a>00470 <span class="keywordflow">if</span> (flipx) sstep = -sstep;
<a name="l00471"></a>00471 sp += sstep;
<a name="l00472"></a>00472
<a name="l00473"></a>00473 <span class="comment">/*</span>
<a name="l00474"></a>00474 <span class="comment"> * Advance destination pointer x</span>
<a name="l00475"></a>00475 <span class="comment"> */</span>
<a name="l00476"></a>00476 dp++;
<a name="l00477"></a>00477 }
<a name="l00478"></a>00478 <span class="comment">/*</span>
<a name="l00479"></a>00479 <span class="comment"> * Advance source pointer y</span>
<a name="l00480"></a>00480 <span class="comment"> */</span>
<a name="l00481"></a>00481 salast = csay;
<a name="l00482"></a>00482 csay++;
<a name="l00483"></a>00483 sstep = (*csay >> 16) - (*salast >> 16);
<a name="l00484"></a>00484 sstep *= spixelgap;
<a name="l00485"></a>00485 <span class="keywordflow">if</span> (flipy) sstep = -sstep;
<a name="l00486"></a>00486 sp = csp + sstep;
<a name="l00487"></a>00487
<a name="l00488"></a>00488 <span class="comment">/*</span>
<a name="l00489"></a>00489 <span class="comment"> * Advance destination pointer y</span>
<a name="l00490"></a>00490 <span class="comment"> */</span>
<a name="l00491"></a>00491 dp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *) ((Uint8 *) dp + dgap);
<a name="l00492"></a>00492 }
<a name="l00493"></a>00493 }
<a name="l00494"></a>00494
<a name="l00495"></a>00495 <span class="comment">/*</span>
<a name="l00496"></a>00496 <span class="comment"> * Remove temp arrays </span>
<a name="l00497"></a>00497 <span class="comment"> */</span>
<a name="l00498"></a>00498 free(sax);
<a name="l00499"></a>00499 free(say);
<a name="l00500"></a>00500
<a name="l00501"></a>00501 <span class="keywordflow">return</span> (0);
<a name="l00502"></a>00502 }
<a name="l00503"></a>00503
<a name="l00519"></a><a class="code" href="_s_d_l__rotozoom_8c.html#acfeb5a322cbb575f105f1762d9d21c29">00519</a> <span class="keywordtype">int</span> <a class="code" href="_s_d_l__rotozoom_8c.html#acfeb5a322cbb575f105f1762d9d21c29" title="Internal 8 bit Zoomer without smoothing.">_zoomSurfaceY</a>(SDL_Surface * src, SDL_Surface * dst, <span class="keywordtype">int</span> flipx, <span class="keywordtype">int</span> flipy)
<a name="l00520"></a>00520 {
<a name="l00521"></a>00521 <span class="keywordtype">int</span> x, y;
<a name="l00522"></a>00522 Uint32 *sax, *say, *csax, *csay;
<a name="l00523"></a>00523 <span class="keywordtype">int</span> csx, csy;
<a name="l00524"></a>00524 Uint8 *sp, *dp, *csp;
<a name="l00525"></a>00525 <span class="keywordtype">int</span> dgap;
<a name="l00526"></a>00526
<a name="l00527"></a>00527 <span class="comment">/*</span>
<a name="l00528"></a>00528 <span class="comment"> * Allocate memory for row increments </span>
<a name="l00529"></a>00529 <span class="comment"> */</span>
<a name="l00530"></a>00530 <span class="keywordflow">if</span> ((sax = (Uint32 *) malloc((dst->w + 1) * <span class="keyword">sizeof</span>(Uint32))) == NULL) {
<a name="l00531"></a>00531 <span class="keywordflow">return</span> (-1);
<a name="l00532"></a>00532 }
<a name="l00533"></a>00533 <span class="keywordflow">if</span> ((say = (Uint32 *) malloc((dst->h + 1) * <span class="keyword">sizeof</span>(Uint32))) == NULL) {
<a name="l00534"></a>00534 free(sax);
<a name="l00535"></a>00535 <span class="keywordflow">return</span> (-1);
<a name="l00536"></a>00536 }
<a name="l00537"></a>00537
<a name="l00538"></a>00538 <span class="comment">/*</span>
<a name="l00539"></a>00539 <span class="comment"> * Pointer setup </span>
<a name="l00540"></a>00540 <span class="comment"> */</span>
<a name="l00541"></a>00541 sp = csp = (Uint8 *) src->pixels;
<a name="l00542"></a>00542 dp = (Uint8 *) dst->pixels;
<a name="l00543"></a>00543 dgap = dst->pitch - dst->w;
<a name="l00544"></a>00544
<a name="l00545"></a>00545 <span class="keywordflow">if</span> (flipx) csp += (src->w-1);
<a name="l00546"></a>00546 <span class="keywordflow">if</span> (flipy) csp = ( (Uint8*)csp + src->pitch*(src->h-1) );
<a name="l00547"></a>00547
<a name="l00548"></a>00548 <span class="comment">/*</span>
<a name="l00549"></a>00549 <span class="comment"> * Precalculate row increments </span>
<a name="l00550"></a>00550 <span class="comment"> */</span>
<a name="l00551"></a>00551 csx = 0;
<a name="l00552"></a>00552 csax = sax;
<a name="l00553"></a>00553 <span class="keywordflow">for</span> (x = 0; x < dst->w; x++) {
<a name="l00554"></a>00554 csx += src->w;
<a name="l00555"></a>00555 *csax = 0;
<a name="l00556"></a>00556 <span class="keywordflow">while</span> (csx >= dst->w) {
<a name="l00557"></a>00557 csx -= dst->w;
<a name="l00558"></a>00558 (*csax)++;
<a name="l00559"></a>00559 }
<a name="l00560"></a>00560 (*csax) = (*csax) * (flipx ? -1 : 1);
<a name="l00561"></a>00561 csax++;
<a name="l00562"></a>00562 }
<a name="l00563"></a>00563 csy = 0;
<a name="l00564"></a>00564 csay = say;
<a name="l00565"></a>00565 <span class="keywordflow">for</span> (y = 0; y < dst->h; y++) {
<a name="l00566"></a>00566 csy += src->h;
<a name="l00567"></a>00567 *csay = 0;
<a name="l00568"></a>00568 <span class="keywordflow">while</span> (csy >= dst->h) {
<a name="l00569"></a>00569 csy -= dst->h;
<a name="l00570"></a>00570 (*csay)++;
<a name="l00571"></a>00571 }
<a name="l00572"></a>00572 (*csay) = (*csay) * (flipy ? -1 : 1);
<a name="l00573"></a>00573 csay++;
<a name="l00574"></a>00574 }
<a name="l00575"></a>00575
<a name="l00576"></a>00576 <span class="comment">/*</span>
<a name="l00577"></a>00577 <span class="comment"> * Draw </span>
<a name="l00578"></a>00578 <span class="comment"> */</span>
<a name="l00579"></a>00579 csay = say;
<a name="l00580"></a>00580 <span class="keywordflow">for</span> (y = 0; y < dst->h; y++) {
<a name="l00581"></a>00581 csax = sax;
<a name="l00582"></a>00582 sp = csp;
<a name="l00583"></a>00583 <span class="keywordflow">for</span> (x = 0; x < dst->w; x++) {
<a name="l00584"></a>00584 <span class="comment">/*</span>
<a name="l00585"></a>00585 <span class="comment"> * Draw </span>
<a name="l00586"></a>00586 <span class="comment"> */</span>
<a name="l00587"></a>00587 *dp = *sp;
<a name="l00588"></a>00588 <span class="comment">/*</span>
<a name="l00589"></a>00589 <span class="comment"> * Advance source pointers </span>
<a name="l00590"></a>00590 <span class="comment"> */</span>
<a name="l00591"></a>00591 sp += (*csax);
<a name="l00592"></a>00592 csax++;
<a name="l00593"></a>00593 <span class="comment">/*</span>
<a name="l00594"></a>00594 <span class="comment"> * Advance destination pointer </span>
<a name="l00595"></a>00595 <span class="comment"> */</span>
<a name="l00596"></a>00596 dp++;
<a name="l00597"></a>00597 }
<a name="l00598"></a>00598 <span class="comment">/*</span>
<a name="l00599"></a>00599 <span class="comment"> * Advance source pointer (for row) </span>
<a name="l00600"></a>00600 <span class="comment"> */</span>
<a name="l00601"></a>00601 csp += ((*csay) * src->pitch);
<a name="l00602"></a>00602 csay++;
<a name="l00603"></a>00603
<a name="l00604"></a>00604 <span class="comment">/*</span>
<a name="l00605"></a>00605 <span class="comment"> * Advance destination pointers </span>
<a name="l00606"></a>00606 <span class="comment"> */</span>
<a name="l00607"></a>00607 dp += dgap;
<a name="l00608"></a>00608 }
<a name="l00609"></a>00609
<a name="l00610"></a>00610 <span class="comment">/*</span>
<a name="l00611"></a>00611 <span class="comment"> * Remove temp arrays </span>
<a name="l00612"></a>00612 <span class="comment"> */</span>
<a name="l00613"></a>00613 free(sax);
<a name="l00614"></a>00614 free(say);
<a name="l00615"></a>00615
<a name="l00616"></a>00616 <span class="keywordflow">return</span> (0);
<a name="l00617"></a>00617 }
<a name="l00618"></a>00618
<a name="l00638"></a><a class="code" href="_s_d_l__rotozoom_8c.html#aae634e7b5e6ec1622fec361ecbd0d1b7">00638</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__rotozoom_8c.html#aae634e7b5e6ec1622fec361ecbd0d1b7" title="Internal 32 bit rotozoomer with optional anti-aliasing.">_transformSurfaceRGBA</a>(SDL_Surface * src, SDL_Surface * dst, <span class="keywordtype">int</span> cx, <span class="keywordtype">int</span> cy, <span class="keywordtype">int</span> isin, <span class="keywordtype">int</span> icos, <span class="keywordtype">int</span> flipx, <span class="keywordtype">int</span> flipy, <span class="keywordtype">int</span> smooth)
<a name="l00639"></a>00639 {
<a name="l00640"></a>00640 <span class="keywordtype">int</span> x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
<a name="l00641"></a>00641 <a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> c00, c01, c10, c11, cswap;
<a name="l00642"></a>00642 <a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *pc, *sp;
<a name="l00643"></a>00643 <span class="keywordtype">int</span> gap;
<a name="l00644"></a>00644
<a name="l00645"></a>00645 <span class="comment">/*</span>
<a name="l00646"></a>00646 <span class="comment"> * Variable setup </span>
<a name="l00647"></a>00647 <span class="comment"> */</span>
<a name="l00648"></a>00648 xd = ((src->w - dst->w) << 15);
<a name="l00649"></a>00649 yd = ((src->h - dst->h) << 15);
<a name="l00650"></a>00650 ax = (cx << 16) - (icos * cx);
<a name="l00651"></a>00651 ay = (cy << 16) - (isin * cx);
<a name="l00652"></a>00652 sw = src->w - 1;
<a name="l00653"></a>00653 sh = src->h - 1;
<a name="l00654"></a>00654 pc = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a>*) dst->pixels;
<a name="l00655"></a>00655 gap = dst->pitch - dst->w * 4;
<a name="l00656"></a>00656
<a name="l00657"></a>00657 <span class="comment">/*</span>
<a name="l00658"></a>00658 <span class="comment"> * Switch between interpolating and non-interpolating code </span>
<a name="l00659"></a>00659 <span class="comment"> */</span>
<a name="l00660"></a>00660 if (smooth) {
<a name="l00661"></a>00661 <span class="keywordflow">for</span> (y = 0; y < dst->h; y++) {
<a name="l00662"></a>00662 dy = cy - y;
<a name="l00663"></a>00663 sdx = (ax + (isin * dy)) + xd;
<a name="l00664"></a>00664 sdy = (ay - (icos * dy)) + yd;
<a name="l00665"></a>00665 <span class="keywordflow">for</span> (x = 0; x < dst->w; x++) {
<a name="l00666"></a>00666 dx = (sdx >> 16);
<a name="l00667"></a>00667 dy = (sdy >> 16);
<a name="l00668"></a>00668 <span class="keywordflow">if</span> (flipx) dx = sw - dx;
<a name="l00669"></a>00669 <span class="keywordflow">if</span> (flipy) dy = sh - dy;
<a name="l00670"></a>00670 <span class="keywordflow">if</span> ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) {
<a name="l00671"></a>00671 sp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *)src->pixels;;
<a name="l00672"></a>00672 sp += ((src->pitch/4) * dy);
<a name="l00673"></a>00673 sp += dx;
<a name="l00674"></a>00674 c00 = *sp;
<a name="l00675"></a>00675 sp += 1;
<a name="l00676"></a>00676 c01 = *sp;
<a name="l00677"></a>00677 sp += (src->pitch/4);
<a name="l00678"></a>00678 c11 = *sp;
<a name="l00679"></a>00679 sp -= 1;
<a name="l00680"></a>00680 c10 = *sp;
<a name="l00681"></a>00681 <span class="keywordflow">if</span> (flipx) {
<a name="l00682"></a>00682 cswap = c00; c00=c01; c01=cswap;
<a name="l00683"></a>00683 cswap = c10; c10=c11; c11=cswap;
<a name="l00684"></a>00684 }
<a name="l00685"></a>00685 <span class="keywordflow">if</span> (flipy) {
<a name="l00686"></a>00686 cswap = c00; c00=c10; c10=cswap;
<a name="l00687"></a>00687 cswap = c01; c01=c11; c11=cswap;
<a name="l00688"></a>00688 }
<a name="l00689"></a>00689 <span class="comment">/*</span>
<a name="l00690"></a>00690 <span class="comment"> * Interpolate colors </span>
<a name="l00691"></a>00691 <span class="comment"> */</span>
<a name="l00692"></a>00692 ex = (sdx & 0xffff);
<a name="l00693"></a>00693 ey = (sdy & 0xffff);
<a name="l00694"></a>00694 t1 = ((((c01.<a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a> - c00.<a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a>) * ex) >> 16) + c00.<a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a>) & 0xff;
<a name="l00695"></a>00695 t2 = ((((c11.<a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a> - c10.<a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a>) * ex) >> 16) + c10.<a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a>) & 0xff;
<a name="l00696"></a>00696 pc-><a class="code" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a> = (((t2 - t1) * ey) >> 16) + t1;
<a name="l00697"></a>00697 t1 = ((((c01.<a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a> - c00.<a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a>) * ex) >> 16) + c00.<a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a>) & 0xff;
<a name="l00698"></a>00698 t2 = ((((c11.<a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a> - c10.<a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a>) * ex) >> 16) + c10.<a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a>) & 0xff;
<a name="l00699"></a>00699 pc-><a class="code" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a> = (((t2 - t1) * ey) >> 16) + t1;
<a name="l00700"></a>00700 t1 = ((((c01.<a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a> - c00.<a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a>) * ex) >> 16) + c00.<a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a>) & 0xff;
<a name="l00701"></a>00701 t2 = ((((c11.<a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a> - c10.<a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a>) * ex) >> 16) + c10.<a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a>) & 0xff;
<a name="l00702"></a>00702 pc-><a class="code" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a> = (((t2 - t1) * ey) >> 16) + t1;
<a name="l00703"></a>00703 t1 = ((((c01.<a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a> - c00.<a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a>) * ex) >> 16) + c00.<a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a>) & 0xff;
<a name="l00704"></a>00704 t2 = ((((c11.<a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a> - c10.<a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a>) * ex) >> 16) + c10.<a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a>) & 0xff;
<a name="l00705"></a>00705 pc-><a class="code" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a> = (((t2 - t1) * ey) >> 16) + t1;
<a name="l00706"></a>00706 }
<a name="l00707"></a>00707 sdx += icos;
<a name="l00708"></a>00708 sdy += isin;
<a name="l00709"></a>00709 pc++;
<a name="l00710"></a>00710 }
<a name="l00711"></a>00711 pc = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *) ((Uint8 *) pc + gap);
<a name="l00712"></a>00712 }
<a name="l00713"></a>00713 } <span class="keywordflow">else</span> {
<a name="l00714"></a>00714 <span class="keywordflow">for</span> (y = 0; y < dst->h; y++) {
<a name="l00715"></a>00715 dy = cy - y;
<a name="l00716"></a>00716 sdx = (ax + (isin * dy)) + xd;
<a name="l00717"></a>00717 sdy = (ay - (icos * dy)) + yd;
<a name="l00718"></a>00718 <span class="keywordflow">for</span> (x = 0; x < dst->w; x++) {
<a name="l00719"></a>00719 dx = (short) (sdx >> 16);
<a name="l00720"></a>00720 dy = (short) (sdy >> 16);
<a name="l00721"></a>00721 <span class="keywordflow">if</span> (flipx) dx = (src->w-1)-dx;
<a name="l00722"></a>00722 <span class="keywordflow">if</span> (flipy) dy = (src->h-1)-dy;
<a name="l00723"></a>00723 <span class="keywordflow">if</span> ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) {
<a name="l00724"></a>00724 sp = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *) ((Uint8 *) src->pixels + src->pitch * dy);
<a name="l00725"></a>00725 sp += dx;
<a name="l00726"></a>00726 *pc = *sp;
<a name="l00727"></a>00727 }
<a name="l00728"></a>00728 sdx += icos;
<a name="l00729"></a>00729 sdy += isin;
<a name="l00730"></a>00730 pc++;
<a name="l00731"></a>00731 }
<a name="l00732"></a>00732 pc = (<a class="code" href="structt_color_r_g_b_a.html" title="A 32 bit RGBA pixel.">tColorRGBA</a> *) ((Uint8 *) pc + gap);
<a name="l00733"></a>00733 }
<a name="l00734"></a>00734 }
<a name="l00735"></a>00735 }
<a name="l00736"></a>00736
<a name="l00755"></a><a class="code" href="_s_d_l__rotozoom_8c.html#a126e3b96b22cc18e78e33cc1f8eb6c3c">00755</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__rotozoom_8c.html#a126e3b96b22cc18e78e33cc1f8eb6c3c" title="Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing.">transformSurfaceY</a>(SDL_Surface * src, SDL_Surface * dst, <span class="keywordtype">int</span> cx, <span class="keywordtype">int</span> cy, <span class="keywordtype">int</span> isin, <span class="keywordtype">int</span> icos, <span class="keywordtype">int</span> flipx, <span class="keywordtype">int</span> flipy)
<a name="l00756"></a>00756 {
<a name="l00757"></a>00757 <span class="keywordtype">int</span> x, y, dx, dy, xd, yd, sdx, sdy, ax, ay, sw, sh;
<a name="l00758"></a>00758 <a class="code" href="structt_color_y.html" title="A 8bit Y/palette pixel.">tColorY</a> *pc, *sp;
<a name="l00759"></a>00759 <span class="keywordtype">int</span> gap;
<a name="l00760"></a>00760
<a name="l00761"></a>00761 <span class="comment">/*</span>
<a name="l00762"></a>00762 <span class="comment"> * Variable setup </span>
<a name="l00763"></a>00763 <span class="comment"> */</span>
<a name="l00764"></a>00764 xd = ((src->w - dst->w) << 15);
<a name="l00765"></a>00765 yd = ((src->h - dst->h) << 15);
<a name="l00766"></a>00766 ax = (cx << 16) - (icos * cx);
<a name="l00767"></a>00767 ay = (cy << 16) - (isin * cx);
<a name="l00768"></a>00768 sw = src->w - 1;
<a name="l00769"></a>00769 sh = src->h - 1;
<a name="l00770"></a>00770 pc = (<a class="code" href="structt_color_y.html" title="A 8bit Y/palette pixel.">tColorY</a>*) dst->pixels;
<a name="l00771"></a>00771 gap = dst->pitch - dst->w;
<a name="l00772"></a>00772 <span class="comment">/*</span>
<a name="l00773"></a>00773 <span class="comment"> * Clear surface to colorkey </span>
<a name="l00774"></a>00774 <span class="comment"> */</span>
<a name="l00775"></a>00775 memset(pc, (<span class="keywordtype">int</span>)(<a class="code" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce" title="Returns colorkey info for a surface.">_colorkey</a>(src) & 0xff), dst->pitch * dst->h);
<a name="l00776"></a>00776 <span class="comment">/*</span>
<a name="l00777"></a>00777 <span class="comment"> * Iterate through destination surface </span>
<a name="l00778"></a>00778 <span class="comment"> */</span>
<a name="l00779"></a>00779 <span class="keywordflow">for</span> (y = 0; y < dst->h; y++) {
<a name="l00780"></a>00780 dy = cy - y;
<a name="l00781"></a>00781 sdx = (ax + (isin * dy)) + xd;
<a name="l00782"></a>00782 sdy = (ay - (icos * dy)) + yd;
<a name="l00783"></a>00783 <span class="keywordflow">for</span> (x = 0; x < dst->w; x++) {
<a name="l00784"></a>00784 dx = (short) (sdx >> 16);
<a name="l00785"></a>00785 dy = (short) (sdy >> 16);
<a name="l00786"></a>00786 <span class="keywordflow">if</span> (flipx) dx = (src->w-1)-dx;
<a name="l00787"></a>00787 <span class="keywordflow">if</span> (flipy) dy = (src->h-1)-dy;
<a name="l00788"></a>00788 <span class="keywordflow">if</span> ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) {
<a name="l00789"></a>00789 sp = (<a class="code" href="structt_color_y.html" title="A 8bit Y/palette pixel.">tColorY</a> *) (src->pixels);
<a name="l00790"></a>00790 sp += (src->pitch * dy + dx);
<a name="l00791"></a>00791 *pc = *sp;
<a name="l00792"></a>00792 }
<a name="l00793"></a>00793 sdx += icos;
<a name="l00794"></a>00794 sdy += isin;
<a name="l00795"></a>00795 pc++;
<a name="l00796"></a>00796 }
<a name="l00797"></a>00797 pc += gap;
<a name="l00798"></a>00798 }
<a name="l00799"></a>00799 }
<a name="l00800"></a>00800
<a name="l00814"></a><a class="code" href="_s_d_l__rotozoom_8h.html#ac06e9fa4fce6a1dbae45462529be581e">00814</a> SDL_Surface* <a class="code" href="_s_d_l__rotozoom_8c.html#a77563d68634cb2624d4f2f0bcdc19e73" title="Rotates a 32 bit surface in increments of 90 degrees.">rotateSurface90Degrees</a>(SDL_Surface* src, <span class="keywordtype">int</span> numClockwiseTurns)
<a name="l00815"></a>00815 {
<a name="l00816"></a>00816 <span class="keywordtype">int</span> row, col, newWidth, newHeight;
<a name="l00817"></a>00817 <span class="keywordtype">int</span> bpp, src_ipr, dst_ipr;
<a name="l00818"></a>00818 SDL_Surface* dst;
<a name="l00819"></a>00819 Uint32* srcBuf;
<a name="l00820"></a>00820 Uint32* dstBuf;
<a name="l00821"></a>00821
<a name="l00822"></a>00822 <span class="comment">/* Has to be a valid surface pointer and only 32-bit surfaces (for now) */</span>
<a name="l00823"></a>00823 <span class="keywordflow">if</span> (!src || src->format->BitsPerPixel != 32) { <span class="keywordflow">return</span> NULL; }
<a name="l00824"></a>00824
<a name="l00825"></a>00825 <span class="comment">/* normalize numClockwiseTurns */</span>
<a name="l00826"></a>00826 <span class="keywordflow">while</span>(numClockwiseTurns < 0) { numClockwiseTurns += 4; }
<a name="l00827"></a>00827 numClockwiseTurns = (numClockwiseTurns % 4);
<a name="l00828"></a>00828
<a name="l00829"></a>00829 <span class="comment">/* if it's even, our new width will be the same as the source surface */</span>
<a name="l00830"></a>00830 newWidth = (numClockwiseTurns % 2) ? (src->h) : (src->w);
<a name="l00831"></a>00831 newHeight = (numClockwiseTurns % 2) ? (src->w) : (src->h);
<a name="l00832"></a>00832 dst = SDL_CreateRGBSurface( src->flags, newWidth, newHeight, src->format->BitsPerPixel,
<a name="l00833"></a>00833 src->format->Rmask,
<a name="l00834"></a>00834 src->format->Gmask,
<a name="l00835"></a>00835 src->format->Bmask,
<a name="l00836"></a>00836 src->format->Amask);
<a name="l00837"></a>00837 <span class="keywordflow">if</span>(!dst) {
<a name="l00838"></a>00838 <span class="keywordflow">return</span> NULL;
<a name="l00839"></a>00839 }
<a name="l00840"></a>00840
<a name="l00841"></a>00841 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) {
<a name="l00842"></a>00842 SDL_LockSurface(dst);
<a name="l00843"></a>00843 }
<a name="l00844"></a>00844 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) {
<a name="l00845"></a>00845 SDL_LockSurface(dst);
<a name="l00846"></a>00846 }
<a name="l00847"></a>00847
<a name="l00848"></a>00848 <span class="comment">/* Calculate int-per-row */</span>
<a name="l00849"></a>00849 bpp = src->format->BitsPerPixel / 8;
<a name="l00850"></a>00850 src_ipr = src->pitch / bpp;
<a name="l00851"></a>00851 dst_ipr = dst->pitch / bpp;
<a name="l00852"></a>00852
<a name="l00853"></a>00853 <span class="keywordflow">switch</span>(numClockwiseTurns) {
<a name="l00854"></a>00854 <span class="keywordflow">case</span> 0: <span class="comment">/* Make a copy of the surface */</span>
<a name="l00855"></a>00855 {
<a name="l00856"></a>00856 <span class="comment">/* Unfortunately SDL_BlitSurface cannot be used to make a copy of the surface</span>
<a name="l00857"></a>00857 <span class="comment"> since it does not preserve alpha. */</span>
<a name="l00858"></a>00858
<a name="l00859"></a>00859 <span class="keywordflow">if</span> (src->pitch == dst->pitch) {
<a name="l00860"></a>00860 <span class="comment">/* If the pitch is the same for both surfaces, the memory can be copied all at once. */</span>
<a name="l00861"></a>00861 memcpy(dst->pixels, src->pixels, (src->h * src->pitch));
<a name="l00862"></a>00862 }
<a name="l00863"></a>00863 <span class="keywordflow">else</span>
<a name="l00864"></a>00864 {
<a name="l00865"></a>00865 <span class="comment">/* If the pitch differs, copy each row separately */</span>
<a name="l00866"></a>00866 srcBuf = (Uint32*)(src->pixels);
<a name="l00867"></a>00867 dstBuf = (Uint32*)(dst->pixels);
<a name="l00868"></a>00868 <span class="keywordflow">for</span> (row = 0; row < src->h; row++) {
<a name="l00869"></a>00869 memcpy(dstBuf, srcBuf, dst->w * bpp);
<a name="l00870"></a>00870 srcBuf += src_ipr;
<a name="l00871"></a>00871 dstBuf += dst_ipr;
<a name="l00872"></a>00872 } <span class="comment">/* end for(col) */</span>
<a name="l00873"></a>00873 } <span class="comment">/* end for(row) */</span>
<a name="l00874"></a>00874 }
<a name="l00875"></a>00875 <span class="keywordflow">break</span>;
<a name="l00876"></a>00876
<a name="l00877"></a>00877 <span class="comment">/* rotate clockwise */</span>
<a name="l00878"></a>00878 <span class="keywordflow">case</span> 1: <span class="comment">/* rotated 90 degrees clockwise */</span>
<a name="l00879"></a>00879 {
<a name="l00880"></a>00880 <span class="keywordflow">for</span> (row = 0; row < src->h; ++row) {
<a name="l00881"></a>00881 srcBuf = (Uint32*)(src->pixels) + (row * src_ipr);
<a name="l00882"></a>00882 dstBuf = (Uint32*)(dst->pixels) + (dst->w - row - 1);
<a name="l00883"></a>00883 <span class="keywordflow">for</span> (col = 0; col < src->w; ++col) {
<a name="l00884"></a>00884 *dstBuf = *srcBuf;
<a name="l00885"></a>00885 ++srcBuf;
<a name="l00886"></a>00886 dstBuf += dst_ipr;
<a name="l00887"></a>00887 }
<a name="l00888"></a>00888 <span class="comment">/* end for(col) */</span>
<a name="l00889"></a>00889 }
<a name="l00890"></a>00890 <span class="comment">/* end for(row) */</span>
<a name="l00891"></a>00891 }
<a name="l00892"></a>00892 <span class="keywordflow">break</span>;
<a name="l00893"></a>00893
<a name="l00894"></a>00894 <span class="keywordflow">case</span> 2: <span class="comment">/* rotated 180 degrees clockwise */</span>
<a name="l00895"></a>00895 {
<a name="l00896"></a>00896 <span class="keywordflow">for</span> (row = 0; row < src->h; ++row) {
<a name="l00897"></a>00897 srcBuf = (Uint32*)(src->pixels) + (row * src_ipr);
<a name="l00898"></a>00898 dstBuf = (Uint32*)(dst->pixels) + ((dst->h - row - 1) * dst_ipr) + (dst->w - 1);
<a name="l00899"></a>00899 <span class="keywordflow">for</span> (col = 0; col < src->w; ++col) {
<a name="l00900"></a>00900 *dstBuf = *srcBuf;
<a name="l00901"></a>00901 ++srcBuf;
<a name="l00902"></a>00902 --dstBuf;
<a name="l00903"></a>00903 }
<a name="l00904"></a>00904 }
<a name="l00905"></a>00905 }
<a name="l00906"></a>00906 <span class="keywordflow">break</span>;
<a name="l00907"></a>00907
<a name="l00908"></a>00908 <span class="keywordflow">case</span> 3:
<a name="l00909"></a>00909 {
<a name="l00910"></a>00910 <span class="keywordflow">for</span> (row = 0; row < src->h; ++row) {
<a name="l00911"></a>00911 srcBuf = (Uint32*)(src->pixels) + (row * src_ipr);
<a name="l00912"></a>00912 dstBuf = (Uint32*)(dst->pixels) + row + ((dst->h - 1) * dst_ipr);
<a name="l00913"></a>00913 <span class="keywordflow">for</span> (col = 0; col < src->w; ++col) {
<a name="l00914"></a>00914 *dstBuf = *srcBuf;
<a name="l00915"></a>00915 ++srcBuf;
<a name="l00916"></a>00916 dstBuf -= dst_ipr;
<a name="l00917"></a>00917 }
<a name="l00918"></a>00918 }
<a name="l00919"></a>00919 }
<a name="l00920"></a>00920 <span class="keywordflow">break</span>;
<a name="l00921"></a>00921 }
<a name="l00922"></a>00922 <span class="comment">/* end switch */</span>
<a name="l00923"></a>00923
<a name="l00924"></a>00924 <span class="keywordflow">if</span> (SDL_MUSTLOCK(src)) {
<a name="l00925"></a>00925 SDL_UnlockSurface(src);
<a name="l00926"></a>00926 }
<a name="l00927"></a>00927 <span class="keywordflow">if</span> (SDL_MUSTLOCK(dst)) {
<a name="l00928"></a>00928 SDL_UnlockSurface(dst);
<a name="l00929"></a>00929 }
<a name="l00930"></a>00930
<a name="l00931"></a>00931 <span class="keywordflow">return</span> dst;
<a name="l00932"></a>00932 }
<a name="l00933"></a>00933
<a name="l00934"></a>00934
<a name="l00949"></a><a class="code" href="_s_d_l__rotozoom_8c.html#af48638a298820d4d1dd24a13896963d8">00949</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__rotozoom_8c.html#af48638a298820d4d1dd24a13896963d8" title="Internal target surface sizing function for rotozooms with trig result return.">_rotozoomSurfaceSizeTrig</a>(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <span class="keywordtype">double</span> angle, <span class="keywordtype">double</span> zoomx, <span class="keywordtype">double</span> zoomy,
<a name="l00950"></a>00950 <span class="keywordtype">int</span> *dstwidth, <span class="keywordtype">int</span> *dstheight,
<a name="l00951"></a>00951 <span class="keywordtype">double</span> *canglezoom, <span class="keywordtype">double</span> *sanglezoom)
<a name="l00952"></a>00952 {
<a name="l00953"></a>00953 <span class="keywordtype">double</span> x, y, cx, cy, sx, sy;
<a name="l00954"></a>00954 <span class="keywordtype">double</span> radangle;
<a name="l00955"></a>00955 <span class="keywordtype">int</span> dstwidthhalf, dstheighthalf;
<a name="l00956"></a>00956
<a name="l00957"></a>00957 <span class="comment">/*</span>
<a name="l00958"></a>00958 <span class="comment"> * Determine destination width and height by rotating a centered source box </span>
<a name="l00959"></a>00959 <span class="comment"> */</span>
<a name="l00960"></a>00960 radangle = angle * (<a class="code" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a> / 180.0);
<a name="l00961"></a>00961 *sanglezoom = sin(radangle);
<a name="l00962"></a>00962 *canglezoom = cos(radangle);
<a name="l00963"></a>00963 *sanglezoom *= zoomx;
<a name="l00964"></a>00964 *canglezoom *= zoomx;
<a name="l00965"></a>00965 x = (double)(width / 2);
<a name="l00966"></a>00966 y = (double)(height / 2);
<a name="l00967"></a>00967 cx = *canglezoom * x;
<a name="l00968"></a>00968 cy = *canglezoom * y;
<a name="l00969"></a>00969 sx = *sanglezoom * x;
<a name="l00970"></a>00970 sy = *sanglezoom * y;
<a name="l00971"></a>00971
<a name="l00972"></a>00972 dstwidthhalf = <a class="code" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f" title="Returns maximum of two numbers a and b.">MAX</a>((<span class="keywordtype">int</span>)
<a name="l00973"></a>00973 ceil(<a class="code" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f" title="Returns maximum of two numbers a and b.">MAX</a>(<a class="code" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f" title="Returns maximum of two numbers a and b.">MAX</a>(<a class="code" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f" title="Returns maximum of two numbers a and b.">MAX</a>(fabs(cx + sy), fabs(cx - sy)), fabs(-cx + sy)), fabs(-cx - sy))), 1);
<a name="l00974"></a>00974 dstheighthalf = <a class="code" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f" title="Returns maximum of two numbers a and b.">MAX</a>((<span class="keywordtype">int</span>)
<a name="l00975"></a>00975 ceil(<a class="code" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f" title="Returns maximum of two numbers a and b.">MAX</a>(<a class="code" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f" title="Returns maximum of two numbers a and b.">MAX</a>(<a class="code" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f" title="Returns maximum of two numbers a and b.">MAX</a>(fabs(sx + cy), fabs(sx - cy)), fabs(-sx + cy)), fabs(-sx - cy))), 1);
<a name="l00976"></a>00976 *dstwidth = 2 * dstwidthhalf;
<a name="l00977"></a>00977 *dstheight = 2 * dstheighthalf;
<a name="l00978"></a>00978 }
<a name="l00979"></a>00979
<a name="l00991"></a><a class="code" href="_s_d_l__rotozoom_8h.html#a612334fa642f672af953f544da6245d0">00991</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__rotozoom_8c.html#aee64992d26c818d9975610754d5c929b" title="Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.">rotozoomSurfaceSizeXY</a>(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <span class="keywordtype">double</span> angle, <span class="keywordtype">double</span> zoomx, <span class="keywordtype">double</span> zoomy, <span class="keywordtype">int</span> *dstwidth, <span class="keywordtype">int</span> *dstheight)
<a name="l00992"></a>00992 {
<a name="l00993"></a>00993 <span class="keywordtype">double</span> dummy_sanglezoom, dummy_canglezoom;
<a name="l00994"></a>00994
<a name="l00995"></a>00995 <a class="code" href="_s_d_l__rotozoom_8c.html#af48638a298820d4d1dd24a13896963d8" title="Internal target surface sizing function for rotozooms with trig result return.">_rotozoomSurfaceSizeTrig</a>(width, height, angle, zoomx, zoomy, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
<a name="l00996"></a>00996 }
<a name="l00997"></a>00997
<a name="l01008"></a><a class="code" href="_s_d_l__rotozoom_8h.html#a3ca2316375d6faf4f19b26c2f1f14bbc">01008</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__rotozoom_8c.html#a9886c783255edfd70a4974f8f3dd5a8c" title="Returns the size of the resulting target surface for a rotozoomSurface() call.">rotozoomSurfaceSize</a>(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <span class="keywordtype">double</span> angle, <span class="keywordtype">double</span> zoom, <span class="keywordtype">int</span> *dstwidth, <span class="keywordtype">int</span> *dstheight)
<a name="l01009"></a>01009 {
<a name="l01010"></a>01010 <span class="keywordtype">double</span> dummy_sanglezoom, dummy_canglezoom;
<a name="l01011"></a>01011
<a name="l01012"></a>01012 <a class="code" href="_s_d_l__rotozoom_8c.html#af48638a298820d4d1dd24a13896963d8" title="Internal target surface sizing function for rotozooms with trig result return.">_rotozoomSurfaceSizeTrig</a>(width, height, angle, zoom, zoom, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
<a name="l01013"></a>01013 }
<a name="l01014"></a>01014
<a name="l01030"></a><a class="code" href="_s_d_l__rotozoom_8h.html#a3cb0c11d5edc929579c807dc7612348c">01030</a> SDL_Surface *<a class="code" href="_s_d_l__rotozoom_8c.html#a5f64ed53eeee5f2667971c857698d1e5" title="Rotates and zooms a surface and optional anti-aliasing.">rotozoomSurface</a>(SDL_Surface * src, <span class="keywordtype">double</span> angle, <span class="keywordtype">double</span> zoom, <span class="keywordtype">int</span> smooth)
<a name="l01031"></a>01031 {
<a name="l01032"></a>01032 <span class="keywordflow">return</span> <a class="code" href="_s_d_l__rotozoom_8c.html#aab98b5b0da4ea468bacf47f7b85f0ee2" title="Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-...">rotozoomSurfaceXY</a>(src, angle, zoom, zoom, smooth);
<a name="l01033"></a>01033 }
<a name="l01034"></a>01034
<a name="l01051"></a><a class="code" href="_s_d_l__rotozoom_8h.html#a454d4234a45eab6ec238a40cc44051d4">01051</a> SDL_Surface *<a class="code" href="_s_d_l__rotozoom_8c.html#aab98b5b0da4ea468bacf47f7b85f0ee2" title="Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-...">rotozoomSurfaceXY</a>(SDL_Surface * src, <span class="keywordtype">double</span> angle, <span class="keywordtype">double</span> zoomx, <span class="keywordtype">double</span> zoomy, <span class="keywordtype">int</span> smooth)
<a name="l01052"></a>01052 {
<a name="l01053"></a>01053 SDL_Surface *rz_src;
<a name="l01054"></a>01054 SDL_Surface *rz_dst;
<a name="l01055"></a>01055 <span class="keywordtype">double</span> zoominv;
<a name="l01056"></a>01056 <span class="keywordtype">double</span> sanglezoom, canglezoom, sanglezoominv, canglezoominv;
<a name="l01057"></a>01057 <span class="keywordtype">int</span> dstwidthhalf, dstwidth, dstheighthalf, dstheight;
<a name="l01058"></a>01058 <span class="keywordtype">int</span> is32bit;
<a name="l01059"></a>01059 <span class="keywordtype">int</span> i, src_converted;
<a name="l01060"></a>01060 <span class="keywordtype">int</span> flipx,flipy;
<a name="l01061"></a>01061 Uint8 r,g,b;
<a name="l01062"></a>01062 Uint32 colorkey = 0;
<a name="l01063"></a>01063 <span class="keywordtype">int</span> colorKeyAvailable = 0;
<a name="l01064"></a>01064
<a name="l01065"></a>01065 <span class="comment">/*</span>
<a name="l01066"></a>01066 <span class="comment"> * Sanity check </span>
<a name="l01067"></a>01067 <span class="comment"> */</span>
<a name="l01068"></a>01068 <span class="keywordflow">if</span> (src == NULL)
<a name="l01069"></a>01069 <span class="keywordflow">return</span> (NULL);
<a name="l01070"></a>01070
<a name="l01071"></a>01071 <span class="keywordflow">if</span> (src->flags & SDL_SRCCOLORKEY)
<a name="l01072"></a>01072 {
<a name="l01073"></a>01073 colorkey = <a class="code" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce" title="Returns colorkey info for a surface.">_colorkey</a>(src);
<a name="l01074"></a>01074 SDL_GetRGB(colorkey, src->format, &r, &g, &b);
<a name="l01075"></a>01075 colorKeyAvailable = 1;
<a name="l01076"></a>01076 }
<a name="l01077"></a>01077 <span class="comment">/*</span>
<a name="l01078"></a>01078 <span class="comment"> * Determine if source surface is 32bit or 8bit </span>
<a name="l01079"></a>01079 <span class="comment"> */</span>
<a name="l01080"></a>01080 is32bit = (src->format->BitsPerPixel == 32);
<a name="l01081"></a>01081 <span class="keywordflow">if</span> ((is32bit) || (src->format->BitsPerPixel == 8)) {
<a name="l01082"></a>01082 <span class="comment">/*</span>
<a name="l01083"></a>01083 <span class="comment"> * Use source surface 'as is' </span>
<a name="l01084"></a>01084 <span class="comment"> */</span>
<a name="l01085"></a>01085 rz_src = src;
<a name="l01086"></a>01086 src_converted = 0;
<a name="l01087"></a>01087 } <span class="keywordflow">else</span> {
<a name="l01088"></a>01088 <span class="comment">/*</span>
<a name="l01089"></a>01089 <span class="comment"> * New source surface is 32bit with a defined RGBA ordering </span>
<a name="l01090"></a>01090 <span class="comment"> */</span>
<a name="l01091"></a>01091 rz_src =
<a name="l01092"></a>01092 SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32,
<a name="l01093"></a>01093 #<span class="keywordflow">if</span> SDL_BYTEORDER == SDL_LIL_ENDIAN
<a name="l01094"></a>01094 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
<a name="l01095"></a>01095 #<span class="keywordflow">else</span>
<a name="l01096"></a>01096 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
<a name="l01097"></a>01097 #endif
<a name="l01098"></a>01098 );
<a name="l01099"></a>01099 <span class="keywordflow">if</span>(colorKeyAvailable)
<a name="l01100"></a>01100 SDL_SetColorKey(src, 0, 0);
<a name="l01101"></a>01101
<a name="l01102"></a>01102 SDL_BlitSurface(src, NULL, rz_src, NULL);
<a name="l01103"></a>01103
<a name="l01104"></a>01104 <span class="keywordflow">if</span>(colorKeyAvailable)
<a name="l01105"></a>01105 SDL_SetColorKey(src, SDL_SRCCOLORKEY, colorkey);
<a name="l01106"></a>01106 src_converted = 1;
<a name="l01107"></a>01107 is32bit = 1;
<a name="l01108"></a>01108 }
<a name="l01109"></a>01109
<a name="l01110"></a>01110 <span class="comment">/*</span>
<a name="l01111"></a>01111 <span class="comment"> * Sanity check zoom factor </span>
<a name="l01112"></a>01112 <span class="comment"> */</span>
<a name="l01113"></a>01113 flipx = (zoomx<0.0);
<a name="l01114"></a>01114 <span class="keywordflow">if</span> (flipx) zoomx=-zoomx;
<a name="l01115"></a>01115 flipy = (zoomy<0.0);
<a name="l01116"></a>01116 <span class="keywordflow">if</span> (flipy) zoomy=-zoomy;
<a name="l01117"></a>01117 <span class="keywordflow">if</span> (zoomx < <a class="code" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9" title="Lower limit of absolute zoom factor or rotation degrees.">VALUE_LIMIT</a>) zoomx = <a class="code" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9" title="Lower limit of absolute zoom factor or rotation degrees.">VALUE_LIMIT</a>;
<a name="l01118"></a>01118 <span class="keywordflow">if</span> (zoomy < <a class="code" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9" title="Lower limit of absolute zoom factor or rotation degrees.">VALUE_LIMIT</a>) zoomy = <a class="code" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9" title="Lower limit of absolute zoom factor or rotation degrees.">VALUE_LIMIT</a>;
<a name="l01119"></a>01119 zoominv = 65536.0 / (zoomx * zoomx);
<a name="l01120"></a>01120
<a name="l01121"></a>01121 <span class="comment">/*</span>
<a name="l01122"></a>01122 <span class="comment"> * Check if we have a rotozoom or just a zoom </span>
<a name="l01123"></a>01123 <span class="comment"> */</span>
<a name="l01124"></a>01124 <span class="keywordflow">if</span> (fabs(angle) > <a class="code" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9" title="Lower limit of absolute zoom factor or rotation degrees.">VALUE_LIMIT</a>) {
<a name="l01125"></a>01125
<a name="l01126"></a>01126 <span class="comment">/*</span>
<a name="l01127"></a>01127 <span class="comment"> * Angle!=0: full rotozoom </span>
<a name="l01128"></a>01128 <span class="comment"> */</span>
<a name="l01129"></a>01129 <span class="comment">/*</span>
<a name="l01130"></a>01130 <span class="comment"> * ----------------------- </span>
<a name="l01131"></a>01131 <span class="comment"> */</span>
<a name="l01132"></a>01132
<a name="l01133"></a>01133 <span class="comment">/* Determine target size */</span>
<a name="l01134"></a>01134 <a class="code" href="_s_d_l__rotozoom_8c.html#af48638a298820d4d1dd24a13896963d8" title="Internal target surface sizing function for rotozooms with trig result return.">_rotozoomSurfaceSizeTrig</a>(rz_src->w, rz_src->h, angle, zoomx, zoomy, &dstwidth, &dstheight, &canglezoom, &sanglezoom);
<a name="l01135"></a>01135
<a name="l01136"></a>01136 <span class="comment">/*</span>
<a name="l01137"></a>01137 <span class="comment"> * Calculate target factors from sin/cos and zoom </span>
<a name="l01138"></a>01138 <span class="comment"> */</span>
<a name="l01139"></a>01139 sanglezoominv = sanglezoom;
<a name="l01140"></a>01140 canglezoominv = canglezoom;
<a name="l01141"></a>01141 sanglezoominv *= zoominv;
<a name="l01142"></a>01142 canglezoominv *= zoominv;
<a name="l01143"></a>01143
<a name="l01144"></a>01144 <span class="comment">/* Calculate half size */</span>
<a name="l01145"></a>01145 dstwidthhalf = dstwidth / 2;
<a name="l01146"></a>01146 dstheighthalf = dstheight / 2;
<a name="l01147"></a>01147
<a name="l01148"></a>01148 <span class="comment">/*</span>
<a name="l01149"></a>01149 <span class="comment"> * Alloc space to completely contain the rotated surface </span>
<a name="l01150"></a>01150 <span class="comment"> */</span>
<a name="l01151"></a>01151 rz_dst = NULL;
<a name="l01152"></a>01152 <span class="keywordflow">if</span> (is32bit) {
<a name="l01153"></a>01153 <span class="comment">/*</span>
<a name="l01154"></a>01154 <span class="comment"> * Target surface is 32bit with source RGBA/ABGR ordering </span>
<a name="l01155"></a>01155 <span class="comment"> */</span>
<a name="l01156"></a>01156 rz_dst =
<a name="l01157"></a>01157 SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + <a class="code" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb" title="Number of guard rows added to destination surfaces.">GUARD_ROWS</a>, 32,
<a name="l01158"></a>01158 rz_src->format->Rmask, rz_src->format->Gmask,
<a name="l01159"></a>01159 rz_src->format->Bmask, rz_src->format->Amask);
<a name="l01160"></a>01160 } <span class="keywordflow">else</span> {
<a name="l01161"></a>01161 <span class="comment">/*</span>
<a name="l01162"></a>01162 <span class="comment"> * Target surface is 8bit </span>
<a name="l01163"></a>01163 <span class="comment"> */</span>
<a name="l01164"></a>01164 rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + <a class="code" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb" title="Number of guard rows added to destination surfaces.">GUARD_ROWS</a>, 8, 0, 0, 0, 0);
<a name="l01165"></a>01165 }
<a name="l01166"></a>01166
<a name="l01167"></a>01167 <span class="comment">/* Check target */</span>
<a name="l01168"></a>01168 <span class="keywordflow">if</span> (rz_dst == NULL)
<a name="l01169"></a>01169 <span class="keywordflow">return</span> NULL;
<a name="l01170"></a>01170
<a name="l01171"></a>01171 <span class="comment">/* Adjust for guard rows */</span>
<a name="l01172"></a>01172 rz_dst->h = dstheight;
<a name="l01173"></a>01173
<a name="l01174"></a>01174 <span class="keywordflow">if</span> (colorKeyAvailable == 1){
<a name="l01175"></a>01175 colorkey = SDL_MapRGB(rz_dst->format, r, g, b);
<a name="l01176"></a>01176
<a name="l01177"></a>01177 SDL_FillRect(rz_dst, NULL, colorkey );
<a name="l01178"></a>01178 }
<a name="l01179"></a>01179
<a name="l01180"></a>01180 <span class="comment">/*</span>
<a name="l01181"></a>01181 <span class="comment"> * Lock source surface </span>
<a name="l01182"></a>01182 <span class="comment"> */</span>
<a name="l01183"></a>01183 <span class="keywordflow">if</span> (SDL_MUSTLOCK(rz_src)) {
<a name="l01184"></a>01184 SDL_LockSurface(rz_src);
<a name="l01185"></a>01185 }
<a name="l01186"></a>01186
<a name="l01187"></a>01187 <span class="comment">/*</span>
<a name="l01188"></a>01188 <span class="comment"> * Check which kind of surface we have </span>
<a name="l01189"></a>01189 <span class="comment"> */</span>
<a name="l01190"></a>01190 <span class="keywordflow">if</span> (is32bit) {
<a name="l01191"></a>01191 <span class="comment">/*</span>
<a name="l01192"></a>01192 <span class="comment"> * Call the 32bit transformation routine to do the rotation (using alpha) </span>
<a name="l01193"></a>01193 <span class="comment"> */</span>
<a name="l01194"></a>01194 <a class="code" href="_s_d_l__rotozoom_8c.html#aae634e7b5e6ec1622fec361ecbd0d1b7" title="Internal 32 bit rotozoomer with optional anti-aliasing.">_transformSurfaceRGBA</a>(rz_src, rz_dst, dstwidthhalf, dstheighthalf,
<a name="l01195"></a>01195 (<span class="keywordtype">int</span>) (sanglezoominv), (<span class="keywordtype">int</span>) (canglezoominv),
<a name="l01196"></a>01196 flipx, flipy,
<a name="l01197"></a>01197 smooth);
<a name="l01198"></a>01198 <span class="comment">/*</span>
<a name="l01199"></a>01199 <span class="comment"> * Turn on source-alpha support </span>
<a name="l01200"></a>01200 <span class="comment"> */</span>
<a name="l01201"></a>01201 SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
<a name="l01202"></a>01202 SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, <a class="code" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce" title="Returns colorkey info for a surface.">_colorkey</a>(rz_src));
<a name="l01203"></a>01203 } <span class="keywordflow">else</span> {
<a name="l01204"></a>01204 <span class="comment">/*</span>
<a name="l01205"></a>01205 <span class="comment"> * Copy palette and colorkey info </span>
<a name="l01206"></a>01206 <span class="comment"> */</span>
<a name="l01207"></a>01207 <span class="keywordflow">for</span> (i = 0; i < rz_src->format->palette->ncolors; i++) {
<a name="l01208"></a>01208 rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
<a name="l01209"></a>01209 }
<a name="l01210"></a>01210 rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
<a name="l01211"></a>01211 <span class="comment">/*</span>
<a name="l01212"></a>01212 <span class="comment"> * Call the 8bit transformation routine to do the rotation </span>
<a name="l01213"></a>01213 <span class="comment"> */</span>
<a name="l01214"></a>01214 <a class="code" href="_s_d_l__rotozoom_8c.html#a126e3b96b22cc18e78e33cc1f8eb6c3c" title="Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing.">transformSurfaceY</a>(rz_src, rz_dst, dstwidthhalf, dstheighthalf,
<a name="l01215"></a>01215 (<span class="keywordtype">int</span>) (sanglezoominv), (<span class="keywordtype">int</span>) (canglezoominv),
<a name="l01216"></a>01216 flipx, flipy);
<a name="l01217"></a>01217 SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, <a class="code" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce" title="Returns colorkey info for a surface.">_colorkey</a>(rz_src));
<a name="l01218"></a>01218 }
<a name="l01219"></a>01219 <span class="comment">/*</span>
<a name="l01220"></a>01220 <span class="comment"> * Unlock source surface </span>
<a name="l01221"></a>01221 <span class="comment"> */</span>
<a name="l01222"></a>01222 <span class="keywordflow">if</span> (SDL_MUSTLOCK(rz_src)) {
<a name="l01223"></a>01223 SDL_UnlockSurface(rz_src);
<a name="l01224"></a>01224 }
<a name="l01225"></a>01225
<a name="l01226"></a>01226 } <span class="keywordflow">else</span> {
<a name="l01227"></a>01227
<a name="l01228"></a>01228 <span class="comment">/*</span>
<a name="l01229"></a>01229 <span class="comment"> * Angle=0: Just a zoom </span>
<a name="l01230"></a>01230 <span class="comment"> */</span>
<a name="l01231"></a>01231 <span class="comment">/*</span>
<a name="l01232"></a>01232 <span class="comment"> * -------------------- </span>
<a name="l01233"></a>01233 <span class="comment"> */</span>
<a name="l01234"></a>01234
<a name="l01235"></a>01235 <span class="comment">/*</span>
<a name="l01236"></a>01236 <span class="comment"> * Calculate target size</span>
<a name="l01237"></a>01237 <span class="comment"> */</span>
<a name="l01238"></a>01238 <a class="code" href="_s_d_l__rotozoom_8c.html#a8ba40859c1a977dae87488dd8be1bf9a" title="Calculates the size of the target surface for a zoomSurface() call.">zoomSurfaceSize</a>(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight);
<a name="l01239"></a>01239
<a name="l01240"></a>01240 <span class="comment">/*</span>
<a name="l01241"></a>01241 <span class="comment"> * Alloc space to completely contain the zoomed surface </span>
<a name="l01242"></a>01242 <span class="comment"> */</span>
<a name="l01243"></a>01243 rz_dst = NULL;
<a name="l01244"></a>01244 <span class="keywordflow">if</span> (is32bit) {
<a name="l01245"></a>01245 <span class="comment">/*</span>
<a name="l01246"></a>01246 <span class="comment"> * Target surface is 32bit with source RGBA/ABGR ordering </span>
<a name="l01247"></a>01247 <span class="comment"> */</span>
<a name="l01248"></a>01248 rz_dst =
<a name="l01249"></a>01249 SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + <a class="code" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb" title="Number of guard rows added to destination surfaces.">GUARD_ROWS</a>, 32,
<a name="l01250"></a>01250 rz_src->format->Rmask, rz_src->format->Gmask,
<a name="l01251"></a>01251 rz_src->format->Bmask, rz_src->format->Amask);
<a name="l01252"></a>01252 } <span class="keywordflow">else</span> {
<a name="l01253"></a>01253 <span class="comment">/*</span>
<a name="l01254"></a>01254 <span class="comment"> * Target surface is 8bit </span>
<a name="l01255"></a>01255 <span class="comment"> */</span>
<a name="l01256"></a>01256 rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + <a class="code" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb" title="Number of guard rows added to destination surfaces.">GUARD_ROWS</a>, 8, 0, 0, 0, 0);
<a name="l01257"></a>01257 }
<a name="l01258"></a>01258
<a name="l01259"></a>01259 <span class="comment">/* Check target */</span>
<a name="l01260"></a>01260 <span class="keywordflow">if</span> (rz_dst == NULL)
<a name="l01261"></a>01261 <span class="keywordflow">return</span> NULL;
<a name="l01262"></a>01262
<a name="l01263"></a>01263 <span class="comment">/* Adjust for guard rows */</span>
<a name="l01264"></a>01264 rz_dst->h = dstheight;
<a name="l01265"></a>01265
<a name="l01266"></a>01266 <span class="keywordflow">if</span> (colorKeyAvailable == 1){
<a name="l01267"></a>01267 colorkey = SDL_MapRGB(rz_dst->format, r, g, b);
<a name="l01268"></a>01268
<a name="l01269"></a>01269 SDL_FillRect(rz_dst, NULL, colorkey );
<a name="l01270"></a>01270 }
<a name="l01271"></a>01271
<a name="l01272"></a>01272 <span class="comment">/*</span>
<a name="l01273"></a>01273 <span class="comment"> * Lock source surface </span>
<a name="l01274"></a>01274 <span class="comment"> */</span>
<a name="l01275"></a>01275 <span class="keywordflow">if</span> (SDL_MUSTLOCK(rz_src)) {
<a name="l01276"></a>01276 SDL_LockSurface(rz_src);
<a name="l01277"></a>01277 }
<a name="l01278"></a>01278
<a name="l01279"></a>01279 <span class="comment">/*</span>
<a name="l01280"></a>01280 <span class="comment"> * Check which kind of surface we have </span>
<a name="l01281"></a>01281 <span class="comment"> */</span>
<a name="l01282"></a>01282 <span class="keywordflow">if</span> (is32bit) {
<a name="l01283"></a>01283 <span class="comment">/*</span>
<a name="l01284"></a>01284 <span class="comment"> * Call the 32bit transformation routine to do the zooming (using alpha) </span>
<a name="l01285"></a>01285 <span class="comment"> */</span>
<a name="l01286"></a>01286 <a class="code" href="_s_d_l__rotozoom_8c.html#a9898b12bb565c4075c2da4db4891fd81" title="Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation.">_zoomSurfaceRGBA</a>(rz_src, rz_dst, flipx, flipy, smooth);
<a name="l01287"></a>01287
<a name="l01288"></a>01288 <span class="comment">/*</span>
<a name="l01289"></a>01289 <span class="comment"> * Turn on source-alpha support </span>
<a name="l01290"></a>01290 <span class="comment"> */</span>
<a name="l01291"></a>01291 SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
<a name="l01292"></a>01292 SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, <a class="code" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce" title="Returns colorkey info for a surface.">_colorkey</a>(rz_src));
<a name="l01293"></a>01293 } <span class="keywordflow">else</span> {
<a name="l01294"></a>01294 <span class="comment">/*</span>
<a name="l01295"></a>01295 <span class="comment"> * Copy palette and colorkey info </span>
<a name="l01296"></a>01296 <span class="comment"> */</span>
<a name="l01297"></a>01297 <span class="keywordflow">for</span> (i = 0; i < rz_src->format->palette->ncolors; i++) {
<a name="l01298"></a>01298 rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
<a name="l01299"></a>01299 }
<a name="l01300"></a>01300 rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
<a name="l01301"></a>01301
<a name="l01302"></a>01302 <span class="comment">/*</span>
<a name="l01303"></a>01303 <span class="comment"> * Call the 8bit transformation routine to do the zooming </span>
<a name="l01304"></a>01304 <span class="comment"> */</span>
<a name="l01305"></a>01305 <a class="code" href="_s_d_l__rotozoom_8c.html#acfeb5a322cbb575f105f1762d9d21c29" title="Internal 8 bit Zoomer without smoothing.">_zoomSurfaceY</a>(rz_src, rz_dst, flipx, flipy);
<a name="l01306"></a>01306 SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, <a class="code" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce" title="Returns colorkey info for a surface.">_colorkey</a>(rz_src));
<a name="l01307"></a>01307 }
<a name="l01308"></a>01308
<a name="l01309"></a>01309 <span class="comment">/*</span>
<a name="l01310"></a>01310 <span class="comment"> * Unlock source surface </span>
<a name="l01311"></a>01311 <span class="comment"> */</span>
<a name="l01312"></a>01312 <span class="keywordflow">if</span> (SDL_MUSTLOCK(rz_src)) {
<a name="l01313"></a>01313 SDL_UnlockSurface(rz_src);
<a name="l01314"></a>01314 }
<a name="l01315"></a>01315 }
<a name="l01316"></a>01316
<a name="l01317"></a>01317 <span class="comment">/*</span>
<a name="l01318"></a>01318 <span class="comment"> * Cleanup temp surface </span>
<a name="l01319"></a>01319 <span class="comment"> */</span>
<a name="l01320"></a>01320 <span class="keywordflow">if</span> (src_converted) {
<a name="l01321"></a>01321 SDL_FreeSurface(rz_src);
<a name="l01322"></a>01322 }
<a name="l01323"></a>01323
<a name="l01324"></a>01324 <span class="comment">/*</span>
<a name="l01325"></a>01325 <span class="comment"> * Return destination surface </span>
<a name="l01326"></a>01326 <span class="comment"> */</span>
<a name="l01327"></a>01327 <span class="keywordflow">return</span> (rz_dst);
<a name="l01328"></a>01328 }
<a name="l01329"></a>01329
<a name="l01342"></a><a class="code" href="_s_d_l__rotozoom_8h.html#a7927e415d87ea7856794cd4cc77e0a25">01342</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__rotozoom_8c.html#a8ba40859c1a977dae87488dd8be1bf9a" title="Calculates the size of the target surface for a zoomSurface() call.">zoomSurfaceSize</a>(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <span class="keywordtype">double</span> zoomx, <span class="keywordtype">double</span> zoomy, <span class="keywordtype">int</span> *dstwidth, <span class="keywordtype">int</span> *dstheight)
<a name="l01343"></a>01343 {
<a name="l01344"></a>01344 <span class="comment">/*</span>
<a name="l01345"></a>01345 <span class="comment"> * Make zoom factors positive </span>
<a name="l01346"></a>01346 <span class="comment"> */</span>
<a name="l01347"></a>01347 <span class="keywordtype">int</span> flipx, flipy;
<a name="l01348"></a>01348 flipx = (zoomx<0.0);
<a name="l01349"></a>01349 <span class="keywordflow">if</span> (flipx) zoomx = -zoomx;
<a name="l01350"></a>01350 flipy = (zoomy<0.0);
<a name="l01351"></a>01351 <span class="keywordflow">if</span> (flipy) zoomy = -zoomy;
<a name="l01352"></a>01352
<a name="l01353"></a>01353 <span class="comment">/*</span>
<a name="l01354"></a>01354 <span class="comment"> * Sanity check zoom factors </span>
<a name="l01355"></a>01355 <span class="comment"> */</span>
<a name="l01356"></a>01356 <span class="keywordflow">if</span> (zoomx < <a class="code" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9" title="Lower limit of absolute zoom factor or rotation degrees.">VALUE_LIMIT</a>) {
<a name="l01357"></a>01357 zoomx = <a class="code" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9" title="Lower limit of absolute zoom factor or rotation degrees.">VALUE_LIMIT</a>;
<a name="l01358"></a>01358 }
<a name="l01359"></a>01359 <span class="keywordflow">if</span> (zoomy < <a class="code" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9" title="Lower limit of absolute zoom factor or rotation degrees.">VALUE_LIMIT</a>) {
<a name="l01360"></a>01360 zoomy = <a class="code" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9" title="Lower limit of absolute zoom factor or rotation degrees.">VALUE_LIMIT</a>;
<a name="l01361"></a>01361 }
<a name="l01362"></a>01362
<a name="l01363"></a>01363 <span class="comment">/*</span>
<a name="l01364"></a>01364 <span class="comment"> * Calculate target size </span>
<a name="l01365"></a>01365 <span class="comment"> */</span>
<a name="l01366"></a>01366 *dstwidth = (int) floor(((<span class="keywordtype">double</span>) width * zoomx) + 0.5);
<a name="l01367"></a>01367 *dstheight = (int) floor(((<span class="keywordtype">double</span>) height * zoomy) + 0.5);
<a name="l01368"></a>01368 <span class="keywordflow">if</span> (*dstwidth < 1) {
<a name="l01369"></a>01369 *dstwidth = 1;
<a name="l01370"></a>01370 }
<a name="l01371"></a>01371 <span class="keywordflow">if</span> (*dstheight < 1) {
<a name="l01372"></a>01372 *dstheight = 1;
<a name="l01373"></a>01373 }
<a name="l01374"></a>01374 }
<a name="l01375"></a>01375
<a name="l01392"></a><a class="code" href="_s_d_l__rotozoom_8h.html#a06c8108f8fe8de77cf841c176ee64850">01392</a> SDL_Surface *<a class="code" href="_s_d_l__rotozoom_8c.html#abdd772b2f6b1f26134e4e90cda657a21" title="Zoom a surface by independent horizontal and vertical factors with optional smoothing.">zoomSurface</a>(SDL_Surface * src, <span class="keywordtype">double</span> zoomx, <span class="keywordtype">double</span> zoomy, <span class="keywordtype">int</span> smooth)
<a name="l01393"></a>01393 {
<a name="l01394"></a>01394 SDL_Surface *rz_src;
<a name="l01395"></a>01395 SDL_Surface *rz_dst;
<a name="l01396"></a>01396 <span class="keywordtype">int</span> dstwidth, dstheight;
<a name="l01397"></a>01397 <span class="keywordtype">int</span> is32bit;
<a name="l01398"></a>01398 <span class="keywordtype">int</span> i, src_converted;
<a name="l01399"></a>01399 <span class="keywordtype">int</span> flipx, flipy;
<a name="l01400"></a>01400
<a name="l01401"></a>01401 <span class="comment">/*</span>
<a name="l01402"></a>01402 <span class="comment"> * Sanity check </span>
<a name="l01403"></a>01403 <span class="comment"> */</span>
<a name="l01404"></a>01404 <span class="keywordflow">if</span> (src == NULL)
<a name="l01405"></a>01405 <span class="keywordflow">return</span> (NULL);
<a name="l01406"></a>01406
<a name="l01407"></a>01407 <span class="comment">/*</span>
<a name="l01408"></a>01408 <span class="comment"> * Determine if source surface is 32bit or 8bit </span>
<a name="l01409"></a>01409 <span class="comment"> */</span>
<a name="l01410"></a>01410 is32bit = (src->format->BitsPerPixel == 32);
<a name="l01411"></a>01411 <span class="keywordflow">if</span> ((is32bit) || (src->format->BitsPerPixel == 8)) {
<a name="l01412"></a>01412 <span class="comment">/*</span>
<a name="l01413"></a>01413 <span class="comment"> * Use source surface 'as is' </span>
<a name="l01414"></a>01414 <span class="comment"> */</span>
<a name="l01415"></a>01415 rz_src = src;
<a name="l01416"></a>01416 src_converted = 0;
<a name="l01417"></a>01417 } <span class="keywordflow">else</span> {
<a name="l01418"></a>01418 <span class="comment">/*</span>
<a name="l01419"></a>01419 <span class="comment"> * New source surface is 32bit with a defined RGBA ordering </span>
<a name="l01420"></a>01420 <span class="comment"> */</span>
<a name="l01421"></a>01421 rz_src =
<a name="l01422"></a>01422 SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32,
<a name="l01423"></a>01423 #<span class="keywordflow">if</span> SDL_BYTEORDER == SDL_LIL_ENDIAN
<a name="l01424"></a>01424 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
<a name="l01425"></a>01425 #<span class="keywordflow">else</span>
<a name="l01426"></a>01426 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
<a name="l01427"></a>01427 #endif
<a name="l01428"></a>01428 );
<a name="l01429"></a>01429 <span class="keywordflow">if</span> (rz_src == NULL) {
<a name="l01430"></a>01430 <span class="keywordflow">return</span> NULL;
<a name="l01431"></a>01431 }
<a name="l01432"></a>01432 SDL_BlitSurface(src, NULL, rz_src, NULL);
<a name="l01433"></a>01433 src_converted = 1;
<a name="l01434"></a>01434 is32bit = 1;
<a name="l01435"></a>01435 }
<a name="l01436"></a>01436
<a name="l01437"></a>01437 flipx = (zoomx<0.0);
<a name="l01438"></a>01438 <span class="keywordflow">if</span> (flipx) zoomx = -zoomx;
<a name="l01439"></a>01439 flipy = (zoomy<0.0);
<a name="l01440"></a>01440 <span class="keywordflow">if</span> (flipy) zoomy = -zoomy;
<a name="l01441"></a>01441
<a name="l01442"></a>01442 <span class="comment">/* Get size if target */</span>
<a name="l01443"></a>01443 <a class="code" href="_s_d_l__rotozoom_8c.html#a8ba40859c1a977dae87488dd8be1bf9a" title="Calculates the size of the target surface for a zoomSurface() call.">zoomSurfaceSize</a>(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight);
<a name="l01444"></a>01444
<a name="l01445"></a>01445 <span class="comment">/*</span>
<a name="l01446"></a>01446 <span class="comment"> * Alloc space to completely contain the zoomed surface </span>
<a name="l01447"></a>01447 <span class="comment"> */</span>
<a name="l01448"></a>01448 rz_dst = NULL;
<a name="l01449"></a>01449 <span class="keywordflow">if</span> (is32bit) {
<a name="l01450"></a>01450 <span class="comment">/*</span>
<a name="l01451"></a>01451 <span class="comment"> * Target surface is 32bit with source RGBA/ABGR ordering </span>
<a name="l01452"></a>01452 <span class="comment"> */</span>
<a name="l01453"></a>01453 rz_dst =
<a name="l01454"></a>01454 SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + <a class="code" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb" title="Number of guard rows added to destination surfaces.">GUARD_ROWS</a>, 32,
<a name="l01455"></a>01455 rz_src->format->Rmask, rz_src->format->Gmask,
<a name="l01456"></a>01456 rz_src->format->Bmask, rz_src->format->Amask);
<a name="l01457"></a>01457 } <span class="keywordflow">else</span> {
<a name="l01458"></a>01458 <span class="comment">/*</span>
<a name="l01459"></a>01459 <span class="comment"> * Target surface is 8bit </span>
<a name="l01460"></a>01460 <span class="comment"> */</span>
<a name="l01461"></a>01461 rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + <a class="code" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb" title="Number of guard rows added to destination surfaces.">GUARD_ROWS</a>, 8, 0, 0, 0, 0);
<a name="l01462"></a>01462 }
<a name="l01463"></a>01463
<a name="l01464"></a>01464 <span class="comment">/* Check target */</span>
<a name="l01465"></a>01465 <span class="keywordflow">if</span> (rz_dst == NULL) {
<a name="l01466"></a>01466 <span class="comment">/*</span>
<a name="l01467"></a>01467 <span class="comment"> * Cleanup temp surface </span>
<a name="l01468"></a>01468 <span class="comment"> */</span>
<a name="l01469"></a>01469 <span class="keywordflow">if</span> (src_converted) {
<a name="l01470"></a>01470 SDL_FreeSurface(rz_src);
<a name="l01471"></a>01471 }
<a name="l01472"></a>01472 <span class="keywordflow">return</span> NULL;
<a name="l01473"></a>01473 }
<a name="l01474"></a>01474
<a name="l01475"></a>01475 <span class="comment">/* Adjust for guard rows */</span>
<a name="l01476"></a>01476 rz_dst->h = dstheight;
<a name="l01477"></a>01477
<a name="l01478"></a>01478 <span class="comment">/*</span>
<a name="l01479"></a>01479 <span class="comment"> * Lock source surface </span>
<a name="l01480"></a>01480 <span class="comment"> */</span>
<a name="l01481"></a>01481 <span class="keywordflow">if</span> (SDL_MUSTLOCK(rz_src)) {
<a name="l01482"></a>01482 SDL_LockSurface(rz_src);
<a name="l01483"></a>01483 }
<a name="l01484"></a>01484
<a name="l01485"></a>01485 <span class="comment">/*</span>
<a name="l01486"></a>01486 <span class="comment"> * Check which kind of surface we have </span>
<a name="l01487"></a>01487 <span class="comment"> */</span>
<a name="l01488"></a>01488 <span class="keywordflow">if</span> (is32bit) {
<a name="l01489"></a>01489 <span class="comment">/*</span>
<a name="l01490"></a>01490 <span class="comment"> * Call the 32bit transformation routine to do the zooming (using alpha) </span>
<a name="l01491"></a>01491 <span class="comment"> */</span>
<a name="l01492"></a>01492 <a class="code" href="_s_d_l__rotozoom_8c.html#a9898b12bb565c4075c2da4db4891fd81" title="Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation.">_zoomSurfaceRGBA</a>(rz_src, rz_dst, flipx, flipy, smooth);
<a name="l01493"></a>01493 <span class="comment">/*</span>
<a name="l01494"></a>01494 <span class="comment"> * Turn on source-alpha support </span>
<a name="l01495"></a>01495 <span class="comment"> */</span>
<a name="l01496"></a>01496 SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
<a name="l01497"></a>01497 } <span class="keywordflow">else</span> {
<a name="l01498"></a>01498 <span class="comment">/*</span>
<a name="l01499"></a>01499 <span class="comment"> * Copy palette and colorkey info </span>
<a name="l01500"></a>01500 <span class="comment"> */</span>
<a name="l01501"></a>01501 <span class="keywordflow">for</span> (i = 0; i < rz_src->format->palette->ncolors; i++) {
<a name="l01502"></a>01502 rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
<a name="l01503"></a>01503 }
<a name="l01504"></a>01504 rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
<a name="l01505"></a>01505 <span class="comment">/*</span>
<a name="l01506"></a>01506 <span class="comment"> * Call the 8bit transformation routine to do the zooming </span>
<a name="l01507"></a>01507 <span class="comment"> */</span>
<a name="l01508"></a>01508 <a class="code" href="_s_d_l__rotozoom_8c.html#acfeb5a322cbb575f105f1762d9d21c29" title="Internal 8 bit Zoomer without smoothing.">_zoomSurfaceY</a>(rz_src, rz_dst, flipx, flipy);
<a name="l01509"></a>01509 SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, <a class="code" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce" title="Returns colorkey info for a surface.">_colorkey</a>(rz_src));
<a name="l01510"></a>01510 }
<a name="l01511"></a>01511 <span class="comment">/*</span>
<a name="l01512"></a>01512 <span class="comment"> * Unlock source surface </span>
<a name="l01513"></a>01513 <span class="comment"> */</span>
<a name="l01514"></a>01514 <span class="keywordflow">if</span> (SDL_MUSTLOCK(rz_src)) {
<a name="l01515"></a>01515 SDL_UnlockSurface(rz_src);
<a name="l01516"></a>01516 }
<a name="l01517"></a>01517
<a name="l01518"></a>01518 <span class="comment">/*</span>
<a name="l01519"></a>01519 <span class="comment"> * Cleanup temp surface </span>
<a name="l01520"></a>01520 <span class="comment"> */</span>
<a name="l01521"></a>01521 <span class="keywordflow">if</span> (src_converted) {
<a name="l01522"></a>01522 SDL_FreeSurface(rz_src);
<a name="l01523"></a>01523 }
<a name="l01524"></a>01524
<a name="l01525"></a>01525 <span class="comment">/*</span>
<a name="l01526"></a>01526 <span class="comment"> * Return destination surface </span>
<a name="l01527"></a>01527 <span class="comment"> */</span>
<a name="l01528"></a>01528 <span class="keywordflow">return</span> (rz_dst);
<a name="l01529"></a>01529 }
<a name="l01530"></a>01530
<a name="l01547"></a>01547 <span class="comment">/*@null@*/</span>
<a name="l01548"></a><a class="code" href="_s_d_l__rotozoom_8h.html#a7a7ac2cc0d79d282b5a4c76143b7e7a9">01548</a> SDL_Surface *<a class="code" href="_s_d_l__rotozoom_8c.html#aad3bf0cd89cc39ff874ffa778fa1495d" title="Shrink a surface by an integer ratio using averaging.">shrinkSurface</a>(SDL_Surface *src, <span class="keywordtype">int</span> factorx, <span class="keywordtype">int</span> factory)
<a name="l01549"></a>01549 {
<a name="l01550"></a>01550 <span class="keywordtype">int</span> result;
<a name="l01551"></a>01551 SDL_Surface *rz_src;
<a name="l01552"></a>01552 SDL_Surface *rz_dst = NULL;
<a name="l01553"></a>01553 <span class="keywordtype">int</span> dstwidth, dstheight;
<a name="l01554"></a>01554 <span class="keywordtype">int</span> is32bit;
<a name="l01555"></a>01555 <span class="keywordtype">int</span> i, src_converted;
<a name="l01556"></a>01556 <span class="keywordtype">int</span> haveError = 0;
<a name="l01557"></a>01557
<a name="l01558"></a>01558 <span class="comment">/*</span>
<a name="l01559"></a>01559 <span class="comment"> * Sanity check </span>
<a name="l01560"></a>01560 <span class="comment"> */</span>
<a name="l01561"></a>01561 <span class="keywordflow">if</span> (src == NULL) {
<a name="l01562"></a>01562 <span class="keywordflow">return</span> (NULL);
<a name="l01563"></a>01563 }
<a name="l01564"></a>01564
<a name="l01565"></a>01565 <span class="comment">/*</span>
<a name="l01566"></a>01566 <span class="comment"> * Determine if source surface is 32bit or 8bit </span>
<a name="l01567"></a>01567 <span class="comment"> */</span>
<a name="l01568"></a>01568 is32bit = (src->format->BitsPerPixel == 32);
<a name="l01569"></a>01569 <span class="keywordflow">if</span> ((is32bit) || (src->format->BitsPerPixel == 8)) {
<a name="l01570"></a>01570 <span class="comment">/*</span>
<a name="l01571"></a>01571 <span class="comment"> * Use source surface 'as is' </span>
<a name="l01572"></a>01572 <span class="comment"> */</span>
<a name="l01573"></a>01573 rz_src = src;
<a name="l01574"></a>01574 src_converted = 0;
<a name="l01575"></a>01575 } <span class="keywordflow">else</span> {
<a name="l01576"></a>01576 <span class="comment">/*</span>
<a name="l01577"></a>01577 <span class="comment"> * New source surface is 32bit with a defined RGBA ordering </span>
<a name="l01578"></a>01578 <span class="comment"> */</span>
<a name="l01579"></a>01579 rz_src = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32,
<a name="l01580"></a>01580 #<span class="keywordflow">if</span> SDL_BYTEORDER == SDL_LIL_ENDIAN
<a name="l01581"></a>01581 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
<a name="l01582"></a>01582 #<span class="keywordflow">else</span>
<a name="l01583"></a>01583 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
<a name="l01584"></a>01584 #endif
<a name="l01585"></a>01585 );
<a name="l01586"></a>01586 <span class="keywordflow">if</span> (rz_src==NULL) {
<a name="l01587"></a>01587 haveError = 1;
<a name="l01588"></a>01588 <span class="keywordflow">goto</span> exitShrinkSurface;
<a name="l01589"></a>01589 }
<a name="l01590"></a>01590
<a name="l01591"></a>01591 SDL_BlitSurface(src, NULL, rz_src, NULL);
<a name="l01592"></a>01592 src_converted = 1;
<a name="l01593"></a>01593 is32bit = 1;
<a name="l01594"></a>01594 }
<a name="l01595"></a>01595
<a name="l01596"></a>01596 <span class="comment">/*</span>
<a name="l01597"></a>01597 <span class="comment"> * Lock the surface </span>
<a name="l01598"></a>01598 <span class="comment"> */</span>
<a name="l01599"></a>01599 <span class="keywordflow">if</span> (SDL_MUSTLOCK(rz_src)) {
<a name="l01600"></a>01600 <span class="keywordflow">if</span> (SDL_LockSurface(rz_src) < 0) {
<a name="l01601"></a>01601 haveError = 1;
<a name="l01602"></a>01602 <span class="keywordflow">goto</span> exitShrinkSurface;
<a name="l01603"></a>01603 }
<a name="l01604"></a>01604 }
<a name="l01605"></a>01605
<a name="l01606"></a>01606 <span class="comment">/* Get size for target */</span>
<a name="l01607"></a>01607 dstwidth=rz_src->w/factorx;
<a name="l01608"></a>01608 <span class="keywordflow">while</span> (dstwidth*factorx>rz_src->w) { dstwidth--; }
<a name="l01609"></a>01609 dstheight=rz_src->h/factory;
<a name="l01610"></a>01610 <span class="keywordflow">while</span> (dstheight*factory>rz_src->h) { dstheight--; }
<a name="l01611"></a>01611
<a name="l01612"></a>01612 <span class="comment">/*</span>
<a name="l01613"></a>01613 <span class="comment"> * Alloc space to completely contain the shrunken surface</span>
<a name="l01614"></a>01614 <span class="comment"> * (with added guard rows)</span>
<a name="l01615"></a>01615 <span class="comment"> */</span>
<a name="l01616"></a>01616 <span class="keywordflow">if</span> (is32bit==1) {
<a name="l01617"></a>01617 <span class="comment">/*</span>
<a name="l01618"></a>01618 <span class="comment"> * Target surface is 32bit with source RGBA/ABGR ordering </span>
<a name="l01619"></a>01619 <span class="comment"> */</span>
<a name="l01620"></a>01620 rz_dst =
<a name="l01621"></a>01621 SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + <a class="code" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb" title="Number of guard rows added to destination surfaces.">GUARD_ROWS</a>, 32,
<a name="l01622"></a>01622 rz_src->format->Rmask, rz_src->format->Gmask,
<a name="l01623"></a>01623 rz_src->format->Bmask, rz_src->format->Amask);
<a name="l01624"></a>01624 } <span class="keywordflow">else</span> {
<a name="l01625"></a>01625 <span class="comment">/*</span>
<a name="l01626"></a>01626 <span class="comment"> * Target surface is 8bit </span>
<a name="l01627"></a>01627 <span class="comment"> */</span>
<a name="l01628"></a>01628 rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + <a class="code" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb" title="Number of guard rows added to destination surfaces.">GUARD_ROWS</a>, 8, 0, 0, 0, 0);
<a name="l01629"></a>01629 }
<a name="l01630"></a>01630
<a name="l01631"></a>01631 <span class="comment">/* Check target */</span>
<a name="l01632"></a>01632 <span class="keywordflow">if</span> (rz_dst == NULL) {
<a name="l01633"></a>01633 haveError = 1;
<a name="l01634"></a>01634 <span class="keywordflow">goto</span> exitShrinkSurface;
<a name="l01635"></a>01635 }
<a name="l01636"></a>01636
<a name="l01637"></a>01637 <span class="comment">/* Adjust for guard rows */</span>
<a name="l01638"></a>01638 rz_dst->h = dstheight;
<a name="l01639"></a>01639
<a name="l01640"></a>01640 <span class="comment">/*</span>
<a name="l01641"></a>01641 <span class="comment"> * Check which kind of surface we have </span>
<a name="l01642"></a>01642 <span class="comment"> */</span>
<a name="l01643"></a>01643 <span class="keywordflow">if</span> (is32bit==1) {
<a name="l01644"></a>01644 <span class="comment">/*</span>
<a name="l01645"></a>01645 <span class="comment"> * Call the 32bit transformation routine to do the shrinking (using alpha) </span>
<a name="l01646"></a>01646 <span class="comment"> */</span>
<a name="l01647"></a>01647 result = <a class="code" href="_s_d_l__rotozoom_8c.html#ac1bde824f44ae9a76930e9782b783512" title="Internal 32 bit integer-factor averaging Shrinker.">_shrinkSurfaceRGBA</a>(rz_src, rz_dst, factorx, factory);
<a name="l01648"></a>01648 <span class="keywordflow">if</span> ((result!=0) || (rz_dst==NULL)) {
<a name="l01649"></a>01649 haveError = 1;
<a name="l01650"></a>01650 <span class="keywordflow">goto</span> exitShrinkSurface;
<a name="l01651"></a>01651 }
<a name="l01652"></a>01652
<a name="l01653"></a>01653 <span class="comment">/*</span>
<a name="l01654"></a>01654 <span class="comment"> * Turn on source-alpha support </span>
<a name="l01655"></a>01655 <span class="comment"> */</span>
<a name="l01656"></a>01656 result = SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
<a name="l01657"></a>01657 <span class="keywordflow">if</span> (result!=0) {
<a name="l01658"></a>01658 haveError = 1;
<a name="l01659"></a>01659 <span class="keywordflow">goto</span> exitShrinkSurface;
<a name="l01660"></a>01660 }
<a name="l01661"></a>01661 } <span class="keywordflow">else</span> {
<a name="l01662"></a>01662 <span class="comment">/*</span>
<a name="l01663"></a>01663 <span class="comment"> * Copy palette and colorkey info </span>
<a name="l01664"></a>01664 <span class="comment"> */</span>
<a name="l01665"></a>01665 <span class="keywordflow">for</span> (i = 0; i < rz_src->format->palette->ncolors; i++) {
<a name="l01666"></a>01666 rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
<a name="l01667"></a>01667 }
<a name="l01668"></a>01668 rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
<a name="l01669"></a>01669 <span class="comment">/*</span>
<a name="l01670"></a>01670 <span class="comment"> * Call the 8bit transformation routine to do the shrinking </span>
<a name="l01671"></a>01671 <span class="comment"> */</span>
<a name="l01672"></a>01672 result = <a class="code" href="_s_d_l__rotozoom_8c.html#aadb38a61ab6727e5fd621b63418399be" title="Internal 8 bit integer-factor averaging shrinker.">_shrinkSurfaceY</a>(rz_src, rz_dst, factorx, factory);
<a name="l01673"></a>01673 <span class="keywordflow">if</span> (result!=0) {
<a name="l01674"></a>01674 haveError = 1;
<a name="l01675"></a>01675 <span class="keywordflow">goto</span> exitShrinkSurface;
<a name="l01676"></a>01676 }
<a name="l01677"></a>01677
<a name="l01678"></a>01678 <span class="comment">/*</span>
<a name="l01679"></a>01679 <span class="comment"> * Set colorkey on target</span>
<a name="l01680"></a>01680 <span class="comment"> */</span>
<a name="l01681"></a>01681 result = SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, <a class="code" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce" title="Returns colorkey info for a surface.">_colorkey</a>(rz_src));
<a name="l01682"></a>01682 <span class="keywordflow">if</span> (result!=0) {
<a name="l01683"></a>01683 haveError = 1;
<a name="l01684"></a>01684 <span class="keywordflow">goto</span> exitShrinkSurface;
<a name="l01685"></a>01685 }
<a name="l01686"></a>01686 }
<a name="l01687"></a>01687
<a name="l01688"></a>01688 exitShrinkSurface:
<a name="l01689"></a>01689 <span class="keywordflow">if</span> (rz_src!=NULL) {
<a name="l01690"></a>01690 <span class="comment">/*</span>
<a name="l01691"></a>01691 <span class="comment"> * Unlock source surface </span>
<a name="l01692"></a>01692 <span class="comment"> */</span>
<a name="l01693"></a>01693 <span class="keywordflow">if</span> (SDL_MUSTLOCK(rz_src)) {
<a name="l01694"></a>01694 SDL_UnlockSurface(rz_src);
<a name="l01695"></a>01695 }
<a name="l01696"></a>01696
<a name="l01697"></a>01697 <span class="comment">/*</span>
<a name="l01698"></a>01698 <span class="comment"> * Cleanup temp surface </span>
<a name="l01699"></a>01699 <span class="comment"> */</span>
<a name="l01700"></a>01700 <span class="keywordflow">if</span> (src_converted==1) {
<a name="l01701"></a>01701 SDL_FreeSurface(rz_src);
<a name="l01702"></a>01702 }
<a name="l01703"></a>01703 }
<a name="l01704"></a>01704
<a name="l01705"></a>01705 <span class="comment">/* Check error state; maybe need to cleanup destination */</span>
<a name="l01706"></a>01706 <span class="keywordflow">if</span> (haveError==1) {
<a name="l01707"></a>01707 <span class="keywordflow">if</span> (rz_dst!=NULL) {
<a name="l01708"></a>01708 SDL_FreeSurface(rz_dst);
<a name="l01709"></a>01709 }
<a name="l01710"></a>01710 rz_dst=NULL;
<a name="l01711"></a>01711 }
<a name="l01712"></a>01712
<a name="l01713"></a>01713 <span class="comment">/*</span>
<a name="l01714"></a>01714 <span class="comment"> * Return destination surface </span>
<a name="l01715"></a>01715 <span class="comment"> */</span>
<a name="l01716"></a>01716 <span class="keywordflow">return</span> (rz_dst);
<a name="l01717"></a>01717 }
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/_s_d_l__rotozoom_8c_source.html | HTML | apache-2.0 | 139,167 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: I:/Sources/sdlgfx/SDL_rotozoom.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#define-members">Defines</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">I:/Sources/sdlgfx/SDL_rotozoom.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include <math.h></code><br/>
<code>#include "SDL.h"</code><br/>
</div>
<p><a href="_s_d_l__rotozoom_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr class="memitem:ae71449b1cc6e6250b91f539153a7a0d3"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a>   3.141592654</td></tr>
<tr class="memitem:a6541cd06edcce77d8a6f1c6350c988af"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#a6541cd06edcce77d8a6f1c6350c988af">SMOOTHING_OFF</a>   0</td></tr>
<tr class="memdesc:a6541cd06edcce77d8a6f1c6350c988af"><td class="mdescLeft"> </td><td class="mdescRight">Disable anti-aliasing (no smoothing). <a href="#a6541cd06edcce77d8a6f1c6350c988af"></a><br/></td></tr>
<tr class="memitem:abeb6ae7618fcb315d0399fe65849a2e8"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#abeb6ae7618fcb315d0399fe65849a2e8">SMOOTHING_ON</a>   1</td></tr>
<tr class="memdesc:abeb6ae7618fcb315d0399fe65849a2e8"><td class="mdescLeft"> </td><td class="mdescRight">Enable anti-aliasing (smoothing). <a href="#abeb6ae7618fcb315d0399fe65849a2e8"></a><br/></td></tr>
<tr class="memitem:a5115250bd769f389e278cd5adfb63179"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a>   extern</td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a3cb0c11d5edc929579c807dc7612348c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#a3cb0c11d5edc929579c807dc7612348c">rotozoomSurface</a> (SDL_Surface *src, double angle, double zoom, int smooth)</td></tr>
<tr class="memdesc:a3cb0c11d5edc929579c807dc7612348c"><td class="mdescLeft"> </td><td class="mdescRight">Rotates and zooms a surface and optional anti-aliasing. <a href="#a3cb0c11d5edc929579c807dc7612348c"></a><br/></td></tr>
<tr class="memitem:a454d4234a45eab6ec238a40cc44051d4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#a454d4234a45eab6ec238a40cc44051d4">rotozoomSurfaceXY</a> (SDL_Surface *src, double angle, double zoomx, double zoomy, int smooth)</td></tr>
<tr class="memdesc:a454d4234a45eab6ec238a40cc44051d4"><td class="mdescLeft"> </td><td class="mdescRight">Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing. <a href="#a454d4234a45eab6ec238a40cc44051d4"></a><br/></td></tr>
<tr class="memitem:a3ca2316375d6faf4f19b26c2f1f14bbc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> void </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#a3ca2316375d6faf4f19b26c2f1f14bbc">rotozoomSurfaceSize</a> (int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)</td></tr>
<tr class="memdesc:a3ca2316375d6faf4f19b26c2f1f14bbc"><td class="mdescLeft"> </td><td class="mdescRight">Returns the size of the resulting target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#a5f64ed53eeee5f2667971c857698d1e5" title="Rotates and zooms a surface and optional anti-aliasing.">rotozoomSurface()</a> call. <a href="#a3ca2316375d6faf4f19b26c2f1f14bbc"></a><br/></td></tr>
<tr class="memitem:a612334fa642f672af953f544da6245d0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> void </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#a612334fa642f672af953f544da6245d0">rotozoomSurfaceSizeXY</a> (int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight)</td></tr>
<tr class="memdesc:a612334fa642f672af953f544da6245d0"><td class="mdescLeft"> </td><td class="mdescRight">Returns the size of the resulting target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#aab98b5b0da4ea468bacf47f7b85f0ee2" title="Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-...">rotozoomSurfaceXY()</a> call. <a href="#a612334fa642f672af953f544da6245d0"></a><br/></td></tr>
<tr class="memitem:a06c8108f8fe8de77cf841c176ee64850"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#a06c8108f8fe8de77cf841c176ee64850">zoomSurface</a> (SDL_Surface *src, double zoomx, double zoomy, int smooth)</td></tr>
<tr class="memdesc:a06c8108f8fe8de77cf841c176ee64850"><td class="mdescLeft"> </td><td class="mdescRight">Zoom a surface by independent horizontal and vertical factors with optional smoothing. <a href="#a06c8108f8fe8de77cf841c176ee64850"></a><br/></td></tr>
<tr class="memitem:a7927e415d87ea7856794cd4cc77e0a25"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> void </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#a7927e415d87ea7856794cd4cc77e0a25">zoomSurfaceSize</a> (int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)</td></tr>
<tr class="memdesc:a7927e415d87ea7856794cd4cc77e0a25"><td class="mdescLeft"> </td><td class="mdescRight">Calculates the size of the target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#abdd772b2f6b1f26134e4e90cda657a21" title="Zoom a surface by independent horizontal and vertical factors with optional smoothing.">zoomSurface()</a> call. <a href="#a7927e415d87ea7856794cd4cc77e0a25"></a><br/></td></tr>
<tr class="memitem:a7a7ac2cc0d79d282b5a4c76143b7e7a9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#a7a7ac2cc0d79d282b5a4c76143b7e7a9">shrinkSurface</a> (SDL_Surface *src, int factorx, int factory)</td></tr>
<tr class="memdesc:a7a7ac2cc0d79d282b5a4c76143b7e7a9"><td class="mdescLeft"> </td><td class="mdescRight">Shrink a surface by an integer ratio using averaging. <a href="#a7a7ac2cc0d79d282b5a4c76143b7e7a9"></a><br/></td></tr>
<tr class="memitem:ac06e9fa4fce6a1dbae45462529be581e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="_s_d_l__rotozoom_8h.html#ac06e9fa4fce6a1dbae45462529be581e">rotateSurface90Degrees</a> (SDL_Surface *src, int numClockwiseTurns)</td></tr>
<tr class="memdesc:ac06e9fa4fce6a1dbae45462529be581e"><td class="mdescLeft"> </td><td class="mdescRight">Rotates a 32 bit surface in increments of 90 degrees. <a href="#ac06e9fa4fce6a1dbae45462529be581e"></a><br/></td></tr>
</table>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="ae71449b1cc6e6250b91f539153a7a0d3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="_s_d_l__rotozoom_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">M_PI</a>   3.141592654</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8h_source.html#l00041">41</a> of file <a class="el" href="_s_d_l__rotozoom_8h_source.html">SDL_rotozoom.h</a>.</p>
</div>
</div>
<a class="anchor" id="a5115250bd769f389e278cd5adfb63179"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a>   extern</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8h_source.html#l00070">70</a> of file <a class="el" href="_s_d_l__rotozoom_8h_source.html">SDL_rotozoom.h</a>.</p>
</div>
</div>
<a class="anchor" id="a6541cd06edcce77d8a6f1c6350c988af"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="_s_d_l__rotozoom_8h.html#a6541cd06edcce77d8a6f1c6350c988af">SMOOTHING_OFF</a>   0</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Disable anti-aliasing (no smoothing). </p>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8h_source.html#l00051">51</a> of file <a class="el" href="_s_d_l__rotozoom_8h_source.html">SDL_rotozoom.h</a>.</p>
</div>
</div>
<a class="anchor" id="abeb6ae7618fcb315d0399fe65849a2e8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="_s_d_l__rotozoom_8h.html#abeb6ae7618fcb315d0399fe65849a2e8">SMOOTHING_ON</a>   1</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Enable anti-aliasing (smoothing). </p>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8h_source.html#l00056">56</a> of file <a class="el" href="_s_d_l__rotozoom_8h_source.html">SDL_rotozoom.h</a>.</p>
</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ac06e9fa4fce6a1dbae45462529be581e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface* <a class="el" href="_s_d_l__rotozoom_8h.html#ac06e9fa4fce6a1dbae45462529be581e">rotateSurface90Degrees</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>numClockwiseTurns</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Rotates a 32 bit surface in increments of 90 degrees. </p>
<p>Specialized 90 degree rotator which rotates a 'src' surface in 90 degree increments clockwise returning a new surface. Faster than rotozoomer since not scanning or interpolation takes place. Input surface must be 32 bit. (code contributed by J. Schiller, improved by C. Allport and A. Schiffler)</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>Source surface to rotate. </td></tr>
<tr><td class="paramname">numClockwiseTurns</td><td>Number of clockwise 90 degree turns to apply to the source.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The new, rotated surface; or NULL for surfaces with incorrect input format. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00814">814</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a3cb0c11d5edc929579c807dc7612348c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface* <a class="el" href="_s_d_l__rotozoom_8h.html#a3cb0c11d5edc929579c807dc7612348c">rotozoomSurface</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>angle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoom</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>smooth</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Rotates and zooms a surface and optional anti-aliasing. </p>
<p>Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees and 'zoom' a scaling factor. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to rotozoom. </td></tr>
<tr><td class="paramname">angle</td><td>The angle to rotate in degrees. </td></tr>
<tr><td class="paramname">zoom</td><td>The scaling factor. </td></tr>
<tr><td class="paramname">smooth</td><td>Antialiasing flag; set to SMOOTHING_ON to enable.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The new rotozoomed surface. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01030">1030</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a3ca2316375d6faf4f19b26c2f1f14bbc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> void <a class="el" href="_s_d_l__rotozoom_8h.html#a3ca2316375d6faf4f19b26c2f1f14bbc">rotozoomSurfaceSize</a> </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>width</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>height</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>angle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoom</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstheight</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the size of the resulting target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#a5f64ed53eeee5f2667971c857698d1e5" title="Rotates and zooms a surface and optional anti-aliasing.">rotozoomSurface()</a> call. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">width</td><td>The source surface width. </td></tr>
<tr><td class="paramname">height</td><td>The source surface height. </td></tr>
<tr><td class="paramname">angle</td><td>The angle to rotate in degrees. </td></tr>
<tr><td class="paramname">zoom</td><td>The scaling factor. </td></tr>
<tr><td class="paramname">dstwidth</td><td>The calculated width of the rotozoomed destination surface. </td></tr>
<tr><td class="paramname">dstheight</td><td>The calculated height of the rotozoomed destination surface. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01008">1008</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a612334fa642f672af953f544da6245d0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> void <a class="el" href="_s_d_l__rotozoom_8h.html#a612334fa642f672af953f544da6245d0">rotozoomSurfaceSizeXY</a> </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>width</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>height</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>angle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstheight</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the size of the resulting target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#aab98b5b0da4ea468bacf47f7b85f0ee2" title="Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-...">rotozoomSurfaceXY()</a> call. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">width</td><td>The source surface width. </td></tr>
<tr><td class="paramname">height</td><td>The source surface height. </td></tr>
<tr><td class="paramname">angle</td><td>The angle to rotate in degrees. </td></tr>
<tr><td class="paramname">zoomx</td><td>The horizontal scaling factor. </td></tr>
<tr><td class="paramname">zoomy</td><td>The vertical scaling factor. </td></tr>
<tr><td class="paramname">dstwidth</td><td>The calculated width of the rotozoomed destination surface. </td></tr>
<tr><td class="paramname">dstheight</td><td>The calculated height of the rotozoomed destination surface. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00991">991</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a454d4234a45eab6ec238a40cc44051d4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface* <a class="el" href="_s_d_l__rotozoom_8h.html#a454d4234a45eab6ec238a40cc44051d4">rotozoomSurfaceXY</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>angle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>smooth</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing. </p>
<p>Rotates and zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees, 'zoomx and 'zoomy' scaling factors. If 'smooth' is set then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to rotozoom. </td></tr>
<tr><td class="paramname">angle</td><td>The angle to rotate in degrees. </td></tr>
<tr><td class="paramname">zoomx</td><td>The horizontal scaling factor. </td></tr>
<tr><td class="paramname">zoomy</td><td>The vertical scaling factor. </td></tr>
<tr><td class="paramname">smooth</td><td>Antialiasing flag; set to SMOOTHING_ON to enable.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The new rotozoomed surface. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01051">1051</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a7a7ac2cc0d79d282b5a4c76143b7e7a9"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface* <a class="el" href="_s_d_l__rotozoom_8h.html#a7a7ac2cc0d79d282b5a4c76143b7e7a9">shrinkSurface</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>factorx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>factory</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Shrink a surface by an integer ratio using averaging. </p>
<p>Shrinks a 32bit or 8bit 'src' surface to a newly created 'dst' surface. 'factorx' and 'factory' are the shrinking ratios (i.e. 2=1/2 the size, 3=1/3 the size, etc.) The destination surface is antialiased by averaging the source box RGBA or Y information. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. The input surface is not modified. The output surface is newly allocated.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to shrink. </td></tr>
<tr><td class="paramname">factorx</td><td>The horizontal shrinking ratio. </td></tr>
<tr><td class="paramname">factory</td><td>The vertical shrinking ratio.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The new, shrunken surface. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01548">1548</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a06c8108f8fe8de77cf841c176ee64850"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface* <a class="el" href="_s_d_l__rotozoom_8h.html#a06c8108f8fe8de77cf841c176ee64850">zoomSurface</a> </td>
<td>(</td>
<td class="paramtype">SDL_Surface * </td>
<td class="paramname"><em>src</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>smooth</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Zoom a surface by independent horizontal and vertical factors with optional smoothing. </p>
<p>Zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is on then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. If zoom factors are negative, the image is flipped on the axes.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">src</td><td>The surface to zoom. </td></tr>
<tr><td class="paramname">zoomx</td><td>The horizontal zoom factor. </td></tr>
<tr><td class="paramname">zoomy</td><td>The vertical zoom factor. </td></tr>
<tr><td class="paramname">smooth</td><td>Antialiasing flag; set to SMOOTHING_ON to enable.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>The new, zoomed surface. </dd></dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01392">1392</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a7927e415d87ea7856794cd4cc77e0a25"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> void <a class="el" href="_s_d_l__rotozoom_8h.html#a7927e415d87ea7856794cd4cc77e0a25">zoomSurfaceSize</a> </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>width</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>height</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>zoomy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>dstheight</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Calculates the size of the target surface for a <a class="el" href="_s_d_l__rotozoom_8c.html#abdd772b2f6b1f26134e4e90cda657a21" title="Zoom a surface by independent horizontal and vertical factors with optional smoothing.">zoomSurface()</a> call. </p>
<p>The minimum size of the target surface is 1. The input factors can be positive or negative.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">width</td><td>The width of the source surface to zoom. </td></tr>
<tr><td class="paramname">height</td><td>The height of the source surface to zoom. </td></tr>
<tr><td class="paramname">zoomx</td><td>The horizontal zoom factor. </td></tr>
<tr><td class="paramname">zoomy</td><td>The vertical zoom factor. </td></tr>
<tr><td class="paramname">dstwidth</td><td>Pointer to an integer to store the calculated width of the zoomed target surface. </td></tr>
<tr><td class="paramname">dstheight</td><td>Pointer to an integer to store the calculated height of the zoomed target surface. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l01342">1342</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/_s_d_l__rotozoom_8h.html | HTML | apache-2.0 | 32,702 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: I:/Sources/sdlgfx/SDL_rotozoom.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">I:/Sources/sdlgfx/SDL_rotozoom.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="_s_d_l__rotozoom_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* </span>
<a name="l00002"></a>00002 <span class="comment"></span>
<a name="l00003"></a>00003 <span class="comment">SDL_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">Copyright (C) 2001-2012 Andreas Schiffler</span>
<a name="l00006"></a>00006 <span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment">This software is provided 'as-is', without any express or implied</span>
<a name="l00008"></a>00008 <span class="comment">warranty. In no event will the authors be held liable for any damages</span>
<a name="l00009"></a>00009 <span class="comment">arising from the use of this software.</span>
<a name="l00010"></a>00010 <span class="comment"></span>
<a name="l00011"></a>00011 <span class="comment">Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00012"></a>00012 <span class="comment">including commercial applications, and to alter it and redistribute it</span>
<a name="l00013"></a>00013 <span class="comment">freely, subject to the following restrictions:</span>
<a name="l00014"></a>00014 <span class="comment"></span>
<a name="l00015"></a>00015 <span class="comment">1. The origin of this software must not be misrepresented; you must not</span>
<a name="l00016"></a>00016 <span class="comment">claim that you wrote the original software. If you use this software</span>
<a name="l00017"></a>00017 <span class="comment">in a product, an acknowledgment in the product documentation would be</span>
<a name="l00018"></a>00018 <span class="comment">appreciated but is not required.</span>
<a name="l00019"></a>00019 <span class="comment"></span>
<a name="l00020"></a>00020 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be</span>
<a name="l00021"></a>00021 <span class="comment">misrepresented as being the original software.</span>
<a name="l00022"></a>00022 <span class="comment"></span>
<a name="l00023"></a>00023 <span class="comment">3. This notice may not be removed or altered from any source</span>
<a name="l00024"></a>00024 <span class="comment">distribution.</span>
<a name="l00025"></a>00025 <span class="comment"></span>
<a name="l00026"></a>00026 <span class="comment">Andreas Schiffler -- aschiffler at ferzkopp dot net</span>
<a name="l00027"></a>00027 <span class="comment"></span>
<a name="l00028"></a>00028 <span class="comment">*/</span>
<a name="l00029"></a>00029
<a name="l00030"></a>00030 <span class="preprocessor">#ifndef _SDL_rotozoom_h</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define _SDL_rotozoom_h</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00033"></a>00033 <span class="preprocessor">#include <math.h></span>
<a name="l00034"></a>00034
<a name="l00035"></a>00035 <span class="comment">/* Set up for C function definitions, even when using C++ */</span>
<a name="l00036"></a>00036 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
<a name="l00038"></a>00038 <span class="preprocessor">#endif</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span>
<a name="l00040"></a>00040 <span class="preprocessor">#ifndef M_PI</span>
<a name="l00041"></a><a class="code" href="_s_d_l__rotozoom_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">00041</a> <span class="preprocessor"></span><span class="preprocessor">#define M_PI 3.141592654</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span>
<a name="l00044"></a>00044 <span class="preprocessor">#include "SDL.h"</span>
<a name="l00045"></a>00045
<a name="l00046"></a>00046 <span class="comment">/* ---- Defines */</span>
<a name="l00047"></a>00047
<a name="l00051"></a><a class="code" href="_s_d_l__rotozoom_8h.html#a6541cd06edcce77d8a6f1c6350c988af">00051</a> <span class="preprocessor">#define SMOOTHING_OFF 0</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span>
<a name="l00056"></a><a class="code" href="_s_d_l__rotozoom_8h.html#abeb6ae7618fcb315d0399fe65849a2e8">00056</a> <span class="preprocessor">#define SMOOTHING_ON 1</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span>
<a name="l00058"></a>00058 <span class="comment">/* ---- Function Prototypes */</span>
<a name="l00059"></a>00059
<a name="l00060"></a>00060 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor"># if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor"># define SDL_ROTOZOOM_SCOPE __declspec(dllexport)</span>
<a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor"># else</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor"># ifdef LIBSDL_GFX_DLL_IMPORT</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor"># define SDL_ROTOZOOM_SCOPE __declspec(dllimport)</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span><span class="preprocessor"># endif</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span><span class="preprocessor"># endif</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#ifndef SDL_ROTOZOOM_SCOPE</span>
<a name="l00070"></a><a class="code" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">00070</a> <span class="preprocessor"></span><span class="preprocessor"># define SDL_ROTOZOOM_SCOPE extern</span>
<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span>
<a name="l00073"></a>00073 <span class="comment">/* </span>
<a name="l00074"></a>00074 <span class="comment"></span>
<a name="l00075"></a>00075 <span class="comment"> Rotozoom functions</span>
<a name="l00076"></a>00076 <span class="comment"></span>
<a name="l00077"></a>00077 <span class="comment"> */</span>
<a name="l00078"></a>00078
<a name="l00079"></a>00079 <a class="code" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface *<a class="code" href="_s_d_l__rotozoom_8c.html#a5f64ed53eeee5f2667971c857698d1e5" title="Rotates and zooms a surface and optional anti-aliasing.">rotozoomSurface</a>(SDL_Surface * src, <span class="keywordtype">double</span> angle, <span class="keywordtype">double</span> zoom, <span class="keywordtype">int</span> smooth);
<a name="l00080"></a>00080
<a name="l00081"></a>00081 <a class="code" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface *<a class="code" href="_s_d_l__rotozoom_8c.html#aab98b5b0da4ea468bacf47f7b85f0ee2" title="Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-...">rotozoomSurfaceXY</a>
<a name="l00082"></a>00082 (SDL_Surface * src, <span class="keywordtype">double</span> angle, <span class="keywordtype">double</span> zoomx, <span class="keywordtype">double</span> zoomy, <span class="keywordtype">int</span> smooth);
<a name="l00083"></a>00083
<a name="l00084"></a>00084
<a name="l00085"></a>00085 <a class="code" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__rotozoom_8c.html#a9886c783255edfd70a4974f8f3dd5a8c" title="Returns the size of the resulting target surface for a rotozoomSurface() call.">rotozoomSurfaceSize</a>(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <span class="keywordtype">double</span> angle, <span class="keywordtype">double</span> zoom, <span class="keywordtype">int</span> *dstwidth,
<a name="l00086"></a>00086 <span class="keywordtype">int</span> *dstheight);
<a name="l00087"></a>00087
<a name="l00088"></a>00088 <a class="code" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__rotozoom_8c.html#aee64992d26c818d9975610754d5c929b" title="Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.">rotozoomSurfaceSizeXY</a>
<a name="l00089"></a>00089 (<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <span class="keywordtype">double</span> angle, <span class="keywordtype">double</span> zoomx, <span class="keywordtype">double</span> zoomy,
<a name="l00090"></a>00090 <span class="keywordtype">int</span> *dstwidth, <span class="keywordtype">int</span> *dstheight);
<a name="l00091"></a>00091
<a name="l00092"></a>00092 <span class="comment">/* </span>
<a name="l00093"></a>00093 <span class="comment"></span>
<a name="l00094"></a>00094 <span class="comment"> Zooming functions</span>
<a name="l00095"></a>00095 <span class="comment"></span>
<a name="l00096"></a>00096 <span class="comment"> */</span>
<a name="l00097"></a>00097
<a name="l00098"></a>00098 <a class="code" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface *<a class="code" href="_s_d_l__rotozoom_8c.html#abdd772b2f6b1f26134e4e90cda657a21" title="Zoom a surface by independent horizontal and vertical factors with optional smoothing.">zoomSurface</a>(SDL_Surface * src, <span class="keywordtype">double</span> zoomx, <span class="keywordtype">double</span> zoomy, <span class="keywordtype">int</span> smooth);
<a name="l00099"></a>00099
<a name="l00100"></a>00100 <a class="code" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> <span class="keywordtype">void</span> <a class="code" href="_s_d_l__rotozoom_8c.html#a8ba40859c1a977dae87488dd8be1bf9a" title="Calculates the size of the target surface for a zoomSurface() call.">zoomSurfaceSize</a>(<span class="keywordtype">int</span> width, <span class="keywordtype">int</span> height, <span class="keywordtype">double</span> zoomx, <span class="keywordtype">double</span> zoomy, <span class="keywordtype">int</span> *dstwidth, <span class="keywordtype">int</span> *dstheight);
<a name="l00101"></a>00101
<a name="l00102"></a>00102 <span class="comment">/* </span>
<a name="l00103"></a>00103 <span class="comment"></span>
<a name="l00104"></a>00104 <span class="comment"> Shrinking functions</span>
<a name="l00105"></a>00105 <span class="comment"></span>
<a name="l00106"></a>00106 <span class="comment"> */</span>
<a name="l00107"></a>00107
<a name="l00108"></a>00108 <a class="code" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface *<a class="code" href="_s_d_l__rotozoom_8c.html#aad3bf0cd89cc39ff874ffa778fa1495d" title="Shrink a surface by an integer ratio using averaging.">shrinkSurface</a>(SDL_Surface * src, <span class="keywordtype">int</span> factorx, <span class="keywordtype">int</span> factory);
<a name="l00109"></a>00109
<a name="l00110"></a>00110 <span class="comment">/* </span>
<a name="l00111"></a>00111 <span class="comment"></span>
<a name="l00112"></a>00112 <span class="comment"> Specialized rotation functions</span>
<a name="l00113"></a>00113 <span class="comment"></span>
<a name="l00114"></a>00114 <span class="comment"> */</span>
<a name="l00115"></a>00115
<a name="l00116"></a>00116 <a class="code" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_ROTOZOOM_SCOPE</a> SDL_Surface* <a class="code" href="_s_d_l__rotozoom_8c.html#a77563d68634cb2624d4f2f0bcdc19e73" title="Rotates a 32 bit surface in increments of 90 degrees.">rotateSurface90Degrees</a>(SDL_Surface* src, <span class="keywordtype">int</span> numClockwiseTurns);
<a name="l00117"></a>00117
<a name="l00118"></a>00118 <span class="comment">/* Ends C function definitions when using C++ */</span>
<a name="l00119"></a>00119 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00120"></a>00120 <span class="preprocessor"></span>}
<a name="l00121"></a>00121 <span class="preprocessor">#endif</span>
<a name="l00122"></a>00122 <span class="preprocessor"></span>
<a name="l00123"></a>00123 <span class="preprocessor">#endif </span><span class="comment">/* _SDL_rotozoom_h */</span>
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/_s_d_l__rotozoom_8h_source.html | HTML | apache-2.0 | 15,026 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Data Structures</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="classes.html"><span>Data Structure Index</span></a></li>
<li><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Data Structures</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock">Here are the data structures with brief descriptions:</div><table>
<tr><td class="indexkey"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a></td><td class="indexvalue">Structure holding the state and timing information of the framerate controller </td></tr>
<tr><td class="indexkey"><a class="el" href="struct_s_d_l__gfx_blit_info.html">SDL_gfxBlitInfo</a></td><td class="indexvalue">The structure passed to the low level blit functions </td></tr>
<tr><td class="indexkey"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html">SDL_gfxBresenhamIterator</a></td><td class="indexvalue">The structure passed to the internal Bresenham iterator </td></tr>
<tr><td class="indexkey"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html">SDL_gfxMurphyIterator</a></td><td class="indexvalue">The structure passed to the internal Murphy iterator </td></tr>
<tr><td class="indexkey"><a class="el" href="structt_color_r_g_b_a.html">tColorRGBA</a></td><td class="indexvalue">A 32 bit RGBA pixel </td></tr>
<tr><td class="indexkey"><a class="el" href="structt_color_y.html">tColorY</a></td><td class="indexvalue">A 8bit Y/palette pixel </td></tr>
</table>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/annotated.html | HTML | apache-2.0 | 3,068 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Data Structure Index</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="classes.html"><span>Data Structure Index</span></a></li>
<li><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Data Structure Index</div> </div>
</div><!--header-->
<div class="contents">
<div class="qindex"><a class="qindex" href="#letter_F">F</a> | <a class="qindex" href="#letter_S">S</a> | <a class="qindex" href="#letter_T">T</a></div>
<table style="margin: 10px; white-space: nowrap;" align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
<tr><td rowspan="2" valign="bottom"><a name="letter_F"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">  F  </div></td></tr></table>
</td><td rowspan="2" valign="bottom"><a name="letter_S"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">  S  </div></td></tr></table>
</td><td valign="top"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html">SDL_gfxBresenhamIterator</a>   </td><td valign="top"><a class="el" href="structt_color_y.html">tColorY</a>   </td></tr>
<tr><td valign="top"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html">SDL_gfxMurphyIterator</a>   </td><td></td></tr>
<tr><td valign="top"><a class="el" href="struct_f_p_smanager.html">FPSmanager</a>   </td><td valign="top"><a class="el" href="struct_s_d_l__gfx_blit_info.html">SDL_gfxBlitInfo</a>   </td><td rowspan="2" valign="bottom"><a name="letter_T"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">  T  </div></td></tr></table>
</td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td valign="top"><a class="el" href="structt_color_r_g_b_a.html">tColorRGBA</a>   </td><td></td></tr>
<tr><td></td><td></td><td></td><td></td></tr>
</table>
<div class="qindex"><a class="qindex" href="#letter_F">F</a> | <a class="qindex" href="#letter_S">S</a> | <a class="qindex" href="#letter_T">T</a></div>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/classes.html | HTML | apache-2.0 | 3,735 |
/* The standard CSS for doxygen */
body, table, div, p, dl {
font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
font-size: 13px;
line-height: 1.3;
}
/* @group Heading Levels */
h1 {
font-size: 150%;
}
.title {
font-size: 150%;
font-weight: bold;
margin: 10px 2px;
}
h2 {
font-size: 120%;
}
h3 {
font-size: 100%;
}
dt {
font-weight: bold;
}
div.multicol {
-moz-column-gap: 1em;
-webkit-column-gap: 1em;
-moz-column-count: 3;
-webkit-column-count: 3;
}
p.startli, p.startdd, p.starttd {
margin-top: 2px;
}
p.endli {
margin-bottom: 0px;
}
p.enddd {
margin-bottom: 4px;
}
p.endtd {
margin-bottom: 2px;
}
/* @end */
caption {
font-weight: bold;
}
span.legend {
font-size: 70%;
text-align: center;
}
h3.version {
font-size: 90%;
text-align: center;
}
div.qindex, div.navtab{
background-color: #EBEFF6;
border: 1px solid #A3B4D7;
text-align: center;
}
div.qindex, div.navpath {
width: 100%;
line-height: 140%;
}
div.navtab {
margin-right: 15px;
}
/* @group Link Styling */
a {
color: #3D578C;
font-weight: normal;
text-decoration: none;
}
.contents a:visited {
color: #4665A2;
}
a:hover {
text-decoration: underline;
}
a.qindex {
font-weight: bold;
}
a.qindexHL {
font-weight: bold;
background-color: #9CAFD4;
color: #ffffff;
border: 1px double #869DCA;
}
.contents a.qindexHL:visited {
color: #ffffff;
}
a.el {
font-weight: bold;
}
a.elRef {
}
a.code, a.code:visited {
color: #4665A2;
}
a.codeRef, a.codeRef:visited {
color: #4665A2;
}
/* @end */
dl.el {
margin-left: -1cm;
}
.fragment {
font-family: monospace, fixed;
font-size: 105%;
}
pre.fragment {
border: 1px solid #C4CFE5;
background-color: #FBFCFD;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
overflow: auto;
word-wrap: break-word;
font-size: 9pt;
line-height: 125%;
}
div.ah {
background-color: black;
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
margin-top: 3px;
padding: 0.2em;
border: solid thin #333;
border-radius: 0.5em;
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
box-shadow: 2px 2px 3px #999;
-webkit-box-shadow: 2px 2px 3px #999;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
font-weight: bold;
}
div.groupText {
margin-left: 16px;
font-style: italic;
}
body {
background-color: white;
color: black;
margin: 0;
}
div.contents {
margin-top: 10px;
margin-left: 8px;
margin-right: 8px;
}
td.indexkey {
background-color: #EBEFF6;
font-weight: bold;
border: 1px solid #C4CFE5;
margin: 2px 0px 2px 0;
padding: 2px 10px;
white-space: nowrap;
vertical-align: top;
}
td.indexvalue {
background-color: #EBEFF6;
border: 1px solid #C4CFE5;
padding: 2px 10px;
margin: 2px 0px;
}
tr.memlist {
background-color: #EEF1F7;
}
p.formulaDsp {
text-align: center;
}
img.formulaDsp {
}
img.formulaInl {
vertical-align: middle;
}
div.center {
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
}
div.center img {
border: 0px;
}
address.footer {
text-align: right;
padding-right: 12px;
}
img.footer {
border: 0px;
vertical-align: middle;
}
/* @group Code Colorization */
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
span.vhdldigit {
color: #ff00ff
}
span.vhdlchar {
color: #000000
}
span.vhdlkeyword {
color: #700070
}
span.vhdllogic {
color: #ff0000
}
blockquote {
background-color: #F7F8FB;
border-left: 2px solid #9CAFD4;
margin: 0 24px 0 4px;
padding: 0 12px 0 16px;
}
/* @end */
/*
.search {
color: #003399;
font-weight: bold;
}
form.search {
margin-bottom: 0px;
margin-top: 0px;
}
input.search {
font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #e8eef2;
}
*/
td.tiny {
font-size: 75%;
}
.dirtab {
padding: 4px;
border-collapse: collapse;
border: 1px solid #A3B4D7;
}
th.dirtab {
background: #EBEFF6;
font-weight: bold;
}
hr {
height: 0px;
border: none;
border-top: 1px solid #4A6AAA;
}
hr.footer {
height: 1px;
}
/* @group Member Descriptions */
table.memberdecls {
border-spacing: 0px;
padding: 0px;
}
.mdescLeft, .mdescRight,
.memItemLeft, .memItemRight,
.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
background-color: #F9FAFC;
border: none;
margin: 4px;
padding: 1px 0 0 8px;
}
.mdescLeft, .mdescRight {
padding: 0px 8px 4px 8px;
color: #555;
}
.memItemLeft, .memItemRight, .memTemplParams {
border-top: 1px solid #C4CFE5;
}
.memItemLeft, .memTemplItemLeft {
white-space: nowrap;
}
.memItemRight {
width: 100%;
}
.memTemplParams {
color: #4665A2;
white-space: nowrap;
}
/* @end */
/* @group Member Details */
/* Styles for detailed member documentation */
.memtemplate {
font-size: 80%;
color: #4665A2;
font-weight: normal;
margin-left: 9px;
}
.memnav {
background-color: #EBEFF6;
border: 1px solid #A3B4D7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
.mempage {
width: 100%;
}
.memitem {
padding: 0;
margin-bottom: 10px;
margin-right: 5px;
}
.memname {
white-space: nowrap;
font-weight: bold;
margin-left: 6px;
}
.memproto, dl.reflist dt {
border-top: 1px solid #A8B8D9;
border-left: 1px solid #A8B8D9;
border-right: 1px solid #A8B8D9;
padding: 6px 0px 6px 0px;
color: #253555;
font-weight: bold;
text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
/* opera specific markup */
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
border-top-right-radius: 8px;
border-top-left-radius: 8px;
/* firefox specific markup */
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
-moz-border-radius-topright: 8px;
-moz-border-radius-topleft: 8px;
/* webkit specific markup */
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
-webkit-border-top-right-radius: 8px;
-webkit-border-top-left-radius: 8px;
background-image:url('nav_f.png');
background-repeat:repeat-x;
background-color: #E2E8F2;
}
.memdoc, dl.reflist dd {
border-bottom: 1px solid #A8B8D9;
border-left: 1px solid #A8B8D9;
border-right: 1px solid #A8B8D9;
padding: 2px 5px;
background-color: #FBFCFD;
border-top-width: 0;
/* opera specific markup */
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
/* firefox specific markup */
-moz-border-radius-bottomleft: 8px;
-moz-border-radius-bottomright: 8px;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7);
/* webkit specific markup */
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7));
}
dl.reflist dt {
padding: 5px;
}
dl.reflist dd {
margin: 0px 0px 10px 0px;
padding: 5px;
}
.paramkey {
text-align: right;
}
.paramtype {
white-space: nowrap;
}
.paramname {
color: #602020;
white-space: nowrap;
}
.paramname em {
font-style: normal;
}
.params, .retval, .exception, .tparams {
border-spacing: 6px 2px;
}
.params .paramname, .retval .paramname {
font-weight: bold;
vertical-align: top;
}
.params .paramtype {
font-style: italic;
vertical-align: top;
}
.params .paramdir {
font-family: "courier new",courier,monospace;
vertical-align: top;
}
/* @end */
/* @group Directory (tree) */
/* for the tree view */
.ftvtree {
font-family: sans-serif;
margin: 0px;
}
/* these are for tree view when used as main index */
.directory {
font-size: 9pt;
font-weight: bold;
margin: 5px;
}
.directory h3 {
margin: 0px;
margin-top: 1em;
font-size: 11pt;
}
/*
The following two styles can be used to replace the root node title
with an image of your choice. Simply uncomment the next two styles,
specify the name of your image and be sure to set 'height' to the
proper pixel height of your image.
*/
/*
.directory h3.swap {
height: 61px;
background-repeat: no-repeat;
background-image: url("yourimage.gif");
}
.directory h3.swap span {
display: none;
}
*/
.directory > h3 {
margin-top: 0;
}
.directory p {
margin: 0px;
white-space: nowrap;
}
.directory div {
display: none;
margin: 0px;
}
.directory img {
vertical-align: -30%;
}
/* these are for tree view when not used as main index */
.directory-alt {
font-size: 100%;
font-weight: bold;
}
.directory-alt h3 {
margin: 0px;
margin-top: 1em;
font-size: 11pt;
}
.directory-alt > h3 {
margin-top: 0;
}
.directory-alt p {
margin: 0px;
white-space: nowrap;
}
.directory-alt div {
display: none;
margin: 0px;
}
.directory-alt img {
vertical-align: -30%;
}
/* @end */
div.dynheader {
margin-top: 8px;
}
address {
font-style: normal;
color: #2A3D61;
}
table.doxtable {
border-collapse:collapse;
margin-top: 4px;
margin-bottom: 4px;
}
table.doxtable td, table.doxtable th {
border: 1px solid #2D4068;
padding: 3px 7px 2px;
}
table.doxtable th {
background-color: #374F7F;
color: #FFFFFF;
font-size: 110%;
padding-bottom: 4px;
padding-top: 5px;
}
table.fieldtable {
width: 100%;
margin-bottom: 10px;
border: 1px solid #A8B8D9;
border-spacing: 0px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
-webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
}
.fieldtable td, .fieldtable th {
padding: 3px 7px 2px;
}
.fieldtable td.fieldtype, .fieldtable td.fieldname {
white-space: nowrap;
border-right: 1px solid #A8B8D9;
border-bottom: 1px solid #A8B8D9;
vertical-align: top;
}
.fieldtable td.fielddoc {
border-bottom: 1px solid #A8B8D9;
width: 100%;
}
.fieldtable tr:last-child td {
border-bottom: none;
}
.fieldtable th {
background-image:url('nav_f.png');
background-repeat:repeat-x;
background-color: #E2E8F2;
font-size: 90%;
color: #253555;
padding-bottom: 4px;
padding-top: 5px;
text-align:left;
-moz-border-radius-topleft: 4px;
-moz-border-radius-topright: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom: 1px solid #A8B8D9;
}
.tabsearch {
top: 0px;
left: 10px;
height: 36px;
background-image: url('tab_b.png');
z-index: 101;
overflow: hidden;
font-size: 13px;
}
.navpath ul
{
font-size: 11px;
background-image:url('tab_b.png');
background-repeat:repeat-x;
height:30px;
line-height:30px;
color:#8AA0CC;
border:solid 1px #C2CDE4;
overflow:hidden;
margin:0px;
padding:0px;
}
.navpath li
{
list-style-type:none;
float:left;
padding-left:10px;
padding-right:15px;
background-image:url('bc_s.png');
background-repeat:no-repeat;
background-position:right;
color:#364D7C;
}
.navpath li.navelem a
{
height:32px;
display:block;
text-decoration: none;
outline: none;
}
.navpath li.navelem a:hover
{
color:#6884BD;
}
.navpath li.footer
{
list-style-type:none;
float:right;
padding-left:10px;
padding-right:15px;
background-image:none;
background-repeat:no-repeat;
background-position:right;
color:#364D7C;
font-size: 8pt;
}
div.summary
{
float: right;
font-size: 8pt;
padding-right: 5px;
width: 50%;
text-align: right;
}
div.summary a
{
white-space: nowrap;
}
div.ingroups
{
margin-left: 5px;
font-size: 8pt;
padding-left: 5px;
width: 50%;
text-align: left;
}
div.ingroups a
{
white-space: nowrap;
}
div.header
{
background-image:url('nav_h.png');
background-repeat:repeat-x;
background-color: #F9FAFC;
margin: 0px;
border-bottom: 1px solid #C4CFE5;
}
div.headertitle
{
padding: 5px 5px 5px 7px;
}
dl
{
padding: 0 0 0 10px;
}
/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */
dl.section
{
border-left:4px solid;
padding: 0 0 0 6px;
}
dl.note
{
border-color: #D0C000;
}
dl.warning, dl.attention
{
border-color: #FF0000;
}
dl.pre, dl.post, dl.invariant
{
border-color: #00D000;
}
dl.deprecated
{
border-color: #505050;
}
dl.todo
{
border-color: #00C0E0;
}
dl.test
{
border-color: #3030E0;
}
dl.bug
{
border-color: #C08050;
}
dl.section dd {
margin-bottom: 6px;
}
#projectlogo
{
text-align: center;
vertical-align: bottom;
border-collapse: separate;
}
#projectlogo img
{
border: 0px none;
}
#projectname
{
font: 300% Tahoma, Arial,sans-serif;
margin: 0px;
padding: 2px 0px;
}
#projectbrief
{
font: 120% Tahoma, Arial,sans-serif;
margin: 0px;
padding: 0px;
}
#projectnumber
{
font: 50% Tahoma, Arial,sans-serif;
margin: 0px;
padding: 0px;
}
#titlearea
{
padding: 0px;
margin: 0px;
width: 100%;
border-bottom: 1px solid #5373B4;
}
.image
{
text-align: center;
}
.dotgraph
{
text-align: center;
}
.mscgraph
{
text-align: center;
}
.caption
{
font-weight: bold;
}
div.zoom
{
border: 1px solid #90A5CE;
}
dl.citelist {
margin-bottom:50px;
}
dl.citelist dt {
color:#334975;
float:left;
font-weight:bold;
margin-right:10px;
padding:5px;
}
dl.citelist dd {
margin:2px 0;
padding:5px 0;
}
div.toc {
padding: 14px 25px;
background-color: #F4F6FA;
border: 1px solid #D8DFEE;
border-radius: 7px 7px 7px 7px;
float: right;
height: auto;
margin: 0 20px 10px 10px;
width: 200px;
}
div.toc li {
background: url("bdwn.png") no-repeat scroll 0 5px transparent;
font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif;
margin-top: 5px;
padding-left: 10px;
padding-top: 2px;
}
div.toc h3 {
font: bold 12px/1.2 Arial,FreeSans,sans-serif;
color: #4665A2;
border-bottom: 0 none;
margin: 0;
}
div.toc ul {
list-style: none outside none;
border: medium none;
padding: 0px;
}
div.toc li.level1 {
margin-left: 0px;
}
div.toc li.level2 {
margin-left: 15px;
}
div.toc li.level3 {
margin-left: 30px;
}
div.toc li.level4 {
margin-left: 45px;
}
@media print
{
#top { display: none; }
#side-nav { display: none; }
#nav-path { display: none; }
body { overflow:visible; }
h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
.summary { display: none; }
.memitem { page-break-inside: avoid; }
#doc-content
{
margin-left:0 !important;
height:auto !important;
width:auto !important;
overflow:inherit;
display:inline;
}
pre.fragment
{
overflow: visible;
text-wrap: unrestricted;
white-space: -moz-pre-wrap; /* Moz */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
}
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/doxygen.css | CSS | apache-2.0 | 16,142 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: File List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li class="current"><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">File List</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock">Here is a list of all files with brief descriptions:</div><table>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_r_e_a_d_m_e.html">README</a> <a href="_r_e_a_d_m_e_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__framerate_8c.html">SDL_framerate.c</a> <a href="_s_d_l__framerate_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__framerate_8h.html">SDL_framerate.h</a> <a href="_s_d_l__framerate_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__gfx_blit_func_8c.html">SDL_gfxBlitFunc.c</a> <a href="_s_d_l__gfx_blit_func_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__gfx_blit_func_8h.html">SDL_gfxBlitFunc.h</a> <a href="_s_d_l__gfx_blit_func_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__gfx_primitives_8c.html">SDL_gfxPrimitives.c</a> <a href="_s_d_l__gfx_primitives_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__gfx_primitives_8h.html">SDL_gfxPrimitives.h</a> <a href="_s_d_l__gfx_primitives_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__gfx_primitives__font_8h.html">SDL_gfxPrimitives_font.h</a> <a href="_s_d_l__gfx_primitives__font_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__image_filter_8c.html">SDL_imageFilter.c</a> <a href="_s_d_l__image_filter_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__image_filter_8h.html">SDL_imageFilter.h</a> <a href="_s_d_l__image_filter_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__rotozoom_8c.html">SDL_rotozoom.c</a> <a href="_s_d_l__rotozoom_8c_source.html">[code]</a></td><td class="indexvalue"></td></tr>
<tr><td class="indexkey">I:/Sources/sdlgfx/<a class="el" href="_s_d_l__rotozoom_8h.html">SDL_rotozoom.h</a> <a href="_s_d_l__rotozoom_8h_source.html">[code]</a></td><td class="indexvalue"></td></tr>
</table>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/files.html | HTML | apache-2.0 | 4,356 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Data Fields</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="classes.html"><span>Data Structure Index</span></a></li>
<li class="current"><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="functions.html"><span>All</span></a></li>
<li><a href="functions_vars.html"><span>Variables</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="#index_a"><span>a</span></a></li>
<li><a href="#index_b"><span>b</span></a></li>
<li><a href="#index_c"><span>c</span></a></li>
<li><a href="#index_d"><span>d</span></a></li>
<li><a href="#index_e"><span>e</span></a></li>
<li><a href="#index_f"><span>f</span></a></li>
<li><a href="#index_g"><span>g</span></a></li>
<li><a href="#index_k"><span>k</span></a></li>
<li><a href="#index_l"><span>l</span></a></li>
<li><a href="#index_o"><span>o</span></a></li>
<li><a href="#index_q"><span>q</span></a></li>
<li><a href="#index_r"><span>r</span></a></li>
<li><a href="#index_s"><span>s</span></a></li>
<li><a href="#index_t"><span>t</span></a></li>
<li><a href="#index_u"><span>u</span></a></li>
<li><a href="#index_v"><span>v</span></a></li>
<li><a href="#index_x"><span>x</span></a></li>
<li><a href="#index_y"><span>y</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all struct and union fields with links to the structures/unions they belong to:</div>
<h3><a class="anchor" id="index_a"></a>- a -</h3><ul>
<li>a
: <a class="el" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">tColorRGBA</a>
</li>
<li>aux_data
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a4b938ad61daa0a9625c6892fd46f32a2">SDL_gfxBlitInfo</a>
</li>
</ul>
<h3><a class="anchor" id="index_b"></a>- b -</h3><ul>
<li>b
: <a class="el" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">tColorRGBA</a>
</li>
<li>baseticks
: <a class="el" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">FPSmanager</a>
</li>
</ul>
<h3><a class="anchor" id="index_c"></a>- c -</h3><ul>
<li>color
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">SDL_gfxMurphyIterator</a>
</li>
<li>count
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a92fcd448f278df155fd5472527a6dc47">SDL_gfxBresenhamIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_d"></a>- d -</h3><ul>
<li>d_height
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#ad31494204fdd3d2cb30faba527cfb9fa">SDL_gfxBlitInfo</a>
</li>
<li>d_pixels
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#ae9146d0f8b236274984127a7a1528966">SDL_gfxBlitInfo</a>
</li>
<li>d_skip
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a9055858de99c49d16ef903fed31715b7">SDL_gfxBlitInfo</a>
</li>
<li>d_width
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#ad49412925c79a9894ea598530ea39b00">SDL_gfxBlitInfo</a>
</li>
<li>dst
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a177d476cb937246853b74253490436db">SDL_gfxBlitInfo</a>
, <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">SDL_gfxMurphyIterator</a>
</li>
<li>dx
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">SDL_gfxBresenhamIterator</a>
</li>
<li>dy
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">SDL_gfxBresenhamIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_e"></a>- e -</h3><ul>
<li>error
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a11614f44ef4d939bdd984953346a7572">SDL_gfxBresenhamIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_f"></a>- f -</h3><ul>
<li>first1x
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a20a0f29217c4df1896f0b5b2e0db8901">SDL_gfxMurphyIterator</a>
</li>
<li>first1y
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a1e6adb477c4b1db15853adf1b5340760">SDL_gfxMurphyIterator</a>
</li>
<li>first2x
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a0043c9be4575c0c75cda25d9cec09deb">SDL_gfxMurphyIterator</a>
</li>
<li>first2y
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac8c0bb60c5be224d8d7fd4d4fd74930c">SDL_gfxMurphyIterator</a>
</li>
<li>framecount
: <a class="el" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">FPSmanager</a>
</li>
</ul>
<h3><a class="anchor" id="index_g"></a>- g -</h3><ul>
<li>g
: <a class="el" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">tColorRGBA</a>
</li>
</ul>
<h3><a class="anchor" id="index_k"></a>- k -</h3><ul>
<li>kd
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ade809c6ad2d8ae1dc2f665077951b81a">SDL_gfxMurphyIterator</a>
</li>
<li>kt
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac77eef4f813ec344cf850b89cc68818d">SDL_gfxMurphyIterator</a>
</li>
<li>ku
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a2d8fc6210660a003e60ac96216cdd9d1">SDL_gfxMurphyIterator</a>
</li>
<li>kv
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_l"></a>- l -</h3><ul>
<li>last1x
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#adc37a4a286331a97587fdf4f239fa5e6">SDL_gfxMurphyIterator</a>
</li>
<li>last1y
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a48dabb55f39ba73ecacc558eba6f5b15">SDL_gfxMurphyIterator</a>
</li>
<li>last2x
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a1acb203975c193230a03cee26bbd3f97">SDL_gfxMurphyIterator</a>
</li>
<li>last2y
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ab85d5d3386d741c19de5bc0a7767d185">SDL_gfxMurphyIterator</a>
</li>
<li>lastticks
: <a class="el" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">FPSmanager</a>
</li>
</ul>
<h3><a class="anchor" id="index_o"></a>- o -</h3><ul>
<li>oct2
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_q"></a>- q -</h3><ul>
<li>quad4
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_r"></a>- r -</h3><ul>
<li>r
: <a class="el" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">tColorRGBA</a>
</li>
<li>rate
: <a class="el" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">FPSmanager</a>
</li>
<li>rateticks
: <a class="el" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">FPSmanager</a>
</li>
</ul>
<h3><a class="anchor" id="index_s"></a>- s -</h3><ul>
<li>s1
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#acfb6b9e2b00e34da4313b463c341e597">SDL_gfxBresenhamIterator</a>
</li>
<li>s2
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a4c68ffea7c3affb6a0ee6219aba89a69">SDL_gfxBresenhamIterator</a>
</li>
<li>s_height
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#aeeec65f001e54fb93ba97cb85cb61592">SDL_gfxBlitInfo</a>
</li>
<li>s_pixels
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a03dd1de15b100cd491eff7d823284189">SDL_gfxBlitInfo</a>
</li>
<li>s_skip
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a25b822e4773e1db6d38aadc5c0bb126f">SDL_gfxBlitInfo</a>
</li>
<li>s_width
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#ad2f7fa9a764e75639fdb6e3b0f8a68fc">SDL_gfxBlitInfo</a>
</li>
<li>src
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a1ce90142d08a06fede5e2a13d66d17f6">SDL_gfxBlitInfo</a>
</li>
<li>swapdir
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#ace147c79e29f2efd14e5744efcb976af">SDL_gfxBresenhamIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_t"></a>- t -</h3><ul>
<li>table
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a9596f5ea6998964e6240fae7ac17ce1e">SDL_gfxBlitInfo</a>
</li>
<li>tempx
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af4320e1b2f9da1ee4155b6cfe35c8d7e">SDL_gfxMurphyIterator</a>
</li>
<li>tempy
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a4c3e88fc7abb5715d04e28d96a154e5f">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_u"></a>- u -</h3><ul>
<li>u
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_v"></a>- v -</h3><ul>
<li>v
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_x"></a>- x -</h3><ul>
<li>x
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">SDL_gfxBresenhamIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_y"></a>- y -</h3><ul>
<li>y
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">SDL_gfxBresenhamIterator</a>
, <a class="el" href="structt_color_y.html#ace61c93d341a0b154df0e9923558a537">tColorY</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/functions.html | HTML | apache-2.0 | 10,903 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Data Fields - Variables</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="classes.html"><span>Data Structure Index</span></a></li>
<li class="current"><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="functions.html"><span>All</span></a></li>
<li class="current"><a href="functions_vars.html"><span>Variables</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="#index_a"><span>a</span></a></li>
<li><a href="#index_b"><span>b</span></a></li>
<li><a href="#index_c"><span>c</span></a></li>
<li><a href="#index_d"><span>d</span></a></li>
<li><a href="#index_e"><span>e</span></a></li>
<li><a href="#index_f"><span>f</span></a></li>
<li><a href="#index_g"><span>g</span></a></li>
<li><a href="#index_k"><span>k</span></a></li>
<li><a href="#index_l"><span>l</span></a></li>
<li><a href="#index_o"><span>o</span></a></li>
<li><a href="#index_q"><span>q</span></a></li>
<li><a href="#index_r"><span>r</span></a></li>
<li><a href="#index_s"><span>s</span></a></li>
<li><a href="#index_t"><span>t</span></a></li>
<li><a href="#index_u"><span>u</span></a></li>
<li><a href="#index_v"><span>v</span></a></li>
<li><a href="#index_x"><span>x</span></a></li>
<li><a href="#index_y"><span>y</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_a"></a>- a -</h3><ul>
<li>a
: <a class="el" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">tColorRGBA</a>
</li>
<li>aux_data
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a4b938ad61daa0a9625c6892fd46f32a2">SDL_gfxBlitInfo</a>
</li>
</ul>
<h3><a class="anchor" id="index_b"></a>- b -</h3><ul>
<li>b
: <a class="el" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">tColorRGBA</a>
</li>
<li>baseticks
: <a class="el" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">FPSmanager</a>
</li>
</ul>
<h3><a class="anchor" id="index_c"></a>- c -</h3><ul>
<li>color
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">SDL_gfxMurphyIterator</a>
</li>
<li>count
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a92fcd448f278df155fd5472527a6dc47">SDL_gfxBresenhamIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_d"></a>- d -</h3><ul>
<li>d_height
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#ad31494204fdd3d2cb30faba527cfb9fa">SDL_gfxBlitInfo</a>
</li>
<li>d_pixels
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#ae9146d0f8b236274984127a7a1528966">SDL_gfxBlitInfo</a>
</li>
<li>d_skip
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a9055858de99c49d16ef903fed31715b7">SDL_gfxBlitInfo</a>
</li>
<li>d_width
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#ad49412925c79a9894ea598530ea39b00">SDL_gfxBlitInfo</a>
</li>
<li>dst
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a177d476cb937246853b74253490436db">SDL_gfxBlitInfo</a>
, <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">SDL_gfxMurphyIterator</a>
</li>
<li>dx
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">SDL_gfxBresenhamIterator</a>
</li>
<li>dy
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">SDL_gfxBresenhamIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_e"></a>- e -</h3><ul>
<li>error
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a11614f44ef4d939bdd984953346a7572">SDL_gfxBresenhamIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_f"></a>- f -</h3><ul>
<li>first1x
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a20a0f29217c4df1896f0b5b2e0db8901">SDL_gfxMurphyIterator</a>
</li>
<li>first1y
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a1e6adb477c4b1db15853adf1b5340760">SDL_gfxMurphyIterator</a>
</li>
<li>first2x
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a0043c9be4575c0c75cda25d9cec09deb">SDL_gfxMurphyIterator</a>
</li>
<li>first2y
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac8c0bb60c5be224d8d7fd4d4fd74930c">SDL_gfxMurphyIterator</a>
</li>
<li>framecount
: <a class="el" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">FPSmanager</a>
</li>
</ul>
<h3><a class="anchor" id="index_g"></a>- g -</h3><ul>
<li>g
: <a class="el" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">tColorRGBA</a>
</li>
</ul>
<h3><a class="anchor" id="index_k"></a>- k -</h3><ul>
<li>kd
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ade809c6ad2d8ae1dc2f665077951b81a">SDL_gfxMurphyIterator</a>
</li>
<li>kt
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac77eef4f813ec344cf850b89cc68818d">SDL_gfxMurphyIterator</a>
</li>
<li>ku
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a2d8fc6210660a003e60ac96216cdd9d1">SDL_gfxMurphyIterator</a>
</li>
<li>kv
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_l"></a>- l -</h3><ul>
<li>last1x
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#adc37a4a286331a97587fdf4f239fa5e6">SDL_gfxMurphyIterator</a>
</li>
<li>last1y
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a48dabb55f39ba73ecacc558eba6f5b15">SDL_gfxMurphyIterator</a>
</li>
<li>last2x
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a1acb203975c193230a03cee26bbd3f97">SDL_gfxMurphyIterator</a>
</li>
<li>last2y
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ab85d5d3386d741c19de5bc0a7767d185">SDL_gfxMurphyIterator</a>
</li>
<li>lastticks
: <a class="el" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">FPSmanager</a>
</li>
</ul>
<h3><a class="anchor" id="index_o"></a>- o -</h3><ul>
<li>oct2
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_q"></a>- q -</h3><ul>
<li>quad4
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_r"></a>- r -</h3><ul>
<li>r
: <a class="el" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">tColorRGBA</a>
</li>
<li>rate
: <a class="el" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">FPSmanager</a>
</li>
<li>rateticks
: <a class="el" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">FPSmanager</a>
</li>
</ul>
<h3><a class="anchor" id="index_s"></a>- s -</h3><ul>
<li>s1
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#acfb6b9e2b00e34da4313b463c341e597">SDL_gfxBresenhamIterator</a>
</li>
<li>s2
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a4c68ffea7c3affb6a0ee6219aba89a69">SDL_gfxBresenhamIterator</a>
</li>
<li>s_height
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#aeeec65f001e54fb93ba97cb85cb61592">SDL_gfxBlitInfo</a>
</li>
<li>s_pixels
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a03dd1de15b100cd491eff7d823284189">SDL_gfxBlitInfo</a>
</li>
<li>s_skip
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a25b822e4773e1db6d38aadc5c0bb126f">SDL_gfxBlitInfo</a>
</li>
<li>s_width
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#ad2f7fa9a764e75639fdb6e3b0f8a68fc">SDL_gfxBlitInfo</a>
</li>
<li>src
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a1ce90142d08a06fede5e2a13d66d17f6">SDL_gfxBlitInfo</a>
</li>
<li>swapdir
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#ace147c79e29f2efd14e5744efcb976af">SDL_gfxBresenhamIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_t"></a>- t -</h3><ul>
<li>table
: <a class="el" href="struct_s_d_l__gfx_blit_info.html#a9596f5ea6998964e6240fae7ac17ce1e">SDL_gfxBlitInfo</a>
</li>
<li>tempx
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af4320e1b2f9da1ee4155b6cfe35c8d7e">SDL_gfxMurphyIterator</a>
</li>
<li>tempy
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a4c3e88fc7abb5715d04e28d96a154e5f">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_u"></a>- u -</h3><ul>
<li>u
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_v"></a>- v -</h3><ul>
<li>v
: <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">SDL_gfxMurphyIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_x"></a>- x -</h3><ul>
<li>x
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">SDL_gfxBresenhamIterator</a>
</li>
</ul>
<h3><a class="anchor" id="index_y"></a>- y -</h3><ul>
<li>y
: <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">SDL_gfxBresenhamIterator</a>
, <a class="el" href="structt_color_y.html#ace61c93d341a0b154df0e9923558a537">tColorY</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/functions_vars.html | HTML | apache-2.0 | 10,795 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li class="current"><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index__"></a>- _ -</h3><ul>
<li>_aalineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a41cb32b84aee2742fabd5bbaced8e016">SDL_gfxPrimitives.c</a>
</li>
<li>_bresenhamInitialize()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#af77127ff68a26c573dc5eb52723fb278">SDL_gfxPrimitives.c</a>
</li>
<li>_bresenhamIterate()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a4e0deda326a4dddde7adb2b20f927125">SDL_gfxPrimitives.c</a>
</li>
<li>_colorkey()
: <a class="el" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce">SDL_rotozoom.c</a>
</li>
<li>_evaluateBezier()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a888411ec724ddb9ff19cf9ba9fc067df">SDL_gfxPrimitives.c</a>
</li>
<li>_filledRectAlpha()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ada8cf05419af4be65d3ea5f7c7384e58">SDL_gfxPrimitives.c</a>
</li>
<li>_getTicks()
: <a class="el" href="_s_d_l__framerate_8c.html#a3bed31ab61648f7d69c8f47c90161cfe">SDL_framerate.c</a>
</li>
<li>_gfxPrimitivesCompareInt()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aeba347cfe2561fdb7f86d995a941ff1a">SDL_gfxPrimitives.c</a>
</li>
<li>_HLineAlpha()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9eb9c20c69b527cda814a19212270efa">SDL_gfxPrimitives.c</a>
</li>
<li>_HLineTextured()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aba318c28a9d4dfcf6a2e413814979a5a">SDL_gfxPrimitives.c</a>
</li>
<li>_murphyIteration()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9611a25f40d9cd4a70b3424dfa568b8b">SDL_gfxPrimitives.c</a>
</li>
<li>_murphyParaline()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae11cad619c4fc85a7ff5d3c9d9686ccb">SDL_gfxPrimitives.c</a>
</li>
<li>_murphyWideline()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#abaa64d3d707ae122c88f2a509cded121">SDL_gfxPrimitives.c</a>
</li>
<li>_pieColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac2e0cefca34b74c900cfa68e3915487b">SDL_gfxPrimitives.c</a>
</li>
<li>_putPixelAlpha()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ad31779f1ef8bad84496d4c930ec2c208">SDL_gfxPrimitives.c</a>
</li>
<li>_rotozoomSurfaceSizeTrig()
: <a class="el" href="_s_d_l__rotozoom_8c.html#af48638a298820d4d1dd24a13896963d8">SDL_rotozoom.c</a>
</li>
<li>_SDL_gfxBlitBlitterRGBA()
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a7ec9cde56a58eee4e6182c32dd8cbee7">SDL_gfxBlitFunc.c</a>
</li>
<li>_SDL_gfxBlitRGBACall()
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a9375eac21cc799258f971034a3be57b5">SDL_gfxBlitFunc.c</a>
</li>
<li>_shrinkSurfaceRGBA()
: <a class="el" href="_s_d_l__rotozoom_8c.html#ac1bde824f44ae9a76930e9782b783512">SDL_rotozoom.c</a>
</li>
<li>_shrinkSurfaceY()
: <a class="el" href="_s_d_l__rotozoom_8c.html#aadb38a61ab6727e5fd621b63418399be">SDL_rotozoom.c</a>
</li>
<li>_transformSurfaceRGBA()
: <a class="el" href="_s_d_l__rotozoom_8c.html#aae634e7b5e6ec1622fec361ecbd0d1b7">SDL_rotozoom.c</a>
</li>
<li>_VLineAlpha()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a61dd5e7523ce84fb103da3338acd3a37">SDL_gfxPrimitives.c</a>
</li>
<li>_zoomSurfaceRGBA()
: <a class="el" href="_s_d_l__rotozoom_8c.html#a9898b12bb565c4075c2da4db4891fd81">SDL_rotozoom.c</a>
</li>
<li>_zoomSurfaceY()
: <a class="el" href="_s_d_l__rotozoom_8c.html#acfeb5a322cbb575f105f1762d9d21c29">SDL_rotozoom.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals.html | HTML | apache-2.0 | 6,831 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li class="current"><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_a"></a>- a -</h3><ul>
<li>AAbits
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2e16571bedf7a97c6fc02d86b48994eb">SDL_gfxPrimitives.c</a>
</li>
<li>aacircleColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aad64361b01181e6aff940add96d23c61">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#aee66c744f9fbe58c9f93ad33375373c3">SDL_gfxPrimitives.h</a>
</li>
<li>aacircleRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a332780885aa2cfdc2de34dcff8d67e8b">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a613099498679e6280959cdfdcd59a143">SDL_gfxPrimitives.h</a>
</li>
<li>aaellipseColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1c7d20dcba8e0d7ce483f4c854c438be">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6edf60c54acc964cbb47ddefc6c0d450">SDL_gfxPrimitives.h</a>
</li>
<li>aaellipseRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ab9f0f00d7fb2f04aa9ba1630e31a27bf">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#ab6db169d39ea972469e761f338153e21">SDL_gfxPrimitives.h</a>
</li>
<li>AAlevels
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a519bc2d4d753c51da1b956d6c200bff1">SDL_gfxPrimitives.c</a>
</li>
<li>aalineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a25c56f2def855db01dcf7ff7f7356182">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4711ada424cb411e328fcedbf28ca5bd">SDL_gfxPrimitives.h</a>
</li>
<li>aalineRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a716b29af8cfc638fad0cfa0f1af15f23">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#aaf65728167a6aa7b37010560507fb4a2">SDL_gfxPrimitives.h</a>
</li>
<li>aapolygonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#acee2be5e220639d3e5c5bc643e091c1c">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a09950a50e8806e88bb20c543c58cc6a8">SDL_gfxPrimitives.c</a>
</li>
<li>aapolygonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a7d08522e52d8290c5c498ce435fa51f0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#aad73d6fc11bb01946d0ffe1c9d657cb1">SDL_gfxPrimitives.h</a>
</li>
<li>aatrigonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a4f928dfaef530c83e304a452d2e55190">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a330917705809bb5f7d74ef232dde5f12">SDL_gfxPrimitives.h</a>
</li>
<li>aatrigonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ab53a84faa65b68e40cb68b8cacbb4b7d">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e88106c90fc2e0e25d0f7617459d4f9">SDL_gfxPrimitives.h</a>
</li>
<li>ABS
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae2f08dc603ae93c402abd918ba4e23e1">SDL_gfxPrimitives.c</a>
</li>
<li>ALPHA_PIXEL_ADDITIVE_BLEND
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aa24430b32607587eae143f31c1ad14dd">SDL_gfxPrimitives.c</a>
</li>
<li>arcColor()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6180558aff14d3c240d9e8bf919869ef">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a461b8ac31e00306aee5f8a4c242671d2">SDL_gfxPrimitives.c</a>
</li>
<li>arcRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2aff993d0d8d64564e16145f401d3cf1">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5d8d25ecb69e9386289125eb21668a2f">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x61.html | HTML | apache-2.0 | 7,065 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li class="current"><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_b"></a>- b -</h3><ul>
<li>bezierColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#adfe8f9c42d29a090aae15eeb19b80d51">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#ad82395ca72b749494ff89be78f168341">SDL_gfxPrimitives.h</a>
</li>
<li>bezierRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7203e3a463da499b5b0cadf211d19ff3">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a4b7fbf6cc366abdf345a25308d53e125">SDL_gfxPrimitives.c</a>
</li>
<li>boxColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a6bb30dfc32d0aee20271a0356a2e2fd0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a16693489da67d6e65a28f9e5217b46f9">SDL_gfxPrimitives.h</a>
</li>
<li>boxRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0ae084c90bd9b734356ad723d45973c8">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1864b3062793a7f7dd81aaf8c8abd6b0">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x62.html | HTML | apache-2.0 | 4,530 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li class="current"><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_c"></a>- c -</h3><ul>
<li>characterColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aef5fdeb16c4578d8cd50e106299e993e">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#af1991f2031346131db4ae8fd40492b08">SDL_gfxPrimitives.h</a>
</li>
<li>characterRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a3f2f624c33ca753d22db52a8d9363fac">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a96379d2ce808aa642afb57bced0c670e">SDL_gfxPrimitives.c</a>
</li>
<li>circleColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aa99bd361cc947b448142720f2ca3320e">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a58d231ecaf113f53c2a28435e0632624">SDL_gfxPrimitives.h</a>
</li>
<li>circleRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8e0945b74c02cdb1441e1b2a29d2c87d">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a7fe51d4c9426c8795e58c7ddd313b0a4">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_ACCEPT
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a004c35133422cb574c41bb114d4592c6">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_BOTTOM_EDGE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae4fa529c5f9a39310b98769cdb007c2d">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_INSIDE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a3f497d83ed5f593a5bc56c2ba7e13f5b">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_LEFT_EDGE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac7260a99c00538400ab4be67304ad36c">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_REJECT
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac1e60af8e37b6b372dcfd2d88299b662">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_RIGHT_EDGE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a0f5e2b2e79afa32c688c77f776a84308">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_TOP_EDGE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#acd233fdea48722eb128c4c48f619a605">SDL_gfxPrimitives.c</a>
</li>
<li>clip_xmax
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#add68946c6ecf1a5b8935309d30b85cab">SDL_gfxPrimitives.c</a>
</li>
<li>clip_xmin
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#adeb851ac45f74ddec914212dd3297433">SDL_gfxPrimitives.c</a>
</li>
<li>clip_ymax
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2f0d9475a02c76e14c8bcba854ac7067">SDL_gfxPrimitives.c</a>
</li>
<li>clip_ymin
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#afc94a05f9b044427c21a77cc468aa5d4">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x63.html | HTML | apache-2.0 | 6,022 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li class="current"><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_d"></a>- d -</h3><ul>
<li>DEFAULT_ALPHA_PIXEL_ROUTINE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aa992e3a7310145e9f9c36edee5795996">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x64.html | HTML | apache-2.0 | 3,696 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li class="current"><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_e"></a>- e -</h3><ul>
<li>ellipseColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a476cff7702f4be9090871e35859782f0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8b46f389c626806e7a1ec148f0980737">SDL_gfxPrimitives.h</a>
</li>
<li>ellipseRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a18c8a26c9009482eec40f9f4a6945fd1">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a523156891302420d2296b1a302c1fc2b">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x65.html | HTML | apache-2.0 | 4,043 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li class="current"><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_f"></a>- f -</h3><ul>
<li>fastPixelColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#abeed0e873efdf3aec8c6c86188d36f89">SDL_gfxPrimitives.c</a>
</li>
<li>fastPixelColorNolock()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742">SDL_gfxPrimitives.c</a>
</li>
<li>fastPixelColorNolockNoclip()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#add868bff0c4cb75012a0407af6b64f03">SDL_gfxPrimitives.c</a>
</li>
<li>fastPixelRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9874fabafdc422223323751671bca7c0">SDL_gfxPrimitives.c</a>
</li>
<li>fastPixelRGBANolock()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a64916bb8270e75d936cda816d3694a25">SDL_gfxPrimitives.c</a>
</li>
<li>filledCircleColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a39147d1282ec814a1b9e31243aad0359">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4f7b717b958ef39bfc8c958476dd0de1">SDL_gfxPrimitives.h</a>
</li>
<li>filledCircleRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a562ba6b18fb70547cd50cb3bb0f70272">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a01af970ce0be38cea9884bc6f816c984">SDL_gfxPrimitives.h</a>
</li>
<li>filledEllipseColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a8fed50800f2f1bdfaa048698f5052f25">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a36e83e5648b95d38d1efe98dcf840fab">SDL_gfxPrimitives.h</a>
</li>
<li>filledEllipseRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a33595ad996dd0dcccde3abbcef540eec">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a26f01b9c0cf7a533023869dff439254f">SDL_gfxPrimitives.h</a>
</li>
<li>filledPieColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2c30ee985b2513dc58d9b19d4e71562b">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8f18679aa7161f885613ec08e7f41692">SDL_gfxPrimitives.h</a>
</li>
<li>filledPieRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a4ffdfd2834f3ef0fd0ee622b5f1d16b8">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a1944c066d27fa9847a5fdecd1d3b9116">SDL_gfxPrimitives.h</a>
</li>
<li>filledPolygonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e1fe45b835b623f6939ff0f08277531">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#af22692175cb73329410cbcc7d7491c4d">SDL_gfxPrimitives.c</a>
</li>
<li>filledPolygonColorMT()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1f3a2dcda741a2c29b5dacce4ffe0271">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0f5583d5b055f3e59a9692ca8a9dfbcf">SDL_gfxPrimitives.h</a>
</li>
<li>filledPolygonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a40ef0b898905c190c193f0f55deb5a6c">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a2b1023ddbbb25d57bd51676b49234af4">SDL_gfxPrimitives.h</a>
</li>
<li>filledPolygonRGBAMT()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a586d64a80ac67de184e33609509d45a9">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a412cddc17a592c167c060ec2d1d2fd1d">SDL_gfxPrimitives.h</a>
</li>
<li>filledRectAlpha()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ace9f2505c12c5dacc778509991cd3716">SDL_gfxPrimitives.c</a>
</li>
<li>filledTrigonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a78d4ed2372527f3b78f5893928b0f519">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6adaf54b33bf067e4fe2cc5a7ae17ef6">SDL_gfxPrimitives.h</a>
</li>
<li>filledTrigonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4a3318a183659aab7c12c0334e261837">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a8f318d776ff1e3c6790405e0e59e5356">SDL_gfxPrimitives.c</a>
</li>
<li>FPS_DEFAULT
: <a class="el" href="_s_d_l__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90">SDL_framerate.h</a>
</li>
<li>FPS_LOWER_LIMIT
: <a class="el" href="_s_d_l__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b">SDL_framerate.h</a>
</li>
<li>FPS_UPPER_LIMIT
: <a class="el" href="_s_d_l__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58">SDL_framerate.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x66.html | HTML | apache-2.0 | 7,832 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li class="current"><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_g"></a>- g -</h3><ul>
<li>GFX_ALPHA_ADJUST_ARRAY
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a6d0c17342154e14322a281603960691a">SDL_gfxBlitFunc.c</a>
, <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a6d0c17342154e14322a281603960691a">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_ALPHA_BLEND
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#ae3efb9e67172838c394c148a62822da6">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_ASSEMBLE_RGBA
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a4e59f926fb98a86c01a4ffc5cc20e8d5">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_DISASSEMBLE_RGBA
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a7dda3984ca04929e2ea0a3679f7452a9">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_DUFFS_LOOP4
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a44c498dca765a515f40eecad8f19aac4">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_FONTDATAMAX
: <a class="el" href="_s_d_l__gfx_primitives__font_8h.html#a510f902dcf7aa55fc4305b6f8e203927">SDL_gfxPrimitives_font.h</a>
</li>
<li>GFX_PIXEL_FROM_RGBA
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a64927ca5690904716f7ac93b1fcd4420">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_RGBA_FROM_PIXEL
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#ae6b2c815be86ad92310efb40d4b0b30e">SDL_gfxBlitFunc.h</a>
</li>
<li>gfxPrimitivesSetFont()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#afacd57651ec0e0ccab60753636862cd0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7cabe806643c19159948639faaf26a38">SDL_gfxPrimitives.h</a>
</li>
<li>gfxPrimitivesSetFontRotation()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a77cc480ba039c758d1cf0cd43db04bd6">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#aef6796a883f07d31bbf7c7df6d1153d2">SDL_gfxPrimitives.c</a>
</li>
<li>GUARD_ROWS
: <a class="el" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb">SDL_rotozoom.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x67.html | HTML | apache-2.0 | 5,415 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li class="current"><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_h"></a>- h -</h3><ul>
<li>hlineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a31ac87bf32186325deedf5188b987ef6">SDL_gfxPrimitives.h</a>
</li>
<li>hlineColorStore()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#af20de4fe06f4d997eb2ab01a2252f071">SDL_gfxPrimitives.c</a>
</li>
<li>hlineRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#ae48e69e0f5d13ea79ffac262b146ae9e">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a6608a0d1d4c7e16fa1afcbd3eb5c3850">SDL_gfxPrimitives.c</a>
</li>
<li>hlineRGBAStore()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1b22ffb35c7690b4b0d8ba901640edae">SDL_gfxPrimitives.c</a>
</li>
<li>HYPOT
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a764ddb925da0921f024fadb4c12d7382">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x68.html | HTML | apache-2.0 | 4,446 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li class="current"><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_l"></a>- l -</h3><ul>
<li>lineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6f37058aed308619de8109ebe84b5fe9">SDL_gfxPrimitives.h</a>
</li>
<li>lineRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a760139e11a9ae5defeb755ca0c794f5f">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e4bd13b12d34698fbcb2dc9d3a0e9f3">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x6c.html | HTML | apache-2.0 | 4,037 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li class="current"><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_m"></a>- m -</h3><ul>
<li>M_PI
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">SDL_rotozoom.h</a>
</li>
<li>MAX
: <a class="el" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f">SDL_rotozoom.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x6d.html | HTML | apache-2.0 | 3,889 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li class="current"><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_p"></a>- p -</h3><ul>
<li>pieColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a3c2bc64deabda74933f31daba6bed7be">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6476d5dad22631d10c1dc95b0e88fc65">SDL_gfxPrimitives.h</a>
</li>
<li>pieRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4a5e4344913667e714560dd204473663">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a8442f2c2bedbe27c96d8d44319981992">SDL_gfxPrimitives.c</a>
</li>
<li>pixelColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7fe611dbb029ae70be89d5314c7e023b">SDL_gfxPrimitives.h</a>
</li>
<li>pixelColorNolock()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0">SDL_gfxPrimitives.c</a>
</li>
<li>pixelColorWeight()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#af9269ad9bbfa20980d5947c85dda63d5">SDL_gfxPrimitives.c</a>
</li>
<li>pixelColorWeightNolock()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1">SDL_gfxPrimitives.c</a>
</li>
<li>pixelRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a7b6f83bdef72f6b356664a93841381c0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0046efc721e77b745fd5b621fbd48513">SDL_gfxPrimitives.h</a>
</li>
<li>polygonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2d692dc25f3b579b386dff8dcd9cbc00">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#abe5d0b2f6193558798eaff3e85e7a1af">SDL_gfxPrimitives.h</a>
</li>
<li>polygonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae55541ec58990420dc6dc6b9d61f33d6">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a46b327da5cba5d401cf400bdef7560d0">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x70.html | HTML | apache-2.0 | 5,454 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li class="current"><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_r"></a>- r -</h3><ul>
<li>rectangleColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a6ab25c393f6e5f8d68ea3365f6ea98d2">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a36453f52608a10f3d6b8edccae260b95">SDL_gfxPrimitives.h</a>
</li>
<li>rectangleRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6c41cbfd0618262de4d4d127ed1e67fe">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a40991c6eeb936d35d0a8e8aa95268f72">SDL_gfxPrimitives.c</a>
</li>
<li>rotateSurface90Degrees()
: <a class="el" href="_s_d_l__rotozoom_8c.html#a77563d68634cb2624d4f2f0bcdc19e73">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#ac06e9fa4fce6a1dbae45462529be581e">SDL_rotozoom.h</a>
</li>
<li>rotozoomSurface()
: <a class="el" href="_s_d_l__rotozoom_8h.html#a3cb0c11d5edc929579c807dc7612348c">SDL_rotozoom.h</a>
, <a class="el" href="_s_d_l__rotozoom_8c.html#a5f64ed53eeee5f2667971c857698d1e5">SDL_rotozoom.c</a>
</li>
<li>rotozoomSurfaceSize()
: <a class="el" href="_s_d_l__rotozoom_8c.html#a9886c783255edfd70a4974f8f3dd5a8c">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a3ca2316375d6faf4f19b26c2f1f14bbc">SDL_rotozoom.h</a>
</li>
<li>rotozoomSurfaceSizeXY()
: <a class="el" href="_s_d_l__rotozoom_8c.html#aee64992d26c818d9975610754d5c929b">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a612334fa642f672af953f544da6245d0">SDL_rotozoom.h</a>
</li>
<li>rotozoomSurfaceXY()
: <a class="el" href="_s_d_l__rotozoom_8c.html#aab98b5b0da4ea468bacf47f7b85f0ee2">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a454d4234a45eab6ec238a40cc44051d4">SDL_rotozoom.h</a>
</li>
<li>roundedBoxColor()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a9f9be6e605e764fd23dd154fb12b80e9">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a718c4f31d1e145106959c2a77d5fee9d">SDL_gfxPrimitives.c</a>
</li>
<li>roundedBoxRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aad706348fec18631d7bc48a2d91f5b4d">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7105b88e62fe42b26602d3b426547bc7">SDL_gfxPrimitives.h</a>
</li>
<li>roundedRectangleColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a830dd9dcfa39f4718aa2c269060326d0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4109d2d1efa021c021fc4a98a0e3691b">SDL_gfxPrimitives.h</a>
</li>
<li>roundedRectangleRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a475432abc4756e6f30ef097d5cac02c9">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a300272b3b799f09ca6cd5c541b19f07a">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x72.html | HTML | apache-2.0 | 6,234 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li class="current"><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_s"></a>- s -</h3><ul>
<li>SDL_FRAMERATE_SCOPE
: <a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_framerate.h</a>
</li>
<li>SDL_framerateDelay()
: <a class="el" href="_s_d_l__framerate_8c.html#afce13fa3dd37130deb4975d8b230c3ba">SDL_framerate.c</a>
, <a class="el" href="_s_d_l__framerate_8h.html#a2c452933d7376dbb0083304b760ed63b">SDL_framerate.h</a>
</li>
<li>SDL_getFramecount()
: <a class="el" href="_s_d_l__framerate_8c.html#a96b13e26f8436222e866904a592a6eec">SDL_framerate.c</a>
, <a class="el" href="_s_d_l__framerate_8h.html#a3f3b7da73f3d92ff82b069b6108aa7ad">SDL_framerate.h</a>
</li>
<li>SDL_getFramerate()
: <a class="el" href="_s_d_l__framerate_8c.html#a575bb511d6f817ad846a788cbd08ae91">SDL_framerate.c</a>
, <a class="el" href="_s_d_l__framerate_8h.html#adeb2ddd02412527aad226ba453a21999">SDL_framerate.h</a>
</li>
<li>SDL_GFXBLITFUNC_SCOPE
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_gfxBlitFunc.h</a>
</li>
<li>SDL_gfxBlitRGBA()
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#ac51ff40d39f3dd0bd08116e8953960f8">SDL_gfxBlitFunc.c</a>
, <a class="el" href="_s_d_l__gfx_blit_func_8h.html#ab49c560e89b8305051b2e6b347215f03">SDL_gfxBlitFunc.h</a>
</li>
<li>SDL_gfxMultiplyAlpha()
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a4ece530dca0ae46b1f5a780f85371687">SDL_gfxBlitFunc.c</a>
, <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a7c93594525ae349b5cef0156b8f758fc">SDL_gfxBlitFunc.h</a>
</li>
<li>SDL_GFXPRIMITIVES_MAJOR
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a2a585f5832061010155d87737ef5bf88">SDL_gfxPrimitives.h</a>
</li>
<li>SDL_GFXPRIMITIVES_MICRO
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a06ea681a295987b8b8ec3fcdb04713df">SDL_gfxPrimitives.h</a>
</li>
<li>SDL_GFXPRIMITIVES_MINOR
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#abd0939b1856bbb822b37b68755dc9ee5">SDL_gfxPrimitives.h</a>
</li>
<li>SDL_GFXPRIMITIVES_SCOPE
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_gfxPrimitives.h</a>
</li>
<li>SDL_gfxSetAlpha()
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a09a376775f9d8c933c7121e34fe5ecfc">SDL_gfxBlitFunc.c</a>
, <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a4627ae4a0037d0b248bed87f3c294735">SDL_gfxBlitFunc.h</a>
</li>
<li>SDL_IMAGEFILTER_SCOPE
: <a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterAbsDiff()
: <a class="el" href="_s_d_l__image_filter_8c.html#a472909f904274255cd6793c520172e48">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a789ce070edcc478ad97a0d7ff90e6aa2">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterAdd()
: <a class="el" href="_s_d_l__image_filter_8c.html#a9f06507eb0b63198dbd67495d61c9b20">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a9034268e2f51550d8f1d6084bda45194">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterAddByte()
: <a class="el" href="_s_d_l__image_filter_8c.html#a812cb307cb60ef31f1ffe81a9eee6bb1">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a6be6dccd000eff4baadd33297e5cc419">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterAddByteToHalf()
: <a class="el" href="_s_d_l__image_filter_8c.html#ab82db97d129c8cfc36780bcdc6286fcc">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a8cbdffd5dbcab3b5dc9207d57af616b3">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterAddUint()
: <a class="el" href="_s_d_l__image_filter_8c.html#a660543426c47dfec39a349eb3b8f905b">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#af1a17645dea69e52c7bd560521286765">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterAlignStack()
: <a class="el" href="_s_d_l__image_filter_8c.html#afbfcc8c03e3d791ac74c955d14a135e4">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a08a45265e9e84bf8beedebba26da947c">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterBinarizeUsingThreshold()
: <a class="el" href="_s_d_l__image_filter_8c.html#a951a062e15df290a137428e1e0f4d5ce">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#ad5bf97d7e39d018d2eeb570e97edf8c0">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterBitAnd()
: <a class="el" href="_s_d_l__image_filter_8c.html#a85837ce1b5de1f907b6b9053922b5cbc">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a5f67460c0b89dadd49d04832608a345b">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterBitNegation()
: <a class="el" href="_s_d_l__image_filter_8c.html#ac3abfaa8ec2e88c3c4893588c5555856">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#abc3c3fc5f018e271f6393921f3964d31">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterBitOr()
: <a class="el" href="_s_d_l__image_filter_8c.html#a5cf1c477f4e32d02f74ee95d9f7b0021">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a0acf0eabba33f8fa7acbc08dc3015cd3">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterClipToRange()
: <a class="el" href="_s_d_l__image_filter_8c.html#ab7224abc4ecc1b8a6f4441ef8379515f">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#ae9d552de9cf5a4a1716d91ee905eafd7">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel3x3Divide()
: <a class="el" href="_s_d_l__image_filter_8c.html#a8e7e4138a93e26f1912763189d407770">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a7286cd21fa0a0cfb0606806dacfbe121">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel3x3ShiftRight()
: <a class="el" href="_s_d_l__image_filter_8c.html#ac329e5a3b60351768c96c94db9f9cf97">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a67929babce179e1e333c5cd2e5fc4091">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel5x5Divide()
: <a class="el" href="_s_d_l__image_filter_8c.html#ac9a556492480ce71f54d456a0ff7e6cb">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a432d7bcc34b6bea42d1a07b4db795e1f">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel5x5ShiftRight()
: <a class="el" href="_s_d_l__image_filter_8c.html#a5253738dc4c892352b078d9a7dec2b20">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a9aaa45452b04f51f52826c2104ea3b85">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel7x7Divide()
: <a class="el" href="_s_d_l__image_filter_8c.html#a363f48e6843fd3f48da53688b89bca48">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#acc177cf891758fdc4bf7533fb266e339">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel7x7ShiftRight()
: <a class="el" href="_s_d_l__image_filter_8c.html#a48b40065652dda699875f1425b9227a6">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a6dbe52e917c0858bd311e9ce75219587">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel9x9Divide()
: <a class="el" href="_s_d_l__image_filter_8c.html#ae1e91ff193beed110a71119ec901f09d">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#af8a8114acd0509787ae5265990049720">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel9x9ShiftRight()
: <a class="el" href="_s_d_l__image_filter_8c.html#a6aaa30dc51d1e51585d02d123b0f1a7a">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#ad2702d0524a16032118fdf67e3e0f44a">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterDiv()
: <a class="el" href="_s_d_l__image_filter_8c.html#a0ea22f01c6a4724bac307da3e5355f58">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#aeb8ed56aa7de3c8b0d0b2aa9163c3e37">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMean()
: <a class="el" href="_s_d_l__image_filter_8c.html#ace072118fef77973210eb04fb4bfc779">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a69cfa83c5d198c8ae4be4ab86e8d3b8f">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMMXdetect()
: <a class="el" href="_s_d_l__image_filter_8h.html#a5823f6eb23fe8e74764a94f3d78204ef">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterMMXoff()
: <a class="el" href="_s_d_l__image_filter_8c.html#a5dff661660755161bb4aaf6199cd1384">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a403adc470cb1dd34520f18d55804d4ea">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMMXon()
: <a class="el" href="_s_d_l__image_filter_8c.html#a353ee234c3b51b33c4c5c4b30db5832d">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a848ce7e9551b25fea19fe1fb739f74fb">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMult()
: <a class="el" href="_s_d_l__image_filter_8c.html#af4633031d40a9ea0956a2f3c6c87a384">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a4657c2a1e1bf55d3241dc737cd618409">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMultByByte()
: <a class="el" href="_s_d_l__image_filter_8c.html#a06f7a19d6e2fc89d7b48cc45d715806d">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#add06bb6ea7847fc13a3041ddceb4ac3c">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMultDivby2()
: <a class="el" href="_s_d_l__image_filter_8c.html#a80737f6427c7bdb30d39a92f6524fc14">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#aa19248767b1fd9ffdea4ba69b9f00175">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMultDivby4()
: <a class="el" href="_s_d_l__image_filter_8c.html#a30e685653eb1050c7d48feaeb8f801a1">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#aa92bea3946c8081c9656304a7d944fae">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMultNor()
: <a class="el" href="_s_d_l__image_filter_8c.html#a5f3c9fd40426bb46eba5ac167505dcc5">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#ac4f3446d0da18746b48606fe37c26385">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMultNorASM()
: <a class="el" href="_s_d_l__image_filter_8c.html#a346db972dff9c56e3c45c904eaa3c39a">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterNormalizeLinear()
: <a class="el" href="_s_d_l__image_filter_8h.html#aacb316a18d8cb7999d5d53ee5e7b9750">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#ab018ace4db884cac953b06b09c00828b">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterRestoreStack()
: <a class="el" href="_s_d_l__image_filter_8c.html#a3147eb5ddd4965d65702f0e533b42974">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a84f360601d5e6e017f0e74a2cf83be6c">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterShiftLeft()
: <a class="el" href="_s_d_l__image_filter_8c.html#a98372fea76310903abef7808db10d226">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a084f9544f049cc01e7b2f1090534abbf">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterShiftLeftByte()
: <a class="el" href="_s_d_l__image_filter_8h.html#ac32f1ea9acbee51c2db94224ef6f7fd2">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a4561a73b249a26babc4c469ffbdae604">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterShiftLeftUint()
: <a class="el" href="_s_d_l__image_filter_8c.html#a250e796fb2db470da0a78b74b78114e8">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a4fd6d4a9711c13163496587454d9f1a2">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterShiftRight()
: <a class="el" href="_s_d_l__image_filter_8h.html#a931f1232cd03acd2ba90af222625f4ca">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a68851aed2dcc5dfd2f3b258236f3b88c">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterShiftRightAndMultByByte()
: <a class="el" href="_s_d_l__image_filter_8h.html#a40e1e21ede9a7ed1eddac2cdbfd0b079">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a0713d6c267fba9756d6beae81e89f9e4">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterShiftRightUint()
: <a class="el" href="_s_d_l__image_filter_8h.html#a4ccddf5c575cc4d6074c9a54789240a6">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a540d4625d76bcd03318c2a59ce650fdb">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterSobelX()
: <a class="el" href="_s_d_l__image_filter_8c.html#a015fe05161b701162d9ecffb01413f1e">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a2a0e4e259150abbe33bcddb046c367ba">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterSobelXShiftRight()
: <a class="el" href="_s_d_l__image_filter_8h.html#ab9cc925cd9b135e245936d718b459032">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a0d21af83f0183fcd697324cffe3ab3d7">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterSub()
: <a class="el" href="_s_d_l__image_filter_8c.html#a3c01cf8576ea7a0dfc09dbaa953c9287">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a0e0fb80a3dad33d61a8147c7fb9f529d">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterSubByte()
: <a class="el" href="_s_d_l__image_filter_8h.html#af8f4ab4050a0661c7696783ba1a1b12b">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a387fb6f0d48cc5d08f37f7f9b92d14b2">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterSubByteMMX()
: <a class="el" href="_s_d_l__image_filter_8c.html#a657e128016cc448778007d8b6475dd65">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterSubUint()
: <a class="el" href="_s_d_l__image_filter_8h.html#ae2f3c5992701bded7c2d256bbbfb403f">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#abb343ef95e22945e1d4d648b2e176e64">SDL_imageFilter.c</a>
</li>
<li>SDL_initFramerate()
: <a class="el" href="_s_d_l__framerate_8c.html#a444ebaaaa6b1ceeafa921562bdab1a44">SDL_framerate.c</a>
, <a class="el" href="_s_d_l__framerate_8h.html#a3ca69231486837c809fdcbe5b0a10787">SDL_framerate.h</a>
</li>
<li>SDL_ROTOZOOM_SCOPE
: <a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_rotozoom.h</a>
</li>
<li>SDL_setFramerate()
: <a class="el" href="_s_d_l__framerate_8c.html#afad4b503cf9719daced45fa4d9653d72">SDL_framerate.c</a>
, <a class="el" href="_s_d_l__framerate_8h.html#a186ef8e6b1ee4ab36e05b162545fb0e4">SDL_framerate.h</a>
</li>
<li>shrinkSurface()
: <a class="el" href="_s_d_l__rotozoom_8h.html#a7a7ac2cc0d79d282b5a4c76143b7e7a9">SDL_rotozoom.h</a>
, <a class="el" href="_s_d_l__rotozoom_8c.html#aad3bf0cd89cc39ff874ffa778fa1495d">SDL_rotozoom.c</a>
</li>
<li>SMOOTHING_OFF
: <a class="el" href="_s_d_l__rotozoom_8h.html#a6541cd06edcce77d8a6f1c6350c988af">SDL_rotozoom.h</a>
</li>
<li>SMOOTHING_ON
: <a class="el" href="_s_d_l__rotozoom_8h.html#abeb6ae7618fcb315d0399fe65849a2e8">SDL_rotozoom.h</a>
</li>
<li>stringColor()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a96b6a43c6ef4753996e33bb7fea483bc">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a62d2ba55abc7673f2dfa29e6bbffefdf">SDL_gfxPrimitives.c</a>
</li>
<li>stringRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a769833ae414222099783a9b69bed4009">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a6ca71826e311bdd9acf13b009256aa1c">SDL_gfxPrimitives.c</a>
</li>
<li>SWAP_32
: <a class="el" href="_s_d_l__image_filter_8c.html#a700fb30611761c46a674a45cc28ff561">SDL_imageFilter.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x73.html | HTML | apache-2.0 | 18,752 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li class="current"><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_t"></a>- t -</h3><ul>
<li>tColorRGBA
: <a class="el" href="_s_d_l__rotozoom_8c.html#ac91ff95383d3a6c0df046a42e23baf04">SDL_rotozoom.c</a>
</li>
<li>tColorY
: <a class="el" href="_s_d_l__rotozoom_8c.html#a9db27e25d1a6e93c64eb768007dcf3da">SDL_rotozoom.c</a>
</li>
<li>texturedPolygon()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5ca5a9bcfeba5b1a1577202e79b494d8">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a65137af308ea878f28abc95419e8aef5">SDL_gfxPrimitives.c</a>
</li>
<li>texturedPolygonMT()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a28ae354c6272da21b5753ae4ab9e1e84">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a326937a19cfbebea09aa0a7c908d89aa">SDL_gfxPrimitives.h</a>
</li>
<li>thickLineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a40c34464b6c99fd72c4bd7acfac5915d">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1494109358b4e4b7ec300d83e3f90300">SDL_gfxPrimitives.c</a>
</li>
<li>thickLineRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a8b24d64b51e23592c93abc2aa50c818e">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#aa740c1eff9163862704eb3bb3b5964db">SDL_gfxPrimitives.h</a>
</li>
<li>transformSurfaceY()
: <a class="el" href="_s_d_l__rotozoom_8c.html#a126e3b96b22cc18e78e33cc1f8eb6c3c">SDL_rotozoom.c</a>
</li>
<li>trigonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a7465d08ef930ebb5442c7dd246fed4b5">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#aec2a0c435b879a29167be6b1c49f1e49">SDL_gfxPrimitives.h</a>
</li>
<li>trigonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a45d6a7edcd8b25e1a60e39b7f60bda3f">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a090024f5f3e38b02b0bca704259b9d11">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x74.html | HTML | apache-2.0 | 5,420 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li class="current"><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_v"></a>- v -</h3><ul>
<li>VALUE_LIMIT
: <a class="el" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9">SDL_rotozoom.c</a>
</li>
<li>vlineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#ab68d565f00527a67c9d88121c753302c">SDL_gfxPrimitives.h</a>
</li>
<li>vlineRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a8b79ac1e779755aee92b04f3a6cfc5d7">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a68ed9a65e3e0de26136566b0cf0c859e">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x76.html | HTML | apache-2.0 | 4,162 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals.html#index__"><span>_</span></a></li>
<li><a href="globals_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_0x64.html#index_d"><span>d</span></a></li>
<li><a href="globals_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="globals_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_0x76.html#index_v"><span>v</span></a></li>
<li class="current"><a href="globals_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<div class="textblock">Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:</div>
<h3><a class="anchor" id="index_z"></a>- z -</h3><ul>
<li>zoomSurface()
: <a class="el" href="_s_d_l__rotozoom_8c.html#abdd772b2f6b1f26134e4e90cda657a21">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a06c8108f8fe8de77cf841c176ee64850">SDL_rotozoom.h</a>
</li>
<li>zoomSurfaceSize()
: <a class="el" href="_s_d_l__rotozoom_8c.html#a8ba40859c1a977dae87488dd8be1bf9a">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a7927e415d87ea7856794cd4cc77e0a25">SDL_rotozoom.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_0x7a.html | HTML | apache-2.0 | 4,002 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li class="current"><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="#index_a"><span>a</span></a></li>
<li><a href="#index_c"><span>c</span></a></li>
<li><a href="#index_d"><span>d</span></a></li>
<li><a href="#index_f"><span>f</span></a></li>
<li><a href="#index_g"><span>g</span></a></li>
<li><a href="#index_h"><span>h</span></a></li>
<li><a href="#index_m"><span>m</span></a></li>
<li><a href="#index_s"><span>s</span></a></li>
<li><a href="#index_v"><span>v</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_a"></a>- a -</h3><ul>
<li>AAbits
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2e16571bedf7a97c6fc02d86b48994eb">SDL_gfxPrimitives.c</a>
</li>
<li>AAlevels
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a519bc2d4d753c51da1b956d6c200bff1">SDL_gfxPrimitives.c</a>
</li>
<li>ABS
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae2f08dc603ae93c402abd918ba4e23e1">SDL_gfxPrimitives.c</a>
</li>
<li>ALPHA_PIXEL_ADDITIVE_BLEND
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aa24430b32607587eae143f31c1ad14dd">SDL_gfxPrimitives.c</a>
</li>
</ul>
<h3><a class="anchor" id="index_c"></a>- c -</h3><ul>
<li>CLIP_ACCEPT
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a004c35133422cb574c41bb114d4592c6">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_BOTTOM_EDGE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae4fa529c5f9a39310b98769cdb007c2d">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_INSIDE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a3f497d83ed5f593a5bc56c2ba7e13f5b">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_LEFT_EDGE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac7260a99c00538400ab4be67304ad36c">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_REJECT
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac1e60af8e37b6b372dcfd2d88299b662">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_RIGHT_EDGE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a0f5e2b2e79afa32c688c77f776a84308">SDL_gfxPrimitives.c</a>
</li>
<li>CLIP_TOP_EDGE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#acd233fdea48722eb128c4c48f619a605">SDL_gfxPrimitives.c</a>
</li>
<li>clip_xmax
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#add68946c6ecf1a5b8935309d30b85cab">SDL_gfxPrimitives.c</a>
</li>
<li>clip_xmin
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#adeb851ac45f74ddec914212dd3297433">SDL_gfxPrimitives.c</a>
</li>
<li>clip_ymax
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2f0d9475a02c76e14c8bcba854ac7067">SDL_gfxPrimitives.c</a>
</li>
<li>clip_ymin
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#afc94a05f9b044427c21a77cc468aa5d4">SDL_gfxPrimitives.c</a>
</li>
</ul>
<h3><a class="anchor" id="index_d"></a>- d -</h3><ul>
<li>DEFAULT_ALPHA_PIXEL_ROUTINE
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aa992e3a7310145e9f9c36edee5795996">SDL_gfxPrimitives.c</a>
</li>
</ul>
<h3><a class="anchor" id="index_f"></a>- f -</h3><ul>
<li>FPS_DEFAULT
: <a class="el" href="_s_d_l__framerate_8h.html#ab3ac02e6acb348129a019b9f20aa5c90">SDL_framerate.h</a>
</li>
<li>FPS_LOWER_LIMIT
: <a class="el" href="_s_d_l__framerate_8h.html#a9555dceeaaffdd2669c991e6a300085b">SDL_framerate.h</a>
</li>
<li>FPS_UPPER_LIMIT
: <a class="el" href="_s_d_l__framerate_8h.html#aeaeac0f0b439344496e29abf60904d58">SDL_framerate.h</a>
</li>
</ul>
<h3><a class="anchor" id="index_g"></a>- g -</h3><ul>
<li>GFX_ALPHA_BLEND
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#ae3efb9e67172838c394c148a62822da6">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_ASSEMBLE_RGBA
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a4e59f926fb98a86c01a4ffc5cc20e8d5">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_DISASSEMBLE_RGBA
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a7dda3984ca04929e2ea0a3679f7452a9">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_DUFFS_LOOP4
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a44c498dca765a515f40eecad8f19aac4">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_FONTDATAMAX
: <a class="el" href="_s_d_l__gfx_primitives__font_8h.html#a510f902dcf7aa55fc4305b6f8e203927">SDL_gfxPrimitives_font.h</a>
</li>
<li>GFX_PIXEL_FROM_RGBA
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a64927ca5690904716f7ac93b1fcd4420">SDL_gfxBlitFunc.h</a>
</li>
<li>GFX_RGBA_FROM_PIXEL
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#ae6b2c815be86ad92310efb40d4b0b30e">SDL_gfxBlitFunc.h</a>
</li>
<li>GUARD_ROWS
: <a class="el" href="_s_d_l__rotozoom_8c.html#a05a2601b7ea2906858ccc31b45fdc6eb">SDL_rotozoom.c</a>
</li>
</ul>
<h3><a class="anchor" id="index_h"></a>- h -</h3><ul>
<li>HYPOT
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a764ddb925da0921f024fadb4c12d7382">SDL_gfxPrimitives.c</a>
</li>
</ul>
<h3><a class="anchor" id="index_m"></a>- m -</h3><ul>
<li>M_PI
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#ae71449b1cc6e6250b91f539153a7a0d3">SDL_rotozoom.h</a>
</li>
<li>MAX
: <a class="el" href="_s_d_l__rotozoom_8c.html#afa99ec4acc4ecb2dc3c2d05da15d0e3f">SDL_rotozoom.c</a>
</li>
</ul>
<h3><a class="anchor" id="index_s"></a>- s -</h3><ul>
<li>SDL_FRAMERATE_SCOPE
: <a class="el" href="_s_d_l__framerate_8h.html#a3dea4aed583d439f014e606c18da6fe4">SDL_framerate.h</a>
</li>
<li>SDL_GFXBLITFUNC_SCOPE
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a8fcea397327309f4ab31a3251f15f911">SDL_gfxBlitFunc.h</a>
</li>
<li>SDL_GFXPRIMITIVES_MAJOR
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a2a585f5832061010155d87737ef5bf88">SDL_gfxPrimitives.h</a>
</li>
<li>SDL_GFXPRIMITIVES_MICRO
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a06ea681a295987b8b8ec3fcdb04713df">SDL_gfxPrimitives.h</a>
</li>
<li>SDL_GFXPRIMITIVES_MINOR
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#abd0939b1856bbb822b37b68755dc9ee5">SDL_gfxPrimitives.h</a>
</li>
<li>SDL_GFXPRIMITIVES_SCOPE
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a9501419cbbd2b8739ec5dc4e890c165b">SDL_gfxPrimitives.h</a>
</li>
<li>SDL_IMAGEFILTER_SCOPE
: <a class="el" href="_s_d_l__image_filter_8h.html#a205445dc4dec6756a28ea815437ed6dd">SDL_imageFilter.h</a>
</li>
<li>SDL_ROTOZOOM_SCOPE
: <a class="el" href="_s_d_l__rotozoom_8h.html#a5115250bd769f389e278cd5adfb63179">SDL_rotozoom.h</a>
</li>
<li>SMOOTHING_OFF
: <a class="el" href="_s_d_l__rotozoom_8h.html#a6541cd06edcce77d8a6f1c6350c988af">SDL_rotozoom.h</a>
</li>
<li>SMOOTHING_ON
: <a class="el" href="_s_d_l__rotozoom_8h.html#abeb6ae7618fcb315d0399fe65849a2e8">SDL_rotozoom.h</a>
</li>
<li>SWAP_32
: <a class="el" href="_s_d_l__image_filter_8c.html#a700fb30611761c46a674a45cc28ff561">SDL_imageFilter.c</a>
</li>
</ul>
<h3><a class="anchor" id="index_v"></a>- v -</h3><ul>
<li>VALUE_LIMIT
: <a class="el" href="_s_d_l__rotozoom_8c.html#a98a929bd64d660c1860c7b60b4fe5bd9">SDL_rotozoom.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_defs.html | HTML | apache-2.0 | 8,924 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li class="current"><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index__"></a>- _ -</h3><ul>
<li>_aalineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a41cb32b84aee2742fabd5bbaced8e016">SDL_gfxPrimitives.c</a>
</li>
<li>_bresenhamInitialize()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#af77127ff68a26c573dc5eb52723fb278">SDL_gfxPrimitives.c</a>
</li>
<li>_bresenhamIterate()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a4e0deda326a4dddde7adb2b20f927125">SDL_gfxPrimitives.c</a>
</li>
<li>_colorkey()
: <a class="el" href="_s_d_l__rotozoom_8c.html#afe2a2e4dc6cc462c5fc98a2110b8e1ce">SDL_rotozoom.c</a>
</li>
<li>_evaluateBezier()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a888411ec724ddb9ff19cf9ba9fc067df">SDL_gfxPrimitives.c</a>
</li>
<li>_filledRectAlpha()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ada8cf05419af4be65d3ea5f7c7384e58">SDL_gfxPrimitives.c</a>
</li>
<li>_getTicks()
: <a class="el" href="_s_d_l__framerate_8c.html#a3bed31ab61648f7d69c8f47c90161cfe">SDL_framerate.c</a>
</li>
<li>_gfxPrimitivesCompareInt()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aeba347cfe2561fdb7f86d995a941ff1a">SDL_gfxPrimitives.c</a>
</li>
<li>_HLineAlpha()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9eb9c20c69b527cda814a19212270efa">SDL_gfxPrimitives.c</a>
</li>
<li>_HLineTextured()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aba318c28a9d4dfcf6a2e413814979a5a">SDL_gfxPrimitives.c</a>
</li>
<li>_murphyIteration()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9611a25f40d9cd4a70b3424dfa568b8b">SDL_gfxPrimitives.c</a>
</li>
<li>_murphyParaline()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae11cad619c4fc85a7ff5d3c9d9686ccb">SDL_gfxPrimitives.c</a>
</li>
<li>_murphyWideline()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#abaa64d3d707ae122c88f2a509cded121">SDL_gfxPrimitives.c</a>
</li>
<li>_pieColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac2e0cefca34b74c900cfa68e3915487b">SDL_gfxPrimitives.c</a>
</li>
<li>_putPixelAlpha()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ad31779f1ef8bad84496d4c930ec2c208">SDL_gfxPrimitives.c</a>
</li>
<li>_rotozoomSurfaceSizeTrig()
: <a class="el" href="_s_d_l__rotozoom_8c.html#af48638a298820d4d1dd24a13896963d8">SDL_rotozoom.c</a>
</li>
<li>_SDL_gfxBlitBlitterRGBA()
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a7ec9cde56a58eee4e6182c32dd8cbee7">SDL_gfxBlitFunc.c</a>
</li>
<li>_SDL_gfxBlitRGBACall()
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a9375eac21cc799258f971034a3be57b5">SDL_gfxBlitFunc.c</a>
</li>
<li>_shrinkSurfaceRGBA()
: <a class="el" href="_s_d_l__rotozoom_8c.html#ac1bde824f44ae9a76930e9782b783512">SDL_rotozoom.c</a>
</li>
<li>_shrinkSurfaceY()
: <a class="el" href="_s_d_l__rotozoom_8c.html#aadb38a61ab6727e5fd621b63418399be">SDL_rotozoom.c</a>
</li>
<li>_transformSurfaceRGBA()
: <a class="el" href="_s_d_l__rotozoom_8c.html#aae634e7b5e6ec1622fec361ecbd0d1b7">SDL_rotozoom.c</a>
</li>
<li>_VLineAlpha()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a61dd5e7523ce84fb103da3338acd3a37">SDL_gfxPrimitives.c</a>
</li>
<li>_zoomSurfaceRGBA()
: <a class="el" href="_s_d_l__rotozoom_8c.html#a9898b12bb565c4075c2da4db4891fd81">SDL_rotozoom.c</a>
</li>
<li>_zoomSurfaceY()
: <a class="el" href="_s_d_l__rotozoom_8c.html#acfeb5a322cbb575f105f1762d9d21c29">SDL_rotozoom.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func.html | HTML | apache-2.0 | 6,631 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li class="current"><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_a"></a>- a -</h3><ul>
<li>aacircleColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aad64361b01181e6aff940add96d23c61">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#aee66c744f9fbe58c9f93ad33375373c3">SDL_gfxPrimitives.h</a>
</li>
<li>aacircleRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a613099498679e6280959cdfdcd59a143">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a332780885aa2cfdc2de34dcff8d67e8b">SDL_gfxPrimitives.c</a>
</li>
<li>aaellipseColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1c7d20dcba8e0d7ce483f4c854c438be">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6edf60c54acc964cbb47ddefc6c0d450">SDL_gfxPrimitives.h</a>
</li>
<li>aaellipseRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#ab6db169d39ea972469e761f338153e21">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#ab9f0f00d7fb2f04aa9ba1630e31a27bf">SDL_gfxPrimitives.c</a>
</li>
<li>aalineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a25c56f2def855db01dcf7ff7f7356182">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4711ada424cb411e328fcedbf28ca5bd">SDL_gfxPrimitives.h</a>
</li>
<li>aalineRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a716b29af8cfc638fad0cfa0f1af15f23">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#aaf65728167a6aa7b37010560507fb4a2">SDL_gfxPrimitives.h</a>
</li>
<li>aapolygonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a09950a50e8806e88bb20c543c58cc6a8">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#acee2be5e220639d3e5c5bc643e091c1c">SDL_gfxPrimitives.h</a>
</li>
<li>aapolygonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a7d08522e52d8290c5c498ce435fa51f0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#aad73d6fc11bb01946d0ffe1c9d657cb1">SDL_gfxPrimitives.h</a>
</li>
<li>aatrigonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a4f928dfaef530c83e304a452d2e55190">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a330917705809bb5f7d74ef232dde5f12">SDL_gfxPrimitives.h</a>
</li>
<li>aatrigonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ab53a84faa65b68e40cb68b8cacbb4b7d">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e88106c90fc2e0e25d0f7617459d4f9">SDL_gfxPrimitives.h</a>
</li>
<li>arcColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a461b8ac31e00306aee5f8a4c242671d2">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6180558aff14d3c240d9e8bf919869ef">SDL_gfxPrimitives.h</a>
</li>
<li>arcRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5d8d25ecb69e9386289125eb21668a2f">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2aff993d0d8d64564e16145f401d3cf1">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x61.html | HTML | apache-2.0 | 6,330 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li class="current"><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_b"></a>- b -</h3><ul>
<li>bezierColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#adfe8f9c42d29a090aae15eeb19b80d51">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#ad82395ca72b749494ff89be78f168341">SDL_gfxPrimitives.h</a>
</li>
<li>bezierRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7203e3a463da499b5b0cadf211d19ff3">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a4b7fbf6cc366abdf345a25308d53e125">SDL_gfxPrimitives.c</a>
</li>
<li>boxColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a6bb30dfc32d0aee20271a0356a2e2fd0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a16693489da67d6e65a28f9e5217b46f9">SDL_gfxPrimitives.h</a>
</li>
<li>boxRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0ae084c90bd9b734356ad723d45973c8">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1864b3062793a7f7dd81aaf8c8abd6b0">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x62.html | HTML | apache-2.0 | 4,330 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li class="current"><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_c"></a>- c -</h3><ul>
<li>characterColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aef5fdeb16c4578d8cd50e106299e993e">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#af1991f2031346131db4ae8fd40492b08">SDL_gfxPrimitives.h</a>
</li>
<li>characterRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a3f2f624c33ca753d22db52a8d9363fac">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a96379d2ce808aa642afb57bced0c670e">SDL_gfxPrimitives.c</a>
</li>
<li>circleColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aa99bd361cc947b448142720f2ca3320e">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a58d231ecaf113f53c2a28435e0632624">SDL_gfxPrimitives.h</a>
</li>
<li>circleRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8e0945b74c02cdb1441e1b2a29d2c87d">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a7fe51d4c9426c8795e58c7ddd313b0a4">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x63.html | HTML | apache-2.0 | 4,342 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li class="current"><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_e"></a>- e -</h3><ul>
<li>ellipseColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a476cff7702f4be9090871e35859782f0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8b46f389c626806e7a1ec148f0980737">SDL_gfxPrimitives.h</a>
</li>
<li>ellipseRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a18c8a26c9009482eec40f9f4a6945fd1">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a523156891302420d2296b1a302c1fc2b">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x65.html | HTML | apache-2.0 | 3,843 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li class="current"><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_f"></a>- f -</h3><ul>
<li>fastPixelColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#abeed0e873efdf3aec8c6c86188d36f89">SDL_gfxPrimitives.c</a>
</li>
<li>fastPixelColorNolock()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a011e3e26d7216998357fb1a089f8f742">SDL_gfxPrimitives.c</a>
</li>
<li>fastPixelColorNolockNoclip()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#add868bff0c4cb75012a0407af6b64f03">SDL_gfxPrimitives.c</a>
</li>
<li>fastPixelRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9874fabafdc422223323751671bca7c0">SDL_gfxPrimitives.c</a>
</li>
<li>fastPixelRGBANolock()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a64916bb8270e75d936cda816d3694a25">SDL_gfxPrimitives.c</a>
</li>
<li>filledCircleColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a39147d1282ec814a1b9e31243aad0359">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4f7b717b958ef39bfc8c958476dd0de1">SDL_gfxPrimitives.h</a>
</li>
<li>filledCircleRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a562ba6b18fb70547cd50cb3bb0f70272">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a01af970ce0be38cea9884bc6f816c984">SDL_gfxPrimitives.h</a>
</li>
<li>filledEllipseColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a8fed50800f2f1bdfaa048698f5052f25">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a36e83e5648b95d38d1efe98dcf840fab">SDL_gfxPrimitives.h</a>
</li>
<li>filledEllipseRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a33595ad996dd0dcccde3abbcef540eec">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a26f01b9c0cf7a533023869dff439254f">SDL_gfxPrimitives.h</a>
</li>
<li>filledPieColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2c30ee985b2513dc58d9b19d4e71562b">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a8f18679aa7161f885613ec08e7f41692">SDL_gfxPrimitives.h</a>
</li>
<li>filledPieRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a4ffdfd2834f3ef0fd0ee622b5f1d16b8">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a1944c066d27fa9847a5fdecd1d3b9116">SDL_gfxPrimitives.h</a>
</li>
<li>filledPolygonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#af22692175cb73329410cbcc7d7491c4d">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e1fe45b835b623f6939ff0f08277531">SDL_gfxPrimitives.h</a>
</li>
<li>filledPolygonColorMT()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1f3a2dcda741a2c29b5dacce4ffe0271">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0f5583d5b055f3e59a9692ca8a9dfbcf">SDL_gfxPrimitives.h</a>
</li>
<li>filledPolygonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a40ef0b898905c190c193f0f55deb5a6c">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a2b1023ddbbb25d57bd51676b49234af4">SDL_gfxPrimitives.h</a>
</li>
<li>filledPolygonRGBAMT()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a412cddc17a592c167c060ec2d1d2fd1d">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a586d64a80ac67de184e33609509d45a9">SDL_gfxPrimitives.c</a>
</li>
<li>filledRectAlpha()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ace9f2505c12c5dacc778509991cd3716">SDL_gfxPrimitives.c</a>
</li>
<li>filledTrigonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6adaf54b33bf067e4fe2cc5a7ae17ef6">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a78d4ed2372527f3b78f5893928b0f519">SDL_gfxPrimitives.c</a>
</li>
<li>filledTrigonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4a3318a183659aab7c12c0334e261837">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a8f318d776ff1e3c6790405e0e59e5356">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x66.html | HTML | apache-2.0 | 7,249 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li class="current"><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_g"></a>- g -</h3><ul>
<li>gfxPrimitivesSetFont()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#afacd57651ec0e0ccab60753636862cd0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7cabe806643c19159948639faaf26a38">SDL_gfxPrimitives.h</a>
</li>
<li>gfxPrimitivesSetFontRotation()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aef6796a883f07d31bbf7c7df6d1153d2">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a77cc480ba039c758d1cf0cd43db04bd6">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x67.html | HTML | apache-2.0 | 3,868 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li class="current"><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_h"></a>- h -</h3><ul>
<li>hlineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ac211a904dce45093315e15b10c80d8ac">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a31ac87bf32186325deedf5188b987ef6">SDL_gfxPrimitives.h</a>
</li>
<li>hlineColorStore()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#af20de4fe06f4d997eb2ab01a2252f071">SDL_gfxPrimitives.c</a>
</li>
<li>hlineRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a6608a0d1d4c7e16fa1afcbd3eb5c3850">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#ae48e69e0f5d13ea79ffac262b146ae9e">SDL_gfxPrimitives.h</a>
</li>
<li>hlineRGBAStore()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1b22ffb35c7690b4b0d8ba901640edae">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x68.html | HTML | apache-2.0 | 4,118 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li class="current"><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_l"></a>- l -</h3><ul>
<li>lineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ad44c550fab3cb736eb049713ede94052">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6f37058aed308619de8109ebe84b5fe9">SDL_gfxPrimitives.h</a>
</li>
<li>lineRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a760139e11a9ae5defeb755ca0c794f5f">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5e4bd13b12d34698fbcb2dc9d3a0e9f3">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x6c.html | HTML | apache-2.0 | 3,837 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li class="current"><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_p"></a>- p -</h3><ul>
<li>pieColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a3c2bc64deabda74933f31daba6bed7be">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6476d5dad22631d10c1dc95b0e88fc65">SDL_gfxPrimitives.h</a>
</li>
<li>pieRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4a5e4344913667e714560dd204473663">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a8442f2c2bedbe27c96d8d44319981992">SDL_gfxPrimitives.c</a>
</li>
<li>pixelColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae6f8690e5c5a85d3263c8e16727b34ef">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7fe611dbb029ae70be89d5314c7e023b">SDL_gfxPrimitives.h</a>
</li>
<li>pixelColorNolock()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae94ba03884eee47c3bcc8e2fc35da9f0">SDL_gfxPrimitives.c</a>
</li>
<li>pixelColorWeight()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#af9269ad9bbfa20980d5947c85dda63d5">SDL_gfxPrimitives.c</a>
</li>
<li>pixelColorWeightNolock()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a93c580afe80682f06ef4f1655180aff1">SDL_gfxPrimitives.c</a>
</li>
<li>pixelRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a7b6f83bdef72f6b356664a93841381c0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a0046efc721e77b745fd5b621fbd48513">SDL_gfxPrimitives.h</a>
</li>
<li>polygonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a2d692dc25f3b579b386dff8dcd9cbc00">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#abe5d0b2f6193558798eaff3e85e7a1af">SDL_gfxPrimitives.h</a>
</li>
<li>polygonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#ae55541ec58990420dc6dc6b9d61f33d6">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a46b327da5cba5d401cf400bdef7560d0">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x70.html | HTML | apache-2.0 | 5,254 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li class="current"><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_r"></a>- r -</h3><ul>
<li>rectangleColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a6ab25c393f6e5f8d68ea3365f6ea98d2">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a36453f52608a10f3d6b8edccae260b95">SDL_gfxPrimitives.h</a>
</li>
<li>rectangleRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a6c41cbfd0618262de4d4d127ed1e67fe">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a40991c6eeb936d35d0a8e8aa95268f72">SDL_gfxPrimitives.c</a>
</li>
<li>rotateSurface90Degrees()
: <a class="el" href="_s_d_l__rotozoom_8c.html#a77563d68634cb2624d4f2f0bcdc19e73">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#ac06e9fa4fce6a1dbae45462529be581e">SDL_rotozoom.h</a>
</li>
<li>rotozoomSurface()
: <a class="el" href="_s_d_l__rotozoom_8h.html#a3cb0c11d5edc929579c807dc7612348c">SDL_rotozoom.h</a>
, <a class="el" href="_s_d_l__rotozoom_8c.html#a5f64ed53eeee5f2667971c857698d1e5">SDL_rotozoom.c</a>
</li>
<li>rotozoomSurfaceSize()
: <a class="el" href="_s_d_l__rotozoom_8c.html#a9886c783255edfd70a4974f8f3dd5a8c">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a3ca2316375d6faf4f19b26c2f1f14bbc">SDL_rotozoom.h</a>
</li>
<li>rotozoomSurfaceSizeXY()
: <a class="el" href="_s_d_l__rotozoom_8c.html#aee64992d26c818d9975610754d5c929b">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a612334fa642f672af953f544da6245d0">SDL_rotozoom.h</a>
</li>
<li>rotozoomSurfaceXY()
: <a class="el" href="_s_d_l__rotozoom_8c.html#aab98b5b0da4ea468bacf47f7b85f0ee2">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a454d4234a45eab6ec238a40cc44051d4">SDL_rotozoom.h</a>
</li>
<li>roundedBoxColor()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a9f9be6e605e764fd23dd154fb12b80e9">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a718c4f31d1e145106959c2a77d5fee9d">SDL_gfxPrimitives.c</a>
</li>
<li>roundedBoxRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#aad706348fec18631d7bc48a2d91f5b4d">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a7105b88e62fe42b26602d3b426547bc7">SDL_gfxPrimitives.h</a>
</li>
<li>roundedRectangleColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a830dd9dcfa39f4718aa2c269060326d0">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a4109d2d1efa021c021fc4a98a0e3691b">SDL_gfxPrimitives.h</a>
</li>
<li>roundedRectangleRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a475432abc4756e6f30ef097d5cac02c9">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a300272b3b799f09ca6cd5c541b19f07a">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x72.html | HTML | apache-2.0 | 6,034 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li class="current"><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_s"></a>- s -</h3><ul>
<li>SDL_framerateDelay()
: <a class="el" href="_s_d_l__framerate_8c.html#afce13fa3dd37130deb4975d8b230c3ba">SDL_framerate.c</a>
, <a class="el" href="_s_d_l__framerate_8h.html#a2c452933d7376dbb0083304b760ed63b">SDL_framerate.h</a>
</li>
<li>SDL_getFramecount()
: <a class="el" href="_s_d_l__framerate_8h.html#a3f3b7da73f3d92ff82b069b6108aa7ad">SDL_framerate.h</a>
, <a class="el" href="_s_d_l__framerate_8c.html#a96b13e26f8436222e866904a592a6eec">SDL_framerate.c</a>
</li>
<li>SDL_getFramerate()
: <a class="el" href="_s_d_l__framerate_8c.html#a575bb511d6f817ad846a788cbd08ae91">SDL_framerate.c</a>
, <a class="el" href="_s_d_l__framerate_8h.html#adeb2ddd02412527aad226ba453a21999">SDL_framerate.h</a>
</li>
<li>SDL_gfxBlitRGBA()
: <a class="el" href="_s_d_l__gfx_blit_func_8h.html#ab49c560e89b8305051b2e6b347215f03">SDL_gfxBlitFunc.h</a>
, <a class="el" href="_s_d_l__gfx_blit_func_8c.html#ac51ff40d39f3dd0bd08116e8953960f8">SDL_gfxBlitFunc.c</a>
</li>
<li>SDL_gfxMultiplyAlpha()
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a4ece530dca0ae46b1f5a780f85371687">SDL_gfxBlitFunc.c</a>
, <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a7c93594525ae349b5cef0156b8f758fc">SDL_gfxBlitFunc.h</a>
</li>
<li>SDL_gfxSetAlpha()
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a09a376775f9d8c933c7121e34fe5ecfc">SDL_gfxBlitFunc.c</a>
, <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a4627ae4a0037d0b248bed87f3c294735">SDL_gfxBlitFunc.h</a>
</li>
<li>SDL_imageFilterAbsDiff()
: <a class="el" href="_s_d_l__image_filter_8c.html#a472909f904274255cd6793c520172e48">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a789ce070edcc478ad97a0d7ff90e6aa2">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterAdd()
: <a class="el" href="_s_d_l__image_filter_8h.html#a9034268e2f51550d8f1d6084bda45194">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a9f06507eb0b63198dbd67495d61c9b20">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterAddByte()
: <a class="el" href="_s_d_l__image_filter_8c.html#a812cb307cb60ef31f1ffe81a9eee6bb1">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a6be6dccd000eff4baadd33297e5cc419">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterAddByteToHalf()
: <a class="el" href="_s_d_l__image_filter_8c.html#ab82db97d129c8cfc36780bcdc6286fcc">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a8cbdffd5dbcab3b5dc9207d57af616b3">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterAddUint()
: <a class="el" href="_s_d_l__image_filter_8c.html#a660543426c47dfec39a349eb3b8f905b">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#af1a17645dea69e52c7bd560521286765">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterAlignStack()
: <a class="el" href="_s_d_l__image_filter_8c.html#afbfcc8c03e3d791ac74c955d14a135e4">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a08a45265e9e84bf8beedebba26da947c">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterBinarizeUsingThreshold()
: <a class="el" href="_s_d_l__image_filter_8c.html#a951a062e15df290a137428e1e0f4d5ce">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#ad5bf97d7e39d018d2eeb570e97edf8c0">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterBitAnd()
: <a class="el" href="_s_d_l__image_filter_8c.html#a85837ce1b5de1f907b6b9053922b5cbc">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a5f67460c0b89dadd49d04832608a345b">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterBitNegation()
: <a class="el" href="_s_d_l__image_filter_8c.html#ac3abfaa8ec2e88c3c4893588c5555856">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#abc3c3fc5f018e271f6393921f3964d31">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterBitOr()
: <a class="el" href="_s_d_l__image_filter_8h.html#a0acf0eabba33f8fa7acbc08dc3015cd3">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a5cf1c477f4e32d02f74ee95d9f7b0021">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterClipToRange()
: <a class="el" href="_s_d_l__image_filter_8c.html#ab7224abc4ecc1b8a6f4441ef8379515f">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#ae9d552de9cf5a4a1716d91ee905eafd7">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel3x3Divide()
: <a class="el" href="_s_d_l__image_filter_8c.html#a8e7e4138a93e26f1912763189d407770">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a7286cd21fa0a0cfb0606806dacfbe121">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel3x3ShiftRight()
: <a class="el" href="_s_d_l__image_filter_8c.html#ac329e5a3b60351768c96c94db9f9cf97">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a67929babce179e1e333c5cd2e5fc4091">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel5x5Divide()
: <a class="el" href="_s_d_l__image_filter_8c.html#ac9a556492480ce71f54d456a0ff7e6cb">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a432d7bcc34b6bea42d1a07b4db795e1f">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel5x5ShiftRight()
: <a class="el" href="_s_d_l__image_filter_8c.html#a5253738dc4c892352b078d9a7dec2b20">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a9aaa45452b04f51f52826c2104ea3b85">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel7x7Divide()
: <a class="el" href="_s_d_l__image_filter_8c.html#a363f48e6843fd3f48da53688b89bca48">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#acc177cf891758fdc4bf7533fb266e339">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel7x7ShiftRight()
: <a class="el" href="_s_d_l__image_filter_8c.html#a48b40065652dda699875f1425b9227a6">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a6dbe52e917c0858bd311e9ce75219587">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel9x9Divide()
: <a class="el" href="_s_d_l__image_filter_8c.html#ae1e91ff193beed110a71119ec901f09d">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#af8a8114acd0509787ae5265990049720">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterConvolveKernel9x9ShiftRight()
: <a class="el" href="_s_d_l__image_filter_8c.html#a6aaa30dc51d1e51585d02d123b0f1a7a">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#ad2702d0524a16032118fdf67e3e0f44a">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterDiv()
: <a class="el" href="_s_d_l__image_filter_8c.html#a0ea22f01c6a4724bac307da3e5355f58">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#aeb8ed56aa7de3c8b0d0b2aa9163c3e37">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMean()
: <a class="el" href="_s_d_l__image_filter_8c.html#ace072118fef77973210eb04fb4bfc779">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a69cfa83c5d198c8ae4be4ab86e8d3b8f">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMMXdetect()
: <a class="el" href="_s_d_l__image_filter_8c.html#a798ce71024ee1a1d1b174fd60fe79917">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a5823f6eb23fe8e74764a94f3d78204ef">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMMXoff()
: <a class="el" href="_s_d_l__image_filter_8c.html#a5dff661660755161bb4aaf6199cd1384">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a403adc470cb1dd34520f18d55804d4ea">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMMXon()
: <a class="el" href="_s_d_l__image_filter_8c.html#a353ee234c3b51b33c4c5c4b30db5832d">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a848ce7e9551b25fea19fe1fb739f74fb">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMult()
: <a class="el" href="_s_d_l__image_filter_8c.html#af4633031d40a9ea0956a2f3c6c87a384">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a4657c2a1e1bf55d3241dc737cd618409">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMultByByte()
: <a class="el" href="_s_d_l__image_filter_8c.html#a06f7a19d6e2fc89d7b48cc45d715806d">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#add06bb6ea7847fc13a3041ddceb4ac3c">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMultDivby2()
: <a class="el" href="_s_d_l__image_filter_8c.html#a80737f6427c7bdb30d39a92f6524fc14">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#aa19248767b1fd9ffdea4ba69b9f00175">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMultDivby4()
: <a class="el" href="_s_d_l__image_filter_8c.html#a30e685653eb1050c7d48feaeb8f801a1">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#aa92bea3946c8081c9656304a7d944fae">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMultNor()
: <a class="el" href="_s_d_l__image_filter_8c.html#a5f3c9fd40426bb46eba5ac167505dcc5">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#ac4f3446d0da18746b48606fe37c26385">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterMultNorASM()
: <a class="el" href="_s_d_l__image_filter_8c.html#a346db972dff9c56e3c45c904eaa3c39a">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterNormalizeLinear()
: <a class="el" href="_s_d_l__image_filter_8c.html#ab018ace4db884cac953b06b09c00828b">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#aacb316a18d8cb7999d5d53ee5e7b9750">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterRestoreStack()
: <a class="el" href="_s_d_l__image_filter_8c.html#a3147eb5ddd4965d65702f0e533b42974">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a84f360601d5e6e017f0e74a2cf83be6c">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterShiftLeft()
: <a class="el" href="_s_d_l__image_filter_8h.html#a084f9544f049cc01e7b2f1090534abbf">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a98372fea76310903abef7808db10d226">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterShiftLeftByte()
: <a class="el" href="_s_d_l__image_filter_8h.html#ac32f1ea9acbee51c2db94224ef6f7fd2">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a4561a73b249a26babc4c469ffbdae604">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterShiftLeftUint()
: <a class="el" href="_s_d_l__image_filter_8h.html#a4fd6d4a9711c13163496587454d9f1a2">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a250e796fb2db470da0a78b74b78114e8">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterShiftRight()
: <a class="el" href="_s_d_l__image_filter_8c.html#a68851aed2dcc5dfd2f3b258236f3b88c">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a931f1232cd03acd2ba90af222625f4ca">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterShiftRightAndMultByByte()
: <a class="el" href="_s_d_l__image_filter_8c.html#a0713d6c267fba9756d6beae81e89f9e4">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a40e1e21ede9a7ed1eddac2cdbfd0b079">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterShiftRightUint()
: <a class="el" href="_s_d_l__image_filter_8h.html#a4ccddf5c575cc4d6074c9a54789240a6">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a540d4625d76bcd03318c2a59ce650fdb">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterSobelX()
: <a class="el" href="_s_d_l__image_filter_8c.html#a015fe05161b701162d9ecffb01413f1e">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a2a0e4e259150abbe33bcddb046c367ba">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterSobelXShiftRight()
: <a class="el" href="_s_d_l__image_filter_8c.html#a0d21af83f0183fcd697324cffe3ab3d7">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#ab9cc925cd9b135e245936d718b459032">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterSub()
: <a class="el" href="_s_d_l__image_filter_8c.html#a3c01cf8576ea7a0dfc09dbaa953c9287">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#a0e0fb80a3dad33d61a8147c7fb9f529d">SDL_imageFilter.h</a>
</li>
<li>SDL_imageFilterSubByte()
: <a class="el" href="_s_d_l__image_filter_8h.html#af8f4ab4050a0661c7696783ba1a1b12b">SDL_imageFilter.h</a>
, <a class="el" href="_s_d_l__image_filter_8c.html#a387fb6f0d48cc5d08f37f7f9b92d14b2">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterSubByteMMX()
: <a class="el" href="_s_d_l__image_filter_8c.html#a657e128016cc448778007d8b6475dd65">SDL_imageFilter.c</a>
</li>
<li>SDL_imageFilterSubUint()
: <a class="el" href="_s_d_l__image_filter_8c.html#abb343ef95e22945e1d4d648b2e176e64">SDL_imageFilter.c</a>
, <a class="el" href="_s_d_l__image_filter_8h.html#ae2f3c5992701bded7c2d256bbbfb403f">SDL_imageFilter.h</a>
</li>
<li>SDL_initFramerate()
: <a class="el" href="_s_d_l__framerate_8c.html#a444ebaaaa6b1ceeafa921562bdab1a44">SDL_framerate.c</a>
, <a class="el" href="_s_d_l__framerate_8h.html#a3ca69231486837c809fdcbe5b0a10787">SDL_framerate.h</a>
</li>
<li>SDL_setFramerate()
: <a class="el" href="_s_d_l__framerate_8c.html#afad4b503cf9719daced45fa4d9653d72">SDL_framerate.c</a>
, <a class="el" href="_s_d_l__framerate_8h.html#a186ef8e6b1ee4ab36e05b162545fb0e4">SDL_framerate.h</a>
</li>
<li>shrinkSurface()
: <a class="el" href="_s_d_l__rotozoom_8c.html#aad3bf0cd89cc39ff874ffa778fa1495d">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a7a7ac2cc0d79d282b5a4c76143b7e7a9">SDL_rotozoom.h</a>
</li>
<li>stringColor()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a96b6a43c6ef4753996e33bb7fea483bc">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a62d2ba55abc7673f2dfa29e6bbffefdf">SDL_gfxPrimitives.c</a>
</li>
<li>stringRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a6ca71826e311bdd9acf13b009256aa1c">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a769833ae414222099783a9b69bed4009">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x73.html | HTML | apache-2.0 | 17,049 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li class="current"><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_t"></a>- t -</h3><ul>
<li>texturedPolygon()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a65137af308ea878f28abc95419e8aef5">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a5ca5a9bcfeba5b1a1577202e79b494d8">SDL_gfxPrimitives.h</a>
</li>
<li>texturedPolygonMT()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a326937a19cfbebea09aa0a7c908d89aa">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a28ae354c6272da21b5753ae4ab9e1e84">SDL_gfxPrimitives.c</a>
</li>
<li>thickLineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a1494109358b4e4b7ec300d83e3f90300">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a40c34464b6c99fd72c4bd7acfac5915d">SDL_gfxPrimitives.h</a>
</li>
<li>thickLineRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#aa740c1eff9163862704eb3bb3b5964db">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a8b24d64b51e23592c93abc2aa50c818e">SDL_gfxPrimitives.c</a>
</li>
<li>transformSurfaceY()
: <a class="el" href="_s_d_l__rotozoom_8c.html#a126e3b96b22cc18e78e33cc1f8eb6c3c">SDL_rotozoom.c</a>
</li>
<li>trigonColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a7465d08ef930ebb5442c7dd246fed4b5">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#aec2a0c435b879a29167be6b1c49f1e49">SDL_gfxPrimitives.h</a>
</li>
<li>trigonRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8h.html#a090024f5f3e38b02b0bca704259b9d11">SDL_gfxPrimitives.h</a>
, <a class="el" href="_s_d_l__gfx_primitives_8c.html#a45d6a7edcd8b25e1a60e39b7f60bda3f">SDL_gfxPrimitives.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x74.html | HTML | apache-2.0 | 4,979 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li class="current"><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_v"></a>- v -</h3><ul>
<li>vlineColor()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a9b45060155a19fee24f998d7790f1d67">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#ab68d565f00527a67c9d88121c753302c">SDL_gfxPrimitives.h</a>
</li>
<li>vlineRGBA()
: <a class="el" href="_s_d_l__gfx_primitives_8c.html#a8b79ac1e779755aee92b04f3a6cfc5d7">SDL_gfxPrimitives.c</a>
, <a class="el" href="_s_d_l__gfx_primitives_8h.html#a68ed9a65e3e0de26136566b0cf0c859e">SDL_gfxPrimitives.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x76.html | HTML | apache-2.0 | 3,839 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li class="current"><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_func.html#index__"><span>_</span></a></li>
<li><a href="globals_func_0x61.html#index_a"><span>a</span></a></li>
<li><a href="globals_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="globals_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="globals_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="globals_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="globals_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="globals_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="globals_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="globals_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="globals_func_0x72.html#index_r"><span>r</span></a></li>
<li><a href="globals_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="globals_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="globals_func_0x76.html#index_v"><span>v</span></a></li>
<li class="current"><a href="globals_func_0x7a.html#index_z"><span>z</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_z"></a>- z -</h3><ul>
<li>zoomSurface()
: <a class="el" href="_s_d_l__rotozoom_8c.html#abdd772b2f6b1f26134e4e90cda657a21">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a06c8108f8fe8de77cf841c176ee64850">SDL_rotozoom.h</a>
</li>
<li>zoomSurfaceSize()
: <a class="el" href="_s_d_l__rotozoom_8c.html#a8ba40859c1a977dae87488dd8be1bf9a">SDL_rotozoom.c</a>
, <a class="el" href="_s_d_l__rotozoom_8h.html#a7927e415d87ea7856794cd4cc77e0a25">SDL_rotozoom.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_func_0x7a.html | HTML | apache-2.0 | 3,802 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
<li class="current"><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 <ul>
<li>tColorRGBA
: <a class="el" href="_s_d_l__rotozoom_8c.html#ac91ff95383d3a6c0df046a42e23baf04">SDL_rotozoom.c</a>
</li>
<li>tColorY
: <a class="el" href="_s_d_l__rotozoom_8c.html#a9db27e25d1a6e93c64eb768007dcf3da">SDL_rotozoom.c</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_type.html | HTML | apache-2.0 | 2,321 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li class="current"><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>All</span></a></li>
<li><a href="globals_func.html"><span>Functions</span></a></li>
<li class="current"><a href="globals_vars.html"><span>Variables</span></a></li>
<li><a href="globals_type.html"><span>Typedefs</span></a></li>
<li><a href="globals_defs.html"><span>Defines</span></a></li>
</ul>
</div>
</div>
<div class="contents">
 <ul>
<li>GFX_ALPHA_ADJUST_ARRAY
: <a class="el" href="_s_d_l__gfx_blit_func_8c.html#a6d0c17342154e14322a281603960691a">SDL_gfxBlitFunc.c</a>
, <a class="el" href="_s_d_l__gfx_blit_func_8h.html#a6d0c17342154e14322a281603960691a">SDL_gfxBlitFunc.h</a>
</li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/globals_vars.html | HTML | apache-2.0 | 2,331 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: SDL_gfx - SDL-1.2 graphics drawing primitives, rotozoom and other supporting functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li class="current"><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">SDL_gfx - SDL-1.2 graphics drawing primitives, rotozoom and other supporting functions </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h2><a class="anchor" id="contact_sec"></a>
Contact and License</h2>
<p>Email aschiffler at ferzkopp dot net to contact the author or better check author's homepage at <a href="http://www.ferzkopp.net">http://www.ferzkopp.net</a> for the most up-to-date contact information.</p>
<p>This library is licenced under the zlib License, see the file LICENSE for details.</p>
<h2><a class="anchor" id="intro_sec"></a>
Introduction</h2>
<p>The SDL_gfx library evolved out of the SDL_gfxPrimitives code which provided basic drawing routines such as lines, circles or polygons for SDL Surfaces and adding a couple other useful functions for zooming images for example and doing basic image processing on byte arrays.</p>
<p>Note that SDL_gfx is compatible with SDL version 1.2 (not SDL2).</p>
<p>The current components of the SDL_gfx library are:</p>
<ul>
<li>Graphic Primitives (<a class="el" href="_s_d_l__gfx_primitives_8h.html">SDL_gfxPrimitives.h</a>, <a class="el" href="_s_d_l__gfx_primitives_8c.html">SDL_gfxPrimitives.c</a>)</li>
<li>Rotozoomer (<a class="el" href="_s_d_l__rotozoom_8h.html">SDL_rotozoom.h</a>, <a class="el" href="_s_d_l__rotozoom_8c.html">SDL_rotozoom.c</a>)</li>
<li>Framerate control (<a class="el" href="_s_d_l__framerate_8h.html">SDL_framerate.h</a>, <a class="el" href="_s_d_l__framerate_8c.html">SDL_framerate.c</a>)</li>
<li>MMX image filters (<a class="el" href="_s_d_l__image_filter_8h.html">SDL_imageFilter.h</a>, <a class="el" href="_s_d_l__image_filter_8c.html">SDL_imageFilter.c</a>)</li>
<li>Custom Blit functions (<a class="el" href="_s_d_l__gfx_blit_func_8h.html">SDL_gfxBlitFunc.h</a>, <a class="el" href="_s_d_l__gfx_blit_func_8c.html">SDL_gfxBlitFunc.c</a>)</li>
<li>Build-in 8x8 Font (<a class="el" href="_s_d_l__gfx_primitives__font_8h.html">SDL_gfxPrimitives_font.h</a>)</li>
</ul>
<h3><a class="anchor" id="notes_gfx"></a>
Notes on Graphics Primitives</h3>
<p>Care has been taken so that all routines are fully alpha-aware and can blend any primitive onto the target surface if ALPHA<255. Surface depths supported are 1,2,3 and 4 bytes per pixel. Surface locking is implemented in each routine and the library should work well with hardware accelerated surfaces.</p>
<a href="../Screenshots/SDL_gfxPrimitives.jpg" target="_blank" title="SDL_gfxPrimitives Screenshot"><img src="../Screenshots/SDL_gfxPrimitives-thumb.jpg" border="0" hspace="5"></a><br />
<p>Currently, The following Anti-Aliased drawing primitives are available:</p>
<ul>
<li>AA-line</li>
<li>AA-polygon</li>
<li>AA-circle</li>
<li>AA-ellipse</li>
</ul>
<p>Note: All ___Color routines expect the color to be in the format 0xRRGGBBAA.</p>
<h3><a class="anchor" id="notes_roto"></a>
Notes on Rotozoomer</h3>
<p>The rotozoom code is not ASM-speed quality, but it should be fast enough even for some realtime effects if the CPU is good or bitmaps small. With interpolation the routines are typically used for pre-rendering stuff in higher quality (i.e. smoothing) - that's also the reason why the API differs from SDL_BlitRect() - as they create a new target surface each time rotozoom is called. The final rendering speed is dependent on the target surface size as it is beeing xy-scanned when rendering the new surface.</p>
<a href="../Screenshots/SDL_rotozoom.jpg" target="_blank" title="SDL_rotozoom Screenshot"><img src="../Screenshots/SDL_rotozoom-thumb.jpg" border="0" hspace="5"></a><br />
<p>Note also that the smoothing toggle is dependent on the input surface bit depth. 8bit surfaces will <b>never</b> be smoothed - only 32bit surfaces will.</p>
<p>Note that surfaces of other bit depth then 8 and 32 will be converted on the fly to a 32bit surface using a blit into a temporary surface. This impacts performance somewhat.</p>
<p>Smoothing (interpolation) flags work only on 32bit surfaces: </p>
<div class="fragment"><pre class="fragment"> #define SMOOTHING_OFF 0
#define SMOOTHING_ON 1
</pre></div><h3><a class="anchor" id="notes_rate"></a>
Notes on Framerate Manager</h3>
<p>The framerate functions are used to insert delays into the graphics loop to maintain a constant framerate.</p>
<p>The implementation is more sophisticated that the usual </p>
<div class="fragment"><pre class="fragment"> SDL_Delay(1000/FPS);
</pre></div><p> call since these functions keep track of the desired game time per frame for a linearly interpolated sequence of future timing points of each frame. This is done to avoid rounding errors from the inherent instability in the delay generation and application.</p>
<a href="../framerate.png" target="_blank" title="Framerate Diagram"><img src="../framerate-thumb.png" border="0"></a><br />
<p>i.e. the 100th frame of a game running at 50Hz will be accurately 2.00sec after the 1st frame (if the machine can keep up with the drawing).</p>
<p>The functions return 0 or 'value' for sucess and -1 for error. All functions use a pointer to a framerate-manager variable to operate.</p>
<h3><a class="anchor" id="notes_filter"></a>
Notes on ImageFilters</h3>
<p>The imagefilter functions are a collection of MMX optimized routines that operate on continuous buffers of bytes - typically greyscale images from framegrabbers and such - performing functions such as image addition and binarization. All functions (almost ... not the the convolution routines) have a C implementation that is automatically used on systems without MMX capabilities.</p>
<p>The compiler flag -DUSE_MMX toggles the conditional compile of MMX assembly. An assembler must be installed (i.e. "nasm").</p>
<h3><a class="anchor" id="notes_blitters"></a>
Notes on Custom Blitters</h3>
<p>The custom blitter functions provide (limited) support for surface compositing - that is surfaces can be blitted together, and then still blitted to the screen with transparency intact.</p>
<h3><a class="anchor" id="platforms"></a>
Supported Platforms</h3>
<h4><a class="anchor" id="platformlinux"></a>
Unix/Linux</h4>
<p>The library compiles and is tested for a Linux target (gcc compiler) via the the usual configure;make;make install sequence.</p>
<h4><a class="anchor" id="platformwindows"></a>
Windows</h4>
<p>A Win32 target is available (VisualC6/7/8/9, mingw32, xmingw32 cross-compiler). The SDL_gfx_VS2010.sln will open VS2010 (the old VS2008 .sln is also still included) including express versions.</p>
<p>See "Other Builds" for additional makefiles (may be out of date).</p>
<p>When using the cross-compiler (available on the author's homepage, very out of date), the build process generates .DLLs. You can use the command line 'LIB.EXE' tool to generate VC6 compatible .LIB files for linking purposes.</p>
<h4><a class="anchor" id="platformosx"></a>
Mac OSX</h4>
<p>The usual autotools build chain should be used. MacPorts or fink may be required (that's what the author uses).</p>
<p>Xcode is supported via templates. See "Other Builds" folder Xcode3+.zip - this template only supports SDL_gfx and not the tests. For this template, the Deployment Target (the lowest version to run on) is set to 10.5 and expects the SDL.framework preinstalled in some default location (either /Library/Frameworks, or ~/Library/Frameworks).</p>
<p>Older targets are also reported to work (10.3+ native and Project Builder).</p>
<h4><a class="anchor" id="platformqnx"></a>
QNX</h4>
<p>QNX was reported to build (see .diff in "Other Builds").</p>
<h4><a class="anchor" id="platformzune"></a>
Zune</h4>
<p>ZuneHD (WinCE 6 ARM) is reported to build (see OpenZDK in "Other Builds"). Note that between rendering on the Zune's ARM CPU and constantly uploading textures to the GPU, SDL_gfx is going to be slow. Also, the libc math functions all use software FP emulation even when VFP floating point support is turned on in the compiler, so there's extra overhead due to that as well.</p>
<h4><a class="anchor" id="platformothers"></a>
Others</h4>
<p>Other platforms might work but have not been tested by the author. Please check the file "INSTALL" as well as the folder "Other Builds".</p>
<p>See also section "Installation" below for more build instructions.</p>
<h2><a class="anchor" id="install_sec"></a>
Installation</h2>
<h3><a class="anchor" id="unix"></a>
Unix/Linux</h3>
<p>To compile the library your need the SDL 1.2 installed from source or installed with the 'devel' RPM package. For example on Mandriva, run: </p>
<div class="fragment"><pre class="fragment"> urpmi libSDL1.2-devel
</pre></div><p>Then run </p>
<div class="fragment"><pre class="fragment"> ./autogen.sh # (optional, recommended)
./configure
make
make install
ldconfig
</pre></div><p>to compile and install the library. The default location for the installation is /usr/local/lib and /usr/local/include. The libary path might need to be added to the file: /etc/ld.so.conf</p>
<p>Run the shell script 'nodebug.sh' before make, to patch the makefile for optimized compilation: </p>
<div class="fragment"><pre class="fragment"> ./autogen.sh # (optional, recommended)
./configure
./nodebug.sh
make
make install
ldconfig
</pre></div><p>Check the folder "Other Builds" for alternative makefiles.</p>
<h3><a class="anchor" id="prep"></a>
Build Prep</h3>
<p>Run autogen.sh or manually: </p>
<div class="fragment"><pre class="fragment"> aclocal --force
libtoolize --force --copy
autoreconf -fvi
</pre></div><h3><a class="anchor" id="nommx"></a>
No-MMX</h3>
<p>To build without MMX code enabled (i.e. PPC or for AMD64 architecture which is missing pusha/popa): </p>
<div class="fragment"><pre class="fragment"> ./configure --disable-mmx
make
make install
</pre></div><p> i.e. to build on MacOSX 10.3+ use: </p>
<div class="fragment"><pre class="fragment"> ./configure --disable-mmx && make
</pre></div><h3><a class="anchor" id="vs9"></a>
Windows (VC9, VS2010)</h3>
<p>Open SDL_gfx_VS2010.sln solution file and review README.</p>
<h3><a class="anchor" id="vs8"></a>
Windows (VC8, VS2008)</h3>
<p>Open SDL_gfx_VS2008.sln solution file and review README.</p>
<h3><a class="anchor" id="vc6"></a>
Windows (VC6/7)</h3>
<p>See folder Other Builds.</p>
<p>To create a Windows DLL using VisualC6: </p>
<div class="fragment"><pre class="fragment"> unzip -a VisualC6.zip
vcvars32.bat
copy VisualC/makefile
nmake
</pre></div><p> or </p>
<div class="fragment"><pre class="fragment"> unzip -a VisualC7.zip
</pre></div><p> and open the project file.</p>
<h3><a class="anchor" id="wince"></a>
WindowsCE</h3>
<p>See folder Other Builds.</p>
<p>May need workaround for missing lrint.</p>
<h3><a class="anchor" id="cross"></a>
Cross-Compilation</h3>
<p>To build using mingw32 on Win32, check the makefile contained in mingw.zip</p>
<p>To create a Windows DLL using the xmingw32 cross-compiler: </p>
<div class="fragment"><pre class="fragment"> cross-configure
cross-make
cross-make install
</pre></div><p>Make sure the -DBUILD_DLL is used (and only then) when creating the DLLs. Make sure -DWIN32 is used when compiling the sources (creating or using the DLLs.</p>
<p>Specify the path to your cross-compiled 'sdl-config', and invoke './configure' with the '--host' and '--build' arguments. For example, to cross-compile a .DLL from GNU/Linux: </p>
<div class="fragment"><pre class="fragment"> SDL_CONFIG=/usr/local/cross-tools/i386-mingw32msvc/bin/sdl-config \
./configure --host=i586-mingw32msvc --build=i686-pc-linux-gnu
make
make install
</pre></div><h3><a class="anchor" id="qnx"></a>
QNX</h3>
<p>To build on QNX6, patch first using: </p>
<div class="fragment"><pre class="fragment"> patch -p0 <QNX.diff
</pre></div><h3><a class="anchor" id="osx"></a>
OSX</h3>
<p>Use standard unix build sequence.</p>
<p>To build on MacOS X with Project Builder, follow these steps:</p>
<ul>
<li>Update your developer tools to the lastest version.</li>
<li>Install the SDL Developers framework for Mac OS X.</li>
<li>Download the latest SDL_gfx source distribution and extract the archive in a convenient location.</li>
<li>Extract the included OSX-PB.tgz archive into the top directory of the SDL_gfx distribution (from step 3). This will create a PB that contains the project files.</li>
<li>The project has targets for the SDL_gfx framework and the four test programs. All can be built using the 'deployment' or 'development' build styles.</li>
</ul>
<p>A newer version for MaxOS X is included in the OSX-PB-XCode.zip archive. The updated version uses relative pathnames where appropriate, and pointers to the standard installation location of SDL. However, it may require XCode in order to be used.</p>
<h2><a class="anchor" id="interfaces_sec"></a>
Language Interfaces</h2>
<p>SDL_gfx has been integrated with the following language interfaces:</p>
<ul>
<li>Pascal: <a href="http://www.freepascal-meets-sdl.net">http://www.freepascal-meets-sdl.net</a></li>
<li>Perl: <a href="http://sdl.perl.org">http://sdl.perl.org</a></li>
<li>Python: <a href="http://www.pygame.org">http://www.pygame.org</a></li>
<li>C#: <a href="http://cs-sdl.sourceforge.net">http://cs-sdl.sourceforge.net</a></li>
<li>Lua: <a href="http://www.egsl.retrogamecoding.org/">http://www.egsl.retrogamecoding.org/</a></li>
<li>Oberon: <a href="http://sourceforge.net/projects/sdl-for-oberon/">http://sourceforge.net/projects/sdl-for-oberon/</a></li>
</ul>
<h2><a class="anchor" id="test_sec"></a>
Test Programs</h2>
<p>Change to the ./Test directory and run </p>
<div class="fragment"><pre class="fragment"> ./autogen.sh
./configure
make
</pre></div><p> to create several test programs for the libraries functions. This requires the library to be previously compiled and installed.</p>
<p>See the source code .c files for some sample code and implementation hints.</p>
<h2><a class="anchor" id="contrib_sec"></a>
Contributors</h2>
<ul>
<li>Fix for filledbox by Ingo van Lil, inguin at gmx.de - thanks Ingo.</li>
</ul>
<ul>
<li>Non-alpha line drawing code adapted from routine by Pete Shinners, pete at shinners.org - thanks Pete.</li>
</ul>
<ul>
<li>More fixes by Karl Bartel, karlb at gmx.net - thanks Karl.</li>
</ul>
<ul>
<li>Much testing and suggestions for fixes from Danny van Bruggen, danny at froukepc.dhs.org - thanks Danny.</li>
</ul>
<ul>
<li>Original AA-circle/-ellipse code idea from Stephane Magnenat, nct at wg0.ysagoon.com - thanks Stephane.</li>
</ul>
<ul>
<li>Faster blending routines contributed by Anders Lindstroem, cal at swipnet.se - thanks Anders.</li>
</ul>
<ul>
<li>New AA-circle/-ellipse code based on ideas from Anders Lindstroem - thanks Anders.</li>
</ul>
<ul>
<li>VisualC makefile contributed by Danny van Bruggen, danny at froukepc.dhs.org - thanks Danny.</li>
</ul>
<ul>
<li>VisualC7 project file contributed by James Turk, jturk at conceptofzero.com - thanks James.</li>
</ul>
<ul>
<li>Project Builder package contributed by Thomas Tongue, TTongue at imagiware.com - Thanks Thomas.</li>
</ul>
<ul>
<li>Fix for filledPolygon contributed by Kentaro Fukuchi fukuchi at is.titech.ac.jp - Thanks Kentaro.</li>
</ul>
<ul>
<li>QNX6 patch contributed by Mike Gorchak, mike at malva.ua - Thanks Mike.</li>
</ul>
<ul>
<li>Pie idea contributed by Eike Lange, eike.lange at uni-essen.de - Thanks Eike.</li>
</ul>
<ul>
<li>Dynamic font setup by Todor Prokopov, koprok at dir.bg - Thanks Todor.</li>
</ul>
<ul>
<li>Horizontal/Vertical flipping code by Victor (Haypo) Stinner, victor.stinner at haypocalc.com - Thanks Victor.</li>
</ul>
<ul>
<li>OSX build fixes by Michael Wybrow, mjwybrow at cs.mu.oz.au - Thanks Michael.</li>
</ul>
<ul>
<li>gcc3.4 build fixes by Dries Verachtert, dries at ulyssis.org - Thanks Dries.</li>
</ul>
<ul>
<li>Updated OSX build by Brian Rice, water451 at gmail.com - Thanks Brian.</li>
</ul>
<ul>
<li>aaellipse issues pointed out by Marco Wertz, marco.wertz at gmx.de - Thanks Marco.</li>
</ul>
<ul>
<li>texturedPolygon idea and code by Kees Jongenburger, kees.jongenburger at gmail.com - Thanks Kees.</li>
</ul>
<ul>
<li>Several bugfixes contributed by Sigborn Skjaeret, cisc at broadpark.no - Thanks CISC.</li>
</ul>
<ul>
<li>Syntax error for C++ found by Olivier Boudeville, olivier.boudeville at online.fr - Thanks Olivier.</li>
</ul>
<ul>
<li>hline/vline clipping fixes found by Daniel Roggen, droggen at gmail.com and Mikael Thieme, mikael.thieme at his.se - Thanks Daniel+Mikael.</li>
</ul>
<ul>
<li>rotozoom fix for big-endian machines (i.e. PPC) by Julian Mayer, julianmayer at mac.com - Thanks Julian.</li>
</ul>
<ul>
<li>Cross-compilation notes contributed by Sylvain Beucler, beuc at beuc.net - Thanks Sylvain.</li>
</ul>
<ul>
<li>Fix duplicate pixel renders in circleColor contributed by David Raber, lotharstar at gmail.com - Thanks David.</li>
</ul>
<ul>
<li>New arcColor (and arcRGBA) routine contributed by David Raber, lotharstar at gmail.com - Thanks David.</li>
</ul>
<ul>
<li>Idea for polygonColorMT and texturePolygonMT routines for multithreaded operation contributed by "unknown" - Thank you.</li>
</ul>
<ul>
<li>Multiple patches applied and repackaged version 2.0.18 by Paul, sweetlilmre at gmail.com - Thanks Paul and other contributors of patches.</li>
</ul>
<ul>
<li>Change to avoid gcc4 compiler warnings contributed by Thien-Thi nguyen, ttn at gnuvola.org - thanks Thi.</li>
</ul>
<ul>
<li>hline 1bpp off-by-one patch contributed by Manuel Lausch mail at manuellausch.de - Thanks Manuel.</li>
</ul>
<ul>
<li>pkg-config support contributed by Luca Bigliardi, shammash at artha.org - thanks Luca.</li>
</ul>
<ul>
<li>Updated mingw Makefile contributed by Jan Leike, jan dot leike at gmx dot net - thanks Jan.</li>
</ul>
<ul>
<li>Rotozoom debugging help by Jeff Wilges, heff at ifup dot us - thanks Jeff.</li>
</ul>
<ul>
<li>Build updates provided by Barry deFreese, bdefreese at debian dot org - thanks Barry.</li>
</ul>
<ul>
<li>Fix for 1-pixel postponement with 8bit scaling by Sylvain Beucler, beuc at beuc dot net - thanks Sylvain.</li>
</ul>
<ul>
<li>Updates to headers and configure to allow for cross-compiling to DLL (not just static .a) and fixes for compiling on Windows using autotools by Sylvain Beucler, beuc at beuc dot net - thanks Sylvain.</li>
</ul>
<ul>
<li>Added Visual CE Project to Builds. Contributed by vrichomme at smartmobili dot com - thanks.</li>
</ul>
<ul>
<li>Added Symbian and Windows 64bit fix with lrint function by Rene Dudfield, renesd at gmail dot com - thanks Rene.</li>
</ul>
<ul>
<li>Fixes for Rotate90 0-degree case by Chris Allport, chris dot allport at gmail dot com - thanks Chris.</li>
</ul>
<ul>
<li>Fixed for Win32 build support defines by tigerfishdaisy (SF) - thanks Tiger Tiger.</li>
</ul>
<ul>
<li>Patch for OpenSDK contributed by itsnotabigtruck at ovi dot com - thanks IsNotABigTruck.</li>
</ul>
<ul>
<li>OSX Xcode 3+ template ZIP contributed by marabus at meta dot ua - thanks Vasyl.</li>
</ul>
<ul>
<li>Memory leak/error check patch for zoomSurface contributed by RodolfoRG - thanks Rodolfo.</li>
</ul>
<ul>
<li>Zoom scaling factor rounding bugfix patch contributed by WanderWander Lairson Costa - thanks Wander.</li>
</ul>
<ul>
<li>Suggestions for speed improvements contributed by inkyankes - thanks.</li>
</ul>
<ul>
<li>Pixel blend routine patches contributed by mitja at lxnav dot com - thanks Mitja.</li>
</ul>
<ul>
<li>ImageFilter patches contributed by beuc at beuc dot net - thanks Sylvain.</li>
</ul>
<ul>
<li>Bug reports contributed by Yannick dot Guesnet at univ-rouen dot fr -</li>
<li>thanks Yannick.</li>
</ul>
<h2><a class="anchor" id="changelog_sec"></a>
Change Log</h2>
<div class="fragment"><pre class="fragment">CHANGES/VERSION
===============
Ver 2.0.25 - Sun, Oct 27, 2013 3:08:15 PM
* Added patch for 32- and 64-bit GCC-compiled MMX support
(contributed by Sylvain Beucler, backported from SDL2_gfx)
* Fixed bug in _aaline when x1>x2 and dy==0 (found by Yannick
Guesnet - thanks!)
* Updated documentation.
* Fixed header in SDL_gfxBlitFunc.h (reported by Jaders77 on
sourceforge - thanks!)
Ver 2.0.24 - Sun, Jul 22, 2012 9:27:29 AM
* Removed some missed LGPL references
* Fixed thick line swap bug (patch contributed by Thien-Thi)
and added accuracy test for thick line
* Improved interface to SDL_framerateDelay (idea contributed by
Neil)
* Fixed dramerate modules dependency on SDL_GetTicks returning a
value >0 (issue report contributed by Douglas)
* Fixed 32bpp blending function for BGRA (thanks for the test code
and contributing a fix sabbetts/Jay)
* Updated VS2010 solution file to use SDL-1.2 sources
* Fix for pixel blend routine (patch contributes by Mitjia)
Ver 2.0.23 - Sat Dec 3 22:55:04 PST 2011
* Updated sources to resolve some splint (static code analysis)
issues
* Updates for OpenSDK (WinCE6/ARM) build target (patch contributed
itsnotabigtruck)
* Added OSX Xcode3+ template files to Other Builds collection
(contributed by Vasyl)
* Added various fixes and improvements contributed by folks on
sourceforge (thanks contributors).
* Switched library and test code to zlib license.
Ver 2.0.22 - Sat Sep 11 23:26:42 EDT 2010
* Fixed line width calculation for normal and textured polygons
(patch contributed by Daniel (SupSuper)
* Fixed version setup in configure.in
* Added rounded rectangle and rounded box primitives
* Updated test program for roundedbox + left/right-click support
* Fixed pie calculation (line-case detection, end-angle clipping)
* Updated DLL_EXPORT handling and added WIN64 test
(patch contributed by tigerfishdaisy)
* Added thick line primitive based on Murphy's algorithm
Ver 2.0.21 - Thu May 27 21:14:37 PDT 2010
* Add VC9 project files, source code formatting, fix compiler
warnings, move VC8 project files, remove leftover autoconf/m4 files
* Move static transfer lookup array from .h to .c
(patch contributed by Zbigniew Holdys)
* Add support for VC++ compiler/MASM assembly with active USE_MMX
(contributed by Markus Hossner)
* Added Haiku build support in configure.in
(contributed by Scott McCreary)
* Added helper function that multiplies the alpha channel in
a 32bit surface (contributed by Zbigniew Holdys)
* Disable MMX for 64bit platforms due to lack of support for
pusha/popa (contributed by Olivier Boudeville)
* Update all library functions for doxygen markup. Add doxygen
configuration file.
* Added font rotation support and updated TestFonts sample
* Fixed rotate90 for 0 degree case
(contributed by Chris Allport)
* Updated TestRotozoom with rotate90 case and message display
* Added support for SDL 1.3
* Added doxygen generated documentation.
Ver 2.0.20 - Wed Sep 23 18:42:02 PDT 2009
* Fix for 1-pixel postponement with 8bit scaling
* Updates to headers and configure to allow for cross-compiling
to DLL (not just static .a) and fixes for compiling on Windows
using autotools
* Added Visual CE Project to Other Builds
* Added Symbian and Windows 64bit fix for lrint function.
Ver 2.0.19 - Mon Apr 20 22:56:59 PDT 2009
* gcc43 compiler patch for asm code in image filters
as per http://bugs.gentoo.org/219621 (Peter Alfredsen)
* off-by-one hline patch for 1byte indexed surfaces (Manuel Lausch)
* update acinclude.m4 from SDL-1.2 and moved # serial in file
* applied patch to add pkg-config support for SDL_gfx (Luca Bigliardi)
* changed configure.in INTERFACE_AGE and BINARY_AGE based on Debian
build feedback (Barry deFreese)
* fixed zoom XY-flip code and made it available for all modes in
zoom and rotations
* fixed edge issue on interpolated rotozoom modes
* updated TestRotozoom custom test mode, added delay parameter, added
tests which include flipping, included negative rotation
* update libtool files
* updated Makefile.mingw (Jan Leike)
Ver 2.0.18 - Sun Dec 21 08:38:20 PST 2008
* libtool update for dependencies
* MSVC C89 variable hoisting to enable MSVC compile (sweetlilmre)
* addition of VC9 (Visual Studio 2008) project file (sweetlilmre)
* update to MinGW make file (Sergio Padrino, sweetlilmre)
* fix uninitialised variables in _putPixelAlpha() (Paul Pedriana)
* reverted to original alpha routine in _putPixelAlpha() as new one was causing issues in 16bbp
new routine #define has been renamed to EXPERIMENTAL_ALPHA_PIXEL_ROUTINE
original is now DEFAULT_ALPHA_PIXEL_ROUTINE
* added colorkey handling patch to rotozoom (Sergio Padrino)
* downgraded optimization to -O for asm compatibility with gcc4
Ver 2.0.17 - Sun Jun 1 15:39:38 EDT 2008
* hline/vline clipping and swap-logic fixed
* clipping box dimension check added and clipping-checks optimized
* TestFonts program updated
* Updated documentation on cross-compilation, AMD64
* Fixed circleColor overdraw
* Added arcColor routine
* Added polygonColorMT and polygonTextureMT routines
* Updated 32bit alpha blending routine
Ver 2.0.16 - Mon Feb 5 19:03:31 AST 2007
* updated config.sub to newer version
* added custom RGBA blitter function that sets/maintains target alpha
* added setAlpha function that sets alpha values in 32bit surfaces
* added TextGfxBlit testprogram for new functions
* Fixed C++ type in .h files (thanks Olivier)
* Update some text in README and .spec file
* Removed broken Uint filter routines from test program
* "Cosmetic" changes to test programs and Automake.am
Ver 2.0.15 - Fri Dec 22 08:44:31 AST 2006
* bugfixes in 32bit _putPixelAlpha/filledRectAlpha (thanks CISC)
* various bugfixes in return value generation and return (thanks CISC)
* lock font-surface before using it (thanks CISC)
* fix some breakage in non-MMX filter routines (thanks CISC)
* fix typo in TestABGR (thanks CISC)
* fix double buffer flipping in Tets programs (thanks CISC)
* fixed microversion in .h
* fixed texturePolygon inverted bug
* fixed wrong surface use in test 21 of TestRotozoom
* added pitch handling in font surface (thanks CISC)
Ver 2.0.14 - Tue Dec 19 08:49:02 AST 2006
* added texturedPolygon routine to library (thanks Jees)
* changed iterator condition in aaellipse to add some overdraw to smooth circle
* added ShrinkImage routine to rotozoom code
* added TestABGR Test program (bug in SDL_gfx or SDL??)
* improved TestImageFilter program (bug in Uint filters)
* changed .so versioning from .so.13.0.0 to .so.0.0.14
(best is to remove all old libs before installing)
* added updated MacOSX ProjectBuilder file (thanks Brian)
* added info on MacOSX 10.3 build
* added mingw (on cygwin) makefile (thanks Brian)
* added Dev-Cpp makefile (thanks Sebastian)
* removed some unused variables from gfx and rotozoom code (thanks Thi)
* fixed a non-critical typecast mistake (thanks Thi)
* converted all C++ comments to C comments in SDL_imageFilter
Ver 2.0.13 - Tue Dec 21 08:41:25 EST 2004
* changed include back to "SDL.h"
* compile fixes for OSX fink (thanks (Michael)
* compile fixes for gcc3.4 (thanks Dries)
* support vertical and horizontal flipping of axis in new
rotozoomSurfaceXY function (thanks Victor)
* updated TestRotozoom program
Ver 2.0.12 - Mon Aug 30 09:04:11 EDT 2004
* piecolor naming fix
* primitive API change to 'filledPie'
* introduction of some const variables
Ver 2.0.11 - Thu May 13 09:42:34 EDT 2004
* added pieRGBA/pieColor primitive (non filled pie)
* added QNX6 build patch
* use $(includedir)/SDL to automake setup
* updated README
* added 2x2 box & pie tests
* added dynamic font setup routine
* added sample font files to the Fonts directory
* added font test program
* string routines changed to use const char
* fixed TestRotozoom clear color bug
Ver 2.0.10 - Thu Dec 11 09:40:08 EST 2003
* Updated "missing" script to newer version to avoid build errors
* Fixed filled polygon int32 overflow error in calculation
* Updated RPM spec file for new website path
* Added micro version number to .h file
Ver 2.0.9 - Mon Oct 27 10:03:18 EST 2003
* Fixed "filled-box width too small by 1 bug" for A=255
* Wrong versioning in .h file
Ver 2.0.8 - Wed Jul 16 16:18:13 EDT 2003
* Modified filledPolygon drawing
(The edges of a filled polygon and a polyline were
reported to not intersect correctly. With this fix, the
edges do still do not intersect 100% due to the difference
in the algorithms. But now a polygon will never draw
outside of the area enclosed by a polyline.)
Ver 2.0.7 - Sun Jun 8 08:17:38 EDT 2003
* Added MacOS X Project Builder code
* changed SDL include to <SDL/SDL.h>
* Added bezier curve
Ver 2.0.6 - Sat May 25 15:12:17 EDT 2002
* Fixed clipping code for most primitives
* Added clipping code for character
* Added VC7 project file
Ver 2.0.5 - n/a
* Removed some unused code
Ver 2.0.4 - Sat Feb 9 22:09:45 EST 2002
* Fixed rectangle drawing bug on edges for A<255
* Added trigons (triangles) as wrapper calls to polygon.
Ver 2.0.3 - Sat Jan 26 10:06:16 EST 2002
* Zipped VisualC directory to avoid EOL problems.
* Fixed aalineColor call (y2 parameter was y1).
* Fixed rotozoom bug that caused black or undefined pixels on edges.
Ver 2.0.2 - Sat Jan 19 21:41:28 EST 2002
* Removed dependency from GL libraries during compile.
* Added VisualC makefile.
Ver 2.0.1 - Sat Jan 5 22:08:17 EST 2002
* New better quality aacircle/aaellipse code
* Better locking optimization for a 4-8% speed improvement on some
primitives (line, aaline, circle, ellipse)
Ver 2.0 - Sat Dec 29 16:27:57 EST 2001
* Initial release of SDL_gfx based on SDL_gfxPrimitives and SDL_rotozoom
code.
* Added framerate code and testprogram.
* Added imageFilters code and testprogram.
* New distribution: source code, README, configure system etc.
Previous versions
=================
SDL_gfxPrimitives:
------------------
Ver 1.5 - Mon Jul 2 11:27:40 EDT 2001
* New alpha blending code for factor 4 speedups if a<255 on all functions.
* Modified include file for W32 DLL support.
* Added VC6 project files for DLL and static library building.
* Added simple AA-circle/-ellipse routine - quality needs improvement.
* Removed 32bit shift on 64bit number from aaline for better portability
across platforms.
* Removed a couple more compiler warnings (i.e. purely cosmetic fix).
Ver 1.4 - Sun Jun 3 11:52:07 EDT 2001
* Fixed hline, vline and rectangle clipping and result codes.
* Fixed AA-line arithmetic (was alpha subtraction, should be alpha ratio).
* More caching on fonts for speedups.
* More pointer checks in several places.
* New special cases for ellipses for rx=0/ry=0.
* Same sanity checks for circles/ellipses.
* Same return code for polygon/filledpolygon.
Ver 1.3 - Thu May 31 12:41:35 EDT 2001
* Minor cleanups and fixes (gcc -Wall is your friend).
Ver 1.2 again - Thu Apr 5 07:50:57 EDT 2001
* Fixed lineRGBA and aalineRGBA calls (had coordinate-passing mixed up twice,
thanks Lion for pointing this out)
Ver 1.2 - Wed Apr 4 08:32:42 EDT 2001
* Changed to a dual, you-have-the-choice(TM) licencing system
to accomodate GPL developments using SDL_gfxPrimitives.
* Some minor fixes (thanks Karl).
* All routines return proper result code now.
* Clipping for aaline, circle and ellipse.
Ver 1.1 - Thu Mar 22 15:28:27 EST 2001
* Added code for Alpha=255 pixel drawing through direct memory writes to all routines
resulting in a much faster performance (factor 5 to 20) for non transparent pixels.
* New test and benchmark program with better info and nicer look.
* More info in README. Proper licence file. Comment cleanup.
Ver 1.0 - Fri Mar 16 08:38:07 EST 2001
* Initial release
SDL_rotozoom:
-------------
Ver 1.6 - Mon Nov 19 21:19:26 EST 2001
* Added interpolation to alpha channel (simplifies code)
* Ran the sourcecode through 'indent' for better readability
Ver 1.5 - Sat Jul 7 13:02:07 EDT 2001
* Added project files (VisualC.zip) and modifications for VC project building.
* Fixed old versioning in configure.in file.
* Fixed LICENSE file and LGPL source reference.
Ver 1.4 - Mon Jun 4 12:15:31 EDT 2001
* Removed SDL_SoftStretch call again in favour of an internal zoom routine.
* Added new zoomSurface() function with seperate X and Y zoom factors.
Ver 1.3 - Thu May 31 08:37:36 EDT 2001
* Modified code to handle RGBA or ABGR source surfaces transparently.
* More error checking, source surface locking.
* Slighly expanded test program with event handling.
Ver 1.2 - Wed May 30 18:18:05 EDT 2001
* Fixed the completely broken 32bit routine's pointer arithmetic.
* Uses SDL_SoftStretch in certain cases (angle=0, smooth=0).
* Convert source surface on the fly if not 8/32bit.
* Added license file - was empty before (duh).
Ver 1.1 - Wed May 23 15:04:42 EDT 2001
* Added automake/autoconf scripts and testprogram.
Ver 1.0 - Fri Mar 16 08:16:06 EST 2001
* Initial release
</pre></div> </div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/index.html | HTML | apache-2.0 | 34,360 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: FPSmanager Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="classes.html"><span>Data Structure Index</span></a></li>
<li><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
<div class="title">FPSmanager Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Structure holding the state and timing information of the framerate controller.
<a href="struct_f_p_smanager.html#details">More...</a></p>
<p><code>#include <<a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>></code></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:a05019faae5de8486dbb69d24b24eed78"><td class="memItemLeft" align="right" valign="top">Uint32 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a></td></tr>
<tr class="memitem:a48695d55d40900a197688bb773b9d431"><td class="memItemLeft" align="right" valign="top">float </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">rateticks</a></td></tr>
<tr class="memitem:ad853f9c03e200a77fd897c1ea3aec43d"><td class="memItemLeft" align="right" valign="top">Uint32 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a></td></tr>
<tr class="memitem:aa7716779b7cc57dee24c15d7c5d62e55"><td class="memItemLeft" align="right" valign="top">Uint32 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">lastticks</a></td></tr>
<tr class="memitem:af7eec7342fd8eb48d5f49ba7f5b91853"><td class="memItemLeft" align="right" valign="top">Uint32 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">rate</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Structure holding the state and timing information of the framerate controller. </p>
<p>Definition at line <a class="el" href="_s_d_l__framerate_8h_source.html#l00062">62</a> of file <a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>.</p>
</div><hr/><h2>Field Documentation</h2>
<a class="anchor" id="ad853f9c03e200a77fd897c1ea3aec43d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint32 <a class="el" href="struct_f_p_smanager.html#ad853f9c03e200a77fd897c1ea3aec43d">baseticks</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__framerate_8h_source.html#l00065">65</a> of file <a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>.</p>
</div>
</div>
<a class="anchor" id="a05019faae5de8486dbb69d24b24eed78"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint32 <a class="el" href="struct_f_p_smanager.html#a05019faae5de8486dbb69d24b24eed78">framecount</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__framerate_8h_source.html#l00063">63</a> of file <a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>.</p>
</div>
</div>
<a class="anchor" id="aa7716779b7cc57dee24c15d7c5d62e55"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint32 <a class="el" href="struct_f_p_smanager.html#aa7716779b7cc57dee24c15d7c5d62e55">lastticks</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__framerate_8h_source.html#l00066">66</a> of file <a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>.</p>
</div>
</div>
<a class="anchor" id="af7eec7342fd8eb48d5f49ba7f5b91853"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint32 <a class="el" href="struct_f_p_smanager.html#af7eec7342fd8eb48d5f49ba7f5b91853">rate</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__framerate_8h_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>.</p>
</div>
</div>
<a class="anchor" id="a48695d55d40900a197688bb773b9d431"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float <a class="el" href="struct_f_p_smanager.html#a48695d55d40900a197688bb773b9d431">rateticks</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__framerate_8h_source.html#l00064">64</a> of file <a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a>.</p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>I:/Sources/sdlgfx/<a class="el" href="_s_d_l__framerate_8h_source.html">SDL_framerate.h</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/struct_f_p_smanager.html | HTML | apache-2.0 | 6,910 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: SDL_gfxBlitInfo Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="classes.html"><span>Data Structure Index</span></a></li>
<li><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
<div class="title">SDL_gfxBlitInfo Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>The structure passed to the low level blit functions.
<a href="struct_s_d_l__gfx_blit_info.html#details">More...</a></p>
<p><code>#include <<a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>></code></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:a03dd1de15b100cd491eff7d823284189"><td class="memItemLeft" align="right" valign="top">Uint8 * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#a03dd1de15b100cd491eff7d823284189">s_pixels</a></td></tr>
<tr class="memitem:ad2f7fa9a764e75639fdb6e3b0f8a68fc"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#ad2f7fa9a764e75639fdb6e3b0f8a68fc">s_width</a></td></tr>
<tr class="memitem:aeeec65f001e54fb93ba97cb85cb61592"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#aeeec65f001e54fb93ba97cb85cb61592">s_height</a></td></tr>
<tr class="memitem:a25b822e4773e1db6d38aadc5c0bb126f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#a25b822e4773e1db6d38aadc5c0bb126f">s_skip</a></td></tr>
<tr class="memitem:ae9146d0f8b236274984127a7a1528966"><td class="memItemLeft" align="right" valign="top">Uint8 * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#ae9146d0f8b236274984127a7a1528966">d_pixels</a></td></tr>
<tr class="memitem:ad49412925c79a9894ea598530ea39b00"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#ad49412925c79a9894ea598530ea39b00">d_width</a></td></tr>
<tr class="memitem:ad31494204fdd3d2cb30faba527cfb9fa"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#ad31494204fdd3d2cb30faba527cfb9fa">d_height</a></td></tr>
<tr class="memitem:a9055858de99c49d16ef903fed31715b7"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#a9055858de99c49d16ef903fed31715b7">d_skip</a></td></tr>
<tr class="memitem:a4b938ad61daa0a9625c6892fd46f32a2"><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#a4b938ad61daa0a9625c6892fd46f32a2">aux_data</a></td></tr>
<tr class="memitem:a1ce90142d08a06fede5e2a13d66d17f6"><td class="memItemLeft" align="right" valign="top">SDL_PixelFormat * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#a1ce90142d08a06fede5e2a13d66d17f6">src</a></td></tr>
<tr class="memitem:a9596f5ea6998964e6240fae7ac17ce1e"><td class="memItemLeft" align="right" valign="top">Uint8 * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#a9596f5ea6998964e6240fae7ac17ce1e">table</a></td></tr>
<tr class="memitem:a177d476cb937246853b74253490436db"><td class="memItemLeft" align="right" valign="top">SDL_PixelFormat * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_blit_info.html#a177d476cb937246853b74253490436db">dst</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The structure passed to the low level blit functions. </p>
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00077">77</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div><hr/><h2>Field Documentation</h2>
<a class="anchor" id="a4b938ad61daa0a9625c6892fd46f32a2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void* <a class="el" href="struct_s_d_l__gfx_blit_info.html#a4b938ad61daa0a9625c6892fd46f32a2">aux_data</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00086">86</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="ad31494204fdd3d2cb30faba527cfb9fa"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_blit_info.html#ad31494204fdd3d2cb30faba527cfb9fa">d_height</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00084">84</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="ae9146d0f8b236274984127a7a1528966"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint8* <a class="el" href="struct_s_d_l__gfx_blit_info.html#ae9146d0f8b236274984127a7a1528966">d_pixels</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00082">82</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="a9055858de99c49d16ef903fed31715b7"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_blit_info.html#a9055858de99c49d16ef903fed31715b7">d_skip</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00085">85</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="ad49412925c79a9894ea598530ea39b00"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_blit_info.html#ad49412925c79a9894ea598530ea39b00">d_width</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00083">83</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="a177d476cb937246853b74253490436db"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SDL_PixelFormat* <a class="el" href="struct_s_d_l__gfx_blit_info.html#a177d476cb937246853b74253490436db">dst</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00089">89</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="aeeec65f001e54fb93ba97cb85cb61592"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_blit_info.html#aeeec65f001e54fb93ba97cb85cb61592">s_height</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00080">80</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="a03dd1de15b100cd491eff7d823284189"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint8* <a class="el" href="struct_s_d_l__gfx_blit_info.html#a03dd1de15b100cd491eff7d823284189">s_pixels</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00078">78</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="a25b822e4773e1db6d38aadc5c0bb126f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_blit_info.html#a25b822e4773e1db6d38aadc5c0bb126f">s_skip</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00081">81</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="ad2f7fa9a764e75639fdb6e3b0f8a68fc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_blit_info.html#ad2f7fa9a764e75639fdb6e3b0f8a68fc">s_width</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00079">79</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="a1ce90142d08a06fede5e2a13d66d17f6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SDL_PixelFormat* <a class="el" href="struct_s_d_l__gfx_blit_info.html#a1ce90142d08a06fede5e2a13d66d17f6">src</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00087">87</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<a class="anchor" id="a9596f5ea6998964e6240fae7ac17ce1e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint8* <a class="el" href="struct_s_d_l__gfx_blit_info.html#a9596f5ea6998964e6240fae7ac17ce1e">table</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html#l00088">88</a> of file <a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a>.</p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>I:/Sources/sdlgfx/<a class="el" href="_s_d_l__gfx_blit_func_8h_source.html">SDL_gfxBlitFunc.h</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/struct_s_d_l__gfx_blit_info.html | HTML | apache-2.0 | 12,787 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: SDL_gfxBresenhamIterator Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="classes.html"><span>Data Structure Index</span></a></li>
<li><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
<div class="title">SDL_gfxBresenhamIterator Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>The structure passed to the internal Bresenham iterator.
<a href="struct_s_d_l__gfx_bresenham_iterator.html#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:ae80d529920f12a3d3eda29b1a29e2e8a"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">x</a></td></tr>
<tr class="memitem:a48ddc054175e25d435c217ad4639c3a1"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">y</a></td></tr>
<tr class="memitem:a6a0d40b2ed6d9e674f93396212f0028f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a></td></tr>
<tr class="memitem:a4817151aee120cc100c400d3076f4b93"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a></td></tr>
<tr class="memitem:acfb6b9e2b00e34da4313b463c341e597"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#acfb6b9e2b00e34da4313b463c341e597">s1</a></td></tr>
<tr class="memitem:a4c68ffea7c3affb6a0ee6219aba89a69"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a4c68ffea7c3affb6a0ee6219aba89a69">s2</a></td></tr>
<tr class="memitem:ace147c79e29f2efd14e5744efcb976af"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#ace147c79e29f2efd14e5744efcb976af">swapdir</a></td></tr>
<tr class="memitem:a11614f44ef4d939bdd984953346a7572"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a11614f44ef4d939bdd984953346a7572">error</a></td></tr>
<tr class="memitem:a92fcd448f278df155fd5472527a6dc47"><td class="memItemLeft" align="right" valign="top">Uint32 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a92fcd448f278df155fd5472527a6dc47">count</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The structure passed to the internal Bresenham iterator. </p>
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00051">51</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div><hr/><h2>Field Documentation</h2>
<a class="anchor" id="a92fcd448f278df155fd5472527a6dc47"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint32 <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a92fcd448f278df155fd5472527a6dc47">count</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00054">54</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a6a0d40b2ed6d9e674f93396212f0028f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a6a0d40b2ed6d9e674f93396212f0028f">dx</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00053">53</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a4817151aee120cc100c400d3076f4b93"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a4817151aee120cc100c400d3076f4b93">dy</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00053">53</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a11614f44ef4d939bdd984953346a7572"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a11614f44ef4d939bdd984953346a7572">error</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00053">53</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="acfb6b9e2b00e34da4313b463c341e597"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#acfb6b9e2b00e34da4313b463c341e597">s1</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00053">53</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a4c68ffea7c3affb6a0ee6219aba89a69"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a4c68ffea7c3affb6a0ee6219aba89a69">s2</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00053">53</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="ace147c79e29f2efd14e5744efcb976af"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#ace147c79e29f2efd14e5744efcb976af">swapdir</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00053">53</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="ae80d529920f12a3d3eda29b1a29e2e8a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#ae80d529920f12a3d3eda29b1a29e2e8a">x</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00052">52</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a48ddc054175e25d435c217ad4639c3a1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_bresenham_iterator.html#a48ddc054175e25d435c217ad4639c3a1">y</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00052">52</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>I:/Sources/sdlgfx/<a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/struct_s_d_l__gfx_bresenham_iterator.html | HTML | apache-2.0 | 10,330 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: SDL_gfxMurphyIterator Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="classes.html"><span>Data Structure Index</span></a></li>
<li><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
<div class="title">SDL_gfxMurphyIterator Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>The structure passed to the internal Murphy iterator.
<a href="struct_s_d_l__gfx_murphy_iterator.html#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:afd133e412238ed9f1e3ba52397115e8d"><td class="memItemLeft" align="right" valign="top">Uint32 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">color</a></td></tr>
<tr class="memitem:af6547de04c77c00ed2d4597dd48ca807"><td class="memItemLeft" align="right" valign="top">SDL_Surface * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a></td></tr>
<tr class="memitem:a5874b4c2ec2e28321eea4e4871d08222"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a></td></tr>
<tr class="memitem:ac8859e8c1ce357c4c8b37bbb1936ba1c"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a></td></tr>
<tr class="memitem:a2d8fc6210660a003e60ac96216cdd9d1"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a2d8fc6210660a003e60ac96216cdd9d1">ku</a></td></tr>
<tr class="memitem:ac77eef4f813ec344cf850b89cc68818d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac77eef4f813ec344cf850b89cc68818d">kt</a></td></tr>
<tr class="memitem:af59597daf52972ab61551495c3d7e6cd"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">kv</a></td></tr>
<tr class="memitem:ade809c6ad2d8ae1dc2f665077951b81a"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ade809c6ad2d8ae1dc2f665077951b81a">kd</a></td></tr>
<tr class="memitem:ab9894ea9f5570af0e7fa86e61a3bb60b"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a></td></tr>
<tr class="memitem:ac65502ab7d0d8cbf739c6e06c35d8edb"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a></td></tr>
<tr class="memitem:adc37a4a286331a97587fdf4f239fa5e6"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#adc37a4a286331a97587fdf4f239fa5e6">last1x</a></td></tr>
<tr class="memitem:a48dabb55f39ba73ecacc558eba6f5b15"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a48dabb55f39ba73ecacc558eba6f5b15">last1y</a></td></tr>
<tr class="memitem:a1acb203975c193230a03cee26bbd3f97"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a1acb203975c193230a03cee26bbd3f97">last2x</a></td></tr>
<tr class="memitem:ab85d5d3386d741c19de5bc0a7767d185"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ab85d5d3386d741c19de5bc0a7767d185">last2y</a></td></tr>
<tr class="memitem:a20a0f29217c4df1896f0b5b2e0db8901"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a20a0f29217c4df1896f0b5b2e0db8901">first1x</a></td></tr>
<tr class="memitem:a1e6adb477c4b1db15853adf1b5340760"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a1e6adb477c4b1db15853adf1b5340760">first1y</a></td></tr>
<tr class="memitem:a0043c9be4575c0c75cda25d9cec09deb"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a0043c9be4575c0c75cda25d9cec09deb">first2x</a></td></tr>
<tr class="memitem:ac8c0bb60c5be224d8d7fd4d4fd74930c"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac8c0bb60c5be224d8d7fd4d4fd74930c">first2y</a></td></tr>
<tr class="memitem:af4320e1b2f9da1ee4155b6cfe35c8d7e"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af4320e1b2f9da1ee4155b6cfe35c8d7e">tempx</a></td></tr>
<tr class="memitem:a4c3e88fc7abb5715d04e28d96a154e5f"><td class="memItemLeft" align="right" valign="top">Sint16 </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a4c3e88fc7abb5715d04e28d96a154e5f">tempy</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The structure passed to the internal Murphy iterator. </p>
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00060">60</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div><hr/><h2>Field Documentation</h2>
<a class="anchor" id="afd133e412238ed9f1e3ba52397115e8d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint32 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#afd133e412238ed9f1e3ba52397115e8d">color</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00061">61</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="af6547de04c77c00ed2d4597dd48ca807"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SDL_Surface* <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af6547de04c77c00ed2d4597dd48ca807">dst</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00062">62</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a20a0f29217c4df1896f0b5b2e0db8901"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a20a0f29217c4df1896f0b5b2e0db8901">first1x</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a1e6adb477c4b1db15853adf1b5340760"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a1e6adb477c4b1db15853adf1b5340760">first1y</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a0043c9be4575c0c75cda25d9cec09deb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a0043c9be4575c0c75cda25d9cec09deb">first2x</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="ac8c0bb60c5be224d8d7fd4d4fd74930c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac8c0bb60c5be224d8d7fd4d4fd74930c">first2y</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="ade809c6ad2d8ae1dc2f665077951b81a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ade809c6ad2d8ae1dc2f665077951b81a">kd</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00064">64</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="ac77eef4f813ec344cf850b89cc68818d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac77eef4f813ec344cf850b89cc68818d">kt</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00064">64</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a2d8fc6210660a003e60ac96216cdd9d1"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a2d8fc6210660a003e60ac96216cdd9d1">ku</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00064">64</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="af59597daf52972ab61551495c3d7e6cd"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af59597daf52972ab61551495c3d7e6cd">kv</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00064">64</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="adc37a4a286331a97587fdf4f239fa5e6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#adc37a4a286331a97587fdf4f239fa5e6">last1x</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a48dabb55f39ba73ecacc558eba6f5b15"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a48dabb55f39ba73ecacc558eba6f5b15">last1y</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a1acb203975c193230a03cee26bbd3f97"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a1acb203975c193230a03cee26bbd3f97">last2x</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="ab85d5d3386d741c19de5bc0a7767d185"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ab85d5d3386d741c19de5bc0a7767d185">last2y</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="ab9894ea9f5570af0e7fa86e61a3bb60b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ab9894ea9f5570af0e7fa86e61a3bb60b">oct2</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00065">65</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="ac65502ab7d0d8cbf739c6e06c35d8edb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac65502ab7d0d8cbf739c6e06c35d8edb">quad4</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00066">66</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="af4320e1b2f9da1ee4155b6cfe35c8d7e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#af4320e1b2f9da1ee4155b6cfe35c8d7e">tempx</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a4c3e88fc7abb5715d04e28d96a154e5f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Sint16 <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a4c3e88fc7abb5715d04e28d96a154e5f">tempy</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00067">67</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="a5874b4c2ec2e28321eea4e4871d08222"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#a5874b4c2ec2e28321eea4e4871d08222">u</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00063">63</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<a class="anchor" id="ac8859e8c1ce357c4c8b37bbb1936ba1c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="struct_s_d_l__gfx_murphy_iterator.html#ac8859e8c1ce357c4c8b37bbb1936ba1c">v</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__gfx_primitives_8c_source.html#l00063">63</a> of file <a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a>.</p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>I:/Sources/sdlgfx/<a class="el" href="_s_d_l__gfx_primitives_8c_source.html">SDL_gfxPrimitives.c</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/struct_s_d_l__gfx_murphy_iterator.html | HTML | apache-2.0 | 19,483 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: tColorRGBA Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="classes.html"><span>Data Structure Index</span></a></li>
<li><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
<div class="title">tColorRGBA Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A 32 bit RGBA pixel.
<a href="structt_color_r_g_b_a.html#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:a91b464c8eae5ece8465e150e16086acd"><td class="memItemLeft" align="right" valign="top">Uint8 </td><td class="memItemRight" valign="bottom"><a class="el" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a></td></tr>
<tr class="memitem:ab4c6f97b95a6d0a8058a62eab9c78c43"><td class="memItemLeft" align="right" valign="top">Uint8 </td><td class="memItemRight" valign="bottom"><a class="el" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a></td></tr>
<tr class="memitem:a3d03a0372246e40434fc7a8a928c1e92"><td class="memItemLeft" align="right" valign="top">Uint8 </td><td class="memItemRight" valign="bottom"><a class="el" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a></td></tr>
<tr class="memitem:ababb728b2453c31cab11523817407956"><td class="memItemLeft" align="right" valign="top">Uint8 </td><td class="memItemRight" valign="bottom"><a class="el" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A 32 bit RGBA pixel. </p>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00044">44</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div><hr/><h2>Field Documentation</h2>
<a class="anchor" id="ababb728b2453c31cab11523817407956"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint8 <a class="el" href="structt_color_r_g_b_a.html#ababb728b2453c31cab11523817407956">a</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00048">48</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a3d03a0372246e40434fc7a8a928c1e92"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint8 <a class="el" href="structt_color_r_g_b_a.html#a3d03a0372246e40434fc7a8a928c1e92">b</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00047">47</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="ab4c6f97b95a6d0a8058a62eab9c78c43"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint8 <a class="el" href="structt_color_r_g_b_a.html#ab4c6f97b95a6d0a8058a62eab9c78c43">g</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00046">46</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<a class="anchor" id="a91b464c8eae5ece8465e150e16086acd"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint8 <a class="el" href="structt_color_r_g_b_a.html#a91b464c8eae5ece8465e150e16086acd">r</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00045">45</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>I:/Sources/sdlgfx/<a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/structt_color_r_g_b_a.html | HTML | apache-2.0 | 5,816 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SDL_gfx: tColorY Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SDL_gfx
 <span id="projectnumber">2.0.25</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.0 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="classes.html"><span>Data Structure Index</span></a></li>
<li><a href="functions.html"><span>Data Fields</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-attribs">Data Fields</a> </div>
<div class="headertitle">
<div class="title">tColorY Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A 8bit Y/palette pixel.
<a href="structt_color_y.html#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:ace61c93d341a0b154df0e9923558a537"><td class="memItemLeft" align="right" valign="top">Uint8 </td><td class="memItemRight" valign="bottom"><a class="el" href="structt_color_y.html#ace61c93d341a0b154df0e9923558a537">y</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A 8bit Y/palette pixel. </p>
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00054">54</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div><hr/><h2>Field Documentation</h2>
<a class="anchor" id="ace61c93d341a0b154df0e9923558a537"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint8 <a class="el" href="structt_color_y.html#ace61c93d341a0b154df0e9923558a537">y</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_s_d_l__rotozoom_8c_source.html#l00055">55</a> of file <a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a>.</p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>I:/Sources/sdlgfx/<a class="el" href="_s_d_l__rotozoom_8c_source.html">SDL_rotozoom.c</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>
</body>
</html>
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/structt_color_y.html | HTML | apache-2.0 | 3,440 |
.tabs, .tabs2, .tabs3 {
background-image: url('tab_b.png');
width: 100%;
z-index: 101;
font-size: 13px;
}
.tabs2 {
font-size: 10px;
}
.tabs3 {
font-size: 9px;
}
.tablist {
margin: 0;
padding: 0;
display: table;
}
.tablist li {
float: left;
display: table-cell;
background-image: url('tab_b.png');
line-height: 36px;
list-style: none;
}
.tablist a {
display: block;
padding: 0 20px;
font-weight: bold;
background-image:url('tab_s.png');
background-repeat:no-repeat;
background-position:right;
color: #283A5D;
text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
text-decoration: none;
outline: none;
}
.tabs3 .tablist a {
padding: 0 10px;
}
.tablist a:hover {
background-image: url('tab_h.png');
background-repeat:repeat-x;
color: #fff;
text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
text-decoration: none;
}
.tablist li.current a {
background-image: url('tab_a.png');
background-repeat:repeat-x;
color: #fff;
text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/html/tabs.css | CSS | apache-2.0 | 1,095 |
<a href="html/index.html">Main Documentation</a>
<script language="javascript">
document.location.href="html/index.html";
</script>
Please see http://www.ferzkopp.net for the latest documentation.
Current URL is http://www.ferzkopp.net/joomla/content/view/19/14/
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Docs/index.html | HTML | apache-2.0 | 270 |
# Makefile.am for the SDL_gfx library/DLL
ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = libSDL_gfx.la
libSDL_gfxincludedir = $(includedir)/SDL
libSDL_gfxinclude_HEADERS = \
SDL_gfxPrimitives.h \
SDL_gfxPrimitives_font.h \
SDL_rotozoom.h \
SDL_framerate.h \
SDL_imageFilter.h \
SDL_gfxBlitFunc.h
libSDL_gfx_la_SOURCES = \
SDL_gfxPrimitives.c \
SDL_rotozoom.c \
SDL_framerate.c \
SDL_imageFilter.c \
SDL_gfxBlitFunc.c
DEFS = @DEFS@ -DBUILD_DLL
libSDL_gfx_la_LDFLAGS = \
-no-undefined -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = SDL_gfx.pc
DISTCLEANFILES = *~ *~c *~h *.cross.cache inc
distclean-local:
-rm -rf autom4te.cache
-rm -f *.suo *.sdf
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Makefile.am | Makefile | apache-2.0 | 726 |
/*
SDL_framerate.c: framerate manager
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
#include "SDL_framerate.h"
/*!
\brief Internal wrapper to SDL_GetTicks that ensures a non-zero return value.
\return The tick count.
*/
Uint32 _getTicks()
{
Uint32 ticks = SDL_GetTicks();
/*
* Since baseticks!=0 is used to track initialization
* we need to ensure that the tick count is always >0
* since SDL_GetTicks may not have incremented yet and
* return 0 depending on the timing of the calls.
*/
if (ticks == 0) {
return 1;
} else {
return ticks;
}
}
/*!
\brief Initialize the framerate manager.
Initialize the framerate manager, set default framerate of 30Hz and
reset delay interpolation.
\param manager Pointer to the framerate manager.
*/
void SDL_initFramerate(FPSmanager * manager)
{
/*
* Store some sane values
*/
manager->framecount = 0;
manager->rate = FPS_DEFAULT;
manager->rateticks = (1000.0f / (float) FPS_DEFAULT);
manager->baseticks = _getTicks();
manager->lastticks = manager->baseticks;
}
/*!
\brief Set the framerate in Hz
Sets a new framerate for the manager and reset delay interpolation.
Rate values must be between FPS_LOWER_LIMIT and FPS_UPPER_LIMIT inclusive to be accepted.
\param manager Pointer to the framerate manager.
\param rate The new framerate in Hz (frames per second).
\return 0 for sucess and -1 for error.
*/
int SDL_setFramerate(FPSmanager * manager, Uint32 rate)
{
if ((rate >= FPS_LOWER_LIMIT) && (rate <= FPS_UPPER_LIMIT)) {
manager->framecount = 0;
manager->rate = rate;
manager->rateticks = (1000.0f / (float) rate);
return (0);
} else {
return (-1);
}
}
/*!
\brief Return the current target framerate in Hz
Get the currently set framerate of the manager.
\param manager Pointer to the framerate manager.
\return Current framerate in Hz or -1 for error.
*/
int SDL_getFramerate(FPSmanager * manager)
{
if (manager == NULL) {
return (-1);
} else {
return ((int)manager->rate);
}
}
/*!
\brief Return the current framecount.
Get the current framecount from the framerate manager.
A frame is counted each time SDL_framerateDelay is called.
\param manager Pointer to the framerate manager.
\return Current frame count or -1 for error.
*/
int SDL_getFramecount(FPSmanager * manager)
{
if (manager == NULL) {
return (-1);
} else {
return ((int)manager->framecount);
}
}
/*!
\brief Delay execution to maintain a constant framerate and calculate fps.
Generate a delay to accomodate currently set framerate. Call once in the
graphics/rendering loop. If the computer cannot keep up with the rate (i.e.
drawing too slow), the delay is zero and the delay interpolation is reset.
\param manager Pointer to the framerate manager.
\return The time that passed since the last call to the function in ms. May return 0.
*/
Uint32 SDL_framerateDelay(FPSmanager * manager)
{
Uint32 current_ticks;
Uint32 target_ticks;
Uint32 the_delay;
Uint32 time_passed = 0;
/*
* No manager, no delay
*/
if (manager == NULL) {
return 0;
}
/*
* Initialize uninitialized manager
*/
if (manager->baseticks == 0) {
SDL_initFramerate(manager);
}
/*
* Next frame
*/
manager->framecount++;
/*
* Get/calc ticks
*/
current_ticks = _getTicks();
time_passed = current_ticks - manager->lastticks;
manager->lastticks = current_ticks;
target_ticks = manager->baseticks + (Uint32) ((float) manager->framecount * manager->rateticks);
if (current_ticks <= target_ticks) {
the_delay = target_ticks - current_ticks;
SDL_Delay(the_delay);
} else {
manager->framecount = 0;
manager->baseticks = _getTicks();
}
return time_passed;
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/SDL_framerate.c | C | apache-2.0 | 4,504 |
/*
SDL_framerate.h: framerate manager
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
#ifndef _SDL_framerate_h
#define _SDL_framerate_h
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* --- */
#include "SDL.h"
/* --------- Definitions */
/*!
\brief Highest possible rate supported by framerate controller in Hz (1/s).
*/
#define FPS_UPPER_LIMIT 200
/*!
\brief Lowest possible rate supported by framerate controller in Hz (1/s).
*/
#define FPS_LOWER_LIMIT 1
/*!
\brief Default rate of framerate controller in Hz (1/s).
*/
#define FPS_DEFAULT 30
/*!
\brief Structure holding the state and timing information of the framerate controller.
*/
typedef struct {
Uint32 framecount;
float rateticks;
Uint32 baseticks;
Uint32 lastticks;
Uint32 rate;
} FPSmanager;
/* ---- Function Prototypes */
#ifdef _MSC_VER
# if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
# define SDL_FRAMERATE_SCOPE __declspec(dllexport)
# else
# ifdef LIBSDL_GFX_DLL_IMPORT
# define SDL_FRAMERATE_SCOPE __declspec(dllimport)
# endif
# endif
#endif
#ifndef SDL_FRAMERATE_SCOPE
# define SDL_FRAMERATE_SCOPE extern
#endif
/* Functions return 0 or value for sucess and -1 for error */
SDL_FRAMERATE_SCOPE void SDL_initFramerate(FPSmanager * manager);
SDL_FRAMERATE_SCOPE int SDL_setFramerate(FPSmanager * manager, Uint32 rate);
SDL_FRAMERATE_SCOPE int SDL_getFramerate(FPSmanager * manager);
SDL_FRAMERATE_SCOPE int SDL_getFramecount(FPSmanager * manager);
SDL_FRAMERATE_SCOPE Uint32 SDL_framerateDelay(FPSmanager * manager);
/* --- */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#endif /* _SDL_framerate_h */
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/SDL_framerate.h | C | apache-2.0 | 2,607 |
/*
SDL_gfxBlitFunc.c: custom blitters
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
#include "SDL_gfxBlitFunc.h"
/*!
\brief Alpha adjustment table for custom blitter.
The table provides values for a modified, non-linear
transfer function which maintain brightness.
*/
const unsigned int GFX_ALPHA_ADJUST_ARRAY[256] = {
0, /* 0 */
15, /* 1 */
22, /* 2 */
27, /* 3 */
31, /* 4 */
35, /* 5 */
39, /* 6 */
42, /* 7 */
45, /* 8 */
47, /* 9 */
50, /* 10 */
52, /* 11 */
55, /* 12 */
57, /* 13 */
59, /* 14 */
61, /* 15 */
63, /* 16 */
65, /* 17 */
67, /* 18 */
69, /* 19 */
71, /* 20 */
73, /* 21 */
74, /* 22 */
76, /* 23 */
78, /* 24 */
79, /* 25 */
81, /* 26 */
82, /* 27 */
84, /* 28 */
85, /* 29 */
87, /* 30 */
88, /* 31 */
90, /* 32 */
91, /* 33 */
93, /* 34 */
94, /* 35 */
95, /* 36 */
97, /* 37 */
98, /* 38 */
99, /* 39 */
100, /* 40 */
102, /* 41 */
103, /* 42 */
104, /* 43 */
105, /* 44 */
107, /* 45 */
108, /* 46 */
109, /* 47 */
110, /* 48 */
111, /* 49 */
112, /* 50 */
114, /* 51 */
115, /* 52 */
116, /* 53 */
117, /* 54 */
118, /* 55 */
119, /* 56 */
120, /* 57 */
121, /* 58 */
122, /* 59 */
123, /* 60 */
124, /* 61 */
125, /* 62 */
126, /* 63 */
127, /* 64 */
128, /* 65 */
129, /* 66 */
130, /* 67 */
131, /* 68 */
132, /* 69 */
133, /* 70 */
134, /* 71 */
135, /* 72 */
136, /* 73 */
137, /* 74 */
138, /* 75 */
139, /* 76 */
140, /* 77 */
141, /* 78 */
141, /* 79 */
142, /* 80 */
143, /* 81 */
144, /* 82 */
145, /* 83 */
146, /* 84 */
147, /* 85 */
148, /* 86 */
148, /* 87 */
149, /* 88 */
150, /* 89 */
151, /* 90 */
152, /* 91 */
153, /* 92 */
153, /* 93 */
154, /* 94 */
155, /* 95 */
156, /* 96 */
157, /* 97 */
158, /* 98 */
158, /* 99 */
159, /* 100 */
160, /* 101 */
161, /* 102 */
162, /* 103 */
162, /* 104 */
163, /* 105 */
164, /* 106 */
165, /* 107 */
165, /* 108 */
166, /* 109 */
167, /* 110 */
168, /* 111 */
168, /* 112 */
169, /* 113 */
170, /* 114 */
171, /* 115 */
171, /* 116 */
172, /* 117 */
173, /* 118 */
174, /* 119 */
174, /* 120 */
175, /* 121 */
176, /* 122 */
177, /* 123 */
177, /* 124 */
178, /* 125 */
179, /* 126 */
179, /* 127 */
180, /* 128 */
181, /* 129 */
182, /* 130 */
182, /* 131 */
183, /* 132 */
184, /* 133 */
184, /* 134 */
185, /* 135 */
186, /* 136 */
186, /* 137 */
187, /* 138 */
188, /* 139 */
188, /* 140 */
189, /* 141 */
190, /* 142 */
190, /* 143 */
191, /* 144 */
192, /* 145 */
192, /* 146 */
193, /* 147 */
194, /* 148 */
194, /* 149 */
195, /* 150 */
196, /* 151 */
196, /* 152 */
197, /* 153 */
198, /* 154 */
198, /* 155 */
199, /* 156 */
200, /* 157 */
200, /* 158 */
201, /* 159 */
201, /* 160 */
202, /* 161 */
203, /* 162 */
203, /* 163 */
204, /* 164 */
205, /* 165 */
205, /* 166 */
206, /* 167 */
206, /* 168 */
207, /* 169 */
208, /* 170 */
208, /* 171 */
209, /* 172 */
210, /* 173 */
210, /* 174 */
211, /* 175 */
211, /* 176 */
212, /* 177 */
213, /* 178 */
213, /* 179 */
214, /* 180 */
214, /* 181 */
215, /* 182 */
216, /* 183 */
216, /* 184 */
217, /* 185 */
217, /* 186 */
218, /* 187 */
218, /* 188 */
219, /* 189 */
220, /* 190 */
220, /* 191 */
221, /* 192 */
221, /* 193 */
222, /* 194 */
222, /* 195 */
223, /* 196 */
224, /* 197 */
224, /* 198 */
225, /* 199 */
225, /* 200 */
226, /* 201 */
226, /* 202 */
227, /* 203 */
228, /* 204 */
228, /* 205 */
229, /* 206 */
229, /* 207 */
230, /* 208 */
230, /* 209 */
231, /* 210 */
231, /* 211 */
232, /* 212 */
233, /* 213 */
233, /* 214 */
234, /* 215 */
234, /* 216 */
235, /* 217 */
235, /* 218 */
236, /* 219 */
236, /* 220 */
237, /* 221 */
237, /* 222 */
238, /* 223 */
238, /* 224 */
239, /* 225 */
240, /* 226 */
240, /* 227 */
241, /* 228 */
241, /* 229 */
242, /* 230 */
242, /* 231 */
243, /* 232 */
243, /* 233 */
244, /* 234 */
244, /* 235 */
245, /* 236 */
245, /* 237 */
246, /* 238 */
246, /* 239 */
247, /* 240 */
247, /* 241 */
248, /* 242 */
248, /* 243 */
249, /* 244 */
249, /* 245 */
250, /* 246 */
250, /* 247 */
251, /* 248 */
251, /* 249 */
252, /* 250 */
252, /* 251 */
253, /* 252 */
253, /* 253 */
254, /* 254 */
255 /* 255 */
};
/*!
\brief Internal blitter using adjusted destination alpha during RGBA->RGBA blits.
Performs the blit based on the 'info' structure and applies the transfer function
to the destination 'a' values.
\param info The blit info to use.
*/
void _SDL_gfxBlitBlitterRGBA(SDL_gfxBlitInfo * info)
{
int width = info->d_width;
int height = info->d_height;
Uint8 *src = info->s_pixels;
int srcskip = info->s_skip;
Uint8 *dst = info->d_pixels;
int dstskip = info->d_skip;
SDL_PixelFormat *srcfmt = info->src;
SDL_PixelFormat *dstfmt = info->dst;
Uint8 srcbpp = srcfmt->BytesPerPixel;
Uint8 dstbpp = dstfmt->BytesPerPixel;
while (height--) {
GFX_DUFFS_LOOP4( {
Uint32 pixel;
unsigned sR;
unsigned sG;
unsigned sB;
unsigned sA;
unsigned dR;
unsigned dG;
unsigned dB;
unsigned dA;
unsigned sAA;
GFX_DISASSEMBLE_RGBA(src, srcbpp, srcfmt, pixel, sR, sG, sB, sA);
GFX_DISASSEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
sAA=GFX_ALPHA_ADJUST_ARRAY[sA & 255];
GFX_ALPHA_BLEND(sR, sG, sB, sAA, dR, dG, dB);
dA |= sAA;
GFX_ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
src += srcbpp; dst += dstbpp;
}, width);
src += srcskip;
dst += dstskip;
}
}
/*!
\brief Internal blitter setup wrapper for RGBA->RGBA blits.
Sets up the blitter info based on the 'src' and 'dst' surfaces and rectangles.
\param src The source surface.
\param srcrect The source rectangle.
\param dst The destination surface.
\param dstrect The destination rectangle.
\returns Returns 1 if blit was performed, 0 otherwise.
*/
int _SDL_gfxBlitRGBACall(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
{
/*
* Set up source and destination buffer pointers, then blit
*/
if (srcrect->w && srcrect->h) {
SDL_gfxBlitInfo info;
/*
* Set up the blit information
*/
#if (SDL_MINOR_VERSION == 3)
info.s_pixels = (Uint8 *) src->pixels + (Uint16) srcrect->y * src->pitch + (Uint16) srcrect->x * src->format->BytesPerPixel;
#else
info.s_pixels = (Uint8 *) src->pixels + src->offset + (Uint16) srcrect->y * src->pitch + (Uint16) srcrect->x * src->format->BytesPerPixel;
#endif
info.s_width = srcrect->w;
info.s_height = srcrect->h;
info.s_skip = (int)(src->pitch - info.s_width * src->format->BytesPerPixel);
#if (SDL_MINOR_VERSION == 3)
info.d_pixels = (Uint8 *) dst->pixels + (Uint16) dstrect->y * dst->pitch + (Uint16) dstrect->x * dst->format->BytesPerPixel;
#else
info.d_pixels = (Uint8 *) dst->pixels + dst->offset + (Uint16) dstrect->y * dst->pitch + (Uint16) dstrect->x * dst->format->BytesPerPixel;
#endif
info.d_width = dstrect->w;
info.d_height = dstrect->h;
info.d_skip = (int)(dst->pitch - info.d_width * dst->format->BytesPerPixel);
info.aux_data = NULL;
info.src = src->format;
info.table = NULL;
info.dst = dst->format;
/*
* Run the actual software blitter
*/
_SDL_gfxBlitBlitterRGBA(&info);
return 1;
}
return (0);
}
/*!
\brief Blitter for RGBA->RGBA blits with alpha adjustment.
Verifies the input 'src' and 'dst' surfaces and rectangles and performs blit.
The destination clip rectangle is honored.
\param src The source surface.
\param srcrect The source rectangle.
\param dst The destination surface.
\param dstrect The destination rectangle.
\returns Returns 1 if blit was performed, 0 otherwise, or -1 if an error occured.
*/
int SDL_gfxBlitRGBA(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
{
SDL_Rect sr, dr;
int srcx, srcy, w, h;
/*
* Make sure the surfaces aren't locked
*/
if (!src || !dst) {
SDL_SetError("SDL_UpperBlit: passed a NULL surface");
return (-1);
}
if ((src->locked) || (dst->locked)) {
SDL_SetError("Surfaces must not be locked during blit");
return (-1);
}
/*
* If the destination rectangle is NULL, use the entire dest surface
*/
if (dstrect == NULL) {
dr.x = dr.y = 0;
dr.w = dst->w;
dr.h = dst->h;
} else {
dr = *dstrect;
}
/*
* Clip the source rectangle to the source surface
*/
if (srcrect) {
int maxw, maxh;
srcx = srcrect->x;
w = srcrect->w;
if (srcx < 0) {
w += srcx;
dr.x -= srcx;
srcx = 0;
}
maxw = src->w - srcx;
if (maxw < w)
w = maxw;
srcy = srcrect->y;
h = srcrect->h;
if (srcy < 0) {
h += srcy;
dr.y -= srcy;
srcy = 0;
}
maxh = src->h - srcy;
if (maxh < h)
h = maxh;
} else {
srcx = srcy = 0;
w = src->w;
h = src->h;
}
/*
* Clip the destination rectangle against the clip rectangle
*/
{
SDL_Rect *clip = &dst->clip_rect;
int dx, dy;
dx = clip->x - dr.x;
if (dx > 0) {
w -= dx;
dr.x += dx;
srcx += dx;
}
dx = dr.x + w - clip->x - clip->w;
if (dx > 0)
w -= dx;
dy = clip->y - dr.y;
if (dy > 0) {
h -= dy;
dr.y += dy;
srcy += dy;
}
dy = dr.y + h - clip->y - clip->h;
if (dy > 0)
h -= dy;
}
if (w > 0 && h > 0) {
sr.x = srcx;
sr.y = srcy;
sr.w = dr.w = w;
sr.h = dr.h = h;
return (_SDL_gfxBlitRGBACall(src, &sr, dst, &dr));
}
return 0;
}
/*!
\brief Sets the alpha channel in a 32 bit surface.
Helper function that sets the alpha channel in a 32 bit surface
to a constant value.
Only 32 bit surfaces can be used with this function.
\param src Pointer to the target surface to change.
\param a The alpha value to set.
\return Returns 1 if alpha was changed, -1 otherwise.
*/
int SDL_gfxSetAlpha(SDL_Surface *src, Uint8 a)
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int alpha_offset = 0;
#else
const int alpha_offset = 3;
#endif
int i, j, row_skip;
Uint8 *pixels;
/* Check if we have a 32bit surface */
if ( (src==NULL) ||
(src->format==NULL) ||
(src->format->BytesPerPixel!=4) ) {
SDL_SetError("SDL_gfxSetAlpha: Invalid input surface.");
return -1;
}
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(src)) {
if (SDL_LockSurface(src) < 0) {
return (-1);
}
}
/* Process */
pixels = (Uint8 *)src->pixels;
row_skip = (src->pitch - (4*src->w));
pixels += alpha_offset;
for ( i=0; i<src->h; i++ ) {
for ( j=0; j<src->w; j++ ) {
*pixels = a;
pixels += 4;
}
pixels += row_skip;
}
/*
* Unlock surface
*/
if (SDL_MUSTLOCK(src)) {
SDL_UnlockSurface(src);
}
return 1;
}
/*!
\brief Multiply the alpha channel in a 32bit surface.
Helper function that multiplies the alpha channel in a 32 bit surface
with a constant value. The final alpha is always scaled to the range
0-255 (i.e. the factor is a/256).
Only 32 bit surfaces can be used with this function.
\param src Pointer to the target surface to change.
\param a The alpha value to multiply with. When a is 255, this function is a NoOp.
\return Returns 1 if alpha was changed, 0 otherwise. Returns -1 if input surface is invalid.
*/
int SDL_gfxMultiplyAlpha(SDL_Surface *src, Uint8 a)
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int alpha_offset = 0;
#else
const int alpha_offset = 3;
#endif
int i, j, row_skip;
Uint8 *pixels;
/* Check if we have a 32bit surface */
if ( (src==NULL) ||
(src->format==NULL) ||
(src->format->BytesPerPixel!=4) ) {
SDL_SetError("SDL_gfxMultiplyAlpha: Invalid input surface.");
return -1;
}
/* Check if multiplication is needed */
if (a==255) {
return 0;
}
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(src)) {
if (SDL_LockSurface(src) < 0) {
return (-1);
}
}
/* Process */
pixels = (Uint8 *)src->pixels;
row_skip = (src->pitch - (4*src->w));
pixels += alpha_offset;
for ( i=0; i<src->h; i++ ) {
for ( j=0; j<src->w; j++ ) {
*pixels = (Uint8)(((int)(*pixels)*a)>>8);
pixels += 4;
}
pixels += row_skip;
}
/*
* Unlock surface
*/
if (SDL_MUSTLOCK(src)) {
SDL_UnlockSurface(src);
}
return 1;
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/SDL_gfxBlitFunc.c | C | apache-2.0 | 13,158 |
/*
SDL_gfxBlitFunc.h: custom blitters
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
#ifndef _SDL_gfxBlitFunc_h
#define _SDL_gfxBlitFunc_h
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include "SDL.h"
#include "SDL_video.h"
extern const unsigned int GFX_ALPHA_ADJUST_ARRAY[256];
/* ---- Function Prototypes */
#ifdef _MSC_VER
# if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
# define SDL_GFXBLITFUNC_SCOPE __declspec(dllexport)
# else
# ifdef LIBSDL_GFX_DLL_IMPORT
# define SDL_GFXBLITFUNC_SCOPE __declspec(dllimport)
# endif
# endif
#endif
#ifndef SDL_GFXBLITFUNC_SCOPE
# define SDL_GFXBLITFUNC_SCOPE extern
#endif
SDL_GFXBLITFUNC_SCOPE int SDL_gfxBlitRGBA(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect);
SDL_GFXBLITFUNC_SCOPE int SDL_gfxSetAlpha(SDL_Surface * src, Uint8 a);
SDL_GFXBLITFUNC_SCOPE int SDL_gfxMultiplyAlpha(SDL_Surface * src, Uint8 a);
/* -------- Macros */
/* Define SDL macros locally as a substitute for an #include "SDL_blit.h", */
/* which doesn't work since the include file doesn't get installed. */
/*!
\brief The structure passed to the low level blit functions.
*/
typedef struct {
Uint8 *s_pixels;
int s_width;
int s_height;
int s_skip;
Uint8 *d_pixels;
int d_width;
int d_height;
int d_skip;
void *aux_data;
SDL_PixelFormat *src;
Uint8 *table;
SDL_PixelFormat *dst;
} SDL_gfxBlitInfo;
/*!
\brief Unwrap RGBA values from a pixel using mask, shift and loss for surface.
*/
#define GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a) \
{ \
r = ((pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss; \
g = ((pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss; \
b = ((pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss; \
a = ((pixel&fmt->Amask)>>fmt->Ashift)<<fmt->Aloss; \
}
/*!
\brief Disassemble buffer pointer into a pixel and separate RGBA values.
*/
#define GFX_DISASSEMBLE_RGBA(buf, bpp, fmt, pixel, r, g, b, a) \
do { \
pixel = *((Uint32 *)(buf)); \
GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a); \
pixel &= ~fmt->Amask; \
} while(0)
/*!
\brief Wrap a pixel from RGBA values using mask, shift and loss for surface.
*/
#define GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a) \
{ \
pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
((g>>fmt->Gloss)<<fmt->Gshift)| \
((b>>fmt->Bloss)<<fmt->Bshift)| \
((a<<fmt->Aloss)<<fmt->Ashift); \
}
/*!
\brief Assemble pixel into buffer pointer from separate RGBA values.
*/
#define GFX_ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) \
{ \
Uint32 pixel; \
\
GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a); \
*((Uint32 *)(buf)) = pixel; \
}
/*!
\brief Blend the RGB values of two pixels based on a source alpha value.
*/
#define GFX_ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB) \
do { \
dR = (((sR-dR)*(A))/255)+dR; \
dG = (((sG-dG)*(A))/255)+dG; \
dB = (((sB-dB)*(A))/255)+dB; \
} while(0)
/*!
\brief 4-times unrolled DUFFs loop.
This is a very useful loop for optimizing blitters.
*/
#define GFX_DUFFS_LOOP4(pixel_copy_increment, width) \
{ int n = (width+3)/4; \
switch (width & 3) { \
case 0: do { pixel_copy_increment; \
case 3: pixel_copy_increment; \
case 2: pixel_copy_increment; \
case 1: pixel_copy_increment; \
} while ( --n > 0 ); \
} \
}
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#endif /* _SDL_gfxBlitFunc_h */
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/SDL_gfxBlitFunc.h | C | apache-2.0 | 4,510 |
/*
SDL_gfxPrimitives.c: graphics primitives for SDL surfaces
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "SDL_gfxPrimitives.h"
#include "SDL_rotozoom.h"
#include "SDL_gfxPrimitives_font.h"
#include "SDL_gfxBlitFunc.h"
/* -===================- */
#define DEFAULT_ALPHA_PIXEL_ROUTINE
#undef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE
#define ALPHA_PIXEL_ADDITIVE_BLEND
/* ---- Structures */
/*!
\brief The structure passed to the internal Bresenham iterator.
*/
typedef struct {
Sint16 x, y;
int dx, dy, s1, s2, swapdir, error;
Uint32 count;
} SDL_gfxBresenhamIterator;
/*!
\brief The structure passed to the internal Murphy iterator.
*/
typedef struct {
Uint32 color;
SDL_Surface *dst;
int u, v; /* delta x , delta y */
int ku, kt, kv, kd; /* loop constants */
int oct2;
int quad4;
Sint16 last1x, last1y, last2x, last2y, first1x, first1y, first2x, first2y, tempx, tempy;
} SDL_gfxMurphyIterator;
/* ----- Defines for pixel clipping tests */
#define clip_xmin(surface) surface->clip_rect.x
#define clip_xmax(surface) surface->clip_rect.x+surface->clip_rect.w-1
#define clip_ymin(surface) surface->clip_rect.y
#define clip_ymax(surface) surface->clip_rect.y+surface->clip_rect.h-1
/*!
\brief Internal pixel drawing - fast, no blending, no locking, clipping.
\param dst The surface to draw on.
\param x The horizontal coordinate of the pixel.
\param y The vertical position of the pixel.
\param color The color value of the pixel to draw.
\returns Returns 0 on success, -1 on failure.
*/
int fastPixelColorNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
{
int bpp;
Uint8 *p;
/*
* Honor clipping setup at pixel level
*/
if ((x >= clip_xmin(dst)) && (x <= clip_xmax(dst)) && (y >= clip_ymin(dst)) && (y <= clip_ymax(dst))) {
/*
* Get destination format
*/
bpp = dst->format->BytesPerPixel;
p = (Uint8 *) dst->pixels + y * dst->pitch + x * bpp;
switch (bpp) {
case 1:
*p = color;
break;
case 2:
*(Uint16 *) p = color;
break;
case 3:
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
p[0] = (color >> 16) & 0xff;
p[1] = (color >> 8) & 0xff;
p[2] = color & 0xff;
} else {
p[0] = color & 0xff;
p[1] = (color >> 8) & 0xff;
p[2] = (color >> 16) & 0xff;
}
break;
case 4:
*(Uint32 *) p = color;
break;
} /* switch */
}
return (0);
}
/*!
\brief Internal pixel drawing - fast, no blending, no locking, no clipping.
Function is faster but dangerous since no clipping check is done.
Code needs to make sure we stay in surface bounds before calling.
\param dst The surface to draw on.
\param x The horizontal coordinate of the pixel.
\param y The vertical position of the pixel.
\param color The color value of the pixel to draw.
\returns Returns 0 on success, -1 on failure.
*/
int fastPixelColorNolockNoclip(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
{
int bpp;
Uint8 *p;
/*
* Get destination format
*/
bpp = dst->format->BytesPerPixel;
p = (Uint8 *) dst->pixels + y * dst->pitch + x * bpp;
switch (bpp) {
case 1:
*p = color;
break;
case 2:
*(Uint16 *) p = color;
break;
case 3:
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
p[0] = (color >> 16) & 0xff;
p[1] = (color >> 8) & 0xff;
p[2] = color & 0xff;
} else {
p[0] = color & 0xff;
p[1] = (color >> 8) & 0xff;
p[2] = (color >> 16) & 0xff;
}
break;
case 4:
*(Uint32 *) p = color;
break;
} /* switch */
return (0);
}
/*!
\brief Internal pixel drawing - fast, no blending, locking, clipping.
\param dst The surface to draw on.
\param x The horizontal coordinate of the pixel.
\param y The vertical position of the pixel.
\param color The color value of the pixel to draw.
\returns Returns 0 on success, -1 on failure.
*/
int fastPixelColor(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
{
int result;
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
result = fastPixelColorNolock(dst, x, y, color);
/*
* Unlock surface
*/
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
return (result);
}
/*!
\brief Internal pixel drawing - fast, no blending, locking, RGB input.
\param dst The surface to draw on.
\param x The horizontal coordinate of the pixel.
\param y The vertical position of the pixel.
\param r The red value of the pixel to draw.
\param g The green value of the pixel to draw.
\param b The blue value of the pixel to draw.
\param a The alpha value of the pixel to draw.
\returns Returns 0 on success, -1 on failure.
*/
int fastPixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
Uint32 color;
/*
* Setup color
*/
color = SDL_MapRGBA(dst->format, r, g, b, a);
/*
* Draw
*/
return (fastPixelColor(dst, x, y, color));
}
/*!
\brief Internal pixel drawing - fast, no blending, no locking RGB input.
\param dst The surface to draw on.
\param x The horizontal coordinate of the pixel.
\param y The vertical position of the pixel.
\param r The red value of the pixel to draw.
\param g The green value of the pixel to draw.
\param b The blue value of the pixel to draw.
\param a The alpha value of the pixel to draw.
\returns Returns 0 on success, -1 on failure.
*/
int fastPixelRGBANolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
Uint32 color;
/*
* Setup color
*/
color = SDL_MapRGBA(dst->format, r, g, b, a);
/*
* Draw
*/
return (fastPixelColorNolock(dst, x, y, color));
}
/*!
\brief Internal pixel drawing function with alpha blending where input color in in destination format.
Contains two alternative 32 bit alpha blending routines which can be enabled at the source
level with the defines DEFAULT_ALPHA_PIXEL_ROUTINE or EXPERIMENTAL_ALPHA_PIXEL_ROUTINE.
Only the bits up to the surface depth are significant in the color value.
\param dst The surface to draw on.
\param x The horizontal coordinate of the pixel.
\param y The vertical position of the pixel.
\param color The color value of the pixel to draw.
\param alpha The blend factor to apply while drawing.
\returns Returns 0 on success, -1 on failure.
*/
int _putPixelAlpha(SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint8 alpha)
{
SDL_PixelFormat *format;
Uint32 Rmask, Gmask, Bmask, Amask;
Uint32 Rshift, Gshift, Bshift, Ashift;
Uint32 sR, sG, sB;
Uint32 dR, dG, dB, dA;
if (dst == NULL)
{
return (-1);
}
if (x >= clip_xmin(dst) && x <= clip_xmax(dst) &&
y >= clip_ymin(dst) && y <= clip_ymax(dst))
{
format = dst->format;
switch (format->BytesPerPixel) {
case 1:
{ /* Assuming 8-bpp */
Uint8 *pixel = (Uint8 *) dst->pixels + y * dst->pitch + x;
if (alpha == 255) {
*pixel = color;
} else {
Uint8 R, G, B;
SDL_Palette *palette = format->palette;
SDL_Color *colors = palette->colors;
SDL_Color dColor = colors[*pixel];
SDL_Color sColor = colors[color];
dR = dColor.r;
dG = dColor.g;
dB = dColor.b;
sR = sColor.r;
sG = sColor.g;
sB = sColor.b;
R = dR + ((sR - dR) * alpha >> 8);
G = dG + ((sG - dG) * alpha >> 8);
B = dB + ((sB - dB) * alpha >> 8);
*pixel = SDL_MapRGB(format, R, G, B);
}
}
break;
case 2:
{ /* Probably 15-bpp or 16-bpp */
Uint16 *pixel = (Uint16 *) dst->pixels + y * dst->pitch / 2 + x;
if (alpha == 255) {
*pixel = color;
} else {
Uint16 R, G, B, A;
Uint16 dc = *pixel;
Rmask = format->Rmask;
Gmask = format->Gmask;
Bmask = format->Bmask;
Amask = format->Amask;
dR = (dc & Rmask);
dG = (dc & Gmask);
dB = (dc & Bmask);
R = (dR + (((color & Rmask) - dR) * alpha >> 8)) & Rmask;
G = (dG + (((color & Gmask) - dG) * alpha >> 8)) & Gmask;
B = (dB + (((color & Bmask) - dB) * alpha >> 8)) & Bmask;
*pixel = R | G | B;
if (Amask!=0) {
dA = (dc & Amask);
A = (dA + (((color & Amask) - dA) * alpha >> 8)) & Amask;
*pixel |= A;
}
}
}
break;
case 3:
{ /* Slow 24-bpp mode, usually not used */
Uint8 R, G, B;
Uint8 Rshift8, Gshift8, Bshift8;
Uint8 *pixel = (Uint8 *) dst->pixels + y * dst->pitch + x * 3;
Rshift = format->Rshift;
Gshift = format->Gshift;
Bshift = format->Bshift;
Rshift8 = Rshift >> 3;
Gshift8 = Gshift >> 3;
Bshift8 = Bshift >> 3;
sR = (color >> Rshift) & 0xFF;
sG = (color >> Gshift) & 0xFF;
sB = (color >> Bshift) & 0xFF;
if (alpha == 255) {
*(pixel + Rshift8) = sR;
*(pixel + Gshift8) = sG;
*(pixel + Bshift8) = sB;
} else {
dR = *((pixel) + Rshift8);
dG = *((pixel) + Gshift8);
dB = *((pixel) + Bshift8);
R = dR + ((sR - dR) * alpha >> 8);
G = dG + ((sG - dG) * alpha >> 8);
B = dB + ((sB - dB) * alpha >> 8);
*((pixel) + Rshift8) = R;
*((pixel) + Gshift8) = G;
*((pixel) + Bshift8) = B;
}
}
break;
#ifdef DEFAULT_ALPHA_PIXEL_ROUTINE
case 4:
{ /* Probably :-) 32-bpp */
Uint32 R, G, B, A;
Uint32 *pixel = (Uint32 *) dst->pixels + y * dst->pitch / 4 + x;
if (alpha == 255) {
*pixel = color;
} else {
Uint32 dc = *pixel;
Rmask = format->Rmask;
Gmask = format->Gmask;
Bmask = format->Bmask;
Amask = format->Amask;
Rshift = format->Rshift;
Gshift = format->Gshift;
Bshift = format->Bshift;
Ashift = format->Ashift;
dR = (dc & Rmask) >> Rshift;
dG = (dc & Gmask) >> Gshift;
dB = (dc & Bmask) >> Bshift;
R = ((dR + ((((color & Rmask) >> Rshift) - dR) * alpha >> 8)) << Rshift) & Rmask;
G = ((dG + ((((color & Gmask) >> Gshift) - dG) * alpha >> 8)) << Gshift) & Gmask;
B = ((dB + ((((color & Bmask) >> Bshift) - dB) * alpha >> 8)) << Bshift) & Bmask;
*pixel = R | G | B;
if (Amask!=0) {
dA = (dc & Amask) >> Ashift;
#ifdef ALPHA_PIXEL_ADDITIVE_BLEND
A = (dA | GFX_ALPHA_ADJUST_ARRAY[alpha & 255]) << Ashift; // make destination less transparent...
#else
A = ((dA + ((((color & Amask) >> Ashift) - dA) * alpha >> 8)) << Ashift) & Amask;
#endif
*pixel |= A;
}
}
}
break;
#endif
#ifdef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE
case 4:{ /* Probably :-) 32-bpp */
if (alpha == 255) {
*((Uint32 *) dst->pixels + y * dst->pitch / 4 + x) = color;
} else {
Uint32 *pixel = (Uint32 *) dst->pixels + y * dst->pitch / 4 + x;
Uint32 dR, dG, dB, dA;
Uint32 dc = *pixel;
Uint32 surfaceAlpha, preMultR, preMultG, preMultB;
Uint32 aTmp;
Rmask = format->Rmask;
Gmask = format->Gmask;
Bmask = format->Bmask;
Amask = format->Amask;
dR = (color & Rmask);
dG = (color & Gmask);
dB = (color & Bmask);
dA = (color & Amask);
Rshift = format->Rshift;
Gshift = format->Gshift;
Bshift = format->Bshift;
Ashift = format->Ashift;
preMultR = (alpha * (dR >> Rshift));
preMultG = (alpha * (dG >> Gshift));
preMultB = (alpha * (dB >> Bshift));
surfaceAlpha = ((dc & Amask) >> Ashift);
aTmp = (255 - alpha);
if (A = 255 - ((aTmp * (255 - surfaceAlpha)) >> 8 )) {
aTmp *= surfaceAlpha;
R = (preMultR + ((aTmp * ((dc & Rmask) >> Rshift)) >> 8)) / A << Rshift & Rmask;
G = (preMultG + ((aTmp * ((dc & Gmask) >> Gshift)) >> 8)) / A << Gshift & Gmask;
B = (preMultB + ((aTmp * ((dc & Bmask) >> Bshift)) >> 8)) / A << Bshift & Bmask;
}
*pixel = R | G | B | (A << Ashift & Amask);
}
}
break;
#endif
}
}
return (0);
}
/*!
\brief Pixel draw with blending enabled if a<255.
\param dst The surface to draw on.
\param x X (horizontal) coordinate of the pixel.
\param y Y (vertical) coordinate of the pixel.
\param color The color value of the pixel to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int pixelColor(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
{
Uint8 alpha;
Uint32 mcolor;
int result = 0;
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* Setup color
*/
alpha = color & 0x000000ff;
mcolor =
SDL_MapRGBA(dst->format, (color & 0xff000000) >> 24,
(color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, alpha);
/*
* Draw
*/
result = _putPixelAlpha(dst, x, y, mcolor, alpha);
/*
* Unlock the surface
*/
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
return (result);
}
/*!
\brief Pixel draw with blending enabled if a<255 - no surface locking.
\param dst The surface to draw on.
\param x X (horizontal) coordinate of the pixel.
\param y Y (vertical) coordinate of the pixel.
\param color The color value of the pixel to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int pixelColorNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
{
Uint8 alpha;
Uint32 mcolor;
int result = 0;
/*
* Setup color
*/
alpha = color & 0x000000ff;
mcolor =
SDL_MapRGBA(dst->format, (color & 0xff000000) >> 24,
(color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, alpha);
/*
* Draw
*/
result = _putPixelAlpha(dst, x, y, mcolor, alpha);
return (result);
}
/*!
\brief Internal function to draw filled rectangle with alpha blending.
Assumes color is in destination format.
\param dst The surface to draw on.
\param x1 X coordinate of the first corner (upper left) of the rectangle.
\param y1 Y coordinate of the first corner (upper left) of the rectangle.
\param x2 X coordinate of the second corner (lower right) of the rectangle.
\param y2 Y coordinate of the second corner (lower right) of the rectangle.
\param color The color value of the rectangle to draw (0xRRGGBBAA).
\param alpha Alpha blending amount for pixels.
\returns Returns 0 on success, -1 on failure.
*/
int _filledRectAlpha(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, Uint8 alpha)
{
SDL_PixelFormat *format;
Uint32 Rmask, Gmask, Bmask, Amask;
Uint32 Rshift, Gshift, Bshift, Ashift;
Uint32 sR, sG, sB, sA;
Uint32 dR, dG, dB, dA;
Sint16 x, y;
if (dst == NULL) {
return (-1);
}
format = dst->format;
switch (format->BytesPerPixel) {
case 1:
{ /* Assuming 8-bpp */
Uint8 *row, *pixel;
Uint8 R, G, B;
SDL_Color *colors = format->palette->colors;
SDL_Color dColor;
SDL_Color sColor = colors[color];
sR = sColor.r;
sG = sColor.g;
sB = sColor.b;
for (y = y1; y <= y2; y++) {
row = (Uint8 *) dst->pixels + y * dst->pitch;
for (x = x1; x <= x2; x++) {
if (alpha == 255) {
*(row + x) = color;
} else {
pixel = row + x;
dColor = colors[*pixel];
dR = dColor.r;
dG = dColor.g;
dB = dColor.b;
R = dR + ((sR - dR) * alpha >> 8);
G = dG + ((sG - dG) * alpha >> 8);
B = dB + ((sB - dB) * alpha >> 8);
*pixel = SDL_MapRGB(format, R, G, B);
}
}
}
}
break;
case 2:
{ /* Probably 15-bpp or 16-bpp */
Uint16 *row, *pixel;
Uint16 R, G, B, A;
Uint16 dc;
Rmask = format->Rmask;
Gmask = format->Gmask;
Bmask = format->Bmask;
Amask = format->Amask;
sR = (color & Rmask);
sG = (color & Gmask);
sB = (color & Bmask);
sA = (color & Amask);
for (y = y1; y <= y2; y++) {
row = (Uint16 *) dst->pixels + y * dst->pitch / 2;
for (x = x1; x <= x2; x++) {
if (alpha == 255) {
*(row + x) = color;
} else {
pixel = row + x;
dc = *pixel;
dR = (dc & Rmask);
dG = (dc & Gmask);
dB = (dc & Bmask);
R = (dR + ((sR - dR) * alpha >> 8)) & Rmask;
G = (dG + ((sG - dG) * alpha >> 8)) & Gmask;
B = (dB + ((sB - dB) * alpha >> 8)) & Bmask;
*pixel = R | G | B;
if (Amask!=0) {
dA = (dc & Amask);
A = (dA + ((sA - dA) * alpha >> 8)) & Amask;
*pixel |= A;
}
}
}
}
}
break;
case 3:
{ /* Slow 24-bpp mode, usually not used */
Uint8 *row, *pixel;
Uint8 R, G, B;
Uint8 Rshift8, Gshift8, Bshift8;
Rshift = format->Rshift;
Gshift = format->Gshift;
Bshift = format->Bshift;
Rshift8 = Rshift >> 3;
Gshift8 = Gshift >> 3;
Bshift8 = Bshift >> 3;
sR = (color >> Rshift) & 0xff;
sG = (color >> Gshift) & 0xff;
sB = (color >> Bshift) & 0xff;
for (y = y1; y <= y2; y++) {
row = (Uint8 *) dst->pixels + y * dst->pitch;
for (x = x1; x <= x2; x++) {
pixel = row + x * 3;
if (alpha == 255) {
*(pixel + Rshift8) = sR;
*(pixel + Gshift8) = sG;
*(pixel + Bshift8) = sB;
} else {
dR = *((pixel) + Rshift8);
dG = *((pixel) + Gshift8);
dB = *((pixel) + Bshift8);
R = dR + ((sR - dR) * alpha >> 8);
G = dG + ((sG - dG) * alpha >> 8);
B = dB + ((sB - dB) * alpha >> 8);
*((pixel) + Rshift8) = R;
*((pixel) + Gshift8) = G;
*((pixel) + Bshift8) = B;
}
}
}
}
break;
#ifdef DEFAULT_ALPHA_PIXEL_ROUTINE
case 4:
{ /* Probably :-) 32-bpp */
Uint32 *row, *pixel;
Uint32 R, G, B, A;
Uint32 dc;
Rmask = format->Rmask;
Gmask = format->Gmask;
Bmask = format->Bmask;
Amask = format->Amask;
Rshift = format->Rshift;
Gshift = format->Gshift;
Bshift = format->Bshift;
Ashift = format->Ashift;
sR = (color & Rmask) >> Rshift;
sG = (color & Gmask) >> Gshift;
sB = (color & Bmask) >> Bshift;
sA = (color & Amask) >> Ashift;
for (y = y1; y <= y2; y++) {
row = (Uint32 *) dst->pixels + y * dst->pitch / 4;
for (x = x1; x <= x2; x++) {
if (alpha == 255) {
*(row + x) = color;
} else {
pixel = row + x;
dc = *pixel;
dR = (dc & Rmask) >> Rshift;
dG = (dc & Gmask) >> Gshift;
dB = (dc & Bmask) >> Bshift;
R = ((dR + ((sR - dR) * alpha >> 8)) << Rshift) & Rmask;
G = ((dG + ((sG - dG) * alpha >> 8)) << Gshift) & Gmask;
B = ((dB + ((sB - dB) * alpha >> 8)) << Bshift) & Bmask;
*pixel = R | G | B;
if (Amask!=0) {
dA = (dc & Amask) >> Ashift;
#ifdef ALPHA_PIXEL_ADDITIVE_BLEND
A = (dA | GFX_ALPHA_ADJUST_ARRAY[sA & 255]) << Ashift; // make destination less transparent...
#else
A = ((dA + ((sA - dA) * alpha >> 8)) << Ashift) & Amask;
#endif
*pixel |= A;
}
}
}
}
}
break;
#endif
#ifdef EXPERIMENTAL_ALPHA_PIXEL_ROUTINE
case 4:{ /* Probably :-) 32-bpp */
Uint32 *row, *pixel;
Uint32 dR, dG, dB, dA;
Uint32 dc;
Uint32 surfaceAlpha, preMultR, preMultG, preMultB;
Uint32 aTmp;
Rmask = format->Rmask;
Gmask = format->Gmask;
Bmask = format->Bmask;
Amask = format->Amask;
dR = (color & Rmask);
dG = (color & Gmask);
dB = (color & Bmask);
dA = (color & Amask);
Rshift = format->Rshift;
Gshift = format->Gshift;
Bshift = format->Bshift;
Ashift = format->Ashift;
preMultR = (alpha * (dR >> Rshift));
preMultG = (alpha * (dG >> Gshift));
preMultB = (alpha * (dB >> Bshift));
for (y = y1; y <= y2; y++) {
row = (Uint32 *) dst->pixels + y * dst->pitch / 4;
for (x = x1; x <= x2; x++) {
if (alpha == 255) {
*(row + x) = color;
} else {
pixel = row + x;
dc = *pixel;
surfaceAlpha = ((dc & Amask) >> Ashift);
aTmp = (255 - alpha);
if (A = 255 - ((aTmp * (255 - surfaceAlpha)) >> 8 )) {
aTmp *= surfaceAlpha;
R = (preMultR + ((aTmp * ((dc & Rmask) >> Rshift)) >> 8)) / A << Rshift & Rmask;
G = (preMultG + ((aTmp * ((dc & Gmask) >> Gshift)) >> 8)) / A << Gshift & Gmask;
B = (preMultB + ((aTmp * ((dc & Bmask) >> Bshift)) >> 8)) / A << Bshift & Bmask;
}
*pixel = R | G | B | (A << Ashift & Amask);
}
}
}
}
break;
#endif
}
return (0);
}
/*!
\brief Draw filled rectangle of RGBA color with alpha blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first corner (upper left) of the rectangle.
\param y1 Y coordinate of the first corner (upper left) of the rectangle.
\param x2 X coordinate of the second corner (lower right) of the rectangle.
\param y2 Y coordinate of the second corner (lower right) of the rectangle.
\param color The color value of the rectangle to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int filledRectAlpha(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
{
Uint8 alpha;
Uint32 mcolor;
int result = 0;
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* Setup color
*/
alpha = color & 0x000000ff;
mcolor =
SDL_MapRGBA(dst->format, (color & 0xff000000) >> 24,
(color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, alpha);
/*
* Draw
*/
result = _filledRectAlpha(dst, x1, y1, x2, y2, mcolor, alpha);
/*
* Unlock the surface
*/
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
return (result);
}
/*!
\brief Internal function to draw horizontal line of RGBA color with alpha blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. left) of the line.
\param x2 X coordinate of the second point (i.e. right) of the line.
\param y Y coordinate of the points of the line.
\param color The color value of the line to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int _HLineAlpha(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
{
return (filledRectAlpha(dst, x1, y, x2, y, color));
}
/*!
\brief Internal function to draw vertical line of RGBA color with alpha blending.
\param dst The surface to draw on.
\param x X coordinate of the points of the line.
\param y1 Y coordinate of the first point (top) of the line.
\param y2 Y coordinate of the second point (bottom) of the line.
\param color The color value of the line to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int _VLineAlpha(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
{
return (filledRectAlpha(dst, x, y1, x, y2, color));
}
/*!
\brief Pixel draw with blending enabled and using alpha weight on color.
\param dst The surface to draw on.
\param x The horizontal coordinate of the pixel.
\param y The vertical position of the pixel.
\param color The color value of the pixel to draw (0xRRGGBBAA).
\param weight The weight multiplied into the alpha value of the pixel.
\returns Returns 0 on success, -1 on failure.
*/
int pixelColorWeight(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
{
Uint32 a;
/*
* Get alpha
*/
a = (color & (Uint32) 0x000000ff);
/*
* Modify Alpha by weight
*/
a = ((a * weight) >> 8);
return (pixelColor(dst, x, y, (color & (Uint32) 0xffffff00) | (Uint32) a));
}
/*!
\brief Pixel draw with blending enabled and using alpha weight on color - no locking.
\param dst The surface to draw on.
\param x The horizontal coordinate of the pixel.
\param y The vertical position of the pixel.
\param color The color value of the pixel to draw (0xRRGGBBAA).
\param weight The weight multiplied into the alpha value of the pixel.
\returns Returns 0 on success, -1 on failure.
*/
int pixelColorWeightNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
{
Uint32 a;
/*
* Get alpha
*/
a = (color & (Uint32) 0x000000ff);
/*
* Modify Alpha by weight
*/
a = ((a * weight) >> 8);
return (pixelColorNolock(dst, x, y, (color & (Uint32) 0xffffff00) | (Uint32) a));
}
/*!
\brief Pixel draw with blending enabled if a<255.
\param dst The surface to draw on.
\param x X (horizontal) coordinate of the pixel.
\param y Y (vertical) coordinate of the pixel.
\param r The red color value of the pixel to draw.
\param g The green color value of the pixel to draw.
\param b The blue color value of the pixel to draw.
\param a The alpha value of the pixel to draw.
\returns Returns 0 on success, -1 on failure.
*/
int pixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
Uint32 color;
/*
* Check Alpha
*/
if (a == 255) {
/*
* No alpha blending required
*/
/*
* Setup color
*/
color = SDL_MapRGBA(dst->format, r, g, b, a);
/*
* Draw
*/
return (fastPixelColor(dst, x, y, color));
} else {
/*
* Alpha blending required
*/
/*
* Draw
*/
return (pixelColor(dst, x, y, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
}
/*!
\brief Draw horizontal line without blending;
Just stores the color value (including the alpha component) without blending.
Only the same number of bits of the destination surface are transfered
from the input color value.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. left) of the line.
\param x2 X coordinate of the second point (i.e. right) of the line.
\param y Y coordinate of the points of the line.
\param color The color value of the line to draw.
\returns Returns 0 on success, -1 on failure.
*/
int hlineColorStore(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
{
Sint16 left, right, top, bottom;
Uint8 *pixel, *pixellast;
int dx;
int pixx, pixy;
Sint16 w;
Sint16 xtmp;
int result = -1;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Swap x1, x2 if required to ensure x1<=x2
*/
if (x1 > x2) {
xtmp = x1;
x1 = x2;
x2 = xtmp;
}
/*
* Get clipping boundary and
* check visibility of hline
*/
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
top = dst->clip_rect.y;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if ((y<top) || (y>bottom)) {
return (0);
}
/*
* Clip x
*/
if (x1 < left) {
x1 = left;
}
if (x2 > right) {
x2 = right;
}
/*
* Calculate width
*/
w = x2 - x1;
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* More variable setup
*/
dx = w;
pixx = dst->format->BytesPerPixel;
pixy = dst->pitch;
pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y;
/*
* Draw
*/
switch (dst->format->BytesPerPixel) {
case 1:
memset(pixel, color, dx+1);
break;
case 2:
pixellast = pixel + dx + dx;
for (; pixel <= pixellast; pixel += pixx) {
*(Uint16 *) pixel = color;
}
break;
case 3:
pixellast = pixel + dx + dx + dx;
for (; pixel <= pixellast; pixel += pixx) {
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
pixel[0] = (color >> 16) & 0xff;
pixel[1] = (color >> 8) & 0xff;
pixel[2] = color & 0xff;
} else {
pixel[0] = color & 0xff;
pixel[1] = (color >> 8) & 0xff;
pixel[2] = (color >> 16) & 0xff;
}
}
break;
default: /* case 4 */
dx = dx + dx;
pixellast = pixel + dx + dx;
for (; pixel <= pixellast; pixel += pixx) {
*(Uint32 *) pixel = color;
}
break;
}
/*
* Unlock surface
*/
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
/*
* Set result code
*/
result = 0;
return (result);
}
/*!
\brief Draw horizontal line without blending
Just stores the color value (including the alpha component) without blending.
Function should only be used for 32 bit target surfaces.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. left) of the line.
\param x2 X coordinate of the second point (i.e. right) of the line.
\param y Y coordinate of the points of the line.
\param r The red value of the line to draw.
\param g The green value of the line to draw.
\param b The blue value of the line to draw.
\param a The alpha value of the line to draw.
\returns Returns 0 on success, -1 on failure.
*/
int hlineRGBAStore(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (hlineColorStore(dst, x1, x2, y, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/*!
\brief Draw horizontal line with blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. left) of the line.
\param x2 X coordinate of the second point (i.e. right) of the line.
\param y Y coordinate of the points of the line.
\param color The color value of the line to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int hlineColor(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
{
Sint16 left, right, top, bottom;
Uint8 *pixel, *pixellast;
int dx;
int pixx, pixy;
Sint16 xtmp;
int result = -1;
Uint8 *colorptr;
Uint8 color3[3];
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Swap x1, x2 if required to ensure x1<=x2
*/
if (x1 > x2) {
xtmp = x1;
x1 = x2;
x2 = xtmp;
}
/*
* Get clipping boundary and
* check visibility of hline
*/
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
top = dst->clip_rect.y;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if ((y<top) || (y>bottom)) {
return (0);
}
/*
* Clip x
*/
if (x1 < left) {
x1 = left;
}
if (x2 > right) {
x2 = right;
}
/*
* Calculate width difference
*/
dx = x2 - x1;
/*
* Alpha check
*/
if ((color & 255) == 255) {
/*
* No alpha-blending required
*/
/*
* Setup color
*/
colorptr = (Uint8 *) & color;
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
} else {
color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
}
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* More variable setup
*/
pixx = dst->format->BytesPerPixel;
pixy = dst->pitch;
pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y;
/*
* Draw
*/
switch (dst->format->BytesPerPixel) {
case 1:
memset(pixel, color, dx + 1);
break;
case 2:
pixellast = pixel + dx + dx;
for (; pixel <= pixellast; pixel += pixx) {
*(Uint16 *) pixel = color;
}
break;
case 3:
pixellast = pixel + dx + dx + dx;
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
color3[0] = (color >> 16) & 0xff;
color3[1] = (color >> 8) & 0xff;
color3[2] = color & 0xff;
} else {
color3[0] = color & 0xff;
color3[1] = (color >> 8) & 0xff;
color3[2] = (color >> 16) & 0xff;
}
for (; pixel <= pixellast; pixel += pixx) {
memcpy(pixel, color3, 3);
}
break;
default: /* case 4 */
dx = dx + dx;
pixellast = pixel + dx + dx;
for (; pixel <= pixellast; pixel += pixx) {
*(Uint32 *) pixel = color;
}
break;
}
/*
* Unlock surface
*/
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
/*
* Set result code
*/
result = 0;
} else {
/*
* Alpha blending blit
*/
result = _HLineAlpha(dst, x1, x1 + dx, y, color);
}
return (result);
}
/*!
\brief Draw horizontal line with blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. left) of the line.
\param x2 X coordinate of the second point (i.e. right) of the line.
\param y Y coordinate of the points of the line.
\param r The red value of the line to draw.
\param g The green value of the line to draw.
\param b The blue value of the line to draw.
\param a The alpha value of the line to draw.
\returns Returns 0 on success, -1 on failure.
*/
int hlineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (hlineColor(dst, x1, x2, y, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/*!
\brief Draw vertical line with blending.
\param dst The surface to draw on.
\param x X coordinate of the points of the line.
\param y1 Y coordinate of the first point (i.e. top) of the line.
\param y2 Y coordinate of the second point (i.e. bottom) of the line.
\param color The color value of the line to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int vlineColor(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
{
Sint16 left, right, top, bottom;
Uint8 *pixel, *pixellast;
int dy;
int pixx, pixy;
Sint16 h;
Sint16 ytmp;
int result = -1;
Uint8 *colorptr;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Swap y1, y2 if required to ensure y1<=y2
*/
if (y1 > y2) {
ytmp = y1;
y1 = y2;
y2 = ytmp;
}
/*
* Get clipping boundary and
* check visibility of vline
*/
left = dst->clip_rect.x;
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if ((x<left) || (x>right)) {
return (0);
}
top = dst->clip_rect.y;
if (y2<top) {
return(0);
}
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if (y1>bottom) {
return(0);
}
/*
* Clip x
*/
if (y1 < top) {
y1 = top;
}
if (y2 > bottom) {
y2 = bottom;
}
/*
* Calculate height
*/
h = y2 - y1;
/*
* Alpha check
*/
if ((color & 255) == 255) {
/*
* No alpha-blending required
*/
/*
* Setup color
*/
colorptr = (Uint8 *) & color;
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
} else {
color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
}
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* More variable setup
*/
dy = h;
pixx = dst->format->BytesPerPixel;
pixy = dst->pitch;
pixel = ((Uint8 *) dst->pixels) + pixx * (int) x + pixy * (int) y1;
pixellast = pixel + pixy * dy;
/*
* Draw
*/
switch (dst->format->BytesPerPixel) {
case 1:
for (; pixel <= pixellast; pixel += pixy) {
*(Uint8 *) pixel = color;
}
break;
case 2:
for (; pixel <= pixellast; pixel += pixy) {
*(Uint16 *) pixel = color;
}
break;
case 3:
for (; pixel <= pixellast; pixel += pixy) {
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
pixel[0] = (color >> 16) & 0xff;
pixel[1] = (color >> 8) & 0xff;
pixel[2] = color & 0xff;
} else {
pixel[0] = color & 0xff;
pixel[1] = (color >> 8) & 0xff;
pixel[2] = (color >> 16) & 0xff;
}
}
break;
default: /* case 4 */
for (; pixel <= pixellast; pixel += pixy) {
*(Uint32 *) pixel = color;
}
break;
}
/* Unlock surface */
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
/*
* Set result code
*/
result = 0;
} else {
/*
* Alpha blending blit
*/
result = _VLineAlpha(dst, x, y1, y1 + h, color);
}
return (result);
}
/*!
\brief Draw vertical line with blending.
\param dst The surface to draw on.
\param x X coordinate of the points of the line.
\param y1 Y coordinate of the first point (i.e. top) of the line.
\param y2 Y coordinate of the second point (i.e. bottom) of the line.
\param r The red value of the line to draw.
\param g The green value of the line to draw.
\param b The blue value of the line to draw.
\param a The alpha value of the line to draw.
\returns Returns 0 on success, -1 on failure.
*/
int vlineRGBA(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (vlineColor(dst, x, y1, y2, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/*!
\brief Draw rectangle with blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. top right) of the rectangle.
\param y1 Y coordinate of the first point (i.e. top right) of the rectangle.
\param x2 X coordinate of the second point (i.e. bottom left) of the rectangle.
\param y2 Y coordinate of the second point (i.e. bottom left) of the rectangle.
\param color The color value of the rectangle to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int rectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
{
int result;
Sint16 tmp;
/* Check destination surface */
if (dst == NULL)
{
return -1;
}
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return 0;
}
/*
* Test for special cases of straight lines or single point
*/
if (x1 == x2) {
if (y1 == y2) {
return (pixelColor(dst, x1, y1, color));
} else {
return (vlineColor(dst, x1, y1, y2, color));
}
} else {
if (y1 == y2) {
return (hlineColor(dst, x1, x2, y1, color));
}
}
/*
* Swap x1, x2 if required
*/
if (x1 > x2) {
tmp = x1;
x1 = x2;
x2 = tmp;
}
/*
* Swap y1, y2 if required
*/
if (y1 > y2) {
tmp = y1;
y1 = y2;
y2 = tmp;
}
/*
* Draw rectangle
*/
result = 0;
result |= hlineColor(dst, x1, x2, y1, color);
result |= hlineColor(dst, x1, x2, y2, color);
y1 += 1;
y2 -= 1;
if (y1 <= y2) {
result |= vlineColor(dst, x1, y1, y2, color);
result |= vlineColor(dst, x2, y1, y2, color);
}
return (result);
}
/*!
\brief Draw rectangle with blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. top right) of the rectangle.
\param y1 Y coordinate of the first point (i.e. top right) of the rectangle.
\param x2 X coordinate of the second point (i.e. bottom left) of the rectangle.
\param y2 Y coordinate of the second point (i.e. bottom left) of the rectangle.
\param r The red value of the rectangle to draw.
\param g The green value of the rectangle to draw.
\param b The blue value of the rectangle to draw.
\param a The alpha value of the rectangle to draw.
\returns Returns 0 on success, -1 on failure.
*/
int rectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (rectangleColor
(dst, x1, y1, x2, y2, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/*!
\brief Draw rounded-corner rectangle with blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. top right) of the rectangle.
\param y1 Y coordinate of the first point (i.e. top right) of the rectangle.
\param x2 X coordinate of the second point (i.e. bottom left) of the rectangle.
\param y2 Y coordinate of the second point (i.e. bottom left) of the rectangle.
\param rad The radius of the corner arc.
\param color The color value of the rectangle to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int roundedRectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
{
int result;
Sint16 w, h, tmp;
Sint16 xx1, xx2, yy1, yy2;
/*
* Check destination surface
*/
if (dst == NULL)
{
return -1;
}
/*
* Check radius vor valid range
*/
if (rad < 0) {
return -1;
}
/*
* Special case - no rounding
*/
if (rad == 0) {
return rectangleColor(dst, x1, y1, x2, y2, color);
}
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return 0;
}
/*
* Test for special cases of straight lines or single point
*/
if (x1 == x2) {
if (y1 == y2) {
return (pixelColor(dst, x1, y1, color));
} else {
return (vlineColor(dst, x1, y1, y2, color));
}
} else {
if (y1 == y2) {
return (hlineColor(dst, x1, x2, y1, color));
}
}
/*
* Swap x1, x2 if required
*/
if (x1 > x2) {
tmp = x1;
x1 = x2;
x2 = tmp;
}
/*
* Swap y1, y2 if required
*/
if (y1 > y2) {
tmp = y1;
y1 = y2;
y2 = tmp;
}
/*
* Calculate width&height
*/
w = x2 - x1;
h = y2 - y1;
/*
* Maybe adjust radius
*/
if ((rad * 2) > w)
{
rad = w / 2;
}
if ((rad * 2) > h)
{
rad = h / 2;
}
/*
* Draw corners
*/
result = 0;
xx1 = x1 + rad;
xx2 = x2 - rad;
yy1 = y1 + rad;
yy2 = y2 - rad;
result |= arcColor(dst, xx1, yy1, rad, 180, 270, color);
result |= arcColor(dst, xx2, yy1, rad, 270, 360, color);
result |= arcColor(dst, xx1, yy2, rad, 90, 180, color);
result |= arcColor(dst, xx2, yy2, rad, 0, 90, color);
/*
* Draw lines
*/
if (xx1 <= xx2) {
result |= hlineColor(dst, xx1, xx2, y1, color);
result |= hlineColor(dst, xx1, xx2, y2, color);
}
if (yy1 <= yy2) {
result |= vlineColor(dst, x1, yy1, yy2, color);
result |= vlineColor(dst, x2, yy1, yy2, color);
}
return result;
}
/*!
\brief Draw rounded-corner rectangle with blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. top right) of the rectangle.
\param y1 Y coordinate of the first point (i.e. top right) of the rectangle.
\param x2 X coordinate of the second point (i.e. bottom left) of the rectangle.
\param y2 Y coordinate of the second point (i.e. bottom left) of the rectangle.
\param rad The radius of the corner arc.
\param r The red value of the rectangle to draw.
\param g The green value of the rectangle to draw.
\param b The blue value of the rectangle to draw.
\param a The alpha value of the rectangle to draw.
\returns Returns 0 on success, -1 on failure.
*/
int roundedRectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (roundedRectangleColor
(dst, x1, y1, x2, y2, rad, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/*!
\brief Draw rounded-corner box (filled rectangle) with blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. top right) of the box.
\param y1 Y coordinate of the first point (i.e. top right) of the box.
\param x2 X coordinate of the second point (i.e. bottom left) of the box.
\param y2 Y coordinate of the second point (i.e. bottom left) of the box.
\param rad The radius of the corner arcs of the box.
\param color The color value of the box to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int roundedBoxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color)
{
int result;
Sint16 w, h, tmp;
Sint16 xx1, xx2, yy1, yy2;
/*
* Check destination surface
*/
if (dst == NULL)
{
return -1;
}
/*
* Check radius vor valid range
*/
if (rad < 0) {
return -1;
}
/*
* Special case - no rounding
*/
if (rad == 0) {
return rectangleColor(dst, x1, y1, x2, y2, color);
}
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return 0;
}
/*
* Test for special cases of straight lines or single point
*/
if (x1 == x2) {
if (y1 == y2) {
return (pixelColor(dst, x1, y1, color));
} else {
return (vlineColor(dst, x1, y1, y2, color));
}
} else {
if (y1 == y2) {
return (hlineColor(dst, x1, x2, y1, color));
}
}
/*
* Swap x1, x2 if required
*/
if (x1 > x2) {
tmp = x1;
x1 = x2;
x2 = tmp;
}
/*
* Swap y1, y2 if required
*/
if (y1 > y2) {
tmp = y1;
y1 = y2;
y2 = tmp;
}
/*
* Calculate width&height
*/
w = x2 - x1;
h = y2 - y1;
/*
* Maybe adjust radius
*/
if ((rad * 2) > w)
{
rad = w / 2;
}
if ((rad * 2) > h)
{
rad = h / 2;
}
/*
* Draw corners
*/
result = 0;
xx1 = x1 + rad;
xx2 = x2 - rad;
yy1 = y1 + rad;
yy2 = y2 - rad;
result |= filledPieColor(dst, xx1, yy1, rad, 180, 270, color);
result |= filledPieColor(dst, xx2, yy1, rad, 270, 360, color);
result |= filledPieColor(dst, xx1, yy2, rad, 90, 180, color);
result |= filledPieColor(dst, xx2, yy2, rad, 0, 90, color);
/*
* Draw body
*/
xx1++;
xx2--;
yy1++;
yy2--;
if (xx1 <= xx2) {
result |= boxColor(dst, xx1, y1, xx2, y2, color);
}
if (yy1 <= yy2) {
result |= boxColor(dst, x1, yy1, xx1-1, yy2, color);
result |= boxColor(dst, xx2+1, yy1, x2, yy2, color);
}
return result;
}
/*!
\brief Draw rounded-corner box (filled rectangle) with blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. top right) of the box.
\param y1 Y coordinate of the first point (i.e. top right) of the box.
\param x2 X coordinate of the second point (i.e. bottom left) of the box.
\param y2 Y coordinate of the second point (i.e. bottom left) of the box.
\param rad The radius of the corner arcs of the box.
\param r The red value of the box to draw.
\param g The green value of the box to draw.
\param b The blue value of the box to draw.
\param a The alpha value of the box to draw.
\returns Returns 0 on success, -1 on failure.
*/
int roundedBoxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2,
Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (roundedBoxColor
(dst, x1, y1, x2, y2, rad, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* --------- Clipping routines for line */
/* Clipping based heavily on code from */
/* http://www.ncsa.uiuc.edu/Vis/Graphics/src/clipCohSuth.c */
#define CLIP_LEFT_EDGE 0x1
#define CLIP_RIGHT_EDGE 0x2
#define CLIP_BOTTOM_EDGE 0x4
#define CLIP_TOP_EDGE 0x8
#define CLIP_INSIDE(a) (!a)
#define CLIP_REJECT(a,b) (a&b)
#define CLIP_ACCEPT(a,b) (!(a|b))
/*!
\brief Internal clip-encoding routine.
Calculates a segement-based clipping encoding for a point against a rectangle.
\param x X coordinate of point.
\param y Y coordinate of point.
\param left X coordinate of left edge of the rectangle.
\param top Y coordinate of top edge of the rectangle.
\param right X coordinate of right edge of the rectangle.
\param bottom Y coordinate of bottom edge of the rectangle.
*/
static int _clipEncode(Sint16 x, Sint16 y, Sint16 left, Sint16 top, Sint16 right, Sint16 bottom)
{
int code = 0;
if (x < left) {
code |= CLIP_LEFT_EDGE;
} else if (x > right) {
code |= CLIP_RIGHT_EDGE;
}
if (y < top) {
code |= CLIP_TOP_EDGE;
} else if (y > bottom) {
code |= CLIP_BOTTOM_EDGE;
}
return code;
}
/*!
\brief Clip line to a the clipping rectangle of a surface.
\param dst Target surface to draw on.
\param x1 Pointer to X coordinate of first point of line.
\param y1 Pointer to Y coordinate of first point of line.
\param x2 Pointer to X coordinate of second point of line.
\param y2 Pointer to Y coordinate of second point of line.
*/
static int _clipLine(SDL_Surface * dst, Sint16 * x1, Sint16 * y1, Sint16 * x2, Sint16 * y2)
{
Sint16 left, right, top, bottom;
int code1, code2;
int draw = 0;
Sint16 swaptmp;
float m;
/*
* Get clipping boundary
*/
left = dst->clip_rect.x;
right = dst->clip_rect.x + dst->clip_rect.w - 1;
top = dst->clip_rect.y;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
while (1) {
code1 = _clipEncode(*x1, *y1, left, top, right, bottom);
code2 = _clipEncode(*x2, *y2, left, top, right, bottom);
if (CLIP_ACCEPT(code1, code2)) {
draw = 1;
break;
} else if (CLIP_REJECT(code1, code2))
break;
else {
if (CLIP_INSIDE(code1)) {
swaptmp = *x2;
*x2 = *x1;
*x1 = swaptmp;
swaptmp = *y2;
*y2 = *y1;
*y1 = swaptmp;
swaptmp = code2;
code2 = code1;
code1 = swaptmp;
}
if (*x2 != *x1) {
m = (float)(*y2 - *y1) / (float)(*x2 - *x1);
} else {
m = 1.0f;
}
if (code1 & CLIP_LEFT_EDGE) {
*y1 += (Sint16) ((left - *x1) * m);
*x1 = left;
} else if (code1 & CLIP_RIGHT_EDGE) {
*y1 += (Sint16) ((right - *x1) * m);
*x1 = right;
} else if (code1 & CLIP_BOTTOM_EDGE) {
if (*x2 != *x1) {
*x1 += (Sint16) ((bottom - *y1) / m);
}
*y1 = bottom;
} else if (code1 & CLIP_TOP_EDGE) {
if (*x2 != *x1) {
*x1 += (Sint16) ((top - *y1) / m);
}
*y1 = top;
}
}
}
return draw;
}
/*!
\brief Draw box (filled rectangle) with blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. top right) of the box.
\param y1 Y coordinate of the first point (i.e. top right) of the box.
\param x2 X coordinate of the second point (i.e. bottom left) of the box.
\param y2 Y coordinate of the second point (i.e. bottom left) of the box.
\param color The color value of the box to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int boxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
{
Sint16 left, right, top, bottom;
Uint8 *pixel, *pixellast;
int x, dx;
int dy;
int pixx, pixy;
Sint16 w, h, tmp;
int result;
Uint8 *colorptr;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Order coordinates to ensure that
* x1<=x2 and y1<=y2
*/
if (x1 > x2) {
tmp = x1;
x1 = x2;
x2 = tmp;
}
if (y1 > y2) {
tmp = y1;
y1 = y2;
y2 = tmp;
}
/*
* Get clipping boundary and
* check visibility
*/
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
top = dst->clip_rect.y;
if (y2<top) {
return(0);
}
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if (y1>bottom) {
return(0);
}
/* Clip all points */
if (x1<left) {
x1=left;
} else if (x1>right) {
x1=right;
}
if (x2<left) {
x2=left;
} else if (x2>right) {
x2=right;
}
if (y1<top) {
y1=top;
} else if (y1>bottom) {
y1=bottom;
}
if (y2<top) {
y2=top;
} else if (y2>bottom) {
y2=bottom;
}
/*
* Test for special cases of straight line or single point
*/
if (x1 == x2) {
if (y1 == y2) {
return (pixelColor(dst, x1, y1, color));
} else {
return (vlineColor(dst, x1, y1, y2, color));
}
}
if (y1 == y2) {
return (hlineColor(dst, x1, x2, y1, color));
}
/*
* Calculate width&height
*/
w = x2 - x1;
h = y2 - y1;
/*
* Alpha check
*/
if ((color & 255) == 255) {
/*
* No alpha-blending required
*/
/*
* Setup color
*/
colorptr = (Uint8 *) & color;
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
} else {
color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
}
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* More variable setup
*/
dx = w;
dy = h;
pixx = dst->format->BytesPerPixel;
pixy = dst->pitch;
pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y1;
pixellast = pixel + pixx * dx + pixy * dy;
dx++;
/*
* Draw
*/
switch (dst->format->BytesPerPixel) {
case 1:
for (; pixel <= pixellast; pixel += pixy) {
memset(pixel, (Uint8) color, dx);
}
break;
case 2:
pixy -= (pixx * dx);
for (; pixel <= pixellast; pixel += pixy) {
for (x = 0; x < dx; x++) {
*(Uint16*) pixel = color;
pixel += pixx;
}
}
break;
case 3:
pixy -= (pixx * dx);
for (; pixel <= pixellast; pixel += pixy) {
for (x = 0; x < dx; x++) {
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
pixel[0] = (color >> 16) & 0xff;
pixel[1] = (color >> 8) & 0xff;
pixel[2] = color & 0xff;
} else {
pixel[0] = color & 0xff;
pixel[1] = (color >> 8) & 0xff;
pixel[2] = (color >> 16) & 0xff;
}
pixel += pixx;
}
}
break;
default: /* case 4 */
pixy -= (pixx * dx);
for (; pixel <= pixellast; pixel += pixy) {
for (x = 0; x < dx; x++) {
*(Uint32 *) pixel = color;
pixel += pixx;
}
}
break;
}
/* Unlock surface */
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
result = 0;
} else {
result = filledRectAlpha(dst, x1, y1, x1 + w, y1 + h, color);
}
return (result);
}
/*!
\brief Draw box (filled rectangle) with blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. top right) of the box.
\param y1 Y coordinate of the first point (i.e. top right) of the box.
\param x2 X coordinate of the second point (i.e. bottom left) of the box.
\param y2 Y coordinate of the second point (i.e. bottom left) of the box.
\param r The red value of the box to draw.
\param g The green value of the box to draw.
\param b The blue value of the box to draw.
\param a The alpha value of the box to draw.
\returns Returns 0 on success, -1 on failure.
*/
int boxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (boxColor(dst, x1, y1, x2, y2, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ----- Line */
/* Non-alpha line drawing code adapted from routine */
/* by Pete Shinners, pete@shinners.org */
/* Originally from pygame, http://pygame.seul.org */
#define ABS(a) (((a)<0) ? -(a) : (a))
/*!
\brief Draw line with alpha blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the line.
\param y1 Y coordinate of the first point of the line.
\param x2 X coordinate of the second point of the line.
\param y2 Y coordinate of the second point of the line.
\param color The color value of the line to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int lineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
{
int pixx, pixy;
int x, y;
int dx, dy;
int ax, ay;
int sx, sy;
int swaptmp;
Uint8 *pixel;
Uint8 *colorptr;
/*
* Clip line and test if we have to draw
*/
if (!(_clipLine(dst, &x1, &y1, &x2, &y2))) {
return (0);
}
/*
* Test for special cases of straight lines or single point
*/
if (x1 == x2) {
if (y1 < y2) {
return (vlineColor(dst, x1, y1, y2, color));
} else if (y1 > y2) {
return (vlineColor(dst, x1, y2, y1, color));
} else {
return (pixelColor(dst, x1, y1, color));
}
}
if (y1 == y2) {
if (x1 < x2) {
return (hlineColor(dst, x1, x2, y1, color));
} else if (x1 > x2) {
return (hlineColor(dst, x2, x1, y1, color));
}
}
/*
* Variable setup
*/
dx = x2 - x1;
dy = y2 - y1;
sx = (dx >= 0) ? 1 : -1;
sy = (dy >= 0) ? 1 : -1;
/* Lock surface */
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* Check for alpha blending
*/
if ((color & 255) == 255) {
/*
* No alpha blending - use fast pixel routines
*/
/*
* Setup color
*/
colorptr = (Uint8 *) & color;
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
} else {
color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
}
/*
* More variable setup
*/
dx = sx * dx + 1;
dy = sy * dy + 1;
pixx = dst->format->BytesPerPixel;
pixy = dst->pitch;
pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y1;
pixx *= sx;
pixy *= sy;
if (dx < dy) {
swaptmp = dx;
dx = dy;
dy = swaptmp;
swaptmp = pixx;
pixx = pixy;
pixy = swaptmp;
}
/*
* Draw
*/
x = 0;
y = 0;
switch (dst->format->BytesPerPixel) {
case 1:
for (; x < dx; x++, pixel += pixx) {
*pixel = color;
y += dy;
if (y >= dx) {
y -= dx;
pixel += pixy;
}
}
break;
case 2:
for (; x < dx; x++, pixel += pixx) {
*(Uint16 *) pixel = color;
y += dy;
if (y >= dx) {
y -= dx;
pixel += pixy;
}
}
break;
case 3:
for (; x < dx; x++, pixel += pixx) {
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
pixel[0] = (color >> 16) & 0xff;
pixel[1] = (color >> 8) & 0xff;
pixel[2] = color & 0xff;
} else {
pixel[0] = color & 0xff;
pixel[1] = (color >> 8) & 0xff;
pixel[2] = (color >> 16) & 0xff;
}
y += dy;
if (y >= dx) {
y -= dx;
pixel += pixy;
}
}
break;
default: /* case 4 */
for (; x < dx; x++, pixel += pixx) {
*(Uint32 *) pixel = color;
y += dy;
if (y >= dx) {
y -= dx;
pixel += pixy;
}
}
break;
}
} else {
/*
* Alpha blending required - use single-pixel blits
*/
ax = ABS(dx) << 1;
ay = ABS(dy) << 1;
x = x1;
y = y1;
if (ax > ay) {
int d = ay - (ax >> 1);
while (x != x2) {
pixelColorNolock (dst, x, y, color);
if (d > 0 || (d == 0 && sx == 1)) {
y += sy;
d -= ax;
}
x += sx;
d += ay;
}
} else {
int d = ax - (ay >> 1);
while (y != y2) {
pixelColorNolock (dst, x, y, color);
if (d > 0 || ((d == 0) && (sy == 1))) {
x += sx;
d -= ay;
}
y += sy;
d += ax;
}
}
pixelColorNolock (dst, x, y, color);
}
/* Unlock surface */
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
return (0);
}
/*!
\brief Draw line with alpha blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the line.
\param y1 Y coordinate of the first point of the line.
\param x2 X coordinate of the second point of the line.
\param y2 Y coordinate of the second point of the line.
\param r The red value of the line to draw.
\param g The green value of the line to draw.
\param b The blue value of the line to draw.
\param a The alpha value of the line to draw.
\returns Returns 0 on success, -1 on failure.
*/
int lineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (lineColor(dst, x1, y1, x2, y2, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* AA Line */
#define AAlevels 256
#define AAbits 8
/*!
\brief Internal function to draw anti-aliased line with alpha blending and endpoint control.
This implementation of the Wu antialiasing code is based on Mike Abrash's
DDJ article which was reprinted as Chapter 42 of his Graphics Programming
Black Book, but has been optimized to work with SDL and utilizes 32-bit
fixed-point arithmetic by A. Schiffler. The endpoint control allows the
supression to draw the last pixel useful for rendering continous aa-lines
with alpha<255.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the aa-line.
\param y1 Y coordinate of the first point of the aa-line.
\param x2 X coordinate of the second point of the aa-line.
\param y2 Y coordinate of the second point of the aa-line.
\param color The color value of the aa-line to draw (0xRRGGBBAA).
\param draw_endpoint Flag indicating if the endpoint should be drawn; draw if non-zero.
\returns Returns 0 on success, -1 on failure.
*/
int _aalineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, int draw_endpoint)
{
Sint32 xx0, yy0, xx1, yy1;
int result;
Uint32 intshift, erracc, erradj;
Uint32 erracctmp, wgt, wgtcompmask;
int dx, dy, tmp, xdir, y0p1, x0pxdir;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Clip line and test if we have to draw
*/
if (!(_clipLine(dst, &x1, &y1, &x2, &y2))) {
return (0);
}
/*
* Keep on working with 32bit numbers
*/
xx0 = x1;
yy0 = y1;
xx1 = x2;
yy1 = y2;
/*
* Reorder points if required
*/
if (yy0 > yy1) {
tmp = yy0;
yy0 = yy1;
yy1 = tmp;
tmp = xx0;
xx0 = xx1;
xx1 = tmp;
}
/*
* Calculate distance
*/
dx = xx1 - xx0;
dy = yy1 - yy0;
/*
* Check for special cases
*/
if (dx == 0) {
/*
* Vertical line
*/
if (draw_endpoint)
{
return (vlineColor(dst, x1, y1, y2, color));
} else {
if (dy>0) {
return (vlineColor(dst, x1, yy0, yy0+dy, color));
} else {
return (pixelColor(dst, x1, y1, color));
}
}
} else if (dy == 0) {
/*
* Horizontal line
*/
if (draw_endpoint)
{
return (hlineColor(dst, x1, x2, y1, color));
} else {
if (dx!=0) {
return (hlineColor(dst, xx0, xx0+dx, y1, color));
} else {
return (pixelColor(dst, x1, y1, color));
}
}
} else if ((dx == dy) && (draw_endpoint)) {
/*
* Diagonal line (with endpoint)
*/
return (lineColor(dst, x1, y1, x2, y2, color));
}
/*
* Adjust for negative dx and set xdir
*/
if (dx >= 0) {
xdir = 1;
} else {
xdir = -1;
dx = (-dx);
}
/*
* Line is not horizontal, vertical or diagonal (with endpoint)
*/
result = 0;
/*
* Zero accumulator
*/
erracc = 0;
/*
* # of bits by which to shift erracc to get intensity level
*/
intshift = 32 - AAbits;
/*
* Mask used to flip all bits in an intensity weighting
*/
wgtcompmask = AAlevels - 1;
/* Lock surface */
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* Draw the initial pixel in the foreground color
*/
result |= pixelColorNolock(dst, x1, y1, color);
/*
* x-major or y-major?
*/
if (dy > dx) {
/*
* y-major. Calculate 16-bit fixed point fractional part of a pixel that
* X advances every time Y advances 1 pixel, truncating the result so that
* we won't overrun the endpoint along the X axis
*/
/*
* Not-so-portable version: erradj = ((Uint64)dx << 32) / (Uint64)dy;
*/
erradj = ((dx << 16) / dy) << 16;
/*
* draw all pixels other than the first and last
*/
x0pxdir = xx0 + xdir;
while (--dy) {
erracctmp = erracc;
erracc += erradj;
if (erracc <= erracctmp) {
/*
* rollover in error accumulator, x coord advances
*/
xx0 = x0pxdir;
x0pxdir += xdir;
}
yy0++; /* y-major so always advance Y */
/*
* the AAbits most significant bits of erracc give us the intensity
* weighting for this pixel, and the complement of the weighting for
* the paired pixel.
*/
wgt = (erracc >> intshift) & 255;
result |= pixelColorWeightNolock (dst, xx0, yy0, color, 255 - wgt);
result |= pixelColorWeightNolock (dst, x0pxdir, yy0, color, wgt);
}
} else {
/*
* x-major line. Calculate 16-bit fixed-point fractional part of a pixel
* that Y advances each time X advances 1 pixel, truncating the result so
* that we won't overrun the endpoint along the X axis.
*/
/*
* Not-so-portable version: erradj = ((Uint64)dy << 32) / (Uint64)dx;
*/
erradj = ((dy << 16) / dx) << 16;
/*
* draw all pixels other than the first and last
*/
y0p1 = yy0 + 1;
while (--dx) {
erracctmp = erracc;
erracc += erradj;
if (erracc <= erracctmp) {
/*
* Accumulator turned over, advance y
*/
yy0 = y0p1;
y0p1++;
}
xx0 += xdir; /* x-major so always advance X */
/*
* the AAbits most significant bits of erracc give us the intensity
* weighting for this pixel, and the complement of the weighting for
* the paired pixel.
*/
wgt = (erracc >> intshift) & 255;
result |= pixelColorWeightNolock (dst, xx0, yy0, color, 255 - wgt);
result |= pixelColorWeightNolock (dst, xx0, y0p1, color, wgt);
}
}
/*
* Do we have to draw the endpoint
*/
if (draw_endpoint) {
/*
* Draw final pixel, always exactly intersected by the line and doesn't
* need to be weighted.
*/
result |= pixelColorNolock (dst, x2, y2, color);
}
/* Unlock surface */
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
return (result);
}
/*!
\brief Ddraw anti-aliased line with alpha blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the aa-line.
\param y1 Y coordinate of the first point of the aa-line.
\param x2 X coordinate of the second point of the aa-line.
\param y2 Y coordinate of the second point of the aa-line.
\param color The color value of the aa-line to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int aalineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
{
return (_aalineColor(dst, x1, y1, x2, y2, color, 1));
}
/*!
\brief Draw anti-aliased line with alpha blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the aa-line.
\param y1 Y coordinate of the first point of the aa-line.
\param x2 X coordinate of the second point of the aa-line.
\param y2 Y coordinate of the second point of the aa-line.
\param r The red value of the aa-line to draw.
\param g The green value of the aa-line to draw.
\param b The blue value of the aa-line to draw.
\param a The alpha value of the aa-line to draw.
\returns Returns 0 on success, -1 on failure.
*/
int aalineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
return (_aalineColor
(dst, x1, y1, x2, y2, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a, 1));
}
/* ----- Circle */
/*!
\brief Draw circle with blending.
Note: Circle drawing routine is based on an algorithms from the sge library,
but modified by A. Schiffler for multiple pixel-draw removal and other
minor speedup changes.
\param dst The surface to draw on.
\param x X coordinate of the center of the circle.
\param y Y coordinate of the center of the circle.
\param rad Radius in pixels of the circle.
\param color The color value of the circle to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int circleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
{
Sint16 left, right, top, bottom;
int result;
Sint16 x1, y1, x2, y2;
Sint16 cx = 0;
Sint16 cy = rad;
Sint16 df = 1 - rad;
Sint16 d_e = 3;
Sint16 d_se = -2 * rad + 5;
Sint16 xpcx, xmcx, xpcy, xmcy;
Sint16 ypcy, ymcy, ypcx, ymcx;
Uint8 *colorptr;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Sanity check radius
*/
if (rad < 0) {
return (-1);
}
/*
* Special case for rad=0 - draw a point
*/
if (rad == 0) {
return (pixelColor(dst, x, y, color));
}
/*
* Get circle and clipping boundary and
* test if bounding box of circle is visible
*/
x2 = x + rad;
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
x1 = x - rad;
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
y2 = y + rad;
top = dst->clip_rect.y;
if (y2<top) {
return(0);
}
y1 = y - rad;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if (y1>bottom) {
return(0);
}
/*
* Draw circle
*/
result = 0;
/* Lock surface */
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* Alpha Check
*/
if ((color & 255) == 255) {
/*
* No Alpha - direct memory writes
*/
/*
* Setup color
*/
colorptr = (Uint8 *) & color;
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
} else {
color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
}
/*
* Draw
*/
do {
ypcy = y + cy;
ymcy = y - cy;
if (cx > 0) {
xpcx = x + cx;
xmcx = x - cx;
result |= fastPixelColorNolock(dst, xmcx, ypcy, color);
result |= fastPixelColorNolock(dst, xpcx, ypcy, color);
result |= fastPixelColorNolock(dst, xmcx, ymcy, color);
result |= fastPixelColorNolock(dst, xpcx, ymcy, color);
} else {
result |= fastPixelColorNolock(dst, x, ymcy, color);
result |= fastPixelColorNolock(dst, x, ypcy, color);
}
xpcy = x + cy;
xmcy = x - cy;
if ((cx > 0) && (cx != cy)) {
ypcx = y + cx;
ymcx = y - cx;
result |= fastPixelColorNolock(dst, xmcy, ypcx, color);
result |= fastPixelColorNolock(dst, xpcy, ypcx, color);
result |= fastPixelColorNolock(dst, xmcy, ymcx, color);
result |= fastPixelColorNolock(dst, xpcy, ymcx, color);
} else if (cx == 0) {
result |= fastPixelColorNolock(dst, xmcy, y, color);
result |= fastPixelColorNolock(dst, xpcy, y, color);
}
/*
* Update
*/
if (df < 0) {
df += d_e;
d_e += 2;
d_se += 2;
} else {
df += d_se;
d_e += 2;
d_se += 4;
cy--;
}
cx++;
} while (cx <= cy);
/*
* Unlock surface
*/
SDL_UnlockSurface(dst);
} else {
/*
* Using Alpha - blended pixel blits
*/
do {
/*
* Draw
*/
ypcy = y + cy;
ymcy = y - cy;
if (cx > 0) {
xpcx = x + cx;
xmcx = x - cx;
result |= pixelColorNolock (dst, xmcx, ypcy, color);
result |= pixelColorNolock (dst, xpcx, ypcy, color);
result |= pixelColorNolock (dst, xmcx, ymcy, color);
result |= pixelColorNolock (dst, xpcx, ymcy, color);
} else {
result |= pixelColorNolock (dst, x, ymcy, color);
result |= pixelColorNolock (dst, x, ypcy, color);
}
xpcy = x + cy;
xmcy = x - cy;
if ((cx > 0) && (cx != cy)) {
ypcx = y + cx;
ymcx = y - cx;
result |= pixelColorNolock (dst, xmcy, ypcx, color);
result |= pixelColorNolock (dst, xpcy, ypcx, color);
result |= pixelColorNolock (dst, xmcy, ymcx, color);
result |= pixelColorNolock (dst, xpcy, ymcx, color);
} else if (cx == 0) {
result |= pixelColorNolock (dst, xmcy, y, color);
result |= pixelColorNolock (dst, xpcy, y, color);
}
/*
* Update
*/
if (df < 0) {
df += d_e;
d_e += 2;
d_se += 2;
} else {
df += d_se;
d_e += 2;
d_se += 4;
cy--;
}
cx++;
} while (cx <= cy);
} /* Alpha check */
/* Unlock surface */
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
return (result);
}
/*!
\brief Draw circle with blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the circle.
\param y Y coordinate of the center of the circle.
\param rad Radius in pixels of the circle.
\param r The red value of the circle to draw.
\param g The green value of the circle to draw.
\param b The blue value of the circle to draw.
\param a The alpha value of the circle to draw.
\returns Returns 0 on success, -1 on failure.
*/
int circleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (circleColor(dst, x, y, rad, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ----- Arc */
/*!
\brief Arc with blending.
Note Arc drawing is based on circle algorithm by A. Schiffler and
written by D. Raber. Calculates which octants arc goes through and
renders pixels accordingly.
\param dst The surface to draw on.
\param x X coordinate of the center of the arc.
\param y Y coordinate of the center of the arc.
\param rad Radius in pixels of the arc.
\param start Starting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
\param end Ending radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
\param color The color value of the arc to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int arcColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
{
Sint16 left, right, top, bottom;
int result;
Sint16 x1, y1, x2, y2;
Sint16 cx = 0;
Sint16 cy = rad;
Sint16 df = 1 - rad;
Sint16 d_e = 3;
Sint16 d_se = -2 * rad + 5;
Sint16 xpcx, xmcx, xpcy, xmcy;
Sint16 ypcy, ymcy, ypcx, ymcx;
Uint8 *colorptr;
Uint8 drawoct;
int startoct, endoct, oct, stopval_start = 0, stopval_end = 0;
double dstart, dend, temp = 0.;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Sanity check radius
*/
if (rad < 0) {
return (-1);
}
/*
* Special case for rad=0 - draw a point
*/
if (rad == 0) {
return (pixelColor(dst, x, y, color));
}
/*
* Get arc's circle and clipping boundary and
* test if bounding box of circle is visible
*/
x2 = x + rad;
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
x1 = x - rad;
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
y2 = y + rad;
top = dst->clip_rect.y;
if (y2<top) {
return(0);
}
y1 = y - rad;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if (y1>bottom) {
return(0);
}
// Octant labelling
//
// \ 5 | 6 /
// \ | /
// 4 \ | / 7
// \|/
//------+------ +x
// /|\
// 3 / | \ 0
// / | \
// / 2 | 1 \
// +y
// Initially reset bitmask to 0x00000000
// the set whether or not to keep drawing a given octant.
// For example: 0x00111100 means we're drawing in octants 2-5
drawoct = 0;
/*
* Fixup angles
*/
start %= 360;
end %= 360;
// 0 <= start & end < 360; note that sometimes start > end - if so, arc goes back through 0.
while (start < 0) start += 360;
while (end < 0) end += 360;
start %= 360;
end %= 360;
// now, we find which octants we're drawing in.
startoct = start / 45;
endoct = end / 45;
oct = startoct - 1; // we increment as first step in loop
// stopval_start, stopval_end;
// what values of cx to stop at.
do {
oct = (oct + 1) % 8;
if (oct == startoct) {
// need to compute stopval_start for this octant. Look at picture above if this is unclear
dstart = (double)start;
switch (oct)
{
case 0:
case 3:
temp = sin(dstart * M_PI / 180.);
break;
case 1:
case 6:
temp = cos(dstart * M_PI / 180.);
break;
case 2:
case 5:
temp = -cos(dstart * M_PI / 180.);
break;
case 4:
case 7:
temp = -sin(dstart * M_PI / 180.);
break;
}
temp *= rad;
stopval_start = (int)temp; // always round down.
// This isn't arbitrary, but requires graph paper to explain well.
// The basic idea is that we're always changing drawoct after we draw, so we
// stop immediately after we render the last sensible pixel at x = ((int)temp).
// and whether to draw in this octant initially
if (oct % 2) drawoct |= (1 << oct); // this is basically like saying drawoct[oct] = true, if drawoct were a bool array
else drawoct &= 255 - (1 << oct); // this is basically like saying drawoct[oct] = false
}
if (oct == endoct) {
// need to compute stopval_end for this octant
dend = (double)end;
switch (oct)
{
case 0:
case 3:
temp = sin(dend * M_PI / 180);
break;
case 1:
case 6:
temp = cos(dend * M_PI / 180);
break;
case 2:
case 5:
temp = -cos(dend * M_PI / 180);
break;
case 4:
case 7:
temp = -sin(dend * M_PI / 180);
break;
}
temp *= rad;
stopval_end = (int)temp;
// and whether to draw in this octant initially
if (startoct == endoct) {
// note: we start drawing, stop, then start again in this case
// otherwise: we only draw in this octant, so initialize it to false, it will get set back to true
if (start > end) {
// unfortunately, if we're in the same octant and need to draw over the whole circle,
// we need to set the rest to true, because the while loop will end at the bottom.
drawoct = 255;
} else {
drawoct &= 255 - (1 << oct);
}
}
else if (oct % 2) drawoct &= 255 - (1 << oct);
else drawoct |= (1 << oct);
} else if (oct != startoct) { // already verified that it's != endoct
drawoct |= (1 << oct); // draw this entire segment
}
} while (oct != endoct);
// so now we have what octants to draw and when to draw them. all that's left is the actual raster code.
/* Lock surface */
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* Draw arc
*/
result = 0;
/*
* Alpha Check
*/
if ((color & 255) == 255) {
/*
* No Alpha - direct memory writes
*/
/*
* Setup color
*/
colorptr = (Uint8 *) & color;
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
} else {
color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
}
/*
* Draw
*/
do {
ypcy = y + cy;
ymcy = y - cy;
if (cx > 0) {
xpcx = x + cx;
xmcx = x - cx;
// always check if we're drawing a certain octant before adding a pixel to that octant.
if (drawoct & 4) result |= fastPixelColorNolock(dst, xmcx, ypcy, color); // drawoct & 4 = 22; drawoct[2]
if (drawoct & 2) result |= fastPixelColorNolock(dst, xpcx, ypcy, color);
if (drawoct & 32) result |= fastPixelColorNolock(dst, xmcx, ymcy, color);
if (drawoct & 64) result |= fastPixelColorNolock(dst, xpcx, ymcy, color);
} else {
if (drawoct & 6) result |= fastPixelColorNolock(dst, x, ypcy, color); // 4 + 2; drawoct[2] || drawoct[1]
if (drawoct & 96) result |= fastPixelColorNolock(dst, x, ymcy, color); // 32 + 64
}
xpcy = x + cy;
xmcy = x - cy;
if (cx > 0 && cx != cy) {
ypcx = y + cx;
ymcx = y - cx;
if (drawoct & 8) result |= fastPixelColorNolock(dst, xmcy, ypcx, color);
if (drawoct & 1) result |= fastPixelColorNolock(dst, xpcy, ypcx, color);
if (drawoct & 16) result |= fastPixelColorNolock(dst, xmcy, ymcx, color);
if (drawoct & 128) result |= fastPixelColorNolock(dst, xpcy, ymcx, color);
} else if (cx == 0) {
if (drawoct & 24) result |= fastPixelColorNolock(dst, xmcy, y, color); // 8 + 16
if (drawoct & 129) result |= fastPixelColorNolock(dst, xpcy, y, color); // 1 + 128
}
/*
* Update whether we're drawing an octant
*/
if (stopval_start == cx) {
// works like an on-off switch because start & end may be in the same octant.
if (drawoct & (1 << startoct)) drawoct &= 255 - (1 << startoct);
else drawoct |= (1 << startoct);
}
if (stopval_end == cx) {
if (drawoct & (1 << endoct)) drawoct &= 255 - (1 << endoct);
else drawoct |= (1 << endoct);
}
/*
* Update pixels
*/
if (df < 0) {
df += d_e;
d_e += 2;
d_se += 2;
} else {
df += d_se;
d_e += 2;
d_se += 4;
cy--;
}
cx++;
} while (cx <= cy);
/*
* Unlock surface
*/
SDL_UnlockSurface(dst);
} else {
/*
* Using Alpha - blended pixel blits
*/
do {
ypcy = y + cy;
ymcy = y - cy;
if (cx > 0) {
xpcx = x + cx;
xmcx = x - cx;
// always check if we're drawing a certain octant before adding a pixel to that octant.
if (drawoct & 4) result |= pixelColorNolock(dst, xmcx, ypcy, color);
if (drawoct & 2) result |= pixelColorNolock(dst, xpcx, ypcy, color);
if (drawoct & 32) result |= pixelColorNolock(dst, xmcx, ymcy, color);
if (drawoct & 64) result |= pixelColorNolock(dst, xpcx, ymcy, color);
} else {
if (drawoct & 96) result |= pixelColorNolock(dst, x, ymcy, color);
if (drawoct & 6) result |= pixelColorNolock(dst, x, ypcy, color);
}
xpcy = x + cy;
xmcy = x - cy;
if (cx > 0 && cx != cy) {
ypcx = y + cx;
ymcx = y - cx;
if (drawoct & 8) result |= pixelColorNolock(dst, xmcy, ypcx, color);
if (drawoct & 1) result |= pixelColorNolock(dst, xpcy, ypcx, color);
if (drawoct & 16) result |= pixelColorNolock(dst, xmcy, ymcx, color);
if (drawoct & 128) result |= pixelColorNolock(dst, xpcy, ymcx, color);
} else if (cx == 0) {
if (drawoct & 24) result |= pixelColorNolock(dst, xmcy, y, color);
if (drawoct & 129) result |= pixelColorNolock(dst, xpcy, y, color);
}
/*
* Update whether we're drawing an octant
*/
if (stopval_start == cx) {
// works like an on-off switch.
// This is just in case start & end are in the same octant.
if (drawoct & (1 << startoct)) drawoct &= 255 - (1 << startoct);
else drawoct |= (1 << startoct);
}
if (stopval_end == cx) {
if (drawoct & (1 << endoct)) drawoct &= 255 - (1 << endoct);
else drawoct |= (1 << endoct);
}
/*
* Update pixels
*/
if (df < 0) {
df += d_e;
d_e += 2;
d_se += 2;
} else {
df += d_se;
d_e += 2;
d_se += 4;
cy--;
}
cx++;
} while (cx <= cy);
} /* Alpha check */
/* Unlock surface */
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
return (result);
}
/*!
\brief Arc with blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the arc.
\param y Y coordinate of the center of the arc.
\param rad Radius in pixels of the arc.
\param start Starting radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
\param end Ending radius in degrees of the arc. 0 degrees is down, increasing counterclockwise.
\param r The red value of the arc to draw.
\param g The green value of the arc to draw.
\param b The blue value of the arc to draw.
\param a The alpha value of the arc to draw.
\returns Returns 0 on success, -1 on failure.
*/
int arcRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (arcColor(dst, x, y, rad, start, end, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ----- AA Circle */
/*!
\brief Draw anti-aliased circle with blending.
Note: The AA-circle routine is based on AA-ellipse with identical radii.
\param dst The surface to draw on.
\param x X coordinate of the center of the aa-circle.
\param y Y coordinate of the center of the aa-circle.
\param rad Radius in pixels of the aa-circle.
\param color The color value of the aa-circle to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int aacircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
{
return (aaellipseColor(dst, x, y, rad, rad, color));
}
/*!
\brief Draw anti-aliased circle with blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the aa-circle.
\param y Y coordinate of the center of the aa-circle.
\param rad Radius in pixels of the aa-circle.
\param r The red value of the aa-circle to draw.
\param g The green value of the aa-circle to draw.
\param b The blue value of the aa-circle to draw.
\param a The alpha value of the aa-circle to draw.
\returns Returns 0 on success, -1 on failure.
*/
int aacircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (aaellipseColor
(dst, x, y, rad, rad, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ----- Filled Circle */
/*!
\brief Draw filled circle with blending.
Note: Based on algorithms from sge library with modifications by A. Schiffler for
multiple-hline draw removal and other minor speedup changes.
\param dst The surface to draw on.
\param x X coordinate of the center of the filled circle.
\param y Y coordinate of the center of the filled circle.
\param rad Radius in pixels of the filled circle.
\param color The color value of the filled circle to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int filledCircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color)
{
Sint16 left, right, top, bottom;
int result;
Sint16 x1, y1, x2, y2;
Sint16 cx = 0;
Sint16 cy = rad;
Sint16 ocx = (Sint16) 0xffff;
Sint16 ocy = (Sint16) 0xffff;
Sint16 df = 1 - rad;
Sint16 d_e = 3;
Sint16 d_se = -2 * rad + 5;
Sint16 xpcx, xmcx, xpcy, xmcy;
Sint16 ypcy, ymcy, ypcx, ymcx;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Sanity check radius
*/
if (rad < 0) {
return (-1);
}
/*
* Special case for rad=0 - draw a point
*/
if (rad == 0) {
return (pixelColor(dst, x, y, color));
}
/*
* Get circle and clipping boundary and
* test if bounding box of circle is visible
*/
x2 = x + rad;
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
x1 = x - rad;
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
y2 = y + rad;
top = dst->clip_rect.y;
if (y2<top) {
return(0);
}
y1 = y - rad;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if (y1>bottom) {
return(0);
}
/*
* Draw
*/
result = 0;
do {
xpcx = x + cx;
xmcx = x - cx;
xpcy = x + cy;
xmcy = x - cy;
if (ocy != cy) {
if (cy > 0) {
ypcy = y + cy;
ymcy = y - cy;
result |= hlineColor(dst, xmcx, xpcx, ypcy, color);
result |= hlineColor(dst, xmcx, xpcx, ymcy, color);
} else {
result |= hlineColor(dst, xmcx, xpcx, y, color);
}
ocy = cy;
}
if (ocx != cx) {
if (cx != cy) {
if (cx > 0) {
ypcx = y + cx;
ymcx = y - cx;
result |= hlineColor(dst, xmcy, xpcy, ymcx, color);
result |= hlineColor(dst, xmcy, xpcy, ypcx, color);
} else {
result |= hlineColor(dst, xmcy, xpcy, y, color);
}
}
ocx = cx;
}
/*
* Update
*/
if (df < 0) {
df += d_e;
d_e += 2;
d_se += 2;
} else {
df += d_se;
d_e += 2;
d_se += 4;
cy--;
}
cx++;
} while (cx <= cy);
return (result);
}
/*!
\brief Draw filled circle with blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the filled circle.
\param y Y coordinate of the center of the filled circle.
\param rad Radius in pixels of the filled circle.
\param r The red value of the filled circle to draw.
\param g The green value of the filled circle to draw.
\param b The blue value of the filled circle to draw.
\param a The alpha value of the filled circle to draw.
\returns Returns 0 on success, -1 on failure.
*/
int filledCircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (filledCircleColor
(dst, x, y, rad, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ----- Ellipse */
/*!
\brief Draw ellipse with blending.
Note: Based on algorithms from sge library with modifications by A. Schiffler for
multiple-pixel draw removal and other minor speedup changes.
\param dst The surface to draw on.
\param x X coordinate of the center of the ellipse.
\param y Y coordinate of the center of the ellipse.
\param rx Horizontal radius in pixels of the ellipse.
\param ry Vertical radius in pixels of the ellipse.
\param color The color value of the ellipse to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int ellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
{
Sint16 left, right, top, bottom;
int result;
Sint16 x1, y1, x2, y2;
int ix, iy;
int h, i, j, k;
int oh, oi, oj, ok;
int xmh, xph, ypk, ymk;
int xmi, xpi, ymj, ypj;
int xmj, xpj, ymi, ypi;
int xmk, xpk, ymh, yph;
Uint8 *colorptr;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Sanity check radii
*/
if ((rx < 0) || (ry < 0)) {
return (-1);
}
/*
* Special case for rx=0 - draw a vline
*/
if (rx == 0) {
return (vlineColor(dst, x, y - ry, y + ry, color));
}
/*
* Special case for ry=0 - draw a hline
*/
if (ry == 0) {
return (hlineColor(dst, x - rx, x + rx, y, color));
}
/*
* Get circle and clipping boundary and
* test if bounding box of circle is visible
*/
x2 = x + rx;
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
x1 = x - rx;
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
y2 = y + ry;
top = dst->clip_rect.y;
if (y2<top) {
return(0);
}
y1 = y - ry;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if (y1>bottom) {
return(0);
}
/*
* Init vars
*/
oh = oi = oj = ok = 0xFFFF;
/*
* Draw
*/
result = 0;
/* Lock surface */
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/*
* Check alpha
*/
if ((color & 255) == 255) {
/*
* No Alpha - direct memory writes
*/
/*
* Setup color
*/
colorptr = (Uint8 *) & color;
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
} else {
color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
}
if (rx > ry) {
ix = 0;
iy = rx * 64;
do {
h = (ix + 32) >> 6;
i = (iy + 32) >> 6;
j = (h * ry) / rx;
k = (i * ry) / rx;
if (((ok != k) && (oj != k)) || ((oj != j) && (ok != j)) || (k != j)) {
xph = x + h;
xmh = x - h;
if (k > 0) {
ypk = y + k;
ymk = y - k;
result |= fastPixelColorNolock(dst, xmh, ypk, color);
result |= fastPixelColorNolock(dst, xph, ypk, color);
result |= fastPixelColorNolock(dst, xmh, ymk, color);
result |= fastPixelColorNolock(dst, xph, ymk, color);
} else {
result |= fastPixelColorNolock(dst, xmh, y, color);
result |= fastPixelColorNolock(dst, xph, y, color);
}
ok = k;
xpi = x + i;
xmi = x - i;
if (j > 0) {
ypj = y + j;
ymj = y - j;
result |= fastPixelColorNolock(dst, xmi, ypj, color);
result |= fastPixelColorNolock(dst, xpi, ypj, color);
result |= fastPixelColorNolock(dst, xmi, ymj, color);
result |= fastPixelColorNolock(dst, xpi, ymj, color);
} else {
result |= fastPixelColorNolock(dst, xmi, y, color);
result |= fastPixelColorNolock(dst, xpi, y, color);
}
oj = j;
}
ix = ix + iy / rx;
iy = iy - ix / rx;
} while (i > h);
} else {
ix = 0;
iy = ry * 64;
do {
h = (ix + 32) >> 6;
i = (iy + 32) >> 6;
j = (h * rx) / ry;
k = (i * rx) / ry;
if (((oi != i) && (oh != i)) || ((oh != h) && (oi != h) && (i != h))) {
xmj = x - j;
xpj = x + j;
if (i > 0) {
ypi = y + i;
ymi = y - i;
result |= fastPixelColorNolock(dst, xmj, ypi, color);
result |= fastPixelColorNolock(dst, xpj, ypi, color);
result |= fastPixelColorNolock(dst, xmj, ymi, color);
result |= fastPixelColorNolock(dst, xpj, ymi, color);
} else {
result |= fastPixelColorNolock(dst, xmj, y, color);
result |= fastPixelColorNolock(dst, xpj, y, color);
}
oi = i;
xmk = x - k;
xpk = x + k;
if (h > 0) {
yph = y + h;
ymh = y - h;
result |= fastPixelColorNolock(dst, xmk, yph, color);
result |= fastPixelColorNolock(dst, xpk, yph, color);
result |= fastPixelColorNolock(dst, xmk, ymh, color);
result |= fastPixelColorNolock(dst, xpk, ymh, color);
} else {
result |= fastPixelColorNolock(dst, xmk, y, color);
result |= fastPixelColorNolock(dst, xpk, y, color);
}
oh = h;
}
ix = ix + iy / ry;
iy = iy - ix / ry;
} while (i > h);
}
} else {
if (rx > ry) {
ix = 0;
iy = rx * 64;
do {
h = (ix + 32) >> 6;
i = (iy + 32) >> 6;
j = (h * ry) / rx;
k = (i * ry) / rx;
if (((ok != k) && (oj != k)) || ((oj != j) && (ok != j)) || (k != j)) {
xph = x + h;
xmh = x - h;
if (k > 0) {
ypk = y + k;
ymk = y - k;
result |= pixelColorNolock (dst, xmh, ypk, color);
result |= pixelColorNolock (dst, xph, ypk, color);
result |= pixelColorNolock (dst, xmh, ymk, color);
result |= pixelColorNolock (dst, xph, ymk, color);
} else {
result |= pixelColorNolock (dst, xmh, y, color);
result |= pixelColorNolock (dst, xph, y, color);
}
ok = k;
xpi = x + i;
xmi = x - i;
if (j > 0) {
ypj = y + j;
ymj = y - j;
result |= pixelColorNolock (dst, xmi, ypj, color);
result |= pixelColorNolock (dst, xpi, ypj, color);
result |= pixelColorNolock (dst, xmi, ymj, color);
result |= pixelColor(dst, xpi, ymj, color);
} else {
result |= pixelColorNolock (dst, xmi, y, color);
result |= pixelColorNolock (dst, xpi, y, color);
}
oj = j;
}
ix = ix + iy / rx;
iy = iy - ix / rx;
} while (i > h);
} else {
ix = 0;
iy = ry * 64;
do {
h = (ix + 32) >> 6;
i = (iy + 32) >> 6;
j = (h * rx) / ry;
k = (i * rx) / ry;
if (((oi != i) && (oh != i)) || ((oh != h) && (oi != h) && (i != h))) {
xmj = x - j;
xpj = x + j;
if (i > 0) {
ypi = y + i;
ymi = y - i;
result |= pixelColorNolock (dst, xmj, ypi, color);
result |= pixelColorNolock (dst, xpj, ypi, color);
result |= pixelColorNolock (dst, xmj, ymi, color);
result |= pixelColorNolock (dst, xpj, ymi, color);
} else {
result |= pixelColorNolock (dst, xmj, y, color);
result |= pixelColorNolock (dst, xpj, y, color);
}
oi = i;
xmk = x - k;
xpk = x + k;
if (h > 0) {
yph = y + h;
ymh = y - h;
result |= pixelColorNolock (dst, xmk, yph, color);
result |= pixelColorNolock (dst, xpk, yph, color);
result |= pixelColorNolock (dst, xmk, ymh, color);
result |= pixelColorNolock (dst, xpk, ymh, color);
} else {
result |= pixelColorNolock (dst, xmk, y, color);
result |= pixelColorNolock (dst, xpk, y, color);
}
oh = h;
}
ix = ix + iy / ry;
iy = iy - ix / ry;
} while (i > h);
}
} /* Alpha check */
/* Unlock surface */
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
return (result);
}
/*!
\brief Draw ellipse with blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the ellipse.
\param y Y coordinate of the center of the ellipse.
\param rx Horizontal radius in pixels of the ellipse.
\param ry Vertical radius in pixels of the ellipse.
\param r The red value of the ellipse to draw.
\param g The green value of the ellipse to draw.
\param b The blue value of the ellipse to draw.
\param a The alpha value of the ellipse to draw.
\returns Returns 0 on success, -1 on failure.
*/
int ellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (ellipseColor(dst, x, y, rx, ry, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ----- AA Ellipse */
/* Windows targets do not have lrint, so provide a local inline version */
#if defined(_MSC_VER)
/* Detect 64bit and use intrinsic version */
#ifdef _M_X64
#include <emmintrin.h>
static __inline long
lrint(float f)
{
return _mm_cvtss_si32(_mm_load_ss(&f));
}
#elif defined(_M_IX86)
__inline long int
lrint (double flt)
{
int intgr;
_asm
{
fld flt
fistp intgr
};
return intgr;
}
#elif defined(_M_ARM)
#include <armintr.h>
#pragma warning(push)
#pragma warning(disable: 4716)
__declspec(naked) long int
lrint (double flt)
{
__emit(0xEC410B10); // fmdrr d0, r0, r1
__emit(0xEEBD0B40); // ftosid s0, d0
__emit(0xEE100A10); // fmrs r0, s0
__emit(0xE12FFF1E); // bx lr
}
#pragma warning(pop)
#else
#error lrint needed for MSVC on non X86/AMD64/ARM targets.
#endif
#endif
/*!
\brief Draw anti-aliased ellipse with blending.
Note: Based on code from Anders Lindstroem, which is based on code from sge library,
which is based on code from TwinLib.
\param dst The surface to draw on.
\param x X coordinate of the center of the aa-ellipse.
\param y Y coordinate of the center of the aa-ellipse.
\param rx Horizontal radius in pixels of the aa-ellipse.
\param ry Vertical radius in pixels of the aa-ellipse.
\param color The color value of the aa-ellipse to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int aaellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
{
Sint16 left, right, top, bottom;
Sint16 x1,y1,x2,y2;
int i;
int a2, b2, ds, dt, dxt, t, s, d;
Sint16 xp, yp, xs, ys, dyt, od, xx, yy, xc2, yc2;
float cp;
double sab;
Uint8 weight, iweight;
int result;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Sanity check radii
*/
if ((rx < 0) || (ry < 0)) {
return (-1);
}
/*
* Special case for rx=0 - draw a vline
*/
if (rx == 0) {
return (vlineColor(dst, x, y - ry, y + ry, color));
}
/*
* Special case for ry=0 - draw an hline
*/
if (ry == 0) {
return (hlineColor(dst, x - rx, x + rx, y, color));
}
/*
* Get circle and clipping boundary and
* test if bounding box of circle is visible
*/
x2 = x + rx;
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
x1 = x - rx;
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
y2 = y + ry;
top = dst->clip_rect.y;
if (y2<top) {
return(0);
}
y1 = y - ry;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if (y1>bottom) {
return(0);
}
/* Variable setup */
a2 = rx * rx;
b2 = ry * ry;
ds = 2 * a2;
dt = 2 * b2;
xc2 = 2 * x;
yc2 = 2 * y;
sab = sqrt((double)(a2 + b2));
od = (Sint16)lrint(sab*0.01) + 1; /* introduce some overdraw */
dxt = (Sint16)lrint((double)a2 / sab) + od;
t = 0;
s = -2 * a2 * ry;
d = 0;
xp = x;
yp = y - ry;
/* Lock surface */
if (SDL_MUSTLOCK(dst)) {
if (SDL_LockSurface(dst) < 0) {
return (-1);
}
}
/* Draw */
result = 0;
/* "End points" */
result |= pixelColorNolock(dst, xp, yp, color);
result |= pixelColorNolock(dst, xc2 - xp, yp, color);
result |= pixelColorNolock(dst, xp, yc2 - yp, color);
result |= pixelColorNolock(dst, xc2 - xp, yc2 - yp, color);
for (i = 1; i <= dxt; i++) {
xp--;
d += t - b2;
if (d >= 0)
ys = yp - 1;
else if ((d - s - a2) > 0) {
if ((2 * d - s - a2) >= 0)
ys = yp + 1;
else {
ys = yp;
yp++;
d -= s + a2;
s += ds;
}
} else {
yp++;
ys = yp + 1;
d -= s + a2;
s += ds;
}
t -= dt;
/* Calculate alpha */
if (s != 0) {
cp = (float) abs(d) / (float) abs(s);
if (cp > 1.0) {
cp = 1.0;
}
} else {
cp = 1.0;
}
/* Calculate weights */
weight = (Uint8) (cp * 255);
iweight = 255 - weight;
/* Upper half */
xx = xc2 - xp;
result |= pixelColorWeightNolock(dst, xp, yp, color, iweight);
result |= pixelColorWeightNolock(dst, xx, yp, color, iweight);
result |= pixelColorWeightNolock(dst, xp, ys, color, weight);
result |= pixelColorWeightNolock(dst, xx, ys, color, weight);
/* Lower half */
yy = yc2 - yp;
result |= pixelColorWeightNolock(dst, xp, yy, color, iweight);
result |= pixelColorWeightNolock(dst, xx, yy, color, iweight);
yy = yc2 - ys;
result |= pixelColorWeightNolock(dst, xp, yy, color, weight);
result |= pixelColorWeightNolock(dst, xx, yy, color, weight);
}
/* Replaces original approximation code dyt = abs(yp - yc); */
dyt = (Sint16)lrint((double)b2 / sab ) + od;
for (i = 1; i <= dyt; i++) {
yp++;
d -= s + a2;
if (d <= 0)
xs = xp + 1;
else if ((d + t - b2) < 0) {
if ((2 * d + t - b2) <= 0)
xs = xp - 1;
else {
xs = xp;
xp--;
d += t - b2;
t -= dt;
}
} else {
xp--;
xs = xp - 1;
d += t - b2;
t -= dt;
}
s += ds;
/* Calculate alpha */
if (t != 0) {
cp = (float) abs(d) / (float) abs(t);
if (cp > 1.0) {
cp = 1.0;
}
} else {
cp = 1.0;
}
/* Calculate weight */
weight = (Uint8) (cp * 255);
iweight = 255 - weight;
/* Left half */
xx = xc2 - xp;
yy = yc2 - yp;
result |= pixelColorWeightNolock(dst, xp, yp, color, iweight);
result |= pixelColorWeightNolock(dst, xx, yp, color, iweight);
result |= pixelColorWeightNolock(dst, xp, yy, color, iweight);
result |= pixelColorWeightNolock(dst, xx, yy, color, iweight);
/* Right half */
xx = xc2 - xs;
result |= pixelColorWeightNolock(dst, xs, yp, color, weight);
result |= pixelColorWeightNolock(dst, xx, yp, color, weight);
result |= pixelColorWeightNolock(dst, xs, yy, color, weight);
result |= pixelColorWeightNolock(dst, xx, yy, color, weight);
}
/* Unlock surface */
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
return (result);
}
/*!
\brief Draw anti-aliased ellipse with blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the aa-ellipse.
\param y Y coordinate of the center of the aa-ellipse.
\param rx Horizontal radius in pixels of the aa-ellipse.
\param ry Vertical radius in pixels of the aa-ellipse.
\param r The red value of the aa-ellipse to draw.
\param g The green value of the aa-ellipse to draw.
\param b The blue value of the aa-ellipse to draw.
\param a The alpha value of the aa-ellipse to draw.
\returns Returns 0 on success, -1 on failure.
*/
int aaellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (aaellipseColor
(dst, x, y, rx, ry, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ---- Filled Ellipse */
/* Note: */
/* Based on algorithm from sge library with multiple-hline draw removal */
/* and other speedup changes. */
/*!
\brief Draw filled ellipse with blending.
Note: Based on algorithm from sge library with multiple-hline draw removal
and other speedup changes.
\param dst The surface to draw on.
\param x X coordinate of the center of the filled ellipse.
\param y Y coordinate of the center of the filled ellipse.
\param rx Horizontal radius in pixels of the filled ellipse.
\param ry Vertical radius in pixels of the filled ellipse.
\param color The color value of the filled ellipse to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int filledEllipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color)
{
Sint16 left, right, top, bottom;
int result;
Sint16 x1, y1, x2, y2;
int ix, iy;
int h, i, j, k;
int oh, oi, oj, ok;
int xmh, xph;
int xmi, xpi;
int xmj, xpj;
int xmk, xpk;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Sanity check radii
*/
if ((rx < 0) || (ry < 0)) {
return (-1);
}
/*
* Special case for rx=0 - draw a vline
*/
if (rx == 0) {
return (vlineColor(dst, x, y - ry, y + ry, color));
}
/*
* Special case for ry=0 - draw a hline
*/
if (ry == 0) {
return (hlineColor(dst, x - rx, x + rx, y, color));
}
/*
* Get circle and clipping boundary and
* test if bounding box of circle is visible
*/
x2 = x + rx;
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
x1 = x - rx;
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
y2 = y + ry;
top = dst->clip_rect.y;
if (y2<top) {
return(0);
}
y1 = y - ry;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if (y1>bottom) {
return(0);
}
/*
* Init vars
*/
oh = oi = oj = ok = 0xFFFF;
/*
* Draw
*/
result = 0;
if (rx > ry) {
ix = 0;
iy = rx * 64;
do {
h = (ix + 32) >> 6;
i = (iy + 32) >> 6;
j = (h * ry) / rx;
k = (i * ry) / rx;
if ((ok != k) && (oj != k)) {
xph = x + h;
xmh = x - h;
if (k > 0) {
result |= hlineColor(dst, xmh, xph, y + k, color);
result |= hlineColor(dst, xmh, xph, y - k, color);
} else {
result |= hlineColor(dst, xmh, xph, y, color);
}
ok = k;
}
if ((oj != j) && (ok != j) && (k != j)) {
xmi = x - i;
xpi = x + i;
if (j > 0) {
result |= hlineColor(dst, xmi, xpi, y + j, color);
result |= hlineColor(dst, xmi, xpi, y - j, color);
} else {
result |= hlineColor(dst, xmi, xpi, y, color);
}
oj = j;
}
ix = ix + iy / rx;
iy = iy - ix / rx;
} while (i > h);
} else {
ix = 0;
iy = ry * 64;
do {
h = (ix + 32) >> 6;
i = (iy + 32) >> 6;
j = (h * rx) / ry;
k = (i * rx) / ry;
if ((oi != i) && (oh != i)) {
xmj = x - j;
xpj = x + j;
if (i > 0) {
result |= hlineColor(dst, xmj, xpj, y + i, color);
result |= hlineColor(dst, xmj, xpj, y - i, color);
} else {
result |= hlineColor(dst, xmj, xpj, y, color);
}
oi = i;
}
if ((oh != h) && (oi != h) && (i != h)) {
xmk = x - k;
xpk = x + k;
if (h > 0) {
result |= hlineColor(dst, xmk, xpk, y + h, color);
result |= hlineColor(dst, xmk, xpk, y - h, color);
} else {
result |= hlineColor(dst, xmk, xpk, y, color);
}
oh = h;
}
ix = ix + iy / ry;
iy = iy - ix / ry;
} while (i > h);
}
return (result);
}
/*!
\brief Draw filled ellipse with blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the filled ellipse.
\param y Y coordinate of the center of the filled ellipse.
\param rx Horizontal radius in pixels of the filled ellipse.
\param ry Vertical radius in pixels of the filled ellipse.
\param r The red value of the filled ellipse to draw.
\param g The green value of the filled ellipse to draw.
\param b The blue value of the filled ellipse to draw.
\param a The alpha value of the filled ellipse to draw.
\returns Returns 0 on success, -1 on failure.
*/
int filledEllipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (filledEllipseColor
(dst, x, y, rx, ry, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ----- pie */
/*!
\brief Internal float (low-speed) pie-calc implementation by drawing polygons.
Note: Determines vertex array and uses polygon or filledPolygon drawing routines to render.
\param dst The surface to draw on.
\param x X coordinate of the center of the pie.
\param y Y coordinate of the center of the pie.
\param rad Radius in pixels of the pie.
\param start Starting radius in degrees of the pie.
\param end Ending radius in degrees of the pie.
\param color The color value of the pie to draw (0xRRGGBBAA).
\param filled Flag indicating if the pie should be filled (=1) or not (=0).
\returns Returns 0 on success, -1 on failure.
*/
int _pieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color, Uint8 filled)
{
Sint16 left, right, top, bottom;
Sint16 x1, y1, x2, y2;
int result;
double angle, start_angle, end_angle;
double deltaAngle;
double dr;
int numpoints, i;
Sint16 *vx, *vy;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Sanity check radii
*/
if (rad < 0) {
return (-1);
}
/*
* Fixup angles
*/
start = start % 360;
end = end % 360;
/*
* Special case for rad=0 - draw a point
*/
if (rad == 0) {
return (pixelColor(dst, x, y, color));
}
/*
* Clip against circle, not pie (not 100% optimal).
* Get pie's circle and clipping boundary and
* test if bounding box of circle is visible
*/
x2 = x + rad;
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
x1 = x - rad;
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
y2 = y + rad;
top = dst->clip_rect.y;
if (y2<top) {
return(0);
}
y1 = y - rad;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if (y1>bottom) {
return(0);
}
/*
* Variable setup
*/
dr = (double) rad;
deltaAngle = 3.0 / dr;
start_angle = (double) start *(2.0 * M_PI / 360.0);
end_angle = (double) end *(2.0 * M_PI / 360.0);
if (start > end) {
end_angle += (2.0 * M_PI);
}
/* We will always have at least 2 points */
numpoints = 2;
/* Count points (rather than calculating it) */
angle = start_angle;
while (angle < end_angle) {
angle += deltaAngle;
numpoints++;
}
/* Allocate combined vertex array */
vx = vy = (Sint16 *) malloc(2 * sizeof(Uint16) * numpoints);
if (vx == NULL) {
return (-1);
}
/* Update point to start of vy */
vy += numpoints;
/* Center */
vx[0] = x;
vy[0] = y;
/* First vertex */
angle = start_angle;
vx[1] = x + (int) (dr * cos(angle));
vy[1] = y + (int) (dr * sin(angle));
if (numpoints<3)
{
result = lineColor(dst, vx[0], vy[0], vx[1], vy[1], color);
}
else
{
/* Calculate other vertices */
i = 2;
angle = start_angle;
while (angle < end_angle) {
angle += deltaAngle;
if (angle>end_angle)
{
angle = end_angle;
}
vx[i] = x + (int) (dr * cos(angle));
vy[i] = y + (int) (dr * sin(angle));
i++;
}
/* Draw */
if (filled) {
result = filledPolygonColor(dst, vx, vy, numpoints, color);
} else {
result = polygonColor(dst, vx, vy, numpoints, color);
}
}
/* Free combined vertex array */
free(vx);
return (result);
}
/*!
\brief Draw pie (outline) with alpha blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the pie.
\param y Y coordinate of the center of the pie.
\param rad Radius in pixels of the pie.
\param start Starting radius in degrees of the pie.
\param end Ending radius in degrees of the pie.
\param color The color value of the pie to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int pieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
Sint16 start, Sint16 end, Uint32 color)
{
return (_pieColor(dst, x, y, rad, start, end, color, 0));
}
/*!
\brief Draw pie (outline) with alpha blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the pie.
\param y Y coordinate of the center of the pie.
\param rad Radius in pixels of the pie.
\param start Starting radius in degrees of the pie.
\param end Ending radius in degrees of the pie.
\param r The red value of the pie to draw.
\param g The green value of the pie to draw.
\param b The blue value of the pie to draw.
\param a The alpha value of the pie to draw.
\returns Returns 0 on success, -1 on failure.
*/
int pieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
return (_pieColor(dst, x, y, rad, start, end,
((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a, 0));
}
/*!
\brief Draw filled pie with alpha blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the filled pie.
\param y Y coordinate of the center of the filled pie.
\param rad Radius in pixels of the filled pie.
\param start Starting radius in degrees of the filled pie.
\param end Ending radius in degrees of the filled pie.
\param color The color value of the filled pie to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int filledPieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color)
{
return (_pieColor(dst, x, y, rad, start, end, color, 1));
}
/*!
\brief Draw filled pie with alpha blending.
\param dst The surface to draw on.
\param x X coordinate of the center of the filled pie.
\param y Y coordinate of the center of the filled pie.
\param rad Radius in pixels of the filled pie.
\param start Starting radius in degrees of the filled pie.
\param end Ending radius in degrees of the filled pie.
\param r The red value of the filled pie to draw.
\param g The green value of the filled pie to draw.
\param b The blue value of the filled pie to draw.
\param a The alpha value of the filled pie to draw.
\returns Returns 0 on success, -1 on failure.
*/
int filledPieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
return (_pieColor(dst, x, y, rad, start, end,
((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a, 1));
}
/* ------ Trigon */
/*!
\brief Draw trigon (triangle outline) with alpha blending.
Note: Creates vertex array and uses polygon routine to render.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the trigon.
\param y1 Y coordinate of the first point of the trigon.
\param x2 X coordinate of the second point of the trigon.
\param y2 Y coordinate of the second point of the trigon.
\param x3 X coordinate of the third point of the trigon.
\param y3 Y coordinate of the third point of the trigon.
\param color The color value of the trigon to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int trigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
{
Sint16 vx[3];
Sint16 vy[3];
vx[0]=x1;
vx[1]=x2;
vx[2]=x3;
vy[0]=y1;
vy[1]=y2;
vy[2]=y3;
return(polygonColor(dst,vx,vy,3,color));
}
/*!
\brief Draw trigon (triangle outline) with alpha blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the trigon.
\param y1 Y coordinate of the first point of the trigon.
\param x2 X coordinate of the second point of the trigon.
\param y2 Y coordinate of the second point of the trigon.
\param x3 X coordinate of the third point of the trigon.
\param y3 Y coordinate of the third point of the trigon.
\param r The red value of the trigon to draw.
\param g The green value of the trigon to draw.
\param b The blue value of the trigon to draw.
\param a The alpha value of the trigon to draw.
\returns Returns 0 on success, -1 on failure.
*/
int trigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
Sint16 vx[3];
Sint16 vy[3];
vx[0]=x1;
vx[1]=x2;
vx[2]=x3;
vy[0]=y1;
vy[1]=y2;
vy[2]=y3;
return(polygonRGBA(dst,vx,vy,3,r,g,b,a));
}
/* ------ AA-Trigon */
/*!
\brief Draw anti-aliased trigon (triangle outline) with alpha blending.
Note: Creates vertex array and uses aapolygon routine to render.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the aa-trigon.
\param y1 Y coordinate of the first point of the aa-trigon.
\param x2 X coordinate of the second point of the aa-trigon.
\param y2 Y coordinate of the second point of the aa-trigon.
\param x3 X coordinate of the third point of the aa-trigon.
\param y3 Y coordinate of the third point of the aa-trigon.
\param color The color value of the aa-trigon to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int aatrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
{
Sint16 vx[3];
Sint16 vy[3];
vx[0]=x1;
vx[1]=x2;
vx[2]=x3;
vy[0]=y1;
vy[1]=y2;
vy[2]=y3;
return(aapolygonColor(dst,vx,vy,3,color));
}
/*!
\brief Draw anti-aliased trigon (triangle outline) with alpha blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the aa-trigon.
\param y1 Y coordinate of the first point of the aa-trigon.
\param x2 X coordinate of the second point of the aa-trigon.
\param y2 Y coordinate of the second point of the aa-trigon.
\param x3 X coordinate of the third point of the aa-trigon.
\param y3 Y coordinate of the third point of the aa-trigon.
\param r The red value of the aa-trigon to draw.
\param g The green value of the aa-trigon to draw.
\param b The blue value of the aa-trigon to draw.
\param a The alpha value of the aa-trigon to draw.
\returns Returns 0 on success, -1 on failure.
*/
int aatrigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
Sint16 vx[3];
Sint16 vy[3];
vx[0]=x1;
vx[1]=x2;
vx[2]=x3;
vy[0]=y1;
vy[1]=y2;
vy[2]=y3;
return(aapolygonRGBA(dst,vx,vy,3,r,g,b,a));
}
/* ------ Filled Trigon */
/*!
\brief Draw filled trigon (triangle) with alpha blending.
Note: Creates vertex array and uses aapolygon routine to render.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the filled trigon.
\param y1 Y coordinate of the first point of the filled trigon.
\param x2 X coordinate of the second point of the filled trigon.
\param y2 Y coordinate of the second point of the filled trigon.
\param x3 X coordinate of the third point of the filled trigon.
\param y3 Y coordinate of the third point of the filled trigon.
\param color The color value of the filled trigon to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int filledTrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
{
Sint16 vx[3];
Sint16 vy[3];
vx[0]=x1;
vx[1]=x2;
vx[2]=x3;
vy[0]=y1;
vy[1]=y2;
vy[2]=y3;
return(filledPolygonColor(dst,vx,vy,3,color));
}
/*!
\brief Draw filled trigon (triangle) with alpha blending.
Note: Creates vertex array and uses aapolygon routine to render.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the filled trigon.
\param y1 Y coordinate of the first point of the filled trigon.
\param x2 X coordinate of the second point of the filled trigon.
\param y2 Y coordinate of the second point of the filled trigon.
\param x3 X coordinate of the third point of the filled trigon.
\param y3 Y coordinate of the third point of the filled trigon.
\param r The red value of the filled trigon to draw.
\param g The green value of the filled trigon to draw.
\param b The blue value of the filled trigon to draw.
\param a The alpha value of the filled trigon to draw.
\returns Returns 0 on success, -1 on failure.
*/
int filledTrigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
Sint16 vx[3];
Sint16 vy[3];
vx[0]=x1;
vx[1]=x2;
vx[2]=x3;
vy[0]=y1;
vy[1]=y2;
vy[2]=y3;
return(filledPolygonRGBA(dst,vx,vy,3,r,g,b,a));
}
/* ---- Polygon */
/*!
\brief Draw polygon with alpha blending.
\param dst The surface to draw on.
\param vx Vertex array containing X coordinates of the points of the polygon.
\param vy Vertex array containing Y coordinates of the points of the polygon.
\param n Number of points in the vertex array. Minimum number is 3.
\param color The color value of the polygon to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int polygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color)
{
int result;
int i;
const Sint16 *x1, *y1, *x2, *y2;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Vertex array NULL check
*/
if (vx == NULL) {
return (-1);
}
if (vy == NULL) {
return (-1);
}
/*
* Sanity check
*/
if (n < 3) {
return (-1);
}
/*
* Pointer setup
*/
x1 = x2 = vx;
y1 = y2 = vy;
x2++;
y2++;
/*
* Draw
*/
result = 0;
for (i = 1; i < n; i++) {
result |= lineColor(dst, *x1, *y1, *x2, *y2, color);
x1 = x2;
y1 = y2;
x2++;
y2++;
}
result |= lineColor(dst, *x1, *y1, *vx, *vy, color);
return (result);
}
/*!
\brief Draw polygon with alpha blending.
\param dst The surface to draw on.
\param vx Vertex array containing X coordinates of the points of the polygon.
\param vy Vertex array containing Y coordinates of the points of the polygon.
\param n Number of points in the vertex array. Minimum number is 3.
\param r The red value of the polygon to draw.
\param g The green value of the polygon to draw.
\param b The blue value of the polygon to draw.
\param a The alpha value of the polygon to draw.
\returns Returns 0 on success, -1 on failure.
*/
int polygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (polygonColor(dst, vx, vy, n, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ---- AA-Polygon */
/*!
\brief Draw anti-aliased polygon with alpha blending.
\param dst The surface to draw on.
\param vx Vertex array containing X coordinates of the points of the aa-polygon.
\param vy Vertex array containing Y coordinates of the points of the aa-polygon.
\param n Number of points in the vertex array. Minimum number is 3.
\param color The color value of the aa-polygon to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int aapolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color)
{
int result;
int i;
const Sint16 *x1, *y1, *x2, *y2;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Vertex array NULL check
*/
if (vx == NULL) {
return (-1);
}
if (vy == NULL) {
return (-1);
}
/*
* Sanity check
*/
if (n < 3) {
return (-1);
}
/*
* Pointer setup
*/
x1 = x2 = vx;
y1 = y2 = vy;
x2++;
y2++;
/*
* Draw
*/
result = 0;
for (i = 1; i < n; i++) {
result |= _aalineColor(dst, *x1, *y1, *x2, *y2, color, 0);
x1 = x2;
y1 = y2;
x2++;
y2++;
}
result |= _aalineColor(dst, *x1, *y1, *vx, *vy, color, 0);
return (result);
}
/*!
\brief Draw anti-aliased polygon with alpha blending.
\param dst The surface to draw on.
\param vx Vertex array containing X coordinates of the points of the aa-polygon.
\param vy Vertex array containing Y coordinates of the points of the aa-polygon.
\param n Number of points in the vertex array. Minimum number is 3.
\param r The red value of the aa-polygon to draw.
\param g The green value of the aa-polygon to draw.
\param b The blue value of the aa-polygon to draw.
\param a The alpha value of the aa-polygon to draw.
\returns Returns 0 on success, -1 on failure.
*/
int aapolygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (aapolygonColor(dst, vx, vy, n, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ---- Filled Polygon */
/*!
\brief Internal helper qsort callback functions used in filled polygon drawing.
\param a The surface to draw on.
\param b Vertex array containing X coordinates of the points of the polygon.
\returns Returns 0 if a==b, a negative number if a<b or a positive number if a>b.
*/
int _gfxPrimitivesCompareInt(const void *a, const void *b)
{
return (*(const int *) a) - (*(const int *) b);
}
/*!
\brief Global vertex array to use if optional parameters are not given in filledPolygonMT calls.
Note: Used for non-multithreaded (default) operation of filledPolygonMT.
*/
static int *gfxPrimitivesPolyIntsGlobal = NULL;
/*!
\brief Flag indicating if global vertex array was already allocated.
Note: Used for non-multithreaded (default) operation of filledPolygonMT.
*/
static int gfxPrimitivesPolyAllocatedGlobal = 0;
/*!
\brief Draw filled polygon with alpha blending (multi-threaded capable).
Note: The last two parameters are optional; but are required for multithreaded operation.
\param dst The surface to draw on.
\param vx Vertex array containing X coordinates of the points of the filled polygon.
\param vy Vertex array containing Y coordinates of the points of the filled polygon.
\param n Number of points in the vertex array. Minimum number is 3.
\param color The color value of the filled polygon to draw (0xRRGGBBAA).
\param polyInts Preallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise.
\param polyAllocated Flag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.
\returns Returns 0 on success, -1 on failure.
*/
int filledPolygonColorMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color, int **polyInts, int *polyAllocated)
{
int result;
int i;
int y, xa, xb;
int miny, maxy;
int x1, y1;
int x2, y2;
int ind1, ind2;
int ints;
int *gfxPrimitivesPolyInts = NULL;
int *gfxPrimitivesPolyIntsNew = NULL;
int gfxPrimitivesPolyAllocated = 0;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Vertex array NULL check
*/
if (vx == NULL) {
return (-1);
}
if (vy == NULL) {
return (-1);
}
/*
* Sanity check number of edges
*/
if (n < 3) {
return -1;
}
/*
* Map polygon cache
*/
if ((polyInts==NULL) || (polyAllocated==NULL)) {
/* Use global cache */
gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
} else {
/* Use local cache */
gfxPrimitivesPolyInts = *polyInts;
gfxPrimitivesPolyAllocated = *polyAllocated;
}
/*
* Allocate temp array, only grow array
*/
if (!gfxPrimitivesPolyAllocated) {
gfxPrimitivesPolyInts = (int *) malloc(sizeof(int) * n);
gfxPrimitivesPolyAllocated = n;
} else {
if (gfxPrimitivesPolyAllocated < n) {
gfxPrimitivesPolyIntsNew = (int *) realloc(gfxPrimitivesPolyInts, sizeof(int) * n);
if (!gfxPrimitivesPolyIntsNew) {
if (!gfxPrimitivesPolyInts) {
free(gfxPrimitivesPolyInts);
gfxPrimitivesPolyInts = NULL;
}
gfxPrimitivesPolyAllocated = 0;
} else {
gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsNew;
gfxPrimitivesPolyAllocated = n;
}
}
}
/*
* Check temp array
*/
if (gfxPrimitivesPolyInts==NULL) {
gfxPrimitivesPolyAllocated = 0;
}
/*
* Update cache variables
*/
if ((polyInts==NULL) || (polyAllocated==NULL)) {
gfxPrimitivesPolyIntsGlobal = gfxPrimitivesPolyInts;
gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
} else {
*polyInts = gfxPrimitivesPolyInts;
*polyAllocated = gfxPrimitivesPolyAllocated;
}
/*
* Check temp array again
*/
if (gfxPrimitivesPolyInts==NULL) {
return(-1);
}
/*
* Determine Y maxima
*/
miny = vy[0];
maxy = vy[0];
for (i = 1; (i < n); i++) {
if (vy[i] < miny) {
miny = vy[i];
} else if (vy[i] > maxy) {
maxy = vy[i];
}
}
/*
* Draw, scanning y
*/
result = 0;
for (y = miny; (y <= maxy); y++) {
ints = 0;
for (i = 0; (i < n); i++) {
if (!i) {
ind1 = n - 1;
ind2 = 0;
} else {
ind1 = i - 1;
ind2 = i;
}
y1 = vy[ind1];
y2 = vy[ind2];
if (y1 < y2) {
x1 = vx[ind1];
x2 = vx[ind2];
} else if (y1 > y2) {
y2 = vy[ind1];
y1 = vy[ind2];
x2 = vx[ind1];
x1 = vx[ind2];
} else {
continue;
}
if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
}
}
qsort(gfxPrimitivesPolyInts, ints, sizeof(int), _gfxPrimitivesCompareInt);
for (i = 0; (i < ints); i += 2) {
xa = gfxPrimitivesPolyInts[i] + 1;
xa = (xa >> 16) + ((xa & 32768) >> 15);
xb = gfxPrimitivesPolyInts[i+1] - 1;
xb = (xb >> 16) + ((xb & 32768) >> 15);
result |= hlineColor(dst, xa, xb, y, color);
}
}
return (result);
}
/*!
\brief Draw filled polygon with alpha blending (multi-threaded capable).
Note: The last two parameters are optional; but are required for multithreaded operation.
\param dst The surface to draw on.
\param vx Vertex array containing X coordinates of the points of the filled polygon.
\param vy Vertex array containing Y coordinates of the points of the filled polygon.
\param n Number of points in the vertex array. Minimum number is 3.
\param r The red value of the filled polygon to draw.
\param g The green value of the filled polygon to draw.
\param b The blue value of the filed polygon to draw.
\param a The alpha value of the filled polygon to draw.
\param polyInts Preallocated, temporary vertex array used for sorting vertices. Required for multithreaded operation; set to NULL otherwise.
\param polyAllocated Flag indicating if temporary vertex array was allocated. Required for multithreaded operation; set to NULL otherwise.
\returns Returns 0 on success, -1 on failure.
*/
int filledPolygonRGBAMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a, int **polyInts, int *polyAllocated)
{
/*
* Draw
*/
return (filledPolygonColorMT(dst, vx, vy, n, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a, polyInts, polyAllocated));
}
/*!
\brief Draw filled polygon with alpha blending.
Note: Standard filledPolygon function is calling multithreaded version with NULL parameters
to use the global vertex cache.
\param dst The surface to draw on.
\param vx Vertex array containing X coordinates of the points of the filled polygon.
\param vy Vertex array containing Y coordinates of the points of the filled polygon.
\param n Number of points in the vertex array. Minimum number is 3.
\param color The color value of the filled polygon to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int filledPolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color)
{
/*
* Draw
*/
return (filledPolygonColorMT(dst, vx, vy, n, color, NULL, NULL));
}
/*!
\brief Draw filled polygon with alpha blending.
\param dst The surface to draw on.
\param vx Vertex array containing X coordinates of the points of the filled polygon.
\param vy Vertex array containing Y coordinates of the points of the filled polygon.
\param n Number of points in the vertex array. Minimum number is 3.
\param r The red value of the filled polygon to draw.
\param g The green value of the filled polygon to draw.
\param b The blue value of the filed polygon to draw.
\param a The alpha value of the filled polygon to draw.
\returns Returns 0 on success, -1 on failure.
*/
int filledPolygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (filledPolygonColorMT(dst, vx, vy, n, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a, NULL, NULL));
}
/*!
\brief Internal function to draw a textured horizontal line.
\param dst The surface to draw on.
\param x1 X coordinate of the first point (i.e. left) of the line.
\param x2 X coordinate of the second point (i.e. right) of the line.
\param y Y coordinate of the points of the line.
\param texture The texture surface to retrieve color information from.
\param texture_dx The X offset for the texture lookup.
\param texture_dy The Y offset for the textured lookup.
\returns Returns 0 on success, -1 on failure.
*/
int _HLineTextured(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, SDL_Surface *texture, int texture_dx, int texture_dy)
{
Sint16 left, right, top, bottom;
Sint16 w;
Sint16 xtmp;
int result = 0;
int texture_x_walker;
int texture_y_start;
SDL_Rect source_rect,dst_rect;
int pixels_written,write_width;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Swap x1, x2 if required to ensure x1<=x2
*/
if (x1 > x2) {
xtmp = x1;
x1 = x2;
x2 = xtmp;
}
/*
* Get clipping boundary and
* check visibility of hline
*/
left = dst->clip_rect.x;
if (x2<left) {
return(0);
}
right = dst->clip_rect.x + dst->clip_rect.w - 1;
if (x1>right) {
return(0);
}
top = dst->clip_rect.y;
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
if ((y<top) || (y>bottom)) {
return (0);
}
/*
* Clip x
*/
if (x1 < left) {
x1 = left;
}
if (x2 > right) {
x2 = right;
}
/*
* Calculate width to draw
*/
w = x2 - x1 + 1;
/*
* Determine where in the texture we start drawing
*/
texture_x_walker = (x1 - texture_dx) % texture->w;
if (texture_x_walker < 0){
texture_x_walker = texture->w + texture_x_walker ;
}
texture_y_start = (y + texture_dy) % texture->h;
if (texture_y_start < 0){
texture_y_start = texture->h + texture_y_start;
}
// setup the source rectangle; we are only drawing one horizontal line
source_rect.y = texture_y_start;
source_rect.x = texture_x_walker;
source_rect.h = 1;
// we will draw to the current y
dst_rect.y = y;
// if there are enough pixels left in the current row of the texture
// draw it all at once
if (w <= texture->w -texture_x_walker){
source_rect.w = w;
source_rect.x = texture_x_walker;
dst_rect.x= x1;
result = (SDL_BlitSurface (texture, &source_rect , dst, &dst_rect) == 0);
} else { // we need to draw multiple times
// draw the first segment
pixels_written = texture->w - texture_x_walker;
source_rect.w = pixels_written;
source_rect.x = texture_x_walker;
dst_rect.x= x1;
result |= (SDL_BlitSurface (texture, &source_rect , dst, &dst_rect) == 0);
write_width = texture->w;
// now draw the rest
// set the source x to 0
source_rect.x = 0;
while (pixels_written < w){
if (write_width >= w - pixels_written) {
write_width = w - pixels_written;
}
source_rect.w = write_width;
dst_rect.x = x1 + pixels_written;
result |= (SDL_BlitSurface (texture,&source_rect , dst, &dst_rect) == 0);
pixels_written += write_width;
}
}
return result;
}
/*!
\brief Draws a polygon filled with the given texture (Multi-Threading Capable).
This operation use internally SDL_BlitSurface for lines of the source texture. It supports
alpha drawing.
To get the best performance of this operation you need to make sure the texture and the dst surface have the same format
(see http://docs.mandragor.org/files/Common_libs_documentation/SDL/SDL_Documentation_project_en/sdlblitsurface.html).
The last two parameters are optional, but required for multithreaded operation. When set to NULL, uses global static temp array.
\param dst the destination surface,
\param vx array of x vector components
\param vy array of x vector components
\param n the amount of vectors in the vx and vy array
\param texture the sdl surface to use to fill the polygon
\param texture_dx the offset of the texture relative to the screeen. if you move the polygon 10 pixels
to the left and want the texture to apear the same you need to increase the texture_dx value
\param texture_dy see texture_dx
\param polyInts preallocated temp array storage for vertex sorting (used for multi-threaded operation)
\param polyAllocated flag indicating oif the temp array was allocated (used for multi-threaded operation)
\returns Returns 0 on success, -1 on failure.
*/
int texturedPolygonMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n,
SDL_Surface * texture, int texture_dx, int texture_dy, int **polyInts, int *polyAllocated)
{
int result;
int i;
int y, xa, xb;
int minx,maxx,miny, maxy;
int x1, y1;
int x2, y2;
int ind1, ind2;
int ints;
int *gfxPrimitivesPolyInts = NULL;
int gfxPrimitivesPolyAllocated = 0;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Sanity check number of edges
*/
if (n < 3) {
return -1;
}
/*
* Map polygon cache
*/
if ((polyInts==NULL) || (polyAllocated==NULL)) {
/* Use global cache */
gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
} else {
/* Use local cache */
gfxPrimitivesPolyInts = *polyInts;
gfxPrimitivesPolyAllocated = *polyAllocated;
}
/*
* Allocate temp array, only grow array
*/
if (!gfxPrimitivesPolyAllocated) {
gfxPrimitivesPolyInts = (int *) malloc(sizeof(int) * n);
gfxPrimitivesPolyAllocated = n;
} else {
if (gfxPrimitivesPolyAllocated < n) {
gfxPrimitivesPolyInts = (int *) realloc(gfxPrimitivesPolyInts, sizeof(int) * n);
gfxPrimitivesPolyAllocated = n;
}
}
/*
* Check temp array
*/
if (gfxPrimitivesPolyInts==NULL) {
gfxPrimitivesPolyAllocated = 0;
}
/*
* Update cache variables
*/
if ((polyInts==NULL) || (polyAllocated==NULL)) {
gfxPrimitivesPolyIntsGlobal = gfxPrimitivesPolyInts;
gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
} else {
*polyInts = gfxPrimitivesPolyInts;
*polyAllocated = gfxPrimitivesPolyAllocated;
}
/*
* Check temp array again
*/
if (gfxPrimitivesPolyInts==NULL) {
return(-1);
}
/*
* Determine X,Y minima,maxima
*/
miny = vy[0];
maxy = vy[0];
minx = vx[0];
maxx = vx[0];
for (i = 1; (i < n); i++) {
if (vy[i] < miny) {
miny = vy[i];
} else if (vy[i] > maxy) {
maxy = vy[i];
}
if (vx[i] < minx) {
minx = vx[i];
} else if (vx[i] > maxx) {
maxx = vx[i];
}
}
if (maxx <0 || minx > dst->w){
return -1;
}
if (maxy <0 || miny > dst->h){
return -1;
}
/*
* Draw, scanning y
*/
result = 0;
for (y = miny; (y <= maxy); y++) {
ints = 0;
for (i = 0; (i < n); i++) {
if (!i) {
ind1 = n - 1;
ind2 = 0;
} else {
ind1 = i - 1;
ind2 = i;
}
y1 = vy[ind1];
y2 = vy[ind2];
if (y1 < y2) {
x1 = vx[ind1];
x2 = vx[ind2];
} else if (y1 > y2) {
y2 = vy[ind1];
y1 = vy[ind2];
x2 = vx[ind1];
x1 = vx[ind2];
} else {
continue;
}
if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
}
}
qsort(gfxPrimitivesPolyInts, ints, sizeof(int), _gfxPrimitivesCompareInt);
for (i = 0; (i < ints); i += 2) {
xa = gfxPrimitivesPolyInts[i] + 1;
xa = (xa >> 16) + ((xa & 32768) >> 15);
xb = gfxPrimitivesPolyInts[i+1] - 1;
xb = (xb >> 16) + ((xb & 32768) >> 15);
result |= _HLineTextured(dst, xa, xb, y, texture, texture_dx, texture_dy);
}
}
return (result);
}
/*!
\brief Draws a polygon filled with the given texture.
This standard version is calling multithreaded versions with NULL cache parameters.
\param dst the destination surface,
\param vx array of x vector components
\param vy array of x vector components
\param n the amount of vectors in the vx and vy array
\param texture the sdl surface to use to fill the polygon
\param texture_dx the offset of the texture relative to the screeen. if you move the polygon 10 pixels
to the left and want the texture to apear the same you need to increase the texture_dx value
\param texture_dy see texture_dx
\returns Returns 0 on success, -1 on failure.
*/
int texturedPolygon(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface *texture, int texture_dx, int texture_dy)
{
/*
* Draw
*/
return (texturedPolygonMT(dst, vx, vy, n, texture, texture_dx, texture_dy, NULL, NULL));
}
/* ---- Character */
/*!
\brief Global cache for NxM pixel font surfaces created at runtime.
*/
static SDL_Surface *gfxPrimitivesFont[256];
/*!
\brief Global cache of the color used for the font surfaces created at runtime.
*/
static Uint32 gfxPrimitivesFontColor[256];
/*!
\brief Pointer to the current font data. Default is a 8x8 pixel internal font.
*/
static const unsigned char *currentFontdata = gfxPrimitivesFontdata;
/*!
\brief Width of the current font. Default is 8.
*/
static Uint32 charWidth = 8;
/*!
\brief Height of the current font. Default is 8.
*/
static Uint32 charHeight = 8;
/*!
\brief Width for rendering. Autocalculated.
*/
static Uint32 charWidthLocal = 8;
/*!
\brief Height for rendering. Autocalculated.
*/
static Uint32 charHeightLocal = 8;
/*!
\brief Pitch of the current font in bytes. Default is 1.
*/
static Uint32 charPitch = 1;
/*!
\brief Characters 90deg clockwise rotations. Default is 0. Max is 3.
*/
static Uint32 charRotation = 0;
/*!
\brief Character data size in bytes of the current font. Default is 8.
*/
static Uint32 charSize = 8;
/*!
\brief Sets or resets the current global font data.
The font data array is organized in follows:
[fontdata] = [character 0][character 1]...[character 255] where
[character n] = [byte 1 row 1][byte 2 row 1]...[byte {pitch} row 1][byte 1 row 2] ...[byte {pitch} row height] where
[byte n] = [bit 0]...[bit 7] where
[bit n] = [0 for transparent pixel|1 for colored pixel]
\param fontdata Pointer to array of font data. Set to NULL, to reset global font to the default 8x8 font.
\param cw Width of character in bytes. Ignored if fontdata==NULL.
\param ch Height of character in bytes. Ignored if fontdata==NULL.
*/
void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch)
{
int i;
if ((fontdata) && (cw) && (ch)) {
currentFontdata = fontdata;
charWidth = cw;
charHeight = ch;
} else {
currentFontdata = gfxPrimitivesFontdata;
charWidth = 8;
charHeight = 8;
}
charPitch = (charWidth+7)/8;
charSize = charPitch * charHeight;
/* Maybe flip width/height for rendering */
if ((charRotation==1) || (charRotation==3))
{
charWidthLocal = charHeight;
charHeightLocal = charWidth;
}
else
{
charWidthLocal = charWidth;
charHeightLocal = charHeight;
}
/* Clear character cache */
for (i = 0; i < 256; i++) {
if (gfxPrimitivesFont[i]) {
SDL_FreeSurface(gfxPrimitivesFont[i]);
gfxPrimitivesFont[i] = NULL;
}
}
}
/*!
\brief Sets current global font character rotation steps.
Default is 0 (no rotation). 1 = 90deg clockwise. 2 = 180deg clockwise. 3 = 270deg clockwise.
Changing the rotation, will reset the character cache.
\param rotation Number of 90deg clockwise steps to rotate
*/
void gfxPrimitivesSetFontRotation(Uint32 rotation)
{
int i;
rotation = rotation & 3;
if (charRotation != rotation)
{
/* Store rotation */
charRotation = rotation;
/* Maybe flip width/height for rendering */
if ((charRotation==1) || (charRotation==3))
{
charWidthLocal = charHeight;
charHeightLocal = charWidth;
}
else
{
charWidthLocal = charWidth;
charHeightLocal = charHeight;
}
/* Clear character cache */
for (i = 0; i < 256; i++) {
if (gfxPrimitivesFont[i]) {
SDL_FreeSurface(gfxPrimitivesFont[i]);
gfxPrimitivesFont[i] = NULL;
}
}
}
}
/*!
\brief Draw a character of the currently set font.
On first call for a particular character and color combination, the function needs to
generate the character surface (slower. Subsequent calls blit a cached surface (fast).
Uses alpha blending if A<255 in color.
\param dst The surface to draw on.
\param x X (horizontal) coordinate of the upper left corner of the character.
\param y Y (vertical) coordinate of the upper left corner of the character.
\param c The character to draw.
\param color The color value of the character to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int characterColor(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint32 color)
{
Sint16 left, right, top, bottom;
Sint16 x1, y1, x2, y2;
SDL_Rect srect;
SDL_Rect drect;
int result;
Uint32 ix, iy;
const unsigned char *charpos;
Uint8 *curpos;
int forced_redraw;
Uint8 patt, mask;
Uint8 *linepos;
Uint32 pitch;
SDL_Surface *rotatedCharacter;
Uint32 ci;
/*
* Check visibility of clipping rectangle
*/
if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
return(0);
}
/*
* Get text and clipping boundary and
* test if bounding box of character is visible
*/
left = dst->clip_rect.x;
x2 = x + charWidthLocal;
if (x2<left) {
return(0);
}
right = dst->clip_rect.x + dst->clip_rect.w - 1;
x1 = x;
if (x1>right) {
return(0);
}
top = dst->clip_rect.y;
y2 = y + charHeightLocal;
if (y2<top) {
return(0);
}
bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
y1 = y;
if (y1>bottom) {
return(0);
}
/*
* Setup source rectangle
*/
srect.x = 0;
srect.y = 0;
srect.w = charWidthLocal;
srect.h = charHeightLocal;
/*
* Setup destination rectangle
*/
drect.x = x;
drect.y = y;
drect.w = charWidthLocal;
drect.h = charHeightLocal;
/* Character index in cache */
ci = (unsigned char) c;
/*
* Create new charWidth x charHeight bitmap surface if not already present.
* Might get rotated later.
*/
if (gfxPrimitivesFont[ci] == NULL) {
gfxPrimitivesFont[ci] =
SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_HWSURFACE | SDL_SRCALPHA,
charWidth, charHeight, 32,
0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
/*
* Check pointer
*/
if (gfxPrimitivesFont[ci] == NULL) {
return (-1);
}
/*
* Definitely redraw
*/
forced_redraw = 1;
} else {
forced_redraw = 0;
}
/*
* Check if color has changed
*/
if ((gfxPrimitivesFontColor[ci] != color) || (forced_redraw)) {
/*
* Redraw character
*/
SDL_SetAlpha(gfxPrimitivesFont[ci], SDL_SRCALPHA, 255);
gfxPrimitivesFontColor[ci] = color;
/* Lock font-surface */
if (SDL_LockSurface(gfxPrimitivesFont[ci]) != 0)
return (-1);
/*
* Variable setup
*/
charpos = currentFontdata + ci * charSize;
linepos = (Uint8 *) gfxPrimitivesFont[ci]->pixels;
pitch = gfxPrimitivesFont[ci]->pitch;
/*
* Drawing loop
*/
patt = 0;
for (iy = 0; iy < charHeight; iy++) {
mask = 0x00;
curpos = linepos;
for (ix = 0; ix < charWidth; ix++) {
if (!(mask >>= 1)) {
patt = *charpos++;
mask = 0x80;
}
if (patt & mask)
*(Uint32 *)curpos = color;
else
*(Uint32 *)curpos = 0;
curpos += 4;
}
linepos += pitch;
}
/* Unlock font-surface */
SDL_UnlockSurface(gfxPrimitivesFont[ci]);
/* Maybe rotate and replace cached image */
if (charRotation>0)
{
rotatedCharacter = rotateSurface90Degrees(gfxPrimitivesFont[ci], charRotation);
SDL_FreeSurface(gfxPrimitivesFont[ci]);
gfxPrimitivesFont[ci] = rotatedCharacter;
}
}
/*
* Draw bitmap onto destination surface
*/
result = SDL_BlitSurface(gfxPrimitivesFont[ci], &srect, dst, &drect);
return (result);
}
/*!
\brief Draw a character of the currently set font.
\param dst The surface to draw on.
\param x X (horizontal) coordinate of the upper left corner of the character.
\param y Y (vertical) coordinate of the upper left corner of the character.
\param c The character to draw.
\param r The red value of the character to draw.
\param g The green value of the character to draw.
\param b The blue value of the character to draw.
\param a The alpha value of the character to draw.
\returns Returns 0 on success, -1 on failure.
*/
int characterRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (characterColor(dst, x, y, c, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/*!
\brief Draw a string in the currently set font.
The spacing between consequtive characters in the string is the fixed number of pixels
of the character width of the current global font.
\param dst The surface to draw on.
\param x X (horizontal) coordinate of the upper left corner of the string.
\param y Y (vertical) coordinate of the upper left corner of the string.
\param s The string to draw.
\param color The color value of the string to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int stringColor(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint32 color)
{
int result = 0;
Sint16 curx = x;
Sint16 cury = y;
const char *curchar = s;
while (*curchar && !result) {
result |= characterColor(dst, curx, cury, *curchar, color);
switch (charRotation)
{
case 0:
curx += charWidthLocal;
break;
case 2:
curx -= charWidthLocal;
break;
case 1:
cury += charHeightLocal;
break;
case 3:
cury -= charHeightLocal;
break;
}
curchar++;
}
return (result);
}
/*!
\brief Draw a string in the currently set font.
\param dst The surface to draw on.
\param x X (horizontal) coordinate of the upper left corner of the string.
\param y Y (vertical) coordinate of the upper left corner of the string.
\param s The string to draw.
\param r The red value of the string to draw.
\param g The green value of the string to draw.
\param b The blue value of the string to draw.
\param a The alpha value of the string to draw.
\returns Returns 0 on success, -1 on failure.
*/
int stringRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (stringColor(dst, x, y, s, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/* ---- Bezier curve */
/*!
\brief Internal function to calculate bezier interpolator of data array with ndata values at position 't'.
\param data Array of values.
\param ndata Size of array.
\param t Position for which to calculate interpolated value. t should be between [0, ndata].
\returns Interpolated value at position t, value[0] when t<0, value[n-1] when t>n.
*/
double _evaluateBezier (double *data, int ndata, double t)
{
double mu, result;
int n,k,kn,nn,nkn;
double blend,muk,munk;
/* Sanity check bounds */
if (t<0.0) {
return(data[0]);
}
if (t>=(double)ndata) {
return(data[ndata-1]);
}
/* Adjust t to the range 0.0 to 1.0 */
mu=t/(double)ndata;
/* Calculate interpolate */
n=ndata-1;
result=0.0;
muk = 1;
munk = pow(1-mu,(double)n);
for (k=0;k<=n;k++) {
nn = n;
kn = k;
nkn = n - k;
blend = muk * munk;
muk *= mu;
munk /= (1-mu);
while (nn >= 1) {
blend *= nn;
nn--;
if (kn > 1) {
blend /= (double)kn;
kn--;
}
if (nkn > 1) {
blend /= (double)nkn;
nkn--;
}
}
result += data[k] * blend;
}
return (result);
}
/*!
\brief Draw a bezier curve with alpha blending.
\param dst The surface to draw on.
\param vx Vertex array containing X coordinates of the points of the bezier curve.
\param vy Vertex array containing Y coordinates of the points of the bezier curve.
\param n Number of points in the vertex array. Minimum number is 3.
\param s Number of steps for the interpolation. Minimum number is 2.
\param color The color value of the bezier curve to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int bezierColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint32 color)
{
int result;
int i;
double *x, *y, t, stepsize;
Sint16 x1, y1, x2, y2;
/*
* Sanity check
*/
if (n < 3) {
return (-1);
}
if (s < 2) {
return (-1);
}
/*
* Variable setup
*/
stepsize=(double)1.0/(double)s;
/* Transfer vertices into float arrays */
if ((x=(double *)malloc(sizeof(double)*(n+1)))==NULL) {
return(-1);
}
if ((y=(double *)malloc(sizeof(double)*(n+1)))==NULL) {
free(x);
return(-1);
}
for (i=0; i<n; i++) {
x[i]=(double)vx[i];
y[i]=(double)vy[i];
}
x[n]=(double)vx[0];
y[n]=(double)vy[0];
/*
* Draw
*/
result = 0;
t=0.0;
x1=(Sint16)lrint(_evaluateBezier(x,n+1,t));
y1=(Sint16)lrint(_evaluateBezier(y,n+1,t));
for (i = 0; i <= (n*s); i++) {
t += stepsize;
x2=(Sint16)_evaluateBezier(x,n,t);
y2=(Sint16)_evaluateBezier(y,n,t);
result |= lineColor(dst, x1, y1, x2, y2, color);
x1 = x2;
y1 = y2;
}
/* Clean up temporary array */
free(x);
free(y);
return (result);
}
/*!
\brief Draw a bezier curve with alpha blending.
\param dst The surface to draw on.
\param vx Vertex array containing X coordinates of the points of the bezier curve.
\param vy Vertex array containing Y coordinates of the points of the bezier curve.
\param n Number of points in the vertex array. Minimum number is 3.
\param s Number of steps for the interpolation. Minimum number is 2.
\param r The red value of the bezier curve to draw.
\param g The green value of the bezier curve to draw.
\param b The blue value of the bezier curve to draw.
\param a The alpha value of the bezier curve to draw.
\returns Returns 0 on success, -1 on failure.
*/
int bezierRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
/*
* Draw
*/
return (bezierColor(dst, vx, vy, n, s, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
/*!
\brief Internal function to initialize the Bresenham line iterator.
Example of use:
SDL_gfxBresenhamIterator b;
_bresenhamInitialize (&b, x1, y1, x2, y2);
do {
plot(b.x, b.y);
} while (_bresenhamIterate(&b)==0);
\param b Pointer to struct for bresenham line drawing state.
\param x1 X coordinate of the first point of the line.
\param y1 Y coordinate of the first point of the line.
\param x2 X coordinate of the second point of the line.
\param y2 Y coordinate of the second point of the line.
\returns Returns 0 on success, -1 on failure.
*/
int _bresenhamInitialize(SDL_gfxBresenhamIterator *b, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2)
{
int temp;
if (b==NULL) {
return(-1);
}
b->x = x1;
b->y = y1;
/* dx = abs(x2-x1), s1 = sign(x2-x1) */
if ((b->dx = x2 - x1) != 0) {
if (b->dx < 0) {
b->dx = -b->dx;
b->s1 = -1;
} else {
b->s1 = 1;
}
} else {
b->s1 = 0;
}
/* dy = abs(y2-y1), s2 = sign(y2-y1) */
if ((b->dy = y2 - y1) != 0) {
if (b->dy < 0) {
b->dy = -b->dy;
b->s2 = -1;
} else {
b->s2 = 1;
}
} else {
b->s2 = 0;
}
if (b->dy > b->dx) {
temp = b->dx;
b->dx = b->dy;
b->dy = temp;
b->swapdir = 1;
} else {
b->swapdir = 0;
}
b->count = (b->dx<0) ? 0 : (unsigned int)b->dx;
b->dy <<= 1;
b->error = b->dy - b->dx;
b->dx <<= 1;
return(0);
}
/*!
\brief Internal function to move Bresenham line iterator to the next position.
Maybe updates the x and y coordinates of the iterator struct.
\param b Pointer to struct for bresenham line drawing state.
\returns Returns 0 on success, 1 if last point was reached, 2 if moving past end-of-line, -1 on failure.
*/
int _bresenhamIterate(SDL_gfxBresenhamIterator *b)
{
if (b==NULL) {
return (-1);
}
/* last point check */
if (b->count==0) {
return (2);
}
while (b->error >= 0) {
if (b->swapdir) {
b->x += b->s1;
} else {
b->y += b->s2;
}
b->error -= b->dx;
}
if (b->swapdir) {
b->y += b->s2;
} else {
b->x += b->s1;
}
b->error += b->dy;
b->count--;
/* count==0 indicates "end-of-line" */
return ((b->count) ? 0 : 1);
}
/*!
\brief Internal function to to draw parallel lines with Murphy algorithm.
\param m Pointer to struct for murphy iterator.
\param x X coordinate of point.
\param y Y coordinate of point.
\param d1 Direction square/diagonal.
*/
void _murphyParaline(SDL_gfxMurphyIterator *m, Sint16 x, Sint16 y, int d1)
{
int p;
d1 = -d1;
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(m->dst)) {
SDL_LockSurface(m->dst);
}
for (p = 0; p <= m->u; p++) {
pixelColorNolock(m->dst, x, y, m->color);
if (d1 <= m->kt) {
if (m->oct2 == 0) {
x++;
} else {
if (m->quad4 == 0) {
y++;
} else {
y--;
}
}
d1 += m->kv;
} else {
x++;
if (m->quad4 == 0) {
y++;
} else {
y--;
}
d1 += m->kd;
}
}
/* Unlock surface */
if (SDL_MUSTLOCK(m->dst)) {
SDL_UnlockSurface(m->dst);
}
m->tempx = x;
m->tempy = y;
}
/*!
\brief Internal function to to draw one iteration of the Murphy algorithm.
\param m Pointer to struct for murphy iterator.
\param miter Iteration count.
\param ml1bx X coordinate of a point.
\param ml1by Y coordinate of a point.
\param ml2bx X coordinate of a point.
\param ml2by Y coordinate of a point.
\param ml1x X coordinate of a point.
\param ml1y Y coordinate of a point.
\param ml2x X coordinate of a point.
\param ml2y Y coordinate of a point.
*/
void _murphyIteration(SDL_gfxMurphyIterator *m, Uint8 miter,
Uint16 ml1bx, Uint16 ml1by, Uint16 ml2bx, Uint16 ml2by,
Uint16 ml1x, Uint16 ml1y, Uint16 ml2x, Uint16 ml2y)
{
int atemp1, atemp2;
int ftmp1, ftmp2;
Uint16 m1x, m1y, m2x, m2y;
Uint16 fix, fiy, lax, lay, curx, cury;
Uint16 px[4], py[4];
SDL_gfxBresenhamIterator b;
if (miter > 1) {
if (m->first1x != -32768) {
fix = (m->first1x + m->first2x) / 2;
fiy = (m->first1y + m->first2y) / 2;
lax = (m->last1x + m->last2x) / 2;
lay = (m->last1y + m->last2y) / 2;
curx = (ml1x + ml2x) / 2;
cury = (ml1y + ml2y) / 2;
atemp1 = (fix - curx);
atemp2 = (fiy - cury);
ftmp1 = atemp1 * atemp1 + atemp2 * atemp2;
atemp1 = (lax - curx);
atemp2 = (lay - cury);
ftmp2 = atemp1 * atemp1 + atemp2 * atemp2;
if (ftmp1 <= ftmp2) {
m1x = m->first1x;
m1y = m->first1y;
m2x = m->first2x;
m2y = m->first2y;
} else {
m1x = m->last1x;
m1y = m->last1y;
m2x = m->last2x;
m2y = m->last2y;
}
atemp1 = (m2x - ml2x);
atemp2 = (m2y - ml2y);
ftmp1 = atemp1 * atemp1 + atemp2 * atemp2;
atemp1 = (m2x - ml2bx);
atemp2 = (m2y - ml2by);
ftmp2 = atemp1 * atemp1 + atemp2 * atemp2;
if (ftmp2 >= ftmp1) {
ftmp1 = ml2bx;
ftmp2 = ml2by;
ml2bx = ml2x;
ml2by = ml2y;
ml2x = ftmp1;
ml2y = ftmp2;
ftmp1 = ml1bx;
ftmp2 = ml1by;
ml1bx = ml1x;
ml1by = ml1y;
ml1x = ftmp1;
ml1y = ftmp2;
}
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(m->dst)) {
SDL_LockSurface(m->dst);
}
_bresenhamInitialize(&b, m2x, m2y, m1x, m1y);
do {
pixelColorNolock(m->dst, b.x, b.y, m->color);
} while (_bresenhamIterate(&b)==0);
_bresenhamInitialize(&b, m1x, m1y, ml1bx, ml1by);
do {
pixelColorNolock(m->dst, b.x, b.y, m->color);
} while (_bresenhamIterate(&b)==0);
_bresenhamInitialize(&b, ml1bx, ml1by, ml2bx, ml2by);
do {
pixelColorNolock(m->dst, b.x, b.y, m->color);
} while (_bresenhamIterate(&b)==0);
_bresenhamInitialize(&b, ml2bx, ml2by, m2x, m2y);
do {
pixelColorNolock(m->dst, b.x, b.y, m->color);
} while (_bresenhamIterate(&b)==0);
/* Unlock surface */
if (SDL_MUSTLOCK(m->dst)) {
SDL_UnlockSurface(m->dst);
}
px[0] = m1x;
px[1] = m2x;
px[2] = ml1bx;
px[3] = ml2bx;
py[0] = m1y;
py[1] = m2y;
py[2] = ml1by;
py[3] = ml2by;
polygonColor(m->dst, px, py, 4, m->color);
}
}
m->last1x = ml1x;
m->last1y = ml1y;
m->last2x = ml2x;
m->last2y = ml2y;
m->first1x = ml1bx;
m->first1y = ml1by;
m->first2x = ml2bx;
m->first2y = ml2by;
}
#define HYPOT(x,y) sqrt((double)(x)*(double)(x)+(double)(y)*(double)(y))
/*!
\brief Internal function to to draw wide lines with Murphy algorithm.
Draws lines parallel to ideal line.
\param m Pointer to struct for murphy iterator.
\param x1 X coordinate of first point.
\param y1 Y coordinate of first point.
\param x2 X coordinate of second point.
\param y2 Y coordinate of second point.
\param width Width of line.
\param miter Iteration count.
*/
void _murphyWideline(SDL_gfxMurphyIterator *m, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 miter)
{
float offset = (float)width / 2.f;
Sint16 temp;
Sint16 ptx, pty, ptxx, ptxy, ml1x, ml1y, ml2x, ml2y, ml1bx, ml1by, ml2bx, ml2by;
int d0, d1; /* difference terms d0=perpendicular to line, d1=along line */
int q; /* pel counter,q=perpendicular to line */
int tmp;
int dd; /* distance along line */
int tk; /* thickness threshold */
double ang; /* angle for initial point calculation */
double sang, cang;
/* Initialisation */
m->u = x2 - x1; /* delta x */
m->v = y2 - y1; /* delta y */
if (m->u < 0) { /* swap to make sure we are in quadrants 1 or 4 */
temp = x1;
x1 = x2;
x2 = temp;
temp = y1;
y1 = y2;
y2 = temp;
m->u *= -1;
m->v *= -1;
}
if (m->v < 0) { /* swap to 1st quadrant and flag */
m->v *= -1;
m->quad4 = 1;
} else {
m->quad4 = 0;
}
if (m->v > m->u) { /* swap things if in 2 octant */
tmp = m->u;
m->u = m->v;
m->v = tmp;
m->oct2 = 1;
} else {
m->oct2 = 0;
}
m->ku = m->u + m->u; /* change in l for square shift */
m->kv = m->v + m->v; /* change in d for square shift */
m->kd = m->kv - m->ku; /* change in d for diagonal shift */
m->kt = m->u - m->kv; /* diag/square decision threshold */
d0 = 0;
d1 = 0;
dd = 0;
ang = atan((double) m->v / (double) m->u); /* calc new initial point - offset both sides of ideal */
sang = sin(ang);
cang = cos(ang);
if (m->oct2 == 0) {
ptx = x1 + (Sint16)lrint(offset * sang);
if (m->quad4 == 0) {
pty = y1 - (Sint16)lrint(offset * cang);
} else {
pty = y1 + (Sint16)lrint(offset * cang);
}
} else {
ptx = x1 - (Sint16)lrint(offset * cang);
if (m->quad4 == 0) {
pty = y1 + (Sint16)lrint(offset * sang);
} else {
pty = y1 - (Sint16)lrint(offset * sang);
}
}
/* used here for constant thickness line */
tk = (int) (4. * HYPOT(ptx - x1, pty - y1) * HYPOT(m->u, m->v));
if (miter == 0) {
m->first1x = -32768;
m->first1y = -32768;
m->first2x = -32768;
m->first2y = -32768;
m->last1x = -32768;
m->last1y = -32768;
m->last2x = -32768;
m->last2y = -32768;
}
ptxx = ptx;
ptxy = pty;
for (q = 0; dd <= tk; q++) { /* outer loop, stepping perpendicular to line */
_murphyParaline(m, ptx, pty, d1); /* call to inner loop - right edge */
if (q == 0) {
ml1x = ptx;
ml1y = pty;
ml1bx = m->tempx;
ml1by = m->tempy;
} else {
ml2x = ptx;
ml2y = pty;
ml2bx = m->tempx;
ml2by = m->tempy;
}
if (d0 < m->kt) { /* square move */
if (m->oct2 == 0) {
if (m->quad4 == 0) {
pty++;
} else {
pty--;
}
} else {
ptx++;
}
} else { /* diagonal move */
dd += m->kv;
d0 -= m->ku;
if (d1 < m->kt) { /* normal diagonal */
if (m->oct2 == 0) {
ptx--;
if (m->quad4 == 0) {
pty++;
} else {
pty--;
}
} else {
ptx++;
if (m->quad4 == 0) {
pty--;
} else {
pty++;
}
}
d1 += m->kv;
} else { /* double square move, extra parallel line */
if (m->oct2 == 0) {
ptx--;
} else {
if (m->quad4 == 0) {
pty--;
} else {
pty++;
}
}
d1 += m->kd;
if (dd > tk) {
_murphyIteration(m, miter, ml1bx, ml1by, ml2bx, ml2by, ml1x, ml1y, ml2x, ml2y);
return; /* breakout on the extra line */
}
_murphyParaline(m, ptx, pty, d1);
if (m->oct2 == 0) {
if (m->quad4 == 0) {
pty++;
} else {
pty--;
}
} else {
ptx++;
}
}
}
dd += m->ku;
d0 += m->kv;
}
_murphyIteration(m, miter, ml1bx, ml1by, ml2bx, ml2by, ml1x, ml1y, ml2x, ml2y);
}
/*!
\brief Draw a thick line with alpha blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the line.
\param y1 Y coordinate of the first point of the line.
\param x2 X coordinate of the second point of the line.
\param y2 Y coordinate of the second point of the line.
\param width Width of the line in pixels. Must be >0.
\param color The color value of the line to draw (0xRRGGBBAA).
\returns Returns 0 on success, -1 on failure.
*/
int thickLineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint32 color)
{
int wh;
SDL_gfxMurphyIterator m;
if (dst == NULL) return -1;
if (width < 1) return -1;
/* Special case: thick "point" */
if ((x1 == x2) && (y1 == y2)) {
wh = width / 2;
return boxColor(dst, x1 - wh, y1 - wh, x2 + width, y2 + width, color);
}
m.dst = dst;
m.color = color;
_murphyWideline(&m, x1, y1, x2, y2, width, 0);
_murphyWideline(&m, x1, y1, x2, y2, width, 1);
return(0);
}
/*!
\brief Draw a thick line with alpha blending.
\param dst The surface to draw on.
\param x1 X coordinate of the first point of the line.
\param y1 Y coordinate of the first point of the line.
\param x2 X coordinate of the second point of the line.
\param y2 Y coordinate of the second point of the line.
\param width Width of the line in pixels. Must be >0.
\param r The red value of the character to draw.
\param g The green value of the character to draw.
\param b The blue value of the character to draw.
\param a The alpha value of the character to draw.
\returns Returns 0 on success, -1 on failure.
*/
int thickLineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
return (thickLineColor(dst, x1, y1, x2, y2, width,
((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a));
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/SDL_gfxPrimitives.c | C | apache-2.0 | 162,955 |
/*
SDL_gfxPrimitives.h: graphics primitives for SDL
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
#ifndef _SDL_gfxPrimitives_h
#define _SDL_gfxPrimitives_h
#include <math.h>
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
#include "SDL.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* ----- Versioning */
#define SDL_GFXPRIMITIVES_MAJOR 2
#define SDL_GFXPRIMITIVES_MINOR 0
#define SDL_GFXPRIMITIVES_MICRO 25
/* ---- Function Prototypes */
#ifdef _MSC_VER
# if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
# define SDL_GFXPRIMITIVES_SCOPE __declspec(dllexport)
# else
# ifdef LIBSDL_GFX_DLL_IMPORT
# define SDL_GFXPRIMITIVES_SCOPE __declspec(dllimport)
# endif
# endif
#endif
#ifndef SDL_GFXPRIMITIVES_SCOPE
# define SDL_GFXPRIMITIVES_SCOPE extern
#endif
/* Note: all ___Color routines expect the color to be in format 0xRRGGBBAA */
/* Pixel */
SDL_GFXPRIMITIVES_SCOPE int pixelColor(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int pixelRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Horizontal line */
SDL_GFXPRIMITIVES_SCOPE int hlineColor(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int hlineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Vertical line */
SDL_GFXPRIMITIVES_SCOPE int vlineColor(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int vlineRGBA(SDL_Surface * dst, Sint16 x, Sint16 y1, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Rectangle */
SDL_GFXPRIMITIVES_SCOPE int rectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int rectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Rounded-Corner Rectangle */
SDL_GFXPRIMITIVES_SCOPE int roundedRectangleColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int roundedRectangleRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
Sint16 x2, Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Filled rectangle (Box) */
SDL_GFXPRIMITIVES_SCOPE int boxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int boxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2,
Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Rounded-Corner Filled rectangle (Box) */
SDL_GFXPRIMITIVES_SCOPE int roundedBoxColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 rad, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int roundedBoxRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2,
Sint16 y2, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Line */
SDL_GFXPRIMITIVES_SCOPE int lineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int lineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* AA Line */
SDL_GFXPRIMITIVES_SCOPE int aalineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int aalineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1,
Sint16 x2, Sint16 y2, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Thick Line */
SDL_GFXPRIMITIVES_SCOPE int thickLineColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2,
Uint8 width, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int thickLineRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2,
Uint8 width, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Circle */
SDL_GFXPRIMITIVES_SCOPE int circleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int circleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Arc */
SDL_GFXPRIMITIVES_SCOPE int arcColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int arcRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Sint16 start, Sint16 end,
Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* AA Circle */
SDL_GFXPRIMITIVES_SCOPE int aacircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int aacircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Filled Circle */
SDL_GFXPRIMITIVES_SCOPE int filledCircleColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 r, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int filledCircleRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
Sint16 rad, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Ellipse */
SDL_GFXPRIMITIVES_SCOPE int ellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int ellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* AA Ellipse */
SDL_GFXPRIMITIVES_SCOPE int aaellipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int aaellipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Filled Ellipse */
SDL_GFXPRIMITIVES_SCOPE int filledEllipseColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rx, Sint16 ry, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int filledEllipseRGBA(SDL_Surface * dst, Sint16 x, Sint16 y,
Sint16 rx, Sint16 ry, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Pie */
SDL_GFXPRIMITIVES_SCOPE int pieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
Sint16 start, Sint16 end, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int pieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Filled Pie */
SDL_GFXPRIMITIVES_SCOPE int filledPieColor(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
Sint16 start, Sint16 end, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int filledPieRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, Sint16 rad,
Sint16 start, Sint16 end, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Trigon */
SDL_GFXPRIMITIVES_SCOPE int trigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int trigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* AA-Trigon */
SDL_GFXPRIMITIVES_SCOPE int aatrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int aatrigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Filled Trigon */
SDL_GFXPRIMITIVES_SCOPE int filledTrigonColor(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int filledTrigonRGBA(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Polygon */
SDL_GFXPRIMITIVES_SCOPE int polygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int polygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* AA-Polygon */
SDL_GFXPRIMITIVES_SCOPE int aapolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int aapolygonRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Filled Polygon */
SDL_GFXPRIMITIVES_SCOPE int filledPolygonColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBA(SDL_Surface * dst, const Sint16 * vx,
const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
SDL_GFXPRIMITIVES_SCOPE int texturedPolygon(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface * texture,int texture_dx,int texture_dy);
/* (Note: These MT versions are required for multi-threaded operation.) */
SDL_GFXPRIMITIVES_SCOPE int filledPolygonColorMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color, int **polyInts, int *polyAllocated);
SDL_GFXPRIMITIVES_SCOPE int filledPolygonRGBAMT(SDL_Surface * dst, const Sint16 * vx,
const Sint16 * vy, int n, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
int **polyInts, int *polyAllocated);
SDL_GFXPRIMITIVES_SCOPE int texturedPolygonMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, SDL_Surface * texture,int texture_dx,int texture_dy, int **polyInts, int *polyAllocated);
/* Bezier */
SDL_GFXPRIMITIVES_SCOPE int bezierColor(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, int s, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int bezierRGBA(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy,
int n, int s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Characters/Strings */
SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFont(const void *fontdata, Uint32 cw, Uint32 ch);
SDL_GFXPRIMITIVES_SCOPE void gfxPrimitivesSetFontRotation(Uint32 rotation);
SDL_GFXPRIMITIVES_SCOPE int characterColor(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int characterRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, char c, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
SDL_GFXPRIMITIVES_SCOPE int stringColor(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint32 color);
SDL_GFXPRIMITIVES_SCOPE int stringRGBA(SDL_Surface * dst, Sint16 x, Sint16 y, const char *s, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#endif /* _SDL_gfxPrimitives_h */
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/SDL_gfxPrimitives.h | C | apache-2.0 | 10,961 |
/*
SDL_imageFilter.c: byte-image "filter" routines
Copyright (C) 2001-2012 Andreas Schiffler
Copyright (C) 2013 Sylvain Beucler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
/*
Note: Uses inline x86 MMX or ASM optimizations if available and enabled.
Note: Most of the MMX code is based on published routines
by Vladimir Kravtchenko at vk@cs.ubc.ca - credits go to
him for his work.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Use GCC intrinsics if available: they support both i386 and x86_64,
provide ASM-grade performances, and lift the PUSHA/POPA issues. */
#ifdef __GNUC__
# ifdef USE_MMX
# include <mmintrin.h>
# endif
#endif
#include <SDL_cpuinfo.h>
#include "SDL_imageFilter.h"
/*!
\brief Swaps the byte order in a 32bit integer (LSB becomes MSB, etc.).
*/
#define SWAP_32(x) (((x) >> 24) | (((x) & 0x00ff0000) >> 8) | (((x) & 0x0000ff00) << 8) | ((x) << 24))
/* ------ Static variables ----- */
/*!
\brief Static state which enables the use of the MMX routines. Enabled by default
*/
static int SDL_imageFilterUseMMX = 1;
/* Detect GCC */
#if defined(__GNUC__)
#define GCC__
#endif
/*!
\brief MMX detection routine (with override flag).
\returns 1 of MMX was detected, 0 otherwise.
*/
int SDL_imageFilterMMXdetect(void)
{
/* Check override flag */
if (SDL_imageFilterUseMMX == 0) {
return (0);
}
return SDL_HasMMX();
}
/*!
\brief Disable MMX check for filter functions and and force to use non-MMX C based code.
*/
void SDL_imageFilterMMXoff()
{
SDL_imageFilterUseMMX = 0;
}
/*!
\brief Enable MMX check for filter functions and use MMX code if available.
*/
void SDL_imageFilterMMXon()
{
SDL_imageFilterUseMMX = 1;
}
/* ------------------------------------------------------------------------------------ */
/*!
\brief Internal MMX Filter using Add: D = saturation255(S1 + S2)
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterAddMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov eax, Src1 /* load Src1 address into eax */
mov ebx, Src2 /* load Src2 address into ebx */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1010:
movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
paddusb mm1, [ebx] /* mm1=Src1+Src2 (add 8 bytes with saturation) */
movq [edi], mm1 /* store result in Dest */
add eax, 8 /* increase Src1, Src2 and Dest */
add ebx, 8 /* register pointers by 8 */
add edi, 8
dec ecx /* decrease loop counter */
jnz L1010 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mSrc2 = (__m64*)Src2;
__m64 *mDest = (__m64*)Dest;
int i;
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_paddusb(*mSrc1, *mSrc2); /* Src1+Src2 (add 8 bytes with saturation) */
mSrc1++;
mSrc2++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using Add: D = saturation255(S1 + S2)
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterAdd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* Use MMX assembly routine */
SDL_imageFilterAddMMX(Src1, Src2, Dest, length);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
cursrc2 = &Src2[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
result = (int) *cursrc1 + (int) *cursrc2;
if (result > 255)
result = 255;
*curdst = (unsigned char) result;
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/*!
\brief Internal MMX Filter using Mean: D = S1/2 + S2/2
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\param Mask Mask array containing 8 bytes with 0x7F value.
]
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterMeanMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength,
unsigned char *Mask)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov edx, Mask /* load Mask address into edx */
movq mm0, [edx] /* load Mask into mm0 */
mov eax, Src1 /* load Src1 address into eax */
mov ebx, Src2 /* load Src2 address into ebx */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L21011:
movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
movq mm2, [ebx] /* load 8 bytes from Src2 into mm2 */
/* --- Byte shift via Word shift --- */
psrlw mm1, 1 /* shift 4 WORDS of mm1 1 bit to the right */
psrlw mm2, 1 /* shift 4 WORDS of mm2 1 bit to the right */
pand mm1, mm0 // apply Mask to 8 BYTES of mm1 */
/* byte 0x0f, 0xdb, 0xc8 */
pand mm2, mm0 // apply Mask to 8 BYTES of mm2 */
/* byte 0x0f, 0xdb, 0xd0 */
paddusb mm1, mm2 /* mm1=mm1+mm2 (add 8 bytes with saturation) */
movq [edi], mm1 /* store result in Dest */
add eax, 8 /* increase Src1, Src2 and Dest */
add ebx, 8 /* register pointers by 8 */
add edi, 8
dec ecx /* decrease loop counter */
jnz L21011 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mSrc2 = (__m64*)Src2;
__m64 *mDest = (__m64*)Dest;
__m64 *mMask = (__m64*)Mask;
int i;
for (i = 0; i < SrcLength/8; i++) {
__m64 mm1 = *mSrc1,
mm2 = *mSrc2;
mm1 = _m_psrlwi(mm1, 1); /* shift 4 WORDS of mm1 1 bit to the right */
mm2 = _m_psrlwi(mm2, 1); /* shift 4 WORDS of mm2 1 bit to the right */
mm1 = _m_pand(mm1, *mMask); /* apply Mask to 8 BYTES of mm1 */
mm2 = _m_pand(mm2, *mMask); /* apply Mask to 8 BYTES of mm2 */
*mDest = _m_paddusb(mm1, mm2); /* mm1+mm2 (add 8 bytes with saturation) */
mSrc1++;
mSrc2++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using Mean: D = S1/2 + S2/2
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterMean(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F };
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterMeanMMX(Src1, Src2, Dest, length, Mask);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
cursrc2 = &Src2[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
result = (int) *cursrc1 / 2 + (int) *cursrc2 / 2;
*curdst = (unsigned char) result;
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/*!
\brief Internal MMX Filter using Sub: D = saturation0(S1 - S2)
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterSubMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov eax, Src1 /* load Src1 address into eax */
mov ebx, Src2 /* load Src2 address into ebx */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1012:
movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
psubusb mm1, [ebx] /* mm1=Src1-Src2 (sub 8 bytes with saturation) */
movq [edi], mm1 /* store result in Dest */
add eax, 8 /* increase Src1, Src2 and Dest */
add ebx, 8 /* register pointers by 8 */
add edi, 8
dec ecx /* decrease loop counter */
jnz L1012 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mSrc2 = (__m64*)Src2;
__m64 *mDest = (__m64*)Dest;
int i;
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_psubusb(*mSrc1, *mSrc2); /* Src1-Src2 (sub 8 bytes with saturation) */
mSrc1++;
mSrc2++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using Sub: D = saturation0(S1 - S2)
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterSub(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterSubMMX(Src1, Src2, Dest, length);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
cursrc2 = &Src2[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
result = (int) *cursrc1 - (int) *cursrc2;
if (result < 0)
result = 0;
*curdst = (unsigned char) result;
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/*!
\brief Internal MMX Filter using AbsDiff: D = | S1 - S2 |
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterAbsDiffMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov eax, Src1 /* load Src1 address into eax */
mov ebx, Src2 /* load Src2 address into ebx */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1013:
movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
movq mm2, [ebx] /* load 8 bytes from Src2 into mm2 */
psubusb mm1, [ebx] /* mm1=Src1-Src2 (sub 8 bytes with saturation) */
psubusb mm2, [eax] /* mm2=Src2-Src1 (sub 8 bytes with saturation) */
por mm1, mm2 /* combine both mm2 and mm1 results */
movq [edi], mm1 /* store result in Dest */
add eax, 8 /* increase Src1, Src2 and Dest */
add ebx, 8 /* register pointers by 8 */
add edi, 8
dec ecx /* decrease loop counter */
jnz L1013 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mSrc2 = (__m64*)Src2;
__m64 *mDest = (__m64*)Dest;
int i;
for (i = 0; i < SrcLength/8; i++) {
__m64 mm1 = _m_psubusb(*mSrc2, *mSrc1); /* Src1-Src2 (sub 8 bytes with saturation) */
__m64 mm2 = _m_psubusb(*mSrc1, *mSrc2); /* Src2-Src1 (sub 8 bytes with saturation) */
*mDest = _m_por(mm1, mm2); /* combine both mm2 and mm1 results */
mSrc1++;
mSrc2++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using AbsDiff: D = | S1 - S2 |
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterAbsDiff(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterAbsDiffMMX(Src1, Src2, Dest, length);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
cursrc2 = &Src2[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
result = abs((int) *cursrc1 - (int) *cursrc2);
*curdst = (unsigned char) result;
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/*!
\brief Internal MMX Filter using Mult: D = saturation255(S1 * S2)
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterMultMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov eax, Src1 /* load Src1 address into eax */
mov ebx, Src2 /* load Src2 address into ebx */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
pxor mm0, mm0 /* zero mm0 register */
align 16 /* 16 byte alignment of the loop entry */
L1014:
movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
movq mm3, [ebx] /* load 8 bytes from Src2 into mm3 */
movq mm2, mm1 /* copy mm1 into mm2 */
movq mm4, mm3 /* copy mm3 into mm4 */
punpcklbw mm1, mm0 /* unpack low bytes of Src1 into words */
punpckhbw mm2, mm0 /* unpack high bytes of Src1 into words */
punpcklbw mm3, mm0 /* unpack low bytes of Src2 into words */
punpckhbw mm4, mm0 /* unpack high bytes of Src2 into words */
pmullw mm1, mm3 /* mul low bytes of Src1 and Src2 */
pmullw mm2, mm4 /* mul high bytes of Src1 and Src2 */
/* Take abs value of the results (signed words) */
movq mm5, mm1 /* copy mm1 into mm5 */
movq mm6, mm2 /* copy mm2 into mm6 */
psraw mm5, 15 /* fill mm5 words with word sign bit */
psraw mm6, 15 /* fill mm6 words with word sign bit */
pxor mm1, mm5 /* take 1's compliment of only neg. words */
pxor mm2, mm6 /* take 1's compliment of only neg. words */
psubsw mm1, mm5 /* add 1 to only neg. words, W-(-1) or W-0 */
psubsw mm2, mm6 /* add 1 to only neg. words, W-(-1) or W-0 */
packuswb mm1, mm2 /* pack words back into bytes with saturation */
movq [edi], mm1 /* store result in Dest */
add eax, 8 /* increase Src1, Src2 and Dest */
add ebx, 8 /* register pointers by 8 */
add edi, 8
dec ecx /* decrease loop counter */
jnz L1014 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 ASM with constraints: */
/* asm volatile ( */
/* "shr $3, %%ecx \n\t" /\* counter/8 (MMX loads 8 bytes at a time) *\/ */
/* "pxor %%mm0, %%mm0 \n\t" /\* zero mm0 register *\/ */
/* ".align 16 \n\t" /\* 16 byte alignment of the loop entry *\/ */
/* "1: movq (%%eax), %%mm1 \n\t" /\* load 8 bytes from Src1 into mm1 *\/ */
/* "movq (%%ebx), %%mm3 \n\t" /\* load 8 bytes from Src2 into mm3 *\/ */
/* "movq %%mm1, %%mm2 \n\t" /\* copy mm1 into mm2 *\/ */
/* "movq %%mm3, %%mm4 \n\t" /\* copy mm3 into mm4 *\/ */
/* "punpcklbw %%mm0, %%mm1 \n\t" /\* unpack low bytes of Src1 into words *\/ */
/* "punpckhbw %%mm0, %%mm2 \n\t" /\* unpack high bytes of Src1 into words *\/ */
/* "punpcklbw %%mm0, %%mm3 \n\t" /\* unpack low bytes of Src2 into words *\/ */
/* "punpckhbw %%mm0, %%mm4 \n\t" /\* unpack high bytes of Src2 into words *\/ */
/* "pmullw %%mm3, %%mm1 \n\t" /\* mul low bytes of Src1 and Src2 *\/ */
/* "pmullw %%mm4, %%mm2 \n\t" /\* mul high bytes of Src1 and Src2 *\/ */
/* /\* Take abs value of the results (signed words) *\/ */
/* "movq %%mm1, %%mm5 \n\t" /\* copy mm1 into mm5 *\/ */
/* "movq %%mm2, %%mm6 \n\t" /\* copy mm2 into mm6 *\/ */
/* "psraw $15, %%mm5 \n\t" /\* fill mm5 words with word sign bit *\/ */
/* "psraw $15, %%mm6 \n\t" /\* fill mm6 words with word sign bit *\/ */
/* "pxor %%mm5, %%mm1 \n\t" /\* take 1's compliment of only neg. words *\/ */
/* "pxor %%mm6, %%mm2 \n\t" /\* take 1's compliment of only neg. words *\/ */
/* "psubsw %%mm5, %%mm1 \n\t" /\* add 1 to only neg. words, W-(-1) or W-0 *\/ */
/* "psubsw %%mm6, %%mm2 \n\t" /\* add 1 to only neg. words, W-(-1) or W-0 *\/ */
/* "packuswb %%mm2, %%mm1 \n\t" /\* pack words back into bytes with saturation *\/ */
/* "movq %%mm1, (%%edi) \n\t" /\* store result in Dest *\/ */
/* "add $8, %%eax \n\t" /\* increase Src1, Src2 and Dest *\/ */
/* "add $8, %%ebx \n\t" /\* register pointers by 8 *\/ */
/* "add $8, %%edi \n\t" */
/* "dec %%ecx \n\t" /\* decrease loop counter *\/ */
/* "jnz 1b \n\t" /\* check loop termination, proceed if required *\/ */
/* "emms \n\t" /\* exit MMX state *\/ */
/* : "+a" (Src1), /\* load Src1 address into rax, modified by the loop *\/ */
/* "+b" (Src2), /\* load Src2 address into rbx, modified by the loop *\/ */
/* "+c" (SrcLength), /\* load loop counter (SIZE) into rcx, modified by the loop *\/ */
/* "+D" (Dest) /\* load Dest address into rdi, modified by the loop *\/ */
/* : */
/* : "memory", /\* *Dest is modified *\/ */
/* "mm0","mm1","mm2","mm3","mm4","mm5","mm6" /\* registers modified *\/ */
/* ); */
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mSrc2 = (__m64*)Src2;
__m64 *mDest = (__m64*)Dest;
__m64 mm0 = _m_from_int(0); /* zero mm0 register */
int i;
for (i = 0; i < SrcLength/8; i++) {
__m64 mm1, mm2, mm3, mm4, mm5, mm6;
mm1 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */
mm2 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */
mm3 = _m_punpcklbw(*mSrc2, mm0); /* unpack low bytes of Src2 into words */
mm4 = _m_punpckhbw(*mSrc2, mm0); /* unpack high bytes of Src2 into words */
mm1 = _m_pmullw(mm1, mm3); /* mul low bytes of Src1 and Src2 */
mm2 = _m_pmullw(mm2, mm4); /* mul high bytes of Src1 and Src2 */
mm5 = _m_psrawi(mm1, 15); /* fill mm5 words with word sign bit */
mm6 = _m_psrawi(mm2, 15); /* fill mm6 words with word sign bit */
mm1 = _m_pxor(mm1, mm5); /* take 1's compliment of only neg. words */
mm2 = _m_pxor(mm2, mm6); /* take 1's compliment of only neg. words */
mm1 = _m_psubsw(mm1, mm5); /* add 1 to only neg. words, W-(-1) or W-0 */
mm2 = _m_psubsw(mm2, mm6); /* add 1 to only neg. words, W-(-1) or W-0 */
*mDest = _m_packuswb(mm1, mm2); /* pack words back into bytes with saturation */
mSrc1++;
mSrc2++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using Mult: D = saturation255(S1 * S2)
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterMult(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterMultMMX(Src1, Src2, Dest, length);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
cursrc2 = &Src2[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
/* NOTE: this is probably wrong - dunno what the MMX code does */
result = (int) *cursrc1 * (int) *cursrc2;
if (result > 255)
result = 255;
*curdst = (unsigned char) result;
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/*!
\brief Internal ASM Filter using MultNor: D = S1 * S2
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterMultNorASM(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov edx, Src1 /* load Src1 address into edx */
mov esi, Src2 /* load Src2 address into esi */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
align 16 /* 16 byte alignment of the loop entry */
L10141:
mov al, [edx] /* load a byte from Src1 */
mul [esi] /* mul with a byte from Src2 */
mov [edi], al /* move a byte result to Dest */
inc edx /* increment Src1, Src2, Dest */
inc esi /* pointer registers by one */
inc edi
dec ecx /* decrease loop counter */
jnz L10141 /* check loop termination, proceed if required */
popa
}
#else
/* Note: ~5% gain on i386, less efficient than C on x86_64 */
/* Also depends on whether this function is static (?!) */
asm volatile (
".align 16 \n\t" /* 16 byte alignment of the loop entry */
# if defined(i386)
"1:mov (%%edx), %%al \n\t" /* load a byte from Src1 */
"mulb (%%esi) \n\t" /* mul with a byte from Src2 */
"mov %%al, (%%edi) \n\t" /* move a byte result to Dest */
"inc %%edx \n\t" /* increment Src1, Src2, Dest */
"inc %%esi \n\t" /* pointer registers by one */
"inc %%edi \n\t"
"dec %%ecx \n\t" /* decrease loop counter */
# elif defined(__x86_64__)
"1:mov (%%rdx), %%al \n\t" /* load a byte from Src1 */
"mulb (%%rsi) \n\t" /* mul with a byte from Src2 */
"mov %%al, (%%rdi) \n\t" /* move a byte result to Dest */
"inc %%rdx \n\t" /* increment Src1, Src2, Dest */
"inc %%rsi \n\t" /* pointer registers by one */
"inc %%rdi \n\t"
"dec %%rcx \n\t" /* decrease loop counter */
# endif
"jnz 1b \n\t" /* check loop termination, proceed if required */
: "+d" (Src1), /* load Src1 address into edx */
"+S" (Src2), /* load Src2 address into esi */
"+c" (SrcLength), /* load loop counter (SIZE) into ecx */
"+D" (Dest) /* load Dest address into edi */
:
: "memory", "rax"
);
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using MultNor: D = S1 * S2
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterMultNor(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if (SDL_imageFilterMMXdetect()) {
if (length > 0) {
/* ASM routine */
SDL_imageFilterMultNorASM(Src1, Src2, Dest, length);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
cursrc2 = &Src2[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* No bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
*curdst = (int)*cursrc1 * (int)*cursrc2; // (int) for efficiency
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/*!
\brief Internal MMX Filter using MultDivby2: D = saturation255(S1/2 * S2)
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterMultDivby2MMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov eax, Src1 /* load Src1 address into eax */
mov ebx, Src2 /* load Src2 address into ebx */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
pxor mm0, mm0 /* zero mm0 register */
align 16 /* 16 byte alignment of the loop entry */
L1015:
movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
movq mm3, [ebx] /* load 8 bytes from Src2 into mm3 */
movq mm2, mm1 /* copy mm1 into mm2 */
movq mm4, mm3 /* copy mm3 into mm4 */
punpcklbw mm1, mm0 /* unpack low bytes of Src1 into words */
punpckhbw mm2, mm0 /* unpack high bytes of Src1 into words */
punpcklbw mm3, mm0 /* unpack low bytes of Src2 into words */
punpckhbw mm4, mm0 /* unpack high bytes of Src2 into words */
psrlw mm1, 1 /* divide mm1 words by 2, Src1 low bytes */
psrlw mm2, 1 /* divide mm2 words by 2, Src1 high bytes */
pmullw mm1, mm3 /* mul low bytes of Src1 and Src2 */
pmullw mm2, mm4 /* mul high bytes of Src1 and Src2 */
packuswb mm1, mm2 /* pack words back into bytes with saturation */
movq [edi], mm1 /* store result in Dest */
add eax, 8 /* increase Src1, Src2 and Dest */
add ebx, 8 /* register pointers by 8 */
add edi, 8
dec ecx /* decrease loop counter */
jnz L1015 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mSrc2 = (__m64*)Src2;
__m64 *mDest = (__m64*)Dest;
__m64 mm0 = _m_from_int(0); /* zero mm0 register */
int i;
for (i = 0; i < SrcLength/8; i++) {
__m64 mm1, mm2, mm3, mm4, mm5, mm6;
mm1 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */
mm2 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */
mm3 = _m_punpcklbw(*mSrc2, mm0); /* unpack low bytes of Src2 into words */
mm4 = _m_punpckhbw(*mSrc2, mm0); /* unpack high bytes of Src2 into words */
mm1 = _m_psrlwi(mm1, 1); /* divide mm1 words by 2, Src1 low bytes */
mm2 = _m_psrlwi(mm2, 1); /* divide mm2 words by 2, Src1 high bytes */
mm1 = _m_pmullw(mm1, mm3); /* mul low bytes of Src1 and Src2 */
mm2 = _m_pmullw(mm2, mm4); /* mul high bytes of Src1 and Src2 */
*mDest = _m_packuswb(mm1, mm2); /* pack words back into bytes with saturation */
mSrc1++;
mSrc2++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using MultDivby2: D = saturation255(S1/2 * S2)
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterMultDivby2(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterMultDivby2MMX(Src1, Src2, Dest, length);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
cursrc2 = &Src2[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
result = ((int) *cursrc1 / 2) * (int) *cursrc2;
if (result > 255)
result = 255;
*curdst = (unsigned char) result;
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/*!
\brief Internal MMX Filter using MultDivby4: D = saturation255(S1/2 * S2/2)
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterMultDivby4MMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov eax, Src1 /* load Src1 address into eax */
mov ebx, Src2 /* load Src2 address into ebx */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
pxor mm0, mm0 /* zero mm0 register */
align 16 /* 16 byte alignment of the loop entry */
L1016:
movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
movq mm3, [ebx] /* load 8 bytes from Src2 into mm3 */
movq mm2, mm1 /* copy mm1 into mm2 */
movq mm4, mm3 /* copy mm3 into mm4 */
punpcklbw mm1, mm0 /* unpack low bytes of Src1 into words */
punpckhbw mm2, mm0 /* unpack high bytes of Src1 into words */
punpcklbw mm3, mm0 /* unpack low bytes of Src2 into words */
punpckhbw mm4, mm0 /* unpack high bytes of Src2 into words */
psrlw mm1, 1 /* divide mm1 words by 2, Src1 low bytes */
psrlw mm2, 1 /* divide mm2 words by 2, Src1 high bytes */
psrlw mm3, 1 /* divide mm3 words by 2, Src2 low bytes */
psrlw mm4, 1 /* divide mm4 words by 2, Src2 high bytes */
pmullw mm1, mm3 /* mul low bytes of Src1 and Src2 */
pmullw mm2, mm4 /* mul high bytes of Src1 and Src2 */
packuswb mm1, mm2 /* pack words back into bytes with saturation */
movq [edi], mm1 /* store result in Dest */
add eax, 8 /* increase Src1, Src2 and Dest */
add ebx, 8 /* register pointers by 8 */
add edi, 8
dec ecx /* decrease loop counter */
jnz L1016 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mSrc2 = (__m64*)Src2;
__m64 *mDest = (__m64*)Dest;
__m64 mm0 = _m_from_int(0); /* zero mm0 register */
int i;
for (i = 0; i < SrcLength/8; i++) {
__m64 mm1, mm2, mm3, mm4, mm5, mm6;
mm1 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */
mm2 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */
mm3 = _m_punpcklbw(*mSrc2, mm0); /* unpack low bytes of Src2 into words */
mm4 = _m_punpckhbw(*mSrc2, mm0); /* unpack high bytes of Src2 into words */
mm1 = _m_psrlwi(mm1, 1); /* divide mm1 words by 2, Src1 low bytes */
mm2 = _m_psrlwi(mm2, 1); /* divide mm2 words by 2, Src1 high bytes */
mm3 = _m_psrlwi(mm3, 1); /* divide mm3 words by 2, Src2 low bytes */
mm4 = _m_psrlwi(mm4, 1); /* divide mm4 words by 2, Src2 high bytes */
mm1 = _m_pmullw(mm1, mm3); /* mul low bytes of Src1 and Src2 */
mm2 = _m_pmullw(mm2, mm4); /* mul high bytes of Src1 and Src2 */
*mDest = _m_packuswb(mm1, mm2); /* pack words back into bytes with saturation */
mSrc1++;
mSrc2++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using MultDivby4: D = saturation255(S1/2 * S2/2)
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterMultDivby4(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterMultDivby4MMX(Src1, Src2, Dest, length);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
cursrc2 = &Src2[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
result = ((int) *cursrc1 / 2) * ((int) *cursrc2 / 2);
if (result > 255)
result = 255;
*curdst = (unsigned char) result;
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/*!
\brief Internal MMX Filter using BitAnd: D = S1 & S2
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterBitAndMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov eax, Src1 /* load Src1 address into eax */
mov ebx, Src2 /* load Src2 address into ebx */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1017:
movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
pand mm1, [ebx] /* mm1=Src1&Src2 */
movq [edi], mm1 /* store result in Dest */
add eax, 8 /* increase Src1, Src2 and Dest */
add ebx, 8 /* register pointers by 8 */
add edi, 8
dec ecx /* decrease loop counter */
jnz L1017 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* x86_64 ASM with constraints: */
/* asm volatile ( */
/* "shr $3, %%rcx \n\t" /\* counter/8 (MMX loads 8 bytes at a time) *\/ */
/* ".align 16 \n\t" /\* 16 byte alignment of the loop entry *\/ */
/* "1: movq (%%rax), %%mm1 \n\t" /\* load 8 bytes from Src1 into mm1 *\/ */
/* "pand (%%rbx), %%mm1 \n\t" /\* mm1=Src1&Src2 *\/ */
/* "movq %%mm1, (%%rdi) \n\t" /\* store result in Dest *\/ */
/* "add $8, %%rax \n\t" /\* increase Src1, Src2 and Dest *\/ */
/* "add $8, %%rbx \n\t" /\* register pointers by 8 *\/ */
/* "add $8, %%rdi \n\t" */
/* "dec %%rcx \n\t" /\* decrease loop counter *\/ */
/* "jnz 1b \n\t" /\* check loop termination, proceed if required *\/ */
/* "emms \n\t" /\* exit MMX state *\/ */
/* : "+a" (Src1), /\* load Src1 address into rax, modified by the loop *\/ */
/* "+b" (Src2), /\* load Src2 address into rbx, modified by the loop *\/ */
/* "+c" (SrcLength), /\* load loop counter (SIZE) into rcx, modified by the loop *\/ */
/* "+D" (Dest) /\* load Dest address into rdi, modified by the loop *\/ */
/* : */
/* : "memory", /\* *Dest is modified *\/ */
/* "mm1" /\* register mm1 modified *\/ */
/* ); */
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mSrc2 = (__m64*)Src2;
__m64 *mDest = (__m64*)Dest;
int i;
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_pand(*mSrc1, *mSrc2); /* Src1&Src2 */
mSrc1++;
mSrc2++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using BitAnd: D = S1 & S2
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterBitAnd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()>0) && (length>7)) {
/* if (length > 7) { */
/* Call MMX routine */
SDL_imageFilterBitAndMMX(Src1, Src2, Dest, length);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
cursrc2 = &Src2[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
*curdst = (*cursrc1) & (*cursrc2);
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/*!
\brief Internal MMX Filter using BitOr: D = S1 | S2
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterBitOrMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov eax, Src1 /* load Src1 address into eax */
mov ebx, Src2 /* load Src2 address into ebx */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L91017:
movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */
por mm1, [ebx] /* mm1=Src1|Src2 */
movq [edi], mm1 /* store result in Dest */
add eax, 8 /* increase Src1, Src2 and Dest */
add ebx, 8 /* register pointers by 8 */
add edi, 8
dec ecx /* decrease loop counter */
jnz L91017 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mSrc2 = (__m64*)Src2;
__m64 *mDest = (__m64*)Dest;
int i;
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_por(*mSrc1, *mSrc2); /* Src1|Src2 */
mSrc1++;
mSrc2++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using BitOr: D = S1 | S2
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterBitOr(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterBitOrMMX(Src1, Src2, Dest, length);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
cursrc2 = &Src2[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
*curdst = *cursrc1 | *cursrc2;
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/*!
\brief Internal ASM Filter using Div: D = S1 / S2
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterDivASM(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov edx, Src1 /* load Src1 address into edx */
mov esi, Src2 /* load Src2 address into esi */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
align 16 /* 16 byte alignment of the loop entry */
L10191:
mov bl, [esi] /* load a byte from Src2 */
cmp bl, 0 /* check if it zero */
jnz L10192
mov [edi], 255 /* division by zero = 255 !!! */
jmp L10193
L10192:
xor ah, ah /* prepare AX, zero AH register */
mov al, [edx] /* load a byte from Src1 into AL */
div bl /* divide AL by BL */
mov [edi], al /* move a byte result to Dest */
L10193:
inc edx /* increment Src1, Src2, Dest */
inc esi /* pointer registers by one */
inc edi
dec ecx /* decrease loop counter */
jnz L10191 /* check loop termination, proceed if required */
popa
}
#else
/* Note: ~15% gain on i386, less efficient than C on x86_64 */
/* Also depends on whether the function is static (?!) */
/* Also depends on whether we work on malloc() or static char[] */
asm volatile (
# if defined(i386)
"pushl %%ebx \n\t" /* %ebx may be the PIC register. */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
"1: mov (%%esi), %%bl \n\t" /* load a byte from Src2 */
"cmp $0, %%bl \n\t" /* check if it zero */
"jnz 2f \n\t"
"movb $255, (%%edi) \n\t" /* division by zero = 255 !!! */
"jmp 3f \n\t"
"2: xor %%ah, %%ah \n\t" /* prepare AX, zero AH register */
"mov (%%edx), %%al \n\t" /* load a byte from Src1 into AL */
"div %%bl \n\t" /* divide AL by BL */
"mov %%al, (%%edi) \n\t" /* move a byte result to Dest */
"3: inc %%edx \n\t" /* increment Src1, Src2, Dest */
"inc %%esi \n\t" /* pointer registers by one */
"inc %%edi \n\t"
"dec %%ecx \n\t" /* decrease loop counter */
"jnz 1b \n\t" /* check loop termination, proceed if required */
"popl %%ebx \n\t" /* restore %ebx */
: "+d" (Src1), /* load Src1 address into edx */
"+S" (Src2), /* load Src2 address into esi */
"+c" (SrcLength), /* load loop counter (SIZE) into ecx */
"+D" (Dest) /* load Dest address into edi */
:
: "memory", "rax"
# elif defined(__x86_64__)
".align 16 \n\t" /* 16 byte alignment of the loop entry */
"1: mov (%%rsi), %%bl \n\t" /* load a byte from Src2 */
"cmp $0, %%bl \n\t" /* check if it zero */
"jnz 2f \n\t"
"movb $255, (%%rdi) \n\t" /* division by zero = 255 !!! */
"jmp 3f \n\t"
"2: xor %%ah, %%ah \n\t" /* prepare AX, zero AH register */
"mov (%%rdx), %%al \n\t" /* load a byte from Src1 into AL */
"div %%bl \n\t" /* divide AL by BL */
"mov %%al, (%%rdi) \n\t" /* move a byte result to Dest */
"3: inc %%rdx \n\t" /* increment Src1, Src2, Dest */
"inc %%rsi \n\t" /* pointer registers by one */
"inc %%rdi \n\t"
"dec %%rcx \n\t" /* decrease loop counter */
"jnz 1b \n\t" /* check loop termination, proceed if required */
: "+d" (Src1), /* load Src1 address into edx */
"+S" (Src2), /* load Src2 address into esi */
"+c" (SrcLength), /* load loop counter (SIZE) into ecx */
"+D" (Dest) /* load Dest address into edi */
:
: "memory", "rax", "rbx"
# endif
);
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using Div: D = S1 / S2
\param Src1 Pointer to the start of the first source byte array (S1).
\param Src2 Pointer to the start of the second source byte array (S2).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *cursrc2, *curdst;
/* Validate input parameters */
if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if (SDL_imageFilterMMXdetect()) {
if (length > 0) {
/* Call ASM routine */
SDL_imageFilterDivASM(Src1, Src2, Dest, length);
/* Never unaligned bytes - we are done */
return (0);
} else {
return (-1);
}
}
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
cursrc2 = Src2;
curdst = Dest;
/* C routine to process image */
/* for (i = istart; i < length; i++) { */
/* if (*cursrc2 == 0) { */
/* *curdst = 255; */
/* } else { */
/* result = (int) *cursrc1 / (int) *cursrc2; */
/* *curdst = (unsigned char) result; */
/* } */
/* /\* Advance pointers *\/ */
/* cursrc1++; */
/* cursrc2++; */
/* curdst++; */
/* } */
for (i = istart; i < length; i++) {
if (*cursrc2 == 0) {
*curdst = 255;
} else {
*curdst = (int)*cursrc1 / (int)*cursrc2; // (int) for efficiency
}
/* Advance pointers */
cursrc1++;
cursrc2++;
curdst++;
}
return (0);
}
/* ------------------------------------------------------------------------------------ */
/*!
\brief Internal MMX Filter using BitNegation: D = !S
\param Src1 Pointer to the start of the source byte array (S1).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterBitNegationMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
pcmpeqb mm1, mm1 /* generate all 1's in mm1 */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L91117:
movq mm0, [eax] /* load 8 bytes from Src1 into mm1 */
pxor mm0, mm1 /* negate mm0 by xoring with mm1 */
movq [edi], mm0 /* store result in Dest */
add eax, 8 /* increase Src1, Src2 and Dest */
add edi, 8
dec ecx /* decrease loop counter */
jnz L91117 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
__m64 mm1;
mm1 = _m_pcmpeqb(mm1, mm1); /* generate all 1's in mm1 */
int i;
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_pxor(*mSrc1, mm1); /* negate mm0 by xoring with mm1 */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using BitNegation: D = !S
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterBitNegation(unsigned char *Src1, unsigned char *Dest, unsigned int length)
{
unsigned int i, istart;
unsigned char *cursrc1, *curdst;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterBitNegationMMX(Src1, Dest, length);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdst = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdst = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
*curdst = ~(*cursrc1);
/* Advance pointers */
cursrc1++;
curdst++;
}
return (0);
}
/*!
\brief Internal MMX Filter using AddByte: D = saturation255(S + C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param C Constant value to add (C).
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterAddByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
/* ** Duplicate C in 8 bytes of MM1 ** */
mov al, C /* load C into AL */
mov ah, al /* copy AL into AH */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm1, eax /* copy EAX into MM1 */
movd mm2, eax /* copy EAX into MM2 */
punpckldq mm1, mm2 /* fill higher bytes of MM1 with C */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1021:
movq mm0, [eax] /* load 8 bytes from Src1 into MM0 */
paddusb mm0, mm1 /* MM0=SrcDest+C (add 8 bytes with saturation) */
movq [edi], mm0 /* store result in Dest */
add eax, 8 /* increase Dest register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L1021 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
/* Duplicate C in 8 bytes of MM1 */
int i;
memset(&i, C, 4);
__m64 mm1 = _m_from_int(i);
__m64 mm2 = _m_from_int(i);
mm1 = _m_punpckldq(mm1, mm2); /* fill higher bytes of MM1 with C */
//__m64 mm1 = _m_from_int64(lli); // x86_64 only
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_paddusb(*mSrc1, mm1); /* Src1+C (add 8 bytes with saturation) */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using AddByte: D = saturation255(S + C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param C Constant value to add (C).
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterAddByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
{
unsigned int i, istart;
int iC;
unsigned char *cursrc1, *curdest;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
/* Special case: C==0 */
if (C == 0) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterAddByteMMX(Src1, Dest, length, C);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
iC = (int) C;
for (i = istart; i < length; i++) {
result = (int) *cursrc1 + iC;
if (result > 255)
result = 255;
*curdest = (unsigned char) result;
/* Advance pointers */
cursrc1++;
curdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param C Constant to add (C).
\param D Byteorder-swapped constant to add (Cs).
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterAddUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned int C, unsigned int D)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
/* ** Duplicate (int)C in 8 bytes of MM1 ** */
mov eax, C /* load C into EAX */
movd mm1, eax /* copy EAX into MM1 */
mov eax, D /* load D into EAX */
movd mm2, eax /* copy EAX into MM2 */
punpckldq mm1, mm2 /* fill higher bytes of MM1 with C */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L11023:
movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */
paddusb mm0, mm1 /* MM0=SrcDest+C (add 8 bytes with saturation) */
movq [edi], mm0 /* store result in SrcDest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L11023 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
/* Duplicate (int)C in 8 bytes of MM1 */
__m64 mm1 = _m_from_int(C);
__m64 mm2 = _m_from_int(C);
mm1 = _m_punpckldq(mm1, mm2); /* fill higher bytes of MM1 with C */
//__m64 mm1 = _m_from_int64(lli); // x86_64 only
int i;
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_paddusb(*mSrc1, mm1); /* Src1+C (add 8 bytes with saturation) */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param C Constant to add (C).
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
{
unsigned int i, j, istart, D;
int iC[4];
unsigned char *cursrc1;
unsigned char *curdest;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
/* Special case: C==0 */
if (C == 0) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
D=SWAP_32(C);
SDL_imageFilterAddUintMMX(Src1, Dest, length, C, D);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process bytes */
iC[3] = (int) ((C >> 24) & 0xff);
iC[2] = (int) ((C >> 16) & 0xff);
iC[1] = (int) ((C >> 8) & 0xff);
iC[0] = (int) ((C >> 0) & 0xff);
for (i = istart; i < length; i += 4) {
for (j = 0; j < 4; j++) {
if ((i+j)<length) {
result = (int) *cursrc1 + iC[j];
if (result > 255) result = 255;
*curdest = (unsigned char) result;
/* Advance pointers */
cursrc1++;
curdest++;
}
}
}
return (0);
}
/*!
\brief Internal MMX Filter using AddByteToHalf: D = saturation255(S/2 + C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param C Constant to add (C).
\param Mask Pointer to 8 mask bytes of value 0x7F.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterAddByteToHalfMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C,
unsigned char *Mask)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
/* ** Duplicate C in 8 bytes of MM1 ** */
mov al, C /* load C into AL */
mov ah, al /* copy AL into AH */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm1, eax /* copy EAX into MM1 */
movd mm2, eax /* copy EAX into MM2 */
punpckldq mm1, mm2 /* fill higher bytes of MM1 with C */
mov edx, Mask /* load Mask address into edx */
movq mm0, [edx] /* load Mask into mm0 */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1022:
movq mm2, [eax] /* load 8 bytes from Src1 into MM2 */
psrlw mm2, 1 /* shift 4 WORDS of MM2 1 bit to the right */
pand mm2, mm0 // apply Mask to 8 BYTES of MM2 */
paddusb mm2, mm1 /* MM2=SrcDest+C (add 8 bytes with saturation) */
movq [edi], mm2 /* store result in Dest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L1022 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
__m64 *mMask = (__m64*)Mask;
/* Duplicate C in 8 bytes of MM1 */
int i;
memset(&i, C, 4);
__m64 mm1 = _m_from_int(i);
__m64 mm2 = _m_from_int(i);
mm1 = _m_punpckldq(mm1, mm2); /* fill higher bytes of MM1 with C */
//__m64 mm1 = _m_from_int64(lli); // x86_64 only
for (i = 0; i < SrcLength/8; i++) {
__m64 mm2 = _m_psrlwi(*mSrc1, 1); /* shift 4 WORDS of MM2 1 bit to the right */
mm2 = _m_pand(mm2, *mMask); /* apply Mask to 8 BYTES of MM2 */
/* byte 0x0f, 0xdb, 0xd0 */
*mDest = _m_paddusb(mm1, mm2); /* Src1+C (add 8 bytes with saturation) */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using AddByteToHalf: D = saturation255(S/2 + C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param C Constant to add (C).
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterAddByteToHalf(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
{
static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F };
unsigned int i, istart;
int iC;
unsigned char *cursrc1;
unsigned char *curdest;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterAddByteToHalfMMX(Src1, Dest, length, C, Mask);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
iC = (int) C;
for (i = istart; i < length; i++) {
result = (int) (*cursrc1 / 2) + iC;
if (result > 255)
result = 255;
*curdest = (unsigned char) result;
/* Advance pointers */
cursrc1++;
curdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter using SubByte: D = saturation0(S - C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param C Constant to subtract (C).
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterSubByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
/* ** Duplicate C in 8 bytes of MM1 ** */
mov al, C /* load C into AL */
mov ah, al /* copy AL into AH */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm1, eax /* copy EAX into MM1 */
movd mm2, eax /* copy EAX into MM2 */
punpckldq mm1, mm2 /* fill higher bytes of MM1 with C */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1023:
movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */
psubusb mm0, mm1 /* MM0=SrcDest-C (sub 8 bytes with saturation) */
movq [edi], mm0 /* store result in SrcDest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L1023 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
/* Duplicate C in 8 bytes of MM1 */
int i;
memset(&i, C, 4);
__m64 mm1 = _m_from_int(i);
__m64 mm2 = _m_from_int(i);
mm1 = _m_punpckldq(mm1, mm2); /* fill higher bytes of MM1 with C */
//__m64 mm1 = _m_from_int64(lli); // x86_64 only
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_psubusb(*mSrc1, mm1); /* Src1-C (sub 8 bytes with saturation) */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using SubByte: D = saturation0(S - C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\param C Constant to subtract (C).
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterSubByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
{
unsigned int i, istart;
int iC;
unsigned char *cursrc1;
unsigned char *curdest;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
/* Special case: C==0 */
if (C == 0) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterSubByteMMX(Src1, Dest, length, C);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
iC = (int) C;
for (i = istart; i < length; i++) {
result = (int) *cursrc1 - iC;
if (result < 0)
result = 0;
*curdest = (unsigned char) result;
/* Advance pointers */
cursrc1++;
curdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param C Constant to subtract (C).
\param D Byteorder-swapped constant to subtract (Cs).
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterSubUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned int C, unsigned int D)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
/* ** Duplicate (int)C in 8 bytes of MM1 ** */
mov eax, C /* load C into EAX */
movd mm1, eax /* copy EAX into MM1 */
mov eax, D /* load D into EAX */
movd mm2, eax /* copy EAX into MM2 */
punpckldq mm1, mm2 /* fill higher bytes of MM1 with C */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L11024:
movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */
psubusb mm0, mm1 /* MM0=SrcDest-C (sub 8 bytes with saturation) */
movq [edi], mm0 /* store result in SrcDest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L11024 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
/* Duplicate (int)C in 8 bytes of MM1 */
__m64 mm1 = _m_from_int(C);
__m64 mm2 = _m_from_int(C);
mm1 = _m_punpckldq(mm1, mm2); /* fill higher bytes of MM1 with C */
//__m64 mm1 = _m_from_int64(lli); // x86_64 only
int i;
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_psubusb(*mSrc1, mm1); /* Src1-C (sub 8 bytes with saturation) */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C)
\param Src1 Pointer to the start of the source byte array (S1).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param C Constant to subtract (C).
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterSubUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C)
{
unsigned int i, j, istart, D;
int iC[4];
unsigned char *cursrc1;
unsigned char *curdest;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
/* Special case: C==0 */
if (C == 0) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
D=SWAP_32(C);
SDL_imageFilterSubUintMMX(Src1, Dest, length, C, D);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
iC[3] = (int) ((C >> 24) & 0xff);
iC[2] = (int) ((C >> 16) & 0xff);
iC[1] = (int) ((C >> 8) & 0xff);
iC[0] = (int) ((C >> 0) & 0xff);
for (i = istart; i < length; i += 4) {
for (j = 0; j < 4; j++) {
if ((i+j)<length) {
result = (int) *cursrc1 - iC[j];
if (result < 0) result = 0;
*curdest = (unsigned char) result;
/* Advance pointers */
cursrc1++;
curdest++;
}
}
}
return (0);
}
/*!
\brief Internal MMX Filter using ShiftRight: D = saturation0(S >> N)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param N Number of bit-positions to shift (N). Valid range is 0 to 8.
\param Mask Byte array containing 8 bytes with 0x7F value.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterShiftRightMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N,
unsigned char *Mask)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov edx, Mask /* load Mask address into edx */
movq mm0, [edx] /* load Mask into mm0 */
xor ecx, ecx /* zero ECX */
mov cl, N /* load loop counter (N) into CL */
movd mm3, ecx /* copy (N) into MM3 */
pcmpeqb mm1, mm1 /* generate all 1's in mm1 */
L10240: /* ** Prepare proper bit-Mask in MM1 ** */
psrlw mm1, 1 /* shift 4 WORDS of MM1 1 bit to the right */
pand mm1, mm0 // apply Mask to 8 BYTES of MM1 */
/* byte 0x0f, 0xdb, 0xc8 */
dec cl /* decrease loop counter */
jnz L10240 /* check loop termination, proceed if required */
/* ** Shift all bytes of the image ** */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L10241:
movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */
psrlw mm0, mm3 /* shift 4 WORDS of MM0 (N) bits to the right */
pand mm0, mm1 // apply proper bit-Mask to 8 BYTES of MM0 */
/* byte 0x0f, 0xdb, 0xc1 */
movq [edi], mm0 /* store result in SrcDest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L10241 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
__m64 *mMask = (__m64*)Mask;
__m64 mm1;
int i;
mm1 = _m_pcmpeqb(mm1, mm1); /* generate all 1's in mm1 */
/* Prepare proper bit-Mask in MM1 */
for (i = 0; i < N; i++) {
mm1 = _m_psrlwi(mm1, 1); /* shift 4 WORDS of MM1 1 bit to the right */
mm1 = _m_pand(mm1, *mMask); /* apply Mask to 8 BYTES of MM1 */
}
/* Shift all bytes of the image */
for (i = 0; i < SrcLength/8; i++) {
__m64 mm0 = _m_psrlwi(*mSrc1, N); /* shift 4 WORDS of MM0 (N) bits to the right */
*mDest = _m_pand(mm0, mm1); /* apply proper bit-Mask to 8 BYTES of MM0 */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using ShiftRight: D = saturation0(S >> N)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param N Number of bit-positions to shift (N). Valid range is 0 to 8.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterShiftRight(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
{
static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F };
unsigned int i, istart;
unsigned char *cursrc1;
unsigned char *curdest;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
/* Check shift */
if (N > 8) {
return (-1);
}
/* Special case: N==0 */
if (N == 0) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
/* MMX routine */
SDL_imageFilterShiftRightMMX(Src1, Dest, length, N, Mask);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
*curdest = (unsigned char) *cursrc1 >> N;
/* Advance pointers */
cursrc1++;
curdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N)
\param Src1 Pointer to the start of the source byte array (S1).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param N Number of bit-positions to shift (N).
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterShiftRightUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L13023:
movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */
psrld mm0, N
movq [edi], mm0 /* store result in SrcDest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L13023 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
int i;
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_psrldi(*mSrc1, N);
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N)
\param Src1 Pointer to the start of the source byte array (S1).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param N Number of bit-positions to shift (N). Valid range is 0 to 32.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterShiftRightUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
{
unsigned int i, istart;
unsigned char *cursrc1, *curdest;
unsigned int *icursrc1, *icurdest;
unsigned int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if (N > 32) {
return (-1);
}
/* Special case: N==0 */
if (N == 0) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
SDL_imageFilterShiftRightUintMMX(Src1, Dest, length, N);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
icursrc1=(unsigned int *)cursrc1;
icurdest=(unsigned int *)curdest;
for (i = istart; i < length; i += 4) {
if ((i+4)<length) {
result = ((unsigned int)*icursrc1 >> N);
*icurdest = result;
}
/* Advance pointers */
icursrc1++;
icurdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter using MultByByte: D = saturation255(S * C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param C Constant to multiply with (C).
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterMultByByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
/* ** Duplicate C in 4 words of MM1 ** */
mov al, C /* load C into AL */
xor ah, ah /* zero AH */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm1, eax /* copy EAX into MM1 */
movd mm2, eax /* copy EAX into MM2 */
punpckldq mm1, mm2 /* fill higher words of MM1 with C */
pxor mm0, mm0 /* zero MM0 register */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
cmp al, 128 /* if (C <= 128) execute more efficient code */
jg L10251
align 16 /* 16 byte alignment of the loop entry */
L10250:
movq mm3, [eax] /* load 8 bytes from Src1 into MM3 */
movq mm4, mm3 /* copy MM3 into MM4 */
punpcklbw mm3, mm0 /* unpack low bytes of SrcDest into words */
punpckhbw mm4, mm0 /* unpack high bytes of SrcDest into words */
pmullw mm3, mm1 /* mul low bytes of SrcDest and MM1 */
pmullw mm4, mm1 /* mul high bytes of SrcDest and MM1 */
packuswb mm3, mm4 /* pack words back into bytes with saturation */
movq [edi], mm3 /* store result in Dest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L10250 /* check loop termination, proceed if required */
jmp L10252
align 16 /* 16 byte alignment of the loop entry */
L10251:
movq mm3, [eax] /* load 8 bytes from Src1 into MM3 */
movq mm4, mm3 /* copy MM3 into MM4 */
punpcklbw mm3, mm0 /* unpack low bytes of SrcDest into words */
punpckhbw mm4, mm0 /* unpack high bytes of SrcDest into words */
pmullw mm3, mm1 /* mul low bytes of SrcDest and MM1 */
pmullw mm4, mm1 /* mul high bytes of SrcDest and MM1 */
/* ** Take abs value of the results (signed words) ** */
movq mm5, mm3 /* copy mm3 into mm5 */
movq mm6, mm4 /* copy mm4 into mm6 */
psraw mm5, 15 /* fill mm5 words with word sign bit */
psraw mm6, 15 /* fill mm6 words with word sign bit */
pxor mm3, mm5 /* take 1's compliment of only neg words */
pxor mm4, mm6 /* take 1's compliment of only neg words */
psubsw mm3, mm5 /* add 1 to only neg words, W-(-1) or W-0 */
psubsw mm4, mm6 /* add 1 to only neg words, W-(-1) or W-0 */
packuswb mm3, mm4 /* pack words back into bytes with saturation */
movq [edi], mm3 /* store result in Dest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L10251 /* check loop termination, proceed if required */
L10252:
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
__m64 mm0 = _m_from_int(0); /* zero mm0 register */
/* Duplicate C in 4 words of MM1 */
int i;
i = C | C<<16;
__m64 mm1 = _m_from_int(i);
__m64 mm2 = _m_from_int(i);
mm1 = _m_punpckldq(mm1, mm2); /* fill higher words of MM1 with C */
// long long lli = C | C<<16 | (long long)C<<32 | (long long)C<<48;
//__m64 mm1 = _m_from_int64(lli); // x86_64 only
if (C <= 128) { /* if (C <= 128) execute more efficient code */
for (i = 0; i < SrcLength/8; i++) {
__m64 mm3, mm4;
mm3 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */
mm4 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */
mm3 = _m_pmullw(mm3, mm1); /* mul low bytes of Src1 and MM1 */
mm4 = _m_pmullw(mm4, mm1); /* mul high bytes of Src1 and MM1 */
*mDest = _m_packuswb(mm3, mm4); /* pack words back into bytes with saturation */
mSrc1++;
mDest++;
}
} else {
for (i = 0; i < SrcLength/8; i++) {
__m64 mm3, mm4, mm5, mm6;
mm3 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */
mm4 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */
mm3 = _m_pmullw(mm3, mm1); /* mul low bytes of Src1 and MM1 */
mm4 = _m_pmullw(mm4, mm1); /* mul high bytes of Src1 and MM1 */
/* Take abs value of the results (signed words) */
mm5 = _m_psrawi(mm3, 15); /* fill mm5 words with word sign bit */
mm6 = _m_psrawi(mm4, 15); /* fill mm6 words with word sign bit */
mm3 = _m_pxor(mm3, mm5); /* take 1's compliment of only neg. words */
mm4 = _m_pxor(mm4, mm6); /* take 1's compliment of only neg. words */
mm3 = _m_psubsw(mm3, mm5); /* add 1 to only neg. words, W-(-1) or W-0 */
mm4 = _m_psubsw(mm4, mm6); /* add 1 to only neg. words, W-(-1) or W-0 */
*mDest = _m_packuswb(mm3, mm4); /* pack words back into bytes with saturation */
mSrc1++;
mDest++;
}
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using MultByByte: D = saturation255(S * C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\param C Constant to multiply with (C).
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C)
{
unsigned int i, istart;
int iC;
unsigned char *cursrc1;
unsigned char *curdest;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
/* Special case: C==1 */
if (C == 1) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
SDL_imageFilterMultByByteMMX(Src1, Dest, length, C);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
iC = (int) C;
for (i = istart; i < length; i++) {
result = (int) *cursrc1 * iC;
if (result > 255)
result = 255;
*curdest = (unsigned char) result;
/* Advance pointers */
cursrc1++;
curdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter using ShiftRightAndMultByByteMMX: D = saturation255((S >> N) * C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param N Number of bit-positions to shift (N). Valid range is 0 to 8.
\param C Constant to multiply with (C).
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterShiftRightAndMultByByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N,
unsigned char C)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
/* ** Duplicate C in 4 words of MM1 ** */
mov al, C /* load C into AL */
xor ah, ah /* zero AH */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm1, eax /* copy EAX into MM1 */
movd mm2, eax /* copy EAX into MM2 */
punpckldq mm1, mm2 /* fill higher words of MM1 with C */
xor ecx, ecx /* zero ECX */
mov cl, N /* load N into CL */
movd mm7, ecx /* copy N into MM7 */
pxor mm0, mm0 /* zero MM0 register */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1026:
movq mm3, [eax] /* load 8 bytes from Src1 into MM3 */
movq mm4, mm3 /* copy MM3 into MM4 */
punpcklbw mm3, mm0 /* unpack low bytes of SrcDest into words */
punpckhbw mm4, mm0 /* unpack high bytes of SrcDest into words */
psrlw mm3, mm7 /* shift 4 WORDS of MM3 (N) bits to the right */
psrlw mm4, mm7 /* shift 4 WORDS of MM4 (N) bits to the right */
pmullw mm3, mm1 /* mul low bytes of SrcDest by MM1 */
pmullw mm4, mm1 /* mul high bytes of SrcDest by MM1 */
packuswb mm3, mm4 /* pack words back into bytes with saturation */
movq [edi], mm3 /* store result in Dest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L1026 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
__m64 mm0 = _m_from_int(0); /* zero mm0 register */
/* Duplicate C in 4 words of MM1 */
int i;
i = (C<<16)|C;
__m64 mm1 = _m_from_int(i);
__m64 mm2 = _m_from_int(i);
mm1 = _m_punpckldq(mm1, mm2); /* fill higher words of MM1 with C */
for (i = 0; i < SrcLength/8; i++) {
__m64 mm3, mm4, mm5, mm6;
mm3 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */
mm4 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */
mm3 = _m_psrlwi(mm3, N); /* shift 4 WORDS of MM3 (N) bits to the right */
mm4 = _m_psrlwi(mm4, N); /* shift 4 WORDS of MM4 (N) bits to the right */
mm3 = _m_pmullw(mm3, mm1); /* mul low bytes of Src1 and MM1 */
mm4 = _m_pmullw(mm4, mm1); /* mul high bytes of Src1 and MM1 */
*mDest = _m_packuswb(mm3, mm4); /* pack words back into bytes with saturation */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using ShiftRightAndMultByByte: D = saturation255((S >> N) * C)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param N Number of bit-positions to shift (N). Valid range is 0 to 8.
\param C Constant to multiply with (C).
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterShiftRightAndMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N,
unsigned char C)
{
unsigned int i, istart;
int iC;
unsigned char *cursrc1;
unsigned char *curdest;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
/* Check shift */
if (N > 8) {
return (-1);
}
/* Special case: N==0 && C==1 */
if ((N == 0) && (C == 1)) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
SDL_imageFilterShiftRightAndMultByByteMMX(Src1, Dest, length, N, C);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
iC = (int) C;
for (i = istart; i < length; i++) {
result = (int) (*cursrc1 >> N) * iC;
if (result > 255)
result = 255;
*curdest = (unsigned char) result;
/* Advance pointers */
cursrc1++;
curdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter using ShiftLeftByte: D = (S << N)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source arrays.
\param N Number of bit-positions to shift (N). Valid range is 0 to 8.
\param Mask Byte array containing 8 bytes of 0xFE value.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterShiftLeftByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N,
unsigned char *Mask)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov edx, Mask /* load Mask address into edx */
movq mm0, [edx] /* load Mask into mm0 */
xor ecx, ecx /* zero ECX */
mov cl, N /* load loop counter (N) into CL */
movd mm3, ecx /* copy (N) into MM3 */
pcmpeqb mm1, mm1 /* generate all 1's in mm1 */
L10270: /* ** Prepare proper bit-Mask in MM1 ** */
psllw mm1, 1 /* shift 4 WORDS of MM1 1 bit to the left */
pand mm1, mm0 // apply Mask to 8 BYTES of MM1 */
/* byte 0x0f, 0xdb, 0xc8 */
dec cl /* decrease loop counter */
jnz L10270 /* check loop termination, proceed if required */
/* ** Shift all bytes of the image ** */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load SrcDest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L10271:
movq mm0, [eax] /* load 8 bytes from Src1 into MM0 */
psllw mm0, mm3 /* shift 4 WORDS of MM0 (N) bits to the left */
pand mm0, mm1 // apply proper bit-Mask to 8 BYTES of MM0 */
/* byte 0x0f, 0xdb, 0xc1 */
movq [edi], mm0 /* store result in Dest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L10271 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
__m64 *mMask = (__m64*)Mask;
__m64 mm1;
int i;
mm1 = _m_pcmpeqb(mm1, mm1); /* generate all 1's in mm1 */
/* Prepare proper bit-Mask in MM1 */
for (i = 0; i < N; i++) {
mm1 = _m_psllwi(mm1, 1); /* shift 4 WORDS of MM1 1 bit to the left */
mm1 = _m_pand(mm1, *mMask); /* apply Mask to 8 BYTES of MM1 */
}
/* ** Shift all bytes of the image ** */
for (i = 0; i < SrcLength/8; i++) {
__m64 mm0 = _m_psllwi(*mSrc1, N); /* shift 4 WORDS of MM0 (N) bits to the left */
*mDest = _m_pand(mm0, mm1); /* apply proper bit-Mask to 8 BYTES of MM0 */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using ShiftLeftByte: D = (S << N)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source arrays.
\param N Number of bit-positions to shift (N). Valid range is 0 to 8.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterShiftLeftByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
{
static unsigned char Mask[8] = { 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE };
unsigned int i, istart;
unsigned char *cursrc1, *curdest;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if (N > 8) {
return (-1);
}
/* Special case: N==0 */
if (N == 0) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
SDL_imageFilterShiftLeftByteMMX(Src1, Dest, length, N, Mask);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
result = ((int) *cursrc1 << N) & 0xff;
*curdest = (unsigned char) result;
/* Advance pointers */
cursrc1++;
curdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter using ShiftLeftUint: D = ((uint)S << N)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param N Number of bit-positions to shift (N). Valid range is 0 to 32.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterShiftLeftUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L12023:
movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */
pslld mm0, N /* MM0=SrcDest+C (add 8 bytes with saturation) */
movq [edi], mm0 /* store result in SrcDest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L12023 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
int i;
for (i = 0; i < SrcLength/8; i++) {
*mDest = _m_pslldi(*mSrc1, N); /* Src1+C (add 8 bytes with saturation) */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using ShiftLeftUint: D = ((uint)S << N)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param N Number of bit-positions to shift (N). Valid range is 0 to 32.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterShiftLeftUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
{
unsigned int i, istart;
unsigned char *cursrc1, *curdest;
unsigned int *icursrc1, *icurdest;
unsigned int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if (N > 32) {
return (-1);
}
/* Special case: N==0 */
if (N == 0) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
SDL_imageFilterShiftLeftUintMMX(Src1, Dest, length, N);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
icursrc1=(unsigned int *)cursrc1;
icurdest=(unsigned int *)curdest;
for (i = istart; i < length; i += 4) {
if ((i+4)<length) {
result = ((unsigned int)*icursrc1 << N);
*icurdest = result;
}
/* Advance pointers */
icursrc1++;
icurdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter ShiftLeft: D = saturation255(S << N)
\param Src1 Pointer to the start of the source byte array (S1).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param N Number of bit-positions to shift (N). Valid range is 0 to 8.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterShiftLeftMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
xor eax, eax /* zero EAX */
mov al, N /* load N into AL */
movd mm7, eax /* copy N into MM7 */
pxor mm0, mm0 /* zero MM0 register */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
cmp al, 7 /* if (N <= 7) execute more efficient code */
jg L10281
align 16 /* 16 byte alignment of the loop entry */
L10280:
movq mm3, [eax] /* load 8 bytes from Src1 into MM3 */
movq mm4, mm3 /* copy MM3 into MM4 */
punpcklbw mm3, mm0 /* unpack low bytes of SrcDest into words */
punpckhbw mm4, mm0 /* unpack high bytes of SrcDest into words */
psllw mm3, mm7 /* shift 4 WORDS of MM3 (N) bits to the left */
psllw mm4, mm7 /* shift 4 WORDS of MM4 (N) bits to the left */
packuswb mm3, mm4 /* pack words back into bytes with saturation */
movq [edi], mm3 /* store result in Dest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L10280 /* check loop termination, proceed if required */
jmp L10282
align 16 /* 16 byte alignment of the loop entry */
L10281:
movq mm3, [eax] /* load 8 bytes from Src1 into MM3 */
movq mm4, mm3 /* copy MM3 into MM4 */
punpcklbw mm3, mm0 /* unpack low bytes of SrcDest into words */
punpckhbw mm4, mm0 /* unpack high bytes of SrcDest into words */
psllw mm3, mm7 /* shift 4 WORDS of MM3 (N) bits to the left */
psllw mm4, mm7 /* shift 4 WORDS of MM4 (N) bits to the left */
/* ** Take abs value of the signed words ** */
movq mm5, mm3 /* copy mm3 into mm5 */
movq mm6, mm4 /* copy mm4 into mm6 */
psraw mm5, 15 /* fill mm5 words with word sign bit */
psraw mm6, 15 /* fill mm6 words with word sign bit */
pxor mm3, mm5 /* take 1's compliment of only neg words */
pxor mm4, mm6 /* take 1's compliment of only neg words */
psubsw mm3, mm5 /* add 1 to only neg words, W-(-1) or W-0 */
psubsw mm4, mm6 /* add 1 to only neg words, W-(-1) or W-0 */
packuswb mm3, mm4 /* pack words back into bytes with saturation */
movq [edi], mm3 /* store result in Dest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L10281 /* check loop termination, proceed if required */
L10282:
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
__m64 mm0 = _m_from_int(0); /* zero mm0 register */
int i;
if (N <= 7) { /* if (N <= 7) execute more efficient code */
for (i = 0; i < SrcLength/8; i++) {
__m64 mm3, mm4;
mm3 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */
mm4 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */
mm3 = _m_psllwi(mm3, N); /* shift 4 WORDS of MM3 (N) bits to the left */
mm4 = _m_psllwi(mm4, N); /* shift 4 WORDS of MM4 (N) bits to the left */
*mDest = _m_packuswb(mm3, mm4); /* pack words back into bytes with saturation */
mSrc1++;
mDest++;
}
} else {
for (i = 0; i < SrcLength/8; i++) {
__m64 mm3, mm4, mm5, mm6;
mm3 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */
mm4 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */
mm3 = _m_psllwi(mm3, N); /* shift 4 WORDS of MM3 (N) bits to the left */
mm4 = _m_psllwi(mm4, N); /* shift 4 WORDS of MM4 (N) bits to the left */
/* Take abs value of the signed words */
mm5 = _m_psrawi(mm3, 15); /* fill mm5 words with word sign bit */
mm6 = _m_psrawi(mm4, 15); /* fill mm6 words with word sign bit */
mm3 = _m_pxor(mm3, mm5); /* take 1's compliment of only neg. words */
mm4 = _m_pxor(mm4, mm6); /* take 1's compliment of only neg. words */
mm3 = _m_psubsw(mm3, mm5); /* add 1 to only neg. words, W-(-1) or W-0 */
mm4 = _m_psubsw(mm4, mm6); /* add 1 to only neg. words, W-(-1) or W-0 */
*mDest = _m_packuswb(mm3, mm4); /* pack words back into bytes with saturation */
mSrc1++;
mDest++;
}
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter ShiftLeft: D = saturation255(S << N)
\param Src1 Pointer to the start of the source byte array (S1).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param N Number of bit-positions to shift (N). Valid range is 0 to 8.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterShiftLeft(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N)
{
unsigned int i, istart;
unsigned char *cursrc1, *curdest;
int result;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if (N > 8) {
return (-1);
}
/* Special case: N==0 */
if (N == 0) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
SDL_imageFilterShiftLeftMMX(Src1, Dest, length, N);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
result = (int) *cursrc1 << N;
if (result > 255)
result = 255;
*curdest = (unsigned char) result;
/* Advance pointers */
cursrc1++;
curdest++;
}
return (0);
}
/*!
\brief MMX BinarizeUsingThreshold: D = (S >= T) ? 255:0
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param T The threshold boundary (inclusive).
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterBinarizeUsingThresholdMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char T)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
/* ** Duplicate T in 8 bytes of MM3 ** */
pcmpeqb mm1, mm1 /* generate all 1's in mm1 */
pcmpeqb mm2, mm2 /* generate all 1's in mm2 */
mov al, T /* load T into AL */
mov ah, al /* copy AL into AH */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm3, eax /* copy EAX into MM3 */
movd mm4, eax /* copy EAX into MM4 */
punpckldq mm3, mm4 /* fill higher bytes of MM3 with T */
psubusb mm2, mm3 /* store 0xFF - T in MM2 */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1029:
movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */
paddusb mm0, mm2 /* MM0=SrcDest+(0xFF-T) (add 8 bytes with saturation) */
pcmpeqb mm0, mm1 /* binarize 255:0, comparing to 255 */
movq [edi], mm0 /* store result in SrcDest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L1029 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
/* Duplicate T in 8 bytes of MM3 */
__m64 mm1 = _m_pcmpeqb(mm1, mm1); /* generate all 1's in mm1 */
__m64 mm2 = _m_pcmpeqb(mm2, mm2); /* generate all 1's in mm1 */
int i;
memset(&i, T, 4);
__m64 mm3 = _m_from_int(i);
__m64 mm4 = _m_from_int(i);
mm3 = _m_punpckldq(mm3, mm4); /* fill higher bytes of MM3 with T */
mm2 = _m_psubusb(mm2, mm3); /* store 0xFF - T in MM2 */
//__m64 mm3 = _m_from_int64(lli); // x86_64 only
for (i = 0; i < SrcLength/8; i++) {
__m64 mm0 = _m_paddusb(*mSrc1, mm2); /* Src1+(0xFF-T) (add 8 bytes with saturation) */
*mDest = _m_pcmpeqb(mm0, mm1); /* binarize 255:0, comparing to 255 */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using BinarizeUsingThreshold: D = (S >= T) ? 255:0
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param T The threshold boundary (inclusive).
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterBinarizeUsingThreshold(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T)
{
unsigned int i, istart;
unsigned char *cursrc1;
unsigned char *curdest;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
/* Special case: T==0 */
if (T == 0) {
memset(Dest, 255, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
SDL_imageFilterBinarizeUsingThresholdMMX(Src1, Dest, length, T);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
*curdest = (unsigned char)(((unsigned char)*cursrc1 >= T) ? 255 : 0);
/* Advance pointers */
cursrc1++;
curdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param Tmin Lower (inclusive) boundary of the clipping range.
\param Tmax Upper (inclusive) boundary of the clipping range.
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterClipToRangeMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char Tmin,
unsigned char Tmax)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
pcmpeqb mm1, mm1 /* generate all 1's in mm1 */
/* ** Duplicate Tmax in 8 bytes of MM3 ** */
mov al, Tmax /* load Tmax into AL */
mov ah, al /* copy AL into AH */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm3, eax /* copy EAX into MM3 */
movd mm4, eax /* copy EAX into MM4 */
punpckldq mm3, mm4 /* fill higher bytes of MM3 with Tmax */
psubusb mm1, mm3 /* store 0xFF - Tmax in MM1 */
/* ** Duplicate Tmin in 8 bytes of MM5 ** */
mov al, Tmin /* load Tmin into AL */
mov ah, al /* copy AL into AH */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm5, eax /* copy EAX into MM5 */
movd mm4, eax /* copy EAX into MM4 */
punpckldq mm5, mm4 /* fill higher bytes of MM5 with Tmin */
movq mm7, mm5 /* copy MM5 into MM7 */
paddusb mm7, mm1 /* store 0xFF - Tmax + Tmin in MM7 */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1030:
movq mm0, [eax] /* load 8 bytes from Src1 into MM0 */
paddusb mm0, mm1 /* MM0=SrcDest+(0xFF-Tmax) */
psubusb mm0, mm7 /* MM0=MM0-(0xFF-Tmax+Tmin) */
paddusb mm0, mm5 /* MM0=MM0+Tmin */
movq [edi], mm0 /* store result in Dest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L1030 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
__m64 mm1 = _m_pcmpeqb(mm1, mm1); /* generate all 1's in mm1 */
int i;
/* Duplicate Tmax in 8 bytes of MM3 */
__m64 mm3, mm4;
memset(&i, Tmax, 4);
mm3 = _m_from_int(i);
mm4 = _m_from_int(i);
mm3 = _m_punpckldq(mm3, mm4); /* fill higher bytes of MM3 with Tmax */
mm1 = _m_psubusb(mm1, mm3); /* store 0xFF - Tmax in MM1 */
//__m64 mm3 = _m_from_int64(lli); // x86_64 only
/* Duplicate Tmax in 8 bytes of MM3 */
__m64 mm5, mm7;
memset(&i, Tmin, 4);
mm5 = _m_from_int(i);
mm4 = _m_from_int(i);
mm5 = _m_punpckldq(mm5, mm4); /* fill higher bytes of MM5 with Tmin */
mm7 = _m_paddusb(mm5, mm1); /* store 0xFF - Tmax + Tmin in MM7 */
for (i = 0; i < SrcLength/8; i++) {
__m64 mm0;
mm0 = _m_paddusb(*mSrc1, mm1); /* MM0=Src1+(0xFF-Tmax) */
mm0 = _m_psubusb(mm0, mm7); /* MM0=MM0-(0xFF-Tmax+Tmin) */
*mDest = _m_paddusb(mm0, mm5); /* MM0+Tmin */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param Tmin Lower (inclusive) boundary of the clipping range.
\param Tmax Upper (inclusive) boundary of the clipping range.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterClipToRange(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin,
unsigned char Tmax)
{
unsigned int i, istart;
unsigned char *cursrc1;
unsigned char *curdest;
/* Validate input parameters */
if ((Src1 == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
/* Special case: Tmin==0 && Tmax = 255 */
if ((Tmin == 0) && (Tmax == 25)) {
memcpy(Src1, Dest, length);
return (0);
}
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
SDL_imageFilterClipToRangeMMX(Src1, Dest, length, Tmin, Tmax);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc1 = &Src1[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc1 = Src1;
curdest = Dest;
}
/* C routine to process image */
for (i = istart; i < length; i++) {
if (*cursrc1 < Tmin) {
*curdest = Tmin;
} else if (*cursrc1 > Tmax) {
*curdest = Tmax;
} else {
*curdest = *cursrc1;
}
/* Advance pointers */
cursrc1++;
curdest++;
}
return (0);
}
/*!
\brief Internal MMX Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
\param Src1 Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param SrcLength The number of bytes in the source array.
\param Cmin Normalization constant (Cmin).
\param Cmax Normalization constant (Cmax).
\param Nmin Normalization constant (Nmin).
\param Nmax Normalization constant (Nmax).
\return Returns 0 for success or -1 for error.
*/
static int SDL_imageFilterNormalizeLinearMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, int Cmin, int Cmax,
int Nmin, int Nmax)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{
pusha
mov ax, WORD PTR Nmax /* load Nmax in AX */
mov bx, WORD PTR Cmax /* load Cmax in BX */
sub ax, WORD PTR Nmin /* AX = Nmax - Nmin */
sub bx, WORD PTR Cmin /* BX = Cmax - Cmin */
jz L10311 /* check division by zero */
xor dx, dx /* prepare for division, zero DX */
div bx /* AX = AX/BX */
jmp L10312
L10311:
mov ax, 255 /* if div by zero, assume result max byte value */
L10312: /* ** Duplicate AX in 4 words of MM0 ** */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm0, eax /* copy EAX into MM0 */
movd mm1, eax /* copy EAX into MM1 */
punpckldq mm0, mm1 /* fill higher words of MM0 with AX */
/* ** Duplicate Cmin in 4 words of MM1 ** */
mov ax, WORD PTR Cmin /* load Cmin into AX */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm1, eax /* copy EAX into MM1 */
movd mm2, eax /* copy EAX into MM2 */
punpckldq mm1, mm2 /* fill higher words of MM1 with Cmin */
/* ** Duplicate Nmin in 4 words of MM2 ** */
mov ax, WORD PTR Nmin /* load Nmin into AX */
mov bx, ax /* copy AX into BX */
shl eax, 16 /* shift 2 bytes of EAX left */
mov ax, bx /* copy BX into AX */
movd mm2, eax /* copy EAX into MM2 */
movd mm3, eax /* copy EAX into MM3 */
punpckldq mm2, mm3 /* fill higher words of MM2 with Nmin */
pxor mm7, mm7 /* zero MM7 register */
mov eax, Src1 /* load Src1 address into eax */
mov edi, Dest /* load Dest address into edi */
mov ecx, SrcLength /* load loop counter (SIZE) into ecx */
shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */
align 16 /* 16 byte alignment of the loop entry */
L1031:
movq mm3, [eax] /* load 8 bytes from Src1 into MM3 */
movq mm4, mm3 /* copy MM3 into MM4 */
punpcklbw mm3, mm7 /* unpack low bytes of SrcDest into words */
punpckhbw mm4, mm7 /* unpack high bytes of SrcDest into words */
psubusb mm3, mm1 /* S-Cmin, low bytes */
psubusb mm4, mm1 /* S-Cmin, high bytes */
pmullw mm3, mm0 /* MM0*(S-Cmin), low bytes */
pmullw mm4, mm0 /* MM0*(S-Cmin), high bytes */
paddusb mm3, mm2 /* MM0*(S-Cmin)+Nmin, low bytes */
paddusb mm4, mm2 /* MM0*(S-Cmin)+Nmin, high bytes */
/* ** Take abs value of the signed words ** */
movq mm5, mm3 /* copy mm3 into mm5 */
movq mm6, mm4 /* copy mm4 into mm6 */
psraw mm5, 15 /* fill mm5 words with word sign bit */
psraw mm6, 15 /* fill mm6 words with word sign bit */
pxor mm3, mm5 /* take 1's compliment of only neg words */
pxor mm4, mm6 /* take 1's compliment of only neg words */
psubsw mm3, mm5 /* add 1 to only neg words, W-(-1) or W-0 */
psubsw mm4, mm6 /* add 1 to only neg words, W-(-1) or W-0 */
packuswb mm3, mm4 /* pack words back into bytes with saturation */
movq [edi], mm3 /* store result in Dest */
add eax, 8 /* increase Src1 register pointer by 8 */
add edi, 8 /* increase Dest register pointer by 8 */
dec ecx /* decrease loop counter */
jnz L1031 /* check loop termination, proceed if required */
emms /* exit MMX state */
popa
}
#else
/* i386 and x86_64 */
__m64 *mSrc1 = (__m64*)Src1;
__m64 *mDest = (__m64*)Dest;
__m64 mm0, mm1, mm2, mm3;
int i;
/* Duplicate (Nmax-Nmin)/(Cmax-Cmin) in 4 words of MM0 */
unsigned short a = Nmax - Nmin;
unsigned short b = Cmax - Cmin;
if (b == 0) {
a = 255;
} else {
a /= b;
}
i = (a<<16)|a;
mm0 = _m_from_int(i);
mm1 = _m_from_int(i);
mm0 = _m_punpckldq(mm0, mm1); /* fill higher words of MM0 with AX */
/* Duplicate Cmin in 4 words of MM1 */
i = (Cmin<<16)|(short)Cmin;
mm1 = _m_from_int(i);
mm2 = _m_from_int(i);
mm1 = _m_punpckldq(mm1, mm2); /* fill higher words of MM1 with Cmin */
/* Duplicate Nmin in 4 words of MM2 */
i = (Nmin<<16)|(short)Nmin;
mm2 = _m_from_int(i);
mm3 = _m_from_int(i);
mm2 = _m_punpckldq(mm2, mm3); /* fill higher words of MM2 with Nmin */
__m64 mm7 = _m_from_int(0); /* zero mm0 register */
for (i = 0; i < SrcLength/8; i++) {
__m64 mm3, mm4, mm5, mm6;
mm3 = _m_punpcklbw(*mSrc1, mm7); /* unpack low bytes of Src1 into words */
mm4 = _m_punpckhbw(*mSrc1, mm7); /* unpack high bytes of Src1 into words */
mm3 = _m_psubusb(mm3, mm1); /* S-Cmin, low bytes */
mm4 = _m_psubusb(mm4, mm1); /* S-Cmin, high bytes */
mm3 = _m_pmullw(mm3, mm0); /* MM0*(S-Cmin), low bytes */
mm4 = _m_pmullw(mm4, mm0); /* MM0*(S-Cmin), high bytes */
mm3 = _m_paddusb(mm3, mm2); /* MM0*(S-Cmin)+Nmin, low bytes */
mm4 = _m_paddusb(mm4, mm2); /* MM0*(S-Cmin)+Nmin, high bytes */
/* Take abs value of the signed words */
mm5 = _m_psrawi(mm3, 15); /* fill mm5 words with word sign bit */
mm6 = _m_psrawi(mm4, 15); /* fill mm6 words with word sign bit */
mm3 = _m_pxor(mm3, mm5); /* take 1's compliment of only neg. words */
mm4 = _m_pxor(mm4, mm6); /* take 1's compliment of only neg. words */
mm3 = _m_psubsw(mm3, mm5); /* add 1 to only neg. words, W-(-1) or W-0 */
mm4 = _m_psubsw(mm4, mm6); /* add 1 to only neg. words, W-(-1) or W-0 */
*mDest = _m_packuswb(mm3, mm4); /* pack words back into bytes with saturation */
mSrc1++;
mDest++;
}
_m_empty(); /* clean MMX state */
#endif
return (0);
#else
return (-1);
#endif
}
/*!
\brief Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
\param Src Pointer to the start of the source byte array (S).
\param Dest Pointer to the start of the destination byte array (D).
\param length The number of bytes in the source array.
\param Cmin Normalization constant.
\param Cmax Normalization constant.
\param Nmin Normalization constant.
\param Nmax Normalization constant.
\return Returns 0 for success or -1 for error.
*/
int SDL_imageFilterNormalizeLinear(unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin,
int Nmax)
{
unsigned int i, istart;
unsigned char *cursrc;
unsigned char *curdest;
int dN, dC, factor;
int result;
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL))
return(-1);
if (length == 0)
return(0);
if ((SDL_imageFilterMMXdetect()) && (length > 7)) {
SDL_imageFilterNormalizeLinearMMX(Src, Dest, length, Cmin, Cmax, Nmin, Nmax);
/* Check for unaligned bytes */
if ((length & 7) > 0) {
/* Setup to process unaligned bytes */
istart = length & 0xfffffff8;
cursrc = &Src[istart];
curdest = &Dest[istart];
} else {
/* No unaligned bytes - we are done */
return (0);
}
} else {
/* Setup to process whole image */
istart = 0;
cursrc = Src;
curdest = Dest;
}
/* C routine to process image */
dC = Cmax - Cmin;
if (dC == 0)
return (0);
dN = Nmax - Nmin;
factor = dN / dC;
for (i = istart; i < length; i++) {
result = factor * ((int) (*cursrc) - Cmin) + Nmin;
if (result > 255)
result = 255;
*curdest = (unsigned char) result;
/* Advance pointers */
cursrc++;
curdest++;
}
return (0);
}
/* ------------------------------------------------------------------------------------ */
/*!
\brief Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... )
\param Src The source 2D byte array to convolve. Should be different from destination.
\param Dest The destination 2D byte array to store the result in. Should be different from source.
\param rows Number of rows in source/destination array. Must be >2.
\param columns Number of columns in source/destination array. Must be >2.
\param Kernel The 2D convolution kernel of size 3x3.
\param Divisor The divisor of the convolution sum. Must be >0.
Note: Non-MMX implementation not available for this function.
\return Returns 1 if filter was applied, 0 otherwise.
*/
int SDL_imageFilterConvolveKernel3x3Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
signed short *Kernel, unsigned char Divisor)
{
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
return(-1);
if ((columns < 3) || (rows < 3) || (Divisor == 0))
return (-1);
if ((SDL_imageFilterMMXdetect())) {
//#ifdef USE_MMX
#if defined(USE_MMX) && defined(i386)
#if !defined(GCC__)
__asm
{
pusha
pxor mm0, mm0 /* zero MM0 */
xor ebx, ebx /* zero EBX */
mov bl, Divisor /* load Divisor into BL */
mov edx, Kernel /* load Kernel address into EDX */
movq mm5, [edx] /* MM5 = {0,K2,K1,K0} */
add edx, 8 /* second row |K0 K1 K2 0| */
movq mm6, [edx] /* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */
add edx, 8 /* third row |K6 K7 K8 0| */
movq mm7, [edx] /* MM7 = {0,K8,K7,K6} */
/* ---, */
mov eax, columns /* load columns into EAX */
mov esi, Src /* ESI = Src row 0 address */
mov edi, Dest /* load Dest address to EDI */
add edi, eax /* EDI = EDI + columns */
inc edi /* 1 byte offset from the left edge */
mov edx, rows /* initialize ROWS counter */
sub edx, 2 /* do not use first and last row */
/* ---, */
L10320:
mov ecx, eax /* initialize COLUMS counter */
sub ecx, 2 /* do not use first and last column */
align 16 /* 16 byte alignment of the loop entry */
L10322:
/* ---, */
movq mm1, [esi] /* load 8 bytes of the image first row */
add esi, eax /* move one row below */
movq mm2, [esi] /* load 8 bytes of the image second row */
add esi, eax /* move one row below */
movq mm3, [esi] /* load 8 bytes of the image third row */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpcklbw mm2, mm0 /* unpack first 4 bytes into words */
punpcklbw mm3, mm0 /* unpack first 4 bytes into words */
pmullw mm1, mm5 /* multiply words first row image*Kernel */
pmullw mm2, mm6 /* multiply words second row image*Kernel */
pmullw mm3, mm7 /* multiply words third row image*Kernel */
paddsw mm1, mm2 /* add 4 words of the first and second rows */
paddsw mm1, mm3 /* add 4 words of the third row and result */
movq mm2, mm1 /* copy MM1 into MM2 */
psrlq mm1, 32 /* shift 2 left words to the right */
paddsw mm1, mm2 /* add 2 left and 2 right result words */
movq mm3, mm1 /* copy MM1 into MM3 */
psrlq mm1, 16 /* shift 1 left word to the right */
paddsw mm1, mm3 /* add 1 left and 1 right result words */
/* --, */
movd mm2, eax /* save EAX in MM2 */
movd mm3, edx /* save EDX in MM3 */
movd eax, mm1 /* copy MM1 into EAX */
psraw mm1, 15 /* spread sign bit of the result */
movd edx, mm1 /* fill EDX with a sign bit */
idiv bx /* IDIV - VERY EXPENSIVE */
movd mm1, eax /* move result of division into MM1 */
packuswb mm1, mm0 /* pack division result with saturation */
movd eax, mm1 /* copy saturated result into EAX */
mov [edi], al /* copy a byte result into Dest */
movd edx, mm3 /* restore saved EDX */
movd eax, mm2 /* restore saved EAX */
/* --, */
sub esi, eax /* move two rows up */
sub esi, eax /* */
inc esi /* move Src pointer to the next pixel */
inc edi /* move Dest pointer to the next pixel */
/* ---, */
dec ecx /* decrease loop counter COLUMNS */
jnz L10322 /* check loop termination, proceed if required */
add esi, 2 /* move to the next row in Src */
add edi, 2 /* move to the next row in Dest */
dec edx /* decrease loop counter ROWS */
jnz L10320 /* check loop termination, proceed if required */
/* ---, */
emms /* exit MMX state */
popa
}
#else
asm volatile
("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */
"xor %%ebx, %%ebx \n\t" /* zero EBX */
"mov %5, %%bl \n\t" /* load Divisor into BL */
"mov %4, %%edx \n\t" /* load Kernel address into EDX */
"movq (%%edx), %%mm5 \n\t" /* MM5 = {0,K2,K1,K0} */
"add $8, %%edx \n\t" /* second row |K0 K1 K2 0| */
"movq (%%edx), %%mm6 \n\t" /* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */
"add $8, %%edx \n\t" /* third row |K6 K7 K8 0| */
"movq (%%edx), %%mm7 \n\t" /* MM7 = {0,K8,K7,K6} */
/* --- */
"mov %3, %%eax \n\t" /* load columns into EAX */
"mov %1, %%esi \n\t" /* ESI = Src row 0 address */
"mov %0, %%edi \n\t" /* load Dest address to EDI */
"add %%eax, %%edi \n\t" /* EDI = EDI + columns */
"inc %%edi \n\t" /* 1 byte offset from the left edge */
"mov %2, %%edx \n\t" /* initialize ROWS counter */
"sub $2, %%edx \n\t" /* do not use first and last row */
/* --- */
".L10320: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMS counter */
"sub $2, %%ecx \n\t" /* do not use first and last column */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
".L10322: \n\t"
/* --- */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the image first row */
"add %%eax, %%esi \n\t" /* move one row below */
"movq (%%esi), %%mm2 \n\t" /* load 8 bytes of the image second row */
"add %%eax, %%esi \n\t" /* move one row below */
"movq (%%esi), %%mm3 \n\t" /* load 8 bytes of the image third row */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpcklbw %%mm0, %%mm2 \n\t" /* unpack first 4 bytes into words */
"punpcklbw %%mm0, %%mm3 \n\t" /* unpack first 4 bytes into words */
"pmullw %%mm5, %%mm1 \n\t" /* multiply words first row image*Kernel */
"pmullw %%mm6, %%mm2 \n\t" /* multiply words second row image*Kernel */
"pmullw %%mm7, %%mm3 \n\t" /* multiply words third row image*Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the first and second rows */
"paddsw %%mm3, %%mm1 \n\t" /* add 4 words of the third row and result */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"psrlq $32, %%mm1 \n\t" /* shift 2 left words to the right */
"paddsw %%mm2, %%mm1 \n\t" /* add 2 left and 2 right result words */
"movq %%mm1, %%mm3 \n\t" /* copy MM1 into MM3 */
"psrlq $16, %%mm1 \n\t" /* shift 1 left word to the right */
"paddsw %%mm3, %%mm1 \n\t" /* add 1 left and 1 right result words */
/* -- */
"movd %%eax, %%mm2 \n\t" /* save EAX in MM2 */
"movd %%edx, %%mm3 \n\t" /* save EDX in MM3 */
"movd %%mm1, %%eax \n\t" /* copy MM1 into EAX */
"psraw $15, %%mm1 \n\t" /* spread sign bit of the result */
"movd %%mm1, %%edx \n\t" /* fill EDX with a sign bit */
"idivw %%bx \n\t" /* IDIV - VERY EXPENSIVE */
"movd %%eax, %%mm1 \n\t" /* move result of division into MM1 */
"packuswb %%mm0, %%mm1 \n\t" /* pack division result with saturation */
"movd %%mm1, %%eax \n\t" /* copy saturated result into EAX */
"mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */
"movd %%mm3, %%edx \n\t" /* restore saved EDX */
"movd %%mm2, %%eax \n\t" /* restore saved EAX */
/* -- */
"sub %%eax, %%esi \n\t" /* move two rows up */
"sub %%eax, %%esi \n\t" /* */
"inc %%esi \n\t" /* move Src pointer to the next pixel */
"inc %%edi \n\t" /* move Dest pointer to the next pixel */
/* --- */
"dec %%ecx \n\t" /* decrease loop counter COLUMNS */
"jnz .L10322 \n\t" /* check loop termination, proceed if required */
"add $2, %%esi \n\t" /* move to the next row in Src */
"add $2, %%edi \n\t" /* move to the next row in Dest */
"dec %%edx \n\t" /* decrease loop counter ROWS */
"jnz .L10320 \n\t" /* check loop termination, proceed if required */
/* --- */
"emms \n\t" /* exit MMX state */
"popa \n\t":"=m" (Dest) /* %0 */
:"m"(Src), /* %1 */
"m"(rows), /* %2 */
"m"(columns), /* %3 */
"m"(Kernel), /* %4 */
"m"(Divisor) /* %5 */
);
#endif
#endif
return (0);
} else {
/* No non-MMX implementation yet */
return (-1);
}
}
/*!
\brief Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... )
\param Src The source 2D byte array to convolve. Should be different from destination.
\param Dest The destination 2D byte array to store the result in. Should be different from source.
\param rows Number of rows in source/destination array. Must be >4.
\param columns Number of columns in source/destination array. Must be >4.
\param Kernel The 2D convolution kernel of size 5x5.
\param Divisor The divisor of the convolution sum. Must be >0.
Note: Non-MMX implementation not available for this function.
\return Returns 1 if filter was applied, 0 otherwise.
*/
int SDL_imageFilterConvolveKernel5x5Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
signed short *Kernel, unsigned char Divisor)
{
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
return(-1);
if ((columns < 5) || (rows < 5) || (Divisor == 0))
return (-1);
if ((SDL_imageFilterMMXdetect())) {
//#ifdef USE_MMX
#if defined(USE_MMX) && defined(i386)
#if !defined(GCC__)
__asm
{
pusha
pxor mm0, mm0 /* zero MM0 */
xor ebx, ebx /* zero EBX */
mov bl, Divisor /* load Divisor into BL */
movd mm5, ebx /* copy Divisor into MM5 */
mov edx, Kernel /* load Kernel address into EDX */
mov esi, Src /* load Src address to ESI */
mov edi, Dest /* load Dest address to EDI */
add edi, 2 /* 2 column offset from the left edge */
mov eax, columns /* load columns into EAX */
shl eax, 1 /* EAX = columns * 2 */
add edi, eax /* 2 row offset from the top edge */
shr eax, 1 /* EAX = columns */
mov ebx, rows /* initialize ROWS counter */
sub ebx, 4 /* do not use first 2 and last 2 rows */
/* ---, */
L10330:
mov ecx, eax /* initialize COLUMNS counter */
sub ecx, 4 /* do not use first 2 and last 2 columns */
align 16 /* 16 byte alignment of the loop entry */
L10332:
pxor mm7, mm7 /* zero MM7 (accumulator) */
movd mm6, esi /* save ESI in MM6 */
/* --- 1 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 2 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 3 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 4 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 5 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* ---, */
movq mm3, mm7 /* copy MM7 into MM3 */
psrlq mm7, 32 /* shift 2 left words to the right */
paddsw mm7, mm3 /* add 2 left and 2 right result words */
movq mm2, mm7 /* copy MM7 into MM2 */
psrlq mm7, 16 /* shift 1 left word to the right */
paddsw mm7, mm2 /* add 1 left and 1 right result words */
/* ---, */
movd mm1, eax /* save EDX in MM1 */
movd mm2, ebx /* save EDX in MM2 */
movd mm3, edx /* save EDX in MM3 */
movd eax, mm7 /* load summation result into EAX */
psraw mm7, 15 /* spread sign bit of the result */
movd ebx, mm5 /* load Divisor into EBX */
movd edx, mm7 /* fill EDX with a sign bit */
idiv bx /* IDIV - VERY EXPENSIVE */
movd mm7, eax /* move result of division into MM7 */
packuswb mm7, mm0 /* pack division result with saturation */
movd eax, mm7 /* copy saturated result into EAX */
mov [edi], al /* copy a byte result into Dest */
movd edx, mm3 /* restore saved EDX */
movd ebx, mm2 /* restore saved EBX */
movd eax, mm1 /* restore saved EAX */
/* --, */
movd esi, mm6 /* move Src pointer to the top pixel */
sub edx, 72 /* EDX = Kernel address */
inc esi /* move Src pointer to the next pixel */
inc edi /* move Dest pointer to the next pixel */
/* ---, */
dec ecx /* decrease loop counter COLUMNS */
jnz L10332 /* check loop termination, proceed if required */
add esi, 4 /* move to the next row in Src */
add edi, 4 /* move to the next row in Dest */
dec ebx /* decrease loop counter ROWS */
jnz L10330 /* check loop termination, proceed if required */
/* ---, */
emms /* exit MMX state */
popa
}
#else
asm volatile
("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */
"xor %%ebx, %%ebx \n\t" /* zero EBX */
"mov %5, %%bl \n\t" /* load Divisor into BL */
"movd %%ebx, %%mm5 \n\t" /* copy Divisor into MM5 */
"mov %4, %%edx \n\t" /* load Kernel address into EDX */
"mov %1, %%esi \n\t" /* load Src address to ESI */
"mov %0, %%edi \n\t" /* load Dest address to EDI */
"add $2, %%edi \n\t" /* 2 column offset from the left edge */
"mov %3, %%eax \n\t" /* load columns into EAX */
"shl $1, %%eax \n\t" /* EAX = columns * 2 */
"add %%eax, %%edi \n\t" /* 2 row offset from the top edge */
"shr $1, %%eax \n\t" /* EAX = columns */
"mov %2, %%ebx \n\t" /* initialize ROWS counter */
"sub $4, %%ebx \n\t" /* do not use first 2 and last 2 rows */
/* --- */
".L10330: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */
"sub $4, %%ecx \n\t" /* do not use first 2 and last 2 columns */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
".L10332: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */
"movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */
/* --- 1 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 2 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 3 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 4 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 5 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- */
"movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */
"psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */
"paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */
"movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */
"psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */
"paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */
/* --- */
"movd %%eax, %%mm1 \n\t" /* save EDX in MM1 */
"movd %%ebx, %%mm2 \n\t" /* save EDX in MM2 */
"movd %%edx, %%mm3 \n\t" /* save EDX in MM3 */
"movd %%mm7, %%eax \n\t" /* load summation result into EAX */
"psraw $15, %%mm7 \n\t" /* spread sign bit of the result */
"movd %%mm5, %%ebx \n\t" /* load Divisor into EBX */
"movd %%mm7, %%edx \n\t" /* fill EDX with a sign bit */
"idivw %%bx \n\t" /* IDIV - VERY EXPENSIVE */
"movd %%eax, %%mm7 \n\t" /* move result of division into MM7 */
"packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */
"movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */
"mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */
"movd %%mm3, %%edx \n\t" /* restore saved EDX */
"movd %%mm2, %%ebx \n\t" /* restore saved EBX */
"movd %%mm1, %%eax \n\t" /* restore saved EAX */
/* -- */
"movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */
"sub $72, %%edx \n\t" /* EDX = Kernel address */
"inc %%esi \n\t" /* move Src pointer to the next pixel */
"inc %%edi \n\t" /* move Dest pointer to the next pixel */
/* --- */
"dec %%ecx \n\t" /* decrease loop counter COLUMNS */
"jnz .L10332 \n\t" /* check loop termination, proceed if required */
"add $4, %%esi \n\t" /* move to the next row in Src */
"add $4, %%edi \n\t" /* move to the next row in Dest */
"dec %%ebx \n\t" /* decrease loop counter ROWS */
"jnz .L10330 \n\t" /* check loop termination, proceed if required */
/* --- */
"emms \n\t" /* exit MMX state */
"popa \n\t":"=m" (Dest) /* %0 */
:"m"(Src), /* %1 */
"m"(rows), /* %2 */
"m"(columns), /* %3 */
"m"(Kernel), /* %4 */
"m"(Divisor) /* %5 */
);
#endif
#endif
return (0);
} else {
/* No non-MMX implementation yet */
return (-1);
}
}
/*!
\brief Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... )
\param Src The source 2D byte array to convolve. Should be different from destination.
\param Dest The destination 2D byte array to store the result in. Should be different from source.
\param rows Number of rows in source/destination array. Must be >6.
\param columns Number of columns in source/destination array. Must be >6.
\param Kernel The 2D convolution kernel of size 7x7.
\param Divisor The divisor of the convolution sum. Must be >0.
Note: Non-MMX implementation not available for this function.
\return Returns 1 if filter was applied, 0 otherwise.
*/
int SDL_imageFilterConvolveKernel7x7Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
signed short *Kernel, unsigned char Divisor)
{
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
return(-1);
if ((columns < 7) || (rows < 7) || (Divisor == 0))
return (-1);
if ((SDL_imageFilterMMXdetect())) {
//#ifdef USE_MMX
#if defined(USE_MMX) && defined(i386)
#if !defined(GCC__)
__asm
{
pusha
pxor mm0, mm0 /* zero MM0 */
xor ebx, ebx /* zero EBX */
mov bl, Divisor /* load Divisor into BL */
movd mm5, ebx /* copy Divisor into MM5 */
mov edx, Kernel /* load Kernel address into EDX */
mov esi, Src /* load Src address to ESI */
mov edi, Dest /* load Dest address to EDI */
add edi, 3 /* 3 column offset from the left edge */
mov eax, columns /* load columns into EAX */
add edi, eax /* 3 row offset from the top edge */
add edi, eax
add edi, eax
mov ebx, rows /* initialize ROWS counter */
sub ebx, 6 /* do not use first 3 and last 3 rows */
/* ---, */
L10340:
mov ecx, eax /* initialize COLUMNS counter */
sub ecx, 6 /* do not use first 3 and last 3 columns */
align 16 /* 16 byte alignment of the loop entry */
L10342:
pxor mm7, mm7 /* zero MM7 (accumulator) */
movd mm6, esi /* save ESI in MM6 */
/* --- 1 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 2 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 3 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 4 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 5 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 6 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 7 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* ---, */
movq mm3, mm7 /* copy MM7 into MM3 */
psrlq mm7, 32 /* shift 2 left words to the right */
paddsw mm7, mm3 /* add 2 left and 2 right result words */
movq mm2, mm7 /* copy MM7 into MM2 */
psrlq mm7, 16 /* shift 1 left word to the right */
paddsw mm7, mm2 /* add 1 left and 1 right result words */
/* ---, */
movd mm1, eax /* save EDX in MM1 */
movd mm2, ebx /* save EDX in MM2 */
movd mm3, edx /* save EDX in MM3 */
movd eax, mm7 /* load summation result into EAX */
psraw mm7, 15 /* spread sign bit of the result */
movd ebx, mm5 /* load Divisor into EBX */
movd edx, mm7 /* fill EDX with a sign bit */
idiv bx /* IDIV - VERY EXPENSIVE */
movd mm7, eax /* move result of division into MM7 */
packuswb mm7, mm0 /* pack division result with saturation */
movd eax, mm7 /* copy saturated result into EAX */
mov [edi], al /* copy a byte result into Dest */
movd edx, mm3 /* restore saved EDX */
movd ebx, mm2 /* restore saved EBX */
movd eax, mm1 /* restore saved EAX */
/* --, */
movd esi, mm6 /* move Src pointer to the top pixel */
sub edx, 104 /* EDX = Kernel address */
inc esi /* move Src pointer to the next pixel */
inc edi /* move Dest pointer to the next pixel */
/* ---, */
dec ecx /* decrease loop counter COLUMNS */
jnz L10342 /* check loop termination, proceed if required */
add esi, 6 /* move to the next row in Src */
add edi, 6 /* move to the next row in Dest */
dec ebx /* decrease loop counter ROWS */
jnz L10340 /* check loop termination, proceed if required */
/* ---, */
emms /* exit MMX state */
popa
}
#else
asm volatile
("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */
"xor %%ebx, %%ebx \n\t" /* zero EBX */
"mov %5, %%bl \n\t" /* load Divisor into BL */
"movd %%ebx, %%mm5 \n\t" /* copy Divisor into MM5 */
"mov %4, %%edx \n\t" /* load Kernel address into EDX */
"mov %1, %%esi \n\t" /* load Src address to ESI */
"mov %0, %%edi \n\t" /* load Dest address to EDI */
"add $3, %%edi \n\t" /* 3 column offset from the left edge */
"mov %3, %%eax \n\t" /* load columns into EAX */
"add %%eax, %%edi \n\t" /* 3 row offset from the top edge */
"add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "mov %2, %%ebx \n\t" /* initialize ROWS counter */
"sub $6, %%ebx \n\t" /* do not use first 3 and last 3 rows */
/* --- */
".L10340: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */
"sub $6, %%ecx \n\t" /* do not use first 3 and last 3 columns */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
".L10342: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */
"movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */
/* --- 1 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 2 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 3 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 4 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 5 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 6 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- */
"movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */
"psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */
"paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */
"movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */
"psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */
"paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */
/* --- */
"movd %%eax, %%mm1 \n\t" /* save EDX in MM1 */
"movd %%ebx, %%mm2 \n\t" /* save EDX in MM2 */
"movd %%edx, %%mm3 \n\t" /* save EDX in MM3 */
"movd %%mm7, %%eax \n\t" /* load summation result into EAX */
"psraw $15, %%mm7 \n\t" /* spread sign bit of the result */
"movd %%mm5, %%ebx \n\t" /* load Divisor into EBX */
"movd %%mm7, %%edx \n\t" /* fill EDX with a sign bit */
"idivw %%bx \n\t" /* IDIV - VERY EXPENSIVE */
"movd %%eax, %%mm7 \n\t" /* move result of division into MM7 */
"packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */
"movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */
"mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */
"movd %%mm3, %%edx \n\t" /* restore saved EDX */
"movd %%mm2, %%ebx \n\t" /* restore saved EBX */
"movd %%mm1, %%eax \n\t" /* restore saved EAX */
/* -- */
"movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */
"sub $104, %%edx \n\t" /* EDX = Kernel address */
"inc %%esi \n\t" /* move Src pointer to the next pixel */
"inc %%edi \n\t" /* move Dest pointer to the next pixel */
/* --- */
"dec %%ecx \n\t" /* decrease loop counter COLUMNS */
"jnz .L10342 \n\t" /* check loop termination, proceed if required */
"add $6, %%esi \n\t" /* move to the next row in Src */
"add $6, %%edi \n\t" /* move to the next row in Dest */
"dec %%ebx \n\t" /* decrease loop counter ROWS */
"jnz .L10340 \n\t" /* check loop termination, proceed if required */
/* --- */
"emms \n\t" /* exit MMX state */
"popa \n\t":"=m" (Dest) /* %0 */
:"m"(Src), /* %1 */
"m"(rows), /* %2 */
"m"(columns), /* %3 */
"m"(Kernel), /* %4 */
"m"(Divisor) /* %5 */
);
#endif
#endif
return (0);
} else {
/* No non-MMX implementation yet */
return (-1);
}
}
/*!
\brief Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... )
\param Src The source 2D byte array to convolve. Should be different from destination.
\param Dest The destination 2D byte array to store the result in. Should be different from source.
\param rows Number of rows in source/destination array. Must be >8.
\param columns Number of columns in source/destination array. Must be >8.
\param Kernel The 2D convolution kernel of size 9x9.
\param Divisor The divisor of the convolution sum. Must be >0.
Note: Non-MMX implementation not available for this function.
\return Returns 1 if filter was applied, 0 otherwise.
*/
int SDL_imageFilterConvolveKernel9x9Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns,
signed short *Kernel, unsigned char Divisor)
{
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
return(-1);
if ((columns < 9) || (rows < 9) || (Divisor == 0))
return (-1);
if ((SDL_imageFilterMMXdetect())) {
//#ifdef USE_MMX
#if defined(USE_MMX) && defined(i386)
#if !defined(GCC__)
__asm
{
pusha
pxor mm0, mm0 /* zero MM0 */
xor ebx, ebx /* zero EBX */
mov bl, Divisor /* load Divisor into BL */
movd mm5, ebx /* copy Divisor into MM5 */
mov edx, Kernel /* load Kernel address into EDX */
mov esi, Src /* load Src address to ESI */
mov edi, Dest /* load Dest address to EDI */
add edi, 4 /* 4 column offset from the left edge */
mov eax, columns /* load columns into EAX */
add edi, eax /* 4 row offset from the top edge */
add edi, eax
add edi, eax
add edi, eax
mov ebx, rows /* initialize ROWS counter */
sub ebx, 8 /* do not use first 4 and last 4 rows */
/* ---, */
L10350:
mov ecx, eax /* initialize COLUMNS counter */
sub ecx, 8 /* do not use first 4 and last 4 columns */
align 16 /* 16 byte alignment of the loop entry */
L10352:
pxor mm7, mm7 /* zero MM7 (accumulator) */
movd mm6, esi /* save ESI in MM6 */
/* --- 1 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 2 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 3 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 4 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 5 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 6 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 7 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 8 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 9 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm3, [edx] /* load 4 words of Kernel */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* ---, */
movq mm3, mm7 /* copy MM7 into MM3 */
psrlq mm7, 32 /* shift 2 left words to the right */
paddsw mm7, mm3 /* add 2 left and 2 right result words */
movq mm2, mm7 /* copy MM7 into MM2 */
psrlq mm7, 16 /* shift 1 left word to the right */
paddsw mm7, mm2 /* add 1 left and 1 right result words */
/* ---, */
movd mm1, eax /* save EDX in MM1 */
movd mm2, ebx /* save EDX in MM2 */
movd mm3, edx /* save EDX in MM3 */
movd eax, mm7 /* load summation result into EAX */
psraw mm7, 15 /* spread sign bit of the result */
movd ebx, mm5 /* load Divisor into EBX */
movd edx, mm7 /* fill EDX with a sign bit */
idiv bx /* IDIV - VERY EXPENSIVE */
movd mm7, eax /* move result of division into MM7 */
packuswb mm7, mm0 /* pack division result with saturation */
movd eax, mm7 /* copy saturated result into EAX */
mov [edi], al /* copy a byte result into Dest */
movd edx, mm3 /* restore saved EDX */
movd ebx, mm2 /* restore saved EBX */
movd eax, mm1 /* restore saved EAX */
/* --, */
movd esi, mm6 /* move Src pointer to the top pixel */
sub edx, 208 /* EDX = Kernel address */
inc esi /* move Src pointer to the next pixel */
inc edi /* move Dest pointer to the next pixel */
/* ---, */
dec ecx /* decrease loop counter COLUMNS */
jnz L10352 /* check loop termination, proceed if required */
add esi, 8 /* move to the next row in Src */
add edi, 8 /* move to the next row in Dest */
dec ebx /* decrease loop counter ROWS */
jnz L10350 /* check loop termination, proceed if required */
/* ---, */
emms /* exit MMX state */
popa
}
#else
asm volatile
("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */
"xor %%ebx, %%ebx \n\t" /* zero EBX */
"mov %5, %%bl \n\t" /* load Divisor into BL */
"movd %%ebx, %%mm5 \n\t" /* copy Divisor into MM5 */
"mov %4, %%edx \n\t" /* load Kernel address into EDX */
"mov %1, %%esi \n\t" /* load Src address to ESI */
"mov %0, %%edi \n\t" /* load Dest address to EDI */
"add $4, %%edi \n\t" /* 4 column offset from the left edge */
"mov %3, %%eax \n\t" /* load columns into EAX */
"add %%eax, %%edi \n\t" /* 4 row offset from the top edge */
"add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "mov %2, %%ebx \n\t" /* initialize ROWS counter */
"sub $8, %%ebx \n\t" /* do not use first 4 and last 4 rows */
/* --- */
".L10350: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */
"sub $8, %%ecx \n\t" /* do not use first 4 and last 4 columns */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
".L10352: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */
"movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */
/* --- 1 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 2 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 3 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 4 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 5 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 6 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 8 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 9 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- */
"movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */
"psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */
"paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */
"movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */
"psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */
"paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */
/* --- */
"movd %%eax, %%mm1 \n\t" /* save EDX in MM1 */
"movd %%ebx, %%mm2 \n\t" /* save EDX in MM2 */
"movd %%edx, %%mm3 \n\t" /* save EDX in MM3 */
"movd %%mm7, %%eax \n\t" /* load summation result into EAX */
"psraw $15, %%mm7 \n\t" /* spread sign bit of the result */
"movd %%mm5, %%ebx \n\t" /* load Divisor into EBX */
"movd %%mm7, %%edx \n\t" /* fill EDX with a sign bit */
"idivw %%bx \n\t" /* IDIV - VERY EXPENSIVE */
"movd %%eax, %%mm7 \n\t" /* move result of division into MM7 */
"packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */
"movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */
"mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */
"movd %%mm3, %%edx \n\t" /* restore saved EDX */
"movd %%mm2, %%ebx \n\t" /* restore saved EBX */
"movd %%mm1, %%eax \n\t" /* restore saved EAX */
/* -- */
"movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */
"sub $208, %%edx \n\t" /* EDX = Kernel address */
"inc %%esi \n\t" /* move Src pointer to the next pixel */
"inc %%edi \n\t" /* move Dest pointer to the next pixel */
/* --- */
"dec %%ecx \n\t" /* decrease loop counter COLUMNS */
"jnz .L10352 \n\t" /* check loop termination, proceed if required */
"add $8, %%esi \n\t" /* move to the next row in Src */
"add $8, %%edi \n\t" /* move to the next row in Dest */
"dec %%ebx \n\t" /* decrease loop counter ROWS */
"jnz .L10350 \n\t" /* check loop termination, proceed if required */
/* --- */
"emms \n\t" /* exit MMX state */
"popa \n\t":"=m" (Dest) /* %0 */
:"m"(Src), /* %1 */
"m"(rows), /* %2 */
"m"(columns), /* %3 */
"m"(Kernel), /* %4 */
"m"(Divisor) /* %5 */
);
#endif
#endif
return (0);
} else {
/* No non-MMX implementation yet */
return (-1);
}
}
/*!
\brief Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
\param Src The source 2D byte array to convolve. Should be different from destination.
\param Dest The destination 2D byte array to store the result in. Should be different from source.
\param rows Number of rows in source/destination array. Must be >2.
\param columns Number of columns in source/destination array. Must be >2.
\param Kernel The 2D convolution kernel of size 3x3.
\param NRightShift The number of right bit shifts to apply to the convolution sum. Must be <7.
Note: Non-MMX implementation not available for this function.
\return Returns 1 if filter was applied, 0 otherwise.
*/
int SDL_imageFilterConvolveKernel3x3ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
signed short *Kernel, unsigned char NRightShift)
{
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
return(-1);
if ((columns < 3) || (rows < 3) || (NRightShift > 7))
return (-1);
if ((SDL_imageFilterMMXdetect())) {
//#ifdef USE_MMX
#if defined(USE_MMX) && defined(i386)
#if !defined(GCC__)
__asm
{
pusha
pxor mm0, mm0 /* zero MM0 */
xor ebx, ebx /* zero EBX */
mov bl, NRightShift /* load NRightShift into BL */
movd mm4, ebx /* copy NRightShift into MM4 */
mov edx, Kernel /* load Kernel address into EDX */
movq mm5, [edx] /* MM5 = {0,K2,K1,K0} */
add edx, 8 /* second row |K0 K1 K2 0| */
movq mm6, [edx] /* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */
add edx, 8 /* third row |K6 K7 K8 0| */
movq mm7, [edx] /* MM7 = {0,K8,K7,K6} */
/* ---, */
mov eax, columns /* load columns into EAX */
mov esi, Src /* ESI = Src row 0 address */
mov edi, Dest /* load Dest address to EDI */
add edi, eax /* EDI = EDI + columns */
inc edi /* 1 byte offset from the left edge */
mov edx, rows /* initialize ROWS counter */
sub edx, 2 /* do not use first and last row */
/* ---, */
L10360:
mov ecx, eax /* initialize COLUMS counter */
sub ecx, 2 /* do not use first and last column */
align 16 /* 16 byte alignment of the loop entry */
L10362:
/* ---, */
movq mm1, [esi] /* load 8 bytes of the image first row */
add esi, eax /* move one row below */
movq mm2, [esi] /* load 8 bytes of the image second row */
add esi, eax /* move one row below */
movq mm3, [esi] /* load 8 bytes of the image third row */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpcklbw mm2, mm0 /* unpack first 4 bytes into words */
punpcklbw mm3, mm0 /* unpack first 4 bytes into words */
psrlw mm1, mm4 /* shift right each pixel NshiftRight times */
psrlw mm2, mm4 /* shift right each pixel NshiftRight times */
psrlw mm3, mm4 /* shift right each pixel NshiftRight times */
pmullw mm1, mm5 /* multiply words first row image*Kernel */
pmullw mm2, mm6 /* multiply words second row image*Kernel */
pmullw mm3, mm7 /* multiply words third row image*Kernel */
paddsw mm1, mm2 /* add 4 words of the first and second rows */
paddsw mm1, mm3 /* add 4 words of the third row and result */
movq mm2, mm1 /* copy MM1 into MM2 */
psrlq mm1, 32 /* shift 2 left words to the right */
paddsw mm1, mm2 /* add 2 left and 2 right result words */
movq mm3, mm1 /* copy MM1 into MM3 */
psrlq mm1, 16 /* shift 1 left word to the right */
paddsw mm1, mm3 /* add 1 left and 1 right result words */
packuswb mm1, mm0 /* pack shift result with saturation */
movd ebx, mm1 /* copy saturated result into EBX */
mov [edi], bl /* copy a byte result into Dest */
/* --, */
sub esi, eax /* move two rows up */
sub esi, eax
inc esi /* move Src pointer to the next pixel */
inc edi /* move Dest pointer to the next pixel */
/* ---, */
dec ecx /* decrease loop counter COLUMNS */
jnz L10362 /* check loop termination, proceed if required */
add esi, 2 /* move to the next row in Src */
add edi, 2 /* move to the next row in Dest */
dec edx /* decrease loop counter ROWS */
jnz L10360 /* check loop termination, proceed if required */
/* ---, */
emms /* exit MMX state */
popa
}
#else
asm volatile
("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */
"xor %%ebx, %%ebx \n\t" /* zero EBX */
"mov %5, %%bl \n\t" /* load NRightShift into BL */
"movd %%ebx, %%mm4 \n\t" /* copy NRightShift into MM4 */
"mov %4, %%edx \n\t" /* load Kernel address into EDX */
"movq (%%edx), %%mm5 \n\t" /* MM5 = {0,K2,K1,K0} */
"add $8, %%edx \n\t" /* second row |K0 K1 K2 0| */
"movq (%%edx), %%mm6 \n\t" /* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */
"add $8, %%edx \n\t" /* third row |K6 K7 K8 0| */
"movq (%%edx), %%mm7 \n\t" /* MM7 = {0,K8,K7,K6} */
/* --- */
"mov %3, %%eax \n\t" /* load columns into EAX */
"mov %1, %%esi \n\t" /* ESI = Src row 0 address */
"mov %0, %%edi \n\t" /* load Dest address to EDI */
"add %%eax, %%edi \n\t" /* EDI = EDI + columns */
"inc %%edi \n\t" /* 1 byte offset from the left edge */
"mov %2, %%edx \n\t" /* initialize ROWS counter */
"sub $2, %%edx \n\t" /* do not use first and last row */
/* --- */
".L10360: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMS counter */
"sub $2, %%ecx \n\t" /* do not use first and last column */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
".L10362: \n\t"
/* --- */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the image first row */
"add %%eax, %%esi \n\t" /* move one row below */
"movq (%%esi), %%mm2 \n\t" /* load 8 bytes of the image second row */
"add %%eax, %%esi \n\t" /* move one row below */
"movq (%%esi), %%mm3 \n\t" /* load 8 bytes of the image third row */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpcklbw %%mm0, %%mm2 \n\t" /* unpack first 4 bytes into words */
"punpcklbw %%mm0, %%mm3 \n\t" /* unpack first 4 bytes into words */
"psrlw %%mm4, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm4, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm4, %%mm3 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm5, %%mm1 \n\t" /* multiply words first row image*Kernel */
"pmullw %%mm6, %%mm2 \n\t" /* multiply words second row image*Kernel */
"pmullw %%mm7, %%mm3 \n\t" /* multiply words third row image*Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the first and second rows */
"paddsw %%mm3, %%mm1 \n\t" /* add 4 words of the third row and result */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"psrlq $32, %%mm1 \n\t" /* shift 2 left words to the right */
"paddsw %%mm2, %%mm1 \n\t" /* add 2 left and 2 right result words */
"movq %%mm1, %%mm3 \n\t" /* copy MM1 into MM3 */
"psrlq $16, %%mm1 \n\t" /* shift 1 left word to the right */
"paddsw %%mm3, %%mm1 \n\t" /* add 1 left and 1 right result words */
"packuswb %%mm0, %%mm1 \n\t" /* pack shift result with saturation */
"movd %%mm1, %%ebx \n\t" /* copy saturated result into EBX */
"mov %%bl, (%%edi) \n\t" /* copy a byte result into Dest */
/* -- */
"sub %%eax, %%esi \n\t" /* move two rows up */
"sub %%eax, %%esi \n\t" "inc %%esi \n\t" /* move Src pointer to the next pixel */
"inc %%edi \n\t" /* move Dest pointer to the next pixel */
/* --- */
"dec %%ecx \n\t" /* decrease loop counter COLUMNS */
"jnz .L10362 \n\t" /* check loop termination, proceed if required */
"add $2, %%esi \n\t" /* move to the next row in Src */
"add $2, %%edi \n\t" /* move to the next row in Dest */
"dec %%edx \n\t" /* decrease loop counter ROWS */
"jnz .L10360 \n\t" /* check loop termination, proceed if required */
/* --- */
"emms \n\t" /* exit MMX state */
"popa \n\t":"=m" (Dest) /* %0 */
:"m"(Src), /* %1 */
"m"(rows), /* %2 */
"m"(columns), /* %3 */
"m"(Kernel), /* %4 */
"m"(NRightShift) /* %5 */
);
#endif
#endif
return (0);
} else {
/* No non-MMX implementation yet */
return (-1);
}
}
/*!
\brief Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
\param Src The source 2D byte array to convolve. Should be different from destination.
\param Dest The destination 2D byte array to store the result in. Should be different from source.
\param rows Number of rows in source/destination array. Must be >4.
\param columns Number of columns in source/destination array. Must be >4.
\param Kernel The 2D convolution kernel of size 5x5.
\param NRightShift The number of right bit shifts to apply to the convolution sum. Must be <7.
Note: Non-MMX implementation not available for this function.
\return Returns 1 if filter was applied, 0 otherwise.
*/
int SDL_imageFilterConvolveKernel5x5ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
signed short *Kernel, unsigned char NRightShift)
{
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
return(-1);
if ((columns < 5) || (rows < 5) || (NRightShift > 7))
return (-1);
if ((SDL_imageFilterMMXdetect())) {
//#ifdef USE_MMX
#if defined(USE_MMX) && defined(i386)
#if !defined(GCC__)
__asm
{
pusha
pxor mm0, mm0 /* zero MM0 */
xor ebx, ebx /* zero EBX */
mov bl, NRightShift /* load NRightShift into BL */
movd mm5, ebx /* copy NRightShift into MM5 */
mov edx, Kernel /* load Kernel address into EDX */
mov esi, Src /* load Src address to ESI */
mov edi, Dest /* load Dest address to EDI */
add edi, 2 /* 2 column offset from the left edge */
mov eax, columns /* load columns into EAX */
shl eax, 1 /* EAX = columns * 2 */
add edi, eax /* 2 row offset from the top edge */
shr eax, 1 /* EAX = columns */
mov ebx, rows /* initialize ROWS counter */
sub ebx, 4 /* do not use first 2 and last 2 rows */
/* ---, */
L10370:
mov ecx, eax /* initialize COLUMNS counter */
sub ecx, 4 /* do not use first 2 and last 2 columns */
align 16 /* 16 byte alignment of the loop entry */
L10372:
pxor mm7, mm7 /* zero MM7 (accumulator) */
movd mm6, esi /* save ESI in MM6 */
/* --- 1 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 2 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 3 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 4 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 5 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* ---, */
movq mm3, mm7 /* copy MM7 into MM3 */
psrlq mm7, 32 /* shift 2 left words to the right */
paddsw mm7, mm3 /* add 2 left and 2 right result words */
movq mm2, mm7 /* copy MM7 into MM2 */
psrlq mm7, 16 /* shift 1 left word to the right */
paddsw mm7, mm2 /* add 1 left and 1 right result words */
movd mm1, eax /* save EAX in MM1 */
packuswb mm7, mm0 /* pack division result with saturation */
movd eax, mm7 /* copy saturated result into EAX */
mov [edi], al /* copy a byte result into Dest */
movd eax, mm1 /* restore saved EAX */
/* --, */
movd esi, mm6 /* move Src pointer to the top pixel */
sub edx, 72 /* EDX = Kernel address */
inc esi /* move Src pointer to the next pixel */
inc edi /* move Dest pointer to the next pixel */
/* ---, */
dec ecx /* decrease loop counter COLUMNS */
jnz L10372 /* check loop termination, proceed if required */
add esi, 4 /* move to the next row in Src */
add edi, 4 /* move to the next row in Dest */
dec ebx /* decrease loop counter ROWS */
jnz L10370 /* check loop termination, proceed if required */
/* ---, */
emms /* exit MMX state */
popa
}
#else
asm volatile
("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */
"xor %%ebx, %%ebx \n\t" /* zero EBX */
"mov %5, %%bl \n\t" /* load NRightShift into BL */
"movd %%ebx, %%mm5 \n\t" /* copy NRightShift into MM5 */
"mov %4, %%edx \n\t" /* load Kernel address into EDX */
"mov %1, %%esi \n\t" /* load Src address to ESI */
"mov %0, %%edi \n\t" /* load Dest address to EDI */
"add $2, %%edi \n\t" /* 2 column offset from the left edge */
"mov %3, %%eax \n\t" /* load columns into EAX */
"shl $1, %%eax \n\t" /* EAX = columns * 2 */
"add %%eax, %%edi \n\t" /* 2 row offset from the top edge */
"shr $1, %%eax \n\t" /* EAX = columns */
"mov %2, %%ebx \n\t" /* initialize ROWS counter */
"sub $4, %%ebx \n\t" /* do not use first 2 and last 2 rows */
/* --- */
".L10370: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */
"sub $4, %%ecx \n\t" /* do not use first 2 and last 2 columns */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
".L10372: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */
"movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */
/* --- 1 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 2 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 3 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 4 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 5 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- */
"movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */
"psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */
"paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */
"movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */
"psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */
"paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */
"movd %%eax, %%mm1 \n\t" /* save EAX in MM1 */
"packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */
"movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */
"mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */
"movd %%mm1, %%eax \n\t" /* restore saved EAX */
/* -- */
"movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */
"sub $72, %%edx \n\t" /* EDX = Kernel address */
"inc %%esi \n\t" /* move Src pointer to the next pixel */
"inc %%edi \n\t" /* move Dest pointer to the next pixel */
/* --- */
"dec %%ecx \n\t" /* decrease loop counter COLUMNS */
"jnz .L10372 \n\t" /* check loop termination, proceed if required */
"add $4, %%esi \n\t" /* move to the next row in Src */
"add $4, %%edi \n\t" /* move to the next row in Dest */
"dec %%ebx \n\t" /* decrease loop counter ROWS */
"jnz .L10370 \n\t" /* check loop termination, proceed if required */
/* --- */
"emms \n\t" /* exit MMX state */
"popa \n\t":"=m" (Dest) /* %0 */
:"m"(Src), /* %1 */
"m"(rows), /* %2 */
"m"(columns), /* %3 */
"m"(Kernel), /* %4 */
"m"(NRightShift) /* %5 */
);
#endif
#endif
return (0);
} else {
/* No non-MMX implementation yet */
return (-1);
}
}
/*!
\brief Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
\param Src The source 2D byte array to convolve. Should be different from destination.
\param Dest The destination 2D byte array to store the result in. Should be different from source.
\param rows Number of rows in source/destination array. Must be >6.
\param columns Number of columns in source/destination array. Must be >6.
\param Kernel The 2D convolution kernel of size 7x7.
\param NRightShift The number of right bit shifts to apply to the convolution sum. Must be <7.
Note: Non-MMX implementation not available for this function.
\return Returns 1 if filter was applied, 0 otherwise.
*/
int SDL_imageFilterConvolveKernel7x7ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
signed short *Kernel, unsigned char NRightShift)
{
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
return(-1);
if ((columns < 7) || (rows < 7) || (NRightShift > 7))
return (-1);
if ((SDL_imageFilterMMXdetect())) {
//#ifdef USE_MMX
#if defined(USE_MMX) && defined(i386)
#if !defined(GCC__)
__asm
{
pusha
pxor mm0, mm0 /* zero MM0 */
xor ebx, ebx /* zero EBX */
mov bl, NRightShift /* load NRightShift into BL */
movd mm5, ebx /* copy NRightShift into MM5 */
mov edx, Kernel /* load Kernel address into EDX */
mov esi, Src /* load Src address to ESI */
mov edi, Dest /* load Dest address to EDI */
add edi, 3 /* 3 column offset from the left edge */
mov eax, columns /* load columns into EAX */
add edi, eax /* 3 row offset from the top edge */
add edi, eax
add edi, eax
mov ebx, rows /* initialize ROWS counter */
sub ebx, 6 /* do not use first 3 and last 3 rows */
/* ---, */
L10380:
mov ecx, eax /* initialize COLUMNS counter */
sub ecx, 6 /* do not use first 3 and last 3 columns */
align 16 /* 16 byte alignment of the loop entry */
L10382:
pxor mm7, mm7 /* zero MM7 (accumulator) */
movd mm6, esi /* save ESI in MM6 */
/* --- 1 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 2 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 3 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 4 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 5 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 6 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 7 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* ---, */
movq mm3, mm7 /* copy MM7 into MM3 */
psrlq mm7, 32 /* shift 2 left words to the right */
paddsw mm7, mm3 /* add 2 left and 2 right result words */
movq mm2, mm7 /* copy MM7 into MM2 */
psrlq mm7, 16 /* shift 1 left word to the right */
paddsw mm7, mm2 /* add 1 left and 1 right result words */
movd mm1, eax /* save EAX in MM1 */
packuswb mm7, mm0 /* pack division result with saturation */
movd eax, mm7 /* copy saturated result into EAX */
mov [edi], al /* copy a byte result into Dest */
movd eax, mm1 /* restore saved EAX */
/* --, */
movd esi, mm6 /* move Src pointer to the top pixel */
sub edx, 104 /* EDX = Kernel address */
inc esi /* move Src pointer to the next pixel */
inc edi /* move Dest pointer to the next pixel */
/* ---, */
dec ecx /* decrease loop counter COLUMNS */
jnz L10382 /* check loop termination, proceed if required */
add esi, 6 /* move to the next row in Src */
add edi, 6 /* move to the next row in Dest */
dec ebx /* decrease loop counter ROWS */
jnz L10380 /* check loop termination, proceed if required */
/* ---, */
emms /* exit MMX state */
popa
}
#else
asm volatile
("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */
"xor %%ebx, %%ebx \n\t" /* zero EBX */
"mov %5, %%bl \n\t" /* load NRightShift into BL */
"movd %%ebx, %%mm5 \n\t" /* copy NRightShift into MM5 */
"mov %4, %%edx \n\t" /* load Kernel address into EDX */
"mov %1, %%esi \n\t" /* load Src address to ESI */
"mov %0, %%edi \n\t" /* load Dest address to EDI */
"add $3, %%edi \n\t" /* 3 column offset from the left edge */
"mov %3, %%eax \n\t" /* load columns into EAX */
"add %%eax, %%edi \n\t" /* 3 row offset from the top edge */
"add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "mov %2, %%ebx \n\t" /* initialize ROWS counter */
"sub $6, %%ebx \n\t" /* do not use first 3 and last 3 rows */
/* --- */
".L10380: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */
"sub $6, %%ecx \n\t" /* do not use first 3 and last 3 columns */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
".L10382: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */
"movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */
/* --- 1 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 2 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 3 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 4 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 5 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 6 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- */
"movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */
"psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */
"paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */
"movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */
"psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */
"paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */
"movd %%eax, %%mm1 \n\t" /* save EAX in MM1 */
"packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */
"movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */
"mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */
"movd %%mm1, %%eax \n\t" /* restore saved EAX */
/* -- */
"movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */
"sub $104, %%edx \n\t" /* EDX = Kernel address */
"inc %%esi \n\t" /* move Src pointer to the next pixel */
"inc %%edi \n\t" /* move Dest pointer to the next pixel */
/* --- */
"dec %%ecx \n\t" /* decrease loop counter COLUMNS */
"jnz .L10382 \n\t" /* check loop termination, proceed if required */
"add $6, %%esi \n\t" /* move to the next row in Src */
"add $6, %%edi \n\t" /* move to the next row in Dest */
"dec %%ebx \n\t" /* decrease loop counter ROWS */
"jnz .L10380 \n\t" /* check loop termination, proceed if required */
/* --- */
"emms \n\t" /* exit MMX state */
"popa \n\t":"=m" (Dest) /* %0 */
:"m"(Src), /* %1 */
"m"(rows), /* %2 */
"m"(columns), /* %3 */
"m"(Kernel), /* %4 */
"m"(NRightShift) /* %5 */
);
#endif
#endif
return (0);
} else {
/* No non-MMX implementation yet */
return (-1);
}
}
/*!
\brief Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... )
\param Src The source 2D byte array to convolve. Should be different from destination.
\param Dest The destination 2D byte array to store the result in. Should be different from source.
\param rows Number of rows in source/destination array. Must be >8.
\param columns Number of columns in source/destination array. Must be >8.
\param Kernel The 2D convolution kernel of size 9x9.
\param NRightShift The number of right bit shifts to apply to the convolution sum. Must be <7.
Note: Non-MMX implementation not available for this function.
\return Returns 1 if filter was applied, 0 otherwise.
*/
int SDL_imageFilterConvolveKernel9x9ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
signed short *Kernel, unsigned char NRightShift)
{
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL))
return(-1);
if ((columns < 9) || (rows < 9) || (NRightShift > 7))
return (-1);
if ((SDL_imageFilterMMXdetect())) {
//#ifdef USE_MMX
#if defined(USE_MMX) && defined(i386)
#if !defined(GCC__)
__asm
{
pusha
pxor mm0, mm0 /* zero MM0 */
xor ebx, ebx /* zero EBX */
mov bl, NRightShift /* load NRightShift into BL */
movd mm5, ebx /* copy NRightShift into MM5 */
mov edx, Kernel /* load Kernel address into EDX */
mov esi, Src /* load Src address to ESI */
mov edi, Dest /* load Dest address to EDI */
add edi, 4 /* 4 column offset from the left edge */
mov eax, columns /* load columns into EAX */
add edi, eax /* 4 row offset from the top edge */
add edi, eax
add edi, eax
add edi, eax
mov ebx, rows /* initialize ROWS counter */
sub ebx, 8 /* do not use first 4 and last 4 rows */
/* ---, */
L10390:
mov ecx, eax /* initialize COLUMNS counter */
sub ecx, 8 /* do not use first 4 and last 4 columns */
align 16 /* 16 byte alignment of the loop entry */
L10392:
pxor mm7, mm7 /* zero MM7 (accumulator) */
movd mm6, esi /* save ESI in MM6 */
/* --- 1 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 2 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 3 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 4 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 5 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 6 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 7 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 8 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
dec esi
add esi, eax /* move Src pointer 1 row below */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* --- 9 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm2, mm1 /* copy MM1 into MM2 */
inc esi /* move pointer to the next 8 bytes of Src */
movq mm3, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
movq mm4, [edx] /* load 4 words of Kernel */
add edx, 8 /* move pointer to other 4 words */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
punpckhbw mm2, mm0 /* unpack second 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
psrlw mm2, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */
paddsw mm1, mm2 /* add 4 words of the high and low bytes */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
movq mm1, [esi] /* load 8 bytes of the Src */
movq mm3, [edx] /* load 4 words of Kernel */
punpcklbw mm1, mm0 /* unpack first 4 bytes into words */
psrlw mm1, mm5 /* shift right each pixel NshiftRight times */
pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */
paddsw mm7, mm1 /* add MM1 to accumulator MM7 */
/* ---, */
movq mm3, mm7 /* copy MM7 into MM3 */
psrlq mm7, 32 /* shift 2 left words to the right */
paddsw mm7, mm3 /* add 2 left and 2 right result words */
movq mm2, mm7 /* copy MM7 into MM2 */
psrlq mm7, 16 /* shift 1 left word to the right */
paddsw mm7, mm2 /* add 1 left and 1 right result words */
movd mm1, eax /* save EAX in MM1 */
packuswb mm7, mm0 /* pack division result with saturation */
movd eax, mm7 /* copy saturated result into EAX */
mov [edi], al /* copy a byte result into Dest */
movd eax, mm1 /* restore saved EAX */
/* --, */
movd esi, mm6 /* move Src pointer to the top pixel */
sub edx, 208 /* EDX = Kernel address */
inc esi /* move Src pointer to the next pixel */
inc edi /* move Dest pointer to the next pixel */
/* ---, */
dec ecx /* decrease loop counter COLUMNS */
jnz L10392 /* check loop termination, proceed if required */
add esi, 8 /* move to the next row in Src */
add edi, 8 /* move to the next row in Dest */
dec ebx /* decrease loop counter ROWS */
jnz L10390 /* check loop termination, proceed if required */
/* ---, */
emms /* exit MMX state */
popa
}
#else
asm volatile
("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */
"xor %%ebx, %%ebx \n\t" /* zero EBX */
"mov %5, %%bl \n\t" /* load NRightShift into BL */
"movd %%ebx, %%mm5 \n\t" /* copy NRightShift into MM5 */
"mov %4, %%edx \n\t" /* load Kernel address into EDX */
"mov %1, %%esi \n\t" /* load Src address to ESI */
"mov %0, %%edi \n\t" /* load Dest address to EDI */
"add $4, %%edi \n\t" /* 4 column offset from the left edge */
"mov %3, %%eax \n\t" /* load columns into EAX */
"add %%eax, %%edi \n\t" /* 4 row offset from the top edge */
"add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "mov %2, %%ebx \n\t" /* initialize ROWS counter */
"sub $8, %%ebx \n\t" /* do not use first 4 and last 4 rows */
/* --- */
".L10390: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */
"sub $8, %%ecx \n\t" /* do not use first 4 and last 4 columns */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
".L10392: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */
"movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */
/* --- 1 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 2 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 3 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 4 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 5 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 6 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 8 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- 9 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */
"inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */
"add $8, %%edx \n\t" /* move pointer to other 4 words */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */
"paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
"movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */
"movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */
"punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */
"psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */
"pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */
"paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */
/* --- */
"movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */
"psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */
"paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */
"movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */
"psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */
"paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */
"movd %%eax, %%mm1 \n\t" /* save EAX in MM1 */
"packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */
"movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */
"mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */
"movd %%mm1, %%eax \n\t" /* restore saved EAX */
/* -- */
"movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */
"sub $208, %%edx \n\t" /* EDX = Kernel address */
"inc %%esi \n\t" /* move Src pointer to the next pixel */
"inc %%edi \n\t" /* move Dest pointer to the next pixel */
/* --- */
"dec %%ecx \n\t" /* decrease loop counter COLUMNS */
"jnz .L10392 \n\t" /* check loop termination, proceed if required */
"add $8, %%esi \n\t" /* move to the next row in Src */
"add $8, %%edi \n\t" /* move to the next row in Dest */
"dec %%ebx \n\t" /* decrease loop counter ROWS */
"jnz .L10390 \n\t" /* check loop termination, proceed if required */
/* --- */
"emms \n\t" /* exit MMX state */
"popa \n\t":"=m" (Dest) /* %0 */
:"m"(Src), /* %1 */
"m"(rows), /* %2 */
"m"(columns), /* %3 */
"m"(Kernel), /* %4 */
"m"(NRightShift) /* %5 */
);
#endif
#endif
return (0);
} else {
/* No non-MMX implementation yet */
return (-1);
}
}
/* ------------------------------------------------------------------------------------ */
/*!
\brief Filter using SobelX: Dij = saturation255( ... )
\param Src The source 2D byte array to sobel-filter. Should be different from destination.
\param Dest The destination 2D byte array to store the result in. Should be different from source.
\param rows Number of rows in source/destination array. Must be >2.
\param columns Number of columns in source/destination array. Must be >7.
Note: Non-MMX implementation not available for this function.
\return Returns 1 if filter was applied, 0 otherwise.
*/
int SDL_imageFilterSobelX(unsigned char *Src, unsigned char *Dest, int rows, int columns)
{
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL))
return(-1);
if ((columns < 8) || (rows < 3))
return (-1);
if ((SDL_imageFilterMMXdetect())) {
//#ifdef USE_MMX
#if defined(USE_MMX) && defined(i386)
#if !defined(GCC__)
__asm
{
pusha
pxor mm0, mm0 /* zero MM0 */
mov eax, columns /* load columns into EAX */
/* ---, */
mov esi, Src /* ESI = Src row 0 address */
mov edi, Dest /* load Dest address to EDI */
add edi, eax /* EDI = EDI + columns */
inc edi /* 1 byte offset from the left edge */
mov edx, rows /* initialize ROWS counter */
sub edx, 2 /* do not use first and last rows */
/* ---, */
L10400:
mov ecx, eax /* initialize COLUMS counter */
shr ecx, 3 /* EBX/8 (MMX loads 8 bytes at a time) */
mov ebx, esi /* save ESI in EBX */
movd mm1, edi /* save EDI in MM1 */
align 16 /* 16 byte alignment of the loop entry */
L10402:
/* ---, */
movq mm4, [esi] /* load 8 bytes from Src */
movq mm5, mm4 /* save MM4 in MM5 */
add esi, 2 /* move ESI pointer 2 bytes right */
punpcklbw mm4, mm0 /* unpack 4 low bytes into words */
punpckhbw mm5, mm0 /* unpack 4 high bytes into words */
movq mm6, [esi] /* load 8 bytes from Src */
movq mm7, mm6 /* save MM6 in MM7 */
sub esi, 2 /* move ESI pointer back 2 bytes left */
punpcklbw mm6, mm0 /* unpack 4 low bytes into words */
punpckhbw mm7, mm0 /* unpack 4 high bytes into words */
add esi, eax /* move to the next row of Src */
movq mm2, [esi] /* load 8 bytes from Src */
movq mm3, mm2 /* save MM2 in MM3 */
add esi, 2 /* move ESI pointer 2 bytes right */
punpcklbw mm2, mm0 /* unpack 4 low bytes into words */
punpckhbw mm3, mm0 /* unpack 4 high bytes into words */
paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */
paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */
paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */
paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */
movq mm2, [esi] /* load 8 bytes from Src */
movq mm3, mm2 /* save MM2 in MM3 */
sub esi, 2 /* move ESI pointer back 2 bytes left */
punpcklbw mm2, mm0 /* unpack 4 low bytes into words */
punpckhbw mm3, mm0 /* unpack 4 high bytes into words */
paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */
paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */
paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */
paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */
add esi, eax /* move to the next row of Src */
movq mm2, [esi] /* load 8 bytes from Src */
movq mm3, mm2 /* save MM2 in MM3 */
add esi, 2 /* move ESI pointer 2 bytes right */
punpcklbw mm2, mm0 /* unpack 4 low bytes into words */
punpckhbw mm3, mm0 /* unpack 4 high bytes into words */
paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */
paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */
movq mm2, [esi] /* load 8 bytes from Src */
movq mm3, mm2 /* save MM2 in MM3 */
sub esi, 2 /* move ESI pointer back 2 bytes left */
punpcklbw mm2, mm0 /* unpack 4 low bytes into words */
punpckhbw mm3, mm0 /* unpack 4 high bytes into words */
paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */
paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */
/* ---, */
movq mm2, mm4 /* copy MM4 into MM2 */
psrlq mm4, 32 /* shift 2 left words to the right */
psubw mm4, mm2 /* MM4 = MM4 - MM2 */
movq mm3, mm6 /* copy MM6 into MM3 */
psrlq mm6, 32 /* shift 2 left words to the right */
psubw mm6, mm3 /* MM6 = MM6 - MM3 */
punpckldq mm4, mm6 /* combine 2 words of MM6 and 2 words of MM4 */
movq mm2, mm5 /* copy MM6 into MM2 */
psrlq mm5, 32 /* shift 2 left words to the right */
psubw mm5, mm2 /* MM5 = MM5 - MM2 */
movq mm3, mm7 /* copy MM7 into MM3 */
psrlq mm7, 32 /* shift 2 left words to the right */
psubw mm7, mm3 /* MM7 = MM7 - MM3 */
punpckldq mm5, mm7 /* combine 2 words of MM7 and 2 words of MM5 */
/* Take abs values of MM4 and MM5 */
movq mm6, mm4 /* copy MM4 into MM6 */
movq mm7, mm5 /* copy MM5 into MM7 */
psraw mm6, 15 /* fill MM6 words with word sign bit */
psraw mm7, 15 /* fill MM7 words with word sign bit */
pxor mm4, mm6 /* take 1's compliment of only neg words */
pxor mm5, mm7 /* take 1's compliment of only neg words */
psubsw mm4, mm6 /* add 1 to only neg words, W-(-1) or W-0 */
psubsw mm5, mm7 /* add 1 to only neg words, W-(-1) or W-0 */
packuswb mm4, mm5 /* combine and pack/saturate MM5 and MM4 */
movq [edi], mm4 /* store result in Dest */
/* ---, */
sub esi, eax /* move to the current top row in Src */
sub esi, eax
add esi, 8 /* move Src pointer to the next 8 pixels */
add edi, 8 /* move Dest pointer to the next 8 pixels */
/* ---, */
dec ecx /* decrease loop counter COLUMNS */
jnz L10402 /* check loop termination, proceed if required */
mov esi, ebx /* restore most left current row Src address */
movd edi, mm1 /* restore most left current row Dest address */
add esi, eax /* move to the next row in Src */
add edi, eax /* move to the next row in Dest */
dec edx /* decrease loop counter ROWS */
jnz L10400 /* check loop termination, proceed if required */
/* ---, */
emms /* exit MMX state */
popa
}
#else
asm volatile
("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */
"mov %3, %%eax \n\t" /* load columns into EAX */
/* --- */
"mov %1, %%esi \n\t" /* ESI = Src row 0 address */
"mov %0, %%edi \n\t" /* load Dest address to EDI */
"add %%eax, %%edi \n\t" /* EDI = EDI + columns */
"inc %%edi \n\t" /* 1 byte offset from the left edge */
"mov %2, %%edx \n\t" /* initialize ROWS counter */
"sub $2, %%edx \n\t" /* do not use first and last rows */
/* --- */
".L10400: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMS counter */
"shr $3, %%ecx \n\t" /* EBX/8 (MMX loads 8 bytes at a time) */
"mov %%esi, %%ebx \n\t" /* save ESI in EBX */
"movd %%edi, %%mm1 \n\t" /* save EDI in MM1 */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
".L10402: \n\t"
/* --- */
"movq (%%esi), %%mm4 \n\t" /* load 8 bytes from Src */
"movq %%mm4, %%mm5 \n\t" /* save MM4 in MM5 */
"add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */
"punpcklbw %%mm0, %%mm4 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm5 \n\t" /* unpack 4 high bytes into words */
"movq (%%esi), %%mm6 \n\t" /* load 8 bytes from Src */
"movq %%mm6, %%mm7 \n\t" /* save MM6 in MM7 */
"sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */
"punpcklbw %%mm0, %%mm6 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm7 \n\t" /* unpack 4 high bytes into words */
"add %%eax, %%esi \n\t" /* move to the next row of Src */
"movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */
"movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */
"add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */
"punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */
"paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */
"paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */
"paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */
"paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */
"movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */
"movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */
"sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */
"punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */
"paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */
"paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */
"paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */
"paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */
"add %%eax, %%esi \n\t" /* move to the next row of Src */
"movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */
"movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */
"add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */
"punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */
"paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */
"paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */
"movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */
"movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */
"sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */
"punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */
"paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */
"paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */
/* --- */
"movq %%mm4, %%mm2 \n\t" /* copy MM4 into MM2 */
"psrlq $32, %%mm4 \n\t" /* shift 2 left words to the right */
"psubw %%mm2, %%mm4 \n\t" /* MM4 = MM4 - MM2 */
"movq %%mm6, %%mm3 \n\t" /* copy MM6 into MM3 */
"psrlq $32, %%mm6 \n\t" /* shift 2 left words to the right */
"psubw %%mm3, %%mm6 \n\t" /* MM6 = MM6 - MM3 */
"punpckldq %%mm6, %%mm4 \n\t" /* combine 2 words of MM6 and 2 words of MM4 */
"movq %%mm5, %%mm2 \n\t" /* copy MM6 into MM2 */
"psrlq $32, %%mm5 \n\t" /* shift 2 left words to the right */
"psubw %%mm2, %%mm5 \n\t" /* MM5 = MM5 - MM2 */
"movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */
"psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */
"psubw %%mm3, %%mm7 \n\t" /* MM7 = MM7 - MM3 */
"punpckldq %%mm7, %%mm5 \n\t" /* combine 2 words of MM7 and 2 words of MM5 */
/* Take abs values of MM4 and MM5 */
"movq %%mm4, %%mm6 \n\t" /* copy MM4 into MM6 */
"movq %%mm5, %%mm7 \n\t" /* copy MM5 into MM7 */
"psraw $15, %%mm6 \n\t" /* fill MM6 words with word sign bit */
"psraw $15, %%mm7 \n\t" /* fill MM7 words with word sign bit */
"pxor %%mm6, %%mm4 \n\t" /* take 1's compliment of only neg. words */
"pxor %%mm7, %%mm5 \n\t" /* take 1's compliment of only neg. words */
"psubsw %%mm6, %%mm4 \n\t" /* add 1 to only neg. words, W-(-1) or W-0 */
"psubsw %%mm7, %%mm5 \n\t" /* add 1 to only neg. words, W-(-1) or W-0 */
"packuswb %%mm5, %%mm4 \n\t" /* combine and pack/saturate MM5 and MM4 */
"movq %%mm4, (%%edi) \n\t" /* store result in Dest */
/* --- */
"sub %%eax, %%esi \n\t" /* move to the current top row in Src */
"sub %%eax, %%esi \n\t" "add $8, %%esi \n\t" /* move Src pointer to the next 8 pixels */
"add $8, %%edi \n\t" /* move Dest pointer to the next 8 pixels */
/* --- */
"dec %%ecx \n\t" /* decrease loop counter COLUMNS */
"jnz .L10402 \n\t" /* check loop termination, proceed if required */
"mov %%ebx, %%esi \n\t" /* restore most left current row Src address */
"movd %%mm1, %%edi \n\t" /* restore most left current row Dest address */
"add %%eax, %%esi \n\t" /* move to the next row in Src */
"add %%eax, %%edi \n\t" /* move to the next row in Dest */
"dec %%edx \n\t" /* decrease loop counter ROWS */
"jnz .L10400 \n\t" /* check loop termination, proceed if required */
/* --- */
"emms \n\t" /* exit MMX state */
"popa \n\t":"=m" (Dest) /* %0 */
:"m"(Src), /* %1 */
"m"(rows), /* %2 */
"m"(columns) /* %3 */
);
#endif
#endif
return (0);
} else {
/* No non-MMX implementation yet */
return (-1);
}
}
/*!
\brief Filter using SobelXShiftRight: Dij = saturation255( ... )
\param Src The source 2D byte array to sobel-filter. Should be different from destination.
\param Dest The destination 2D byte array to store the result in. Should be different from source.
\param rows Number of rows in source/destination array. Must be >2.
\param columns Number of columns in source/destination array. Must be >8.
\param NRightShift The number of right bit shifts to apply to the filter sum. Must be <7.
Note: Non-MMX implementation not available for this function.
\return Returns 1 if filter was applied, 0 otherwise.
*/
int SDL_imageFilterSobelXShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
unsigned char NRightShift)
{
/* Validate input parameters */
if ((Src == NULL) || (Dest == NULL))
return(-1);
if ((columns < 8) || (rows < 3) || (NRightShift > 7))
return (-1);
if ((SDL_imageFilterMMXdetect())) {
//#ifdef USE_MMX
#if defined(USE_MMX) && defined(i386)
#if !defined(GCC__)
__asm
{
pusha
pxor mm0, mm0 /* zero MM0 */
mov eax, columns /* load columns into EAX */
xor ebx, ebx /* zero EBX */
mov bl, NRightShift /* load NRightShift into BL */
movd mm1, ebx /* copy NRightShift into MM1 */
/* ---, */
mov esi, Src /* ESI = Src row 0 address */
mov edi, Dest /* load Dest address to EDI */
add edi, eax /* EDI = EDI + columns */
inc edi /* 1 byte offset from the left edge */
/* initialize ROWS counter */
sub rows, 2 /* do not use first and last rows */
/* ---, */
L10410:
mov ecx, eax /* initialize COLUMS counter */
shr ecx, 3 /* EBX/8 (MMX loads 8 bytes at a time) */
mov ebx, esi /* save ESI in EBX */
mov edx, edi /* save EDI in EDX */
align 16 /* 16 byte alignment of the loop entry */
L10412:
/* ---, */
movq mm4, [esi] /* load 8 bytes from Src */
movq mm5, mm4 /* save MM4 in MM5 */
add esi, 2 /* move ESI pointer 2 bytes right */
punpcklbw mm4, mm0 /* unpack 4 low bytes into words */
punpckhbw mm5, mm0 /* unpack 4 high bytes into words */
psrlw mm4, mm1 /* shift right each pixel NshiftRight times */
psrlw mm5, mm1 /* shift right each pixel NshiftRight times */
movq mm6, [esi] /* load 8 bytes from Src */
movq mm7, mm6 /* save MM6 in MM7 */
sub esi, 2 /* move ESI pointer back 2 bytes left */
punpcklbw mm6, mm0 /* unpack 4 low bytes into words */
punpckhbw mm7, mm0 /* unpack 4 high bytes into words */
psrlw mm6, mm1 /* shift right each pixel NshiftRight times */
psrlw mm7, mm1 /* shift right each pixel NshiftRight times */
add esi, eax /* move to the next row of Src */
movq mm2, [esi] /* load 8 bytes from Src */
movq mm3, mm2 /* save MM2 in MM3 */
add esi, 2 /* move ESI pointer 2 bytes right */
punpcklbw mm2, mm0 /* unpack 4 low bytes into words */
punpckhbw mm3, mm0 /* unpack 4 high bytes into words */
psrlw mm2, mm1 /* shift right each pixel NshiftRight times */
psrlw mm3, mm1 /* shift right each pixel NshiftRight times */
paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */
paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */
paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */
paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */
movq mm2, [esi] /* load 8 bytes from Src */
movq mm3, mm2 /* save MM2 in MM3 */
sub esi, 2 /* move ESI pointer back 2 bytes left */
punpcklbw mm2, mm0 /* unpack 4 low bytes into words */
punpckhbw mm3, mm0 /* unpack 4 high bytes into words */
psrlw mm2, mm1 /* shift right each pixel NshiftRight times */
psrlw mm3, mm1 /* shift right each pixel NshiftRight times */
paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */
paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */
paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */
paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */
add esi, eax /* move to the next row of Src */
movq mm2, [esi] /* load 8 bytes from Src */
movq mm3, mm2 /* save MM2 in MM3 */
add esi, 2 /* move ESI pointer 2 bytes right */
punpcklbw mm2, mm0 /* unpack 4 low bytes into words */
punpckhbw mm3, mm0 /* unpack 4 high bytes into words */
psrlw mm2, mm1 /* shift right each pixel NshiftRight times */
psrlw mm3, mm1 /* shift right each pixel NshiftRight times */
paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */
paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */
movq mm2, [esi] /* load 8 bytes from Src */
movq mm3, mm2 /* save MM2 in MM3 */
sub esi, 2 /* move ESI pointer back 2 bytes left */
punpcklbw mm2, mm0 /* unpack 4 low bytes into words */
punpckhbw mm3, mm0 /* unpack 4 high bytes into words */
psrlw mm2, mm1 /* shift right each pixel NshiftRight times */
psrlw mm3, mm1 /* shift right each pixel NshiftRight times */
paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */
paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */
/* ---, */
movq mm2, mm4 /* copy MM4 into MM2 */
psrlq mm4, 32 /* shift 2 left words to the right */
psubw mm4, mm2 /* MM4 = MM4 - MM2 */
movq mm3, mm6 /* copy MM6 into MM3 */
psrlq mm6, 32 /* shift 2 left words to the right */
psubw mm6, mm3 /* MM6 = MM6 - MM3 */
punpckldq mm4, mm6 /* combine 2 words of MM6 and 2 words of MM4 */
movq mm2, mm5 /* copy MM6 into MM2 */
psrlq mm5, 32 /* shift 2 left words to the right */
psubw mm5, mm2 /* MM5 = MM5 - MM2 */
movq mm3, mm7 /* copy MM7 into MM3 */
psrlq mm7, 32 /* shift 2 left words to the right */
psubw mm7, mm3 /* MM7 = MM7 - MM3 */
punpckldq mm5, mm7 /* combine 2 words of MM7 and 2 words of MM5 */
/* Take abs values of MM4 and MM5 */
movq mm6, mm4 /* copy MM4 into MM6 */
movq mm7, mm5 /* copy MM5 into MM7 */
psraw mm6, 15 /* fill MM6 words with word sign bit */
psraw mm7, 15 /* fill MM7 words with word sign bit */
pxor mm4, mm6 /* take 1's compliment of only neg words */
pxor mm5, mm7 /* take 1's compliment of only neg words */
psubsw mm4, mm6 /* add 1 to only neg words, W-(-1) or W-0 */
psubsw mm5, mm7 /* add 1 to only neg words, W-(-1) or W-0 */
packuswb mm4, mm5 /* combine and pack/saturate MM5 and MM4 */
movq [edi], mm4 /* store result in Dest */
/* ---, */
sub esi, eax /* move to the current top row in Src */
sub esi, eax
add esi, 8 /* move Src pointer to the next 8 pixels */
add edi, 8 /* move Dest pointer to the next 8 pixels */
/* ---, */
dec ecx /* decrease loop counter COLUMNS */
jnz L10412 /* check loop termination, proceed if required */
mov esi, ebx /* restore most left current row Src address */
mov edi, edx /* restore most left current row Dest address */
add esi, eax /* move to the next row in Src */
add edi, eax /* move to the next row in Dest */
dec rows /* decrease loop counter ROWS */
jnz L10410 /* check loop termination, proceed if required */
/* ---, */
emms /* exit MMX state */
popa
}
#else
asm volatile
("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */
"mov %3, %%eax \n\t" /* load columns into EAX */
"xor %%ebx, %%ebx \n\t" /* zero EBX */
"mov %4, %%bl \n\t" /* load NRightShift into BL */
"movd %%ebx, %%mm1 \n\t" /* copy NRightShift into MM1 */
/* --- */
"mov %1, %%esi \n\t" /* ESI = Src row 0 address */
"mov %0, %%edi \n\t" /* load Dest address to EDI */
"add %%eax, %%edi \n\t" /* EDI = EDI + columns */
"inc %%edi \n\t" /* 1 byte offset from the left edge */
/* initialize ROWS counter */
"subl $2, %2 \n\t" /* do not use first and last rows */
/* --- */
".L10410: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMS counter */
"shr $3, %%ecx \n\t" /* EBX/8 (MMX loads 8 bytes at a time) */
"mov %%esi, %%ebx \n\t" /* save ESI in EBX */
"mov %%edi, %%edx \n\t" /* save EDI in EDX */
".align 16 \n\t" /* 16 byte alignment of the loop entry */
".L10412: \n\t"
/* --- */
"movq (%%esi), %%mm4 \n\t" /* load 8 bytes from Src */
"movq %%mm4, %%mm5 \n\t" /* save MM4 in MM5 */
"add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */
"punpcklbw %%mm0, %%mm4 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm5 \n\t" /* unpack 4 high bytes into words */
"psrlw %%mm1, %%mm4 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm1, %%mm5 \n\t" /* shift right each pixel NshiftRight times */
"movq (%%esi), %%mm6 \n\t" /* load 8 bytes from Src */
"movq %%mm6, %%mm7 \n\t" /* save MM6 in MM7 */
"sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */
"punpcklbw %%mm0, %%mm6 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm7 \n\t" /* unpack 4 high bytes into words */
"psrlw %%mm1, %%mm6 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm1, %%mm7 \n\t" /* shift right each pixel NshiftRight times */
"add %%eax, %%esi \n\t" /* move to the next row of Src */
"movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */
"movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */
"add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */
"punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */
"psrlw %%mm1, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm1, %%mm3 \n\t" /* shift right each pixel NshiftRight times */
"paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */
"paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */
"paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */
"paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */
"movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */
"movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */
"sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */
"punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */
"psrlw %%mm1, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm1, %%mm3 \n\t" /* shift right each pixel NshiftRight times */
"paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */
"paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */
"paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */
"paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */
"add %%eax, %%esi \n\t" /* move to the next row of Src */
"movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */
"movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */
"add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */
"punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */
"psrlw %%mm1, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm1, %%mm3 \n\t" /* shift right each pixel NshiftRight times */
"paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */
"paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */
"movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */
"movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */
"sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */
"punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */
"punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */
"psrlw %%mm1, %%mm2 \n\t" /* shift right each pixel NshiftRight times */
"psrlw %%mm1, %%mm3 \n\t" /* shift right each pixel NshiftRight times */
"paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */
"paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */
/* --- */
"movq %%mm4, %%mm2 \n\t" /* copy MM4 into MM2 */
"psrlq $32, %%mm4 \n\t" /* shift 2 left words to the right */
"psubw %%mm2, %%mm4 \n\t" /* MM4 = MM4 - MM2 */
"movq %%mm6, %%mm3 \n\t" /* copy MM6 into MM3 */
"psrlq $32, %%mm6 \n\t" /* shift 2 left words to the right */
"psubw %%mm3, %%mm6 \n\t" /* MM6 = MM6 - MM3 */
"punpckldq %%mm6, %%mm4 \n\t" /* combine 2 words of MM6 and 2 words of MM4 */
"movq %%mm5, %%mm2 \n\t" /* copy MM6 into MM2 */
"psrlq $32, %%mm5 \n\t" /* shift 2 left words to the right */
"psubw %%mm2, %%mm5 \n\t" /* MM5 = MM5 - MM2 */
"movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */
"psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */
"psubw %%mm3, %%mm7 \n\t" /* MM7 = MM7 - MM3 */
"punpckldq %%mm7, %%mm5 \n\t" /* combine 2 words of MM7 and 2 words of MM5 */
/* Take abs values of MM4 and MM5 */
"movq %%mm4, %%mm6 \n\t" /* copy MM4 into MM6 */
"movq %%mm5, %%mm7 \n\t" /* copy MM5 into MM7 */
"psraw $15, %%mm6 \n\t" /* fill MM6 words with word sign bit */
"psraw $15, %%mm7 \n\t" /* fill MM7 words with word sign bit */
"pxor %%mm6, %%mm4 \n\t" /* take 1's compliment of only neg. words */
"pxor %%mm7, %%mm5 \n\t" /* take 1's compliment of only neg. words */
"psubsw %%mm6, %%mm4 \n\t" /* add 1 to only neg. words, W-(-1) or W-0 */
"psubsw %%mm7, %%mm5 \n\t" /* add 1 to only neg. words, W-(-1) or W-0 */
"packuswb %%mm5, %%mm4 \n\t" /* combine and pack/saturate MM5 and MM4 */
"movq %%mm4, (%%edi) \n\t" /* store result in Dest */
/* --- */
"sub %%eax, %%esi \n\t" /* move to the current top row in Src */
"sub %%eax, %%esi \n\t" "add $8, %%esi \n\t" /* move Src pointer to the next 8 pixels */
"add $8, %%edi \n\t" /* move Dest pointer to the next 8 pixels */
/* --- */
"dec %%ecx \n\t" /* decrease loop counter COLUMNS */
"jnz .L10412 \n\t" /* check loop termination, proceed if required */
"mov %%ebx, %%esi \n\t" /* restore most left current row Src address */
"mov %%edx, %%edi \n\t" /* restore most left current row Dest address */
"add %%eax, %%esi \n\t" /* move to the next row in Src */
"add %%eax, %%edi \n\t" /* move to the next row in Dest */
"decl %2 \n\t" /* decrease loop counter ROWS */
"jnz .L10410 \n\t" /* check loop termination, proceed if required */
/* --- */
"emms \n\t" /* exit MMX state */
"popa \n\t":"=m" (Dest) /* %0 */
:"m"(Src), /* %1 */
"m"(rows), /* %2 */
"m"(columns), /* %3 */
"m"(NRightShift) /* %4 */
);
#endif
#endif
return (0);
} else {
/* No non-MMX implementation yet */
return (-1);
}
}
/*!
\brief Align stack to 32 byte boundary,
*/
void SDL_imageFilterAlignStack(void)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{ /* --- stack alignment --- */
mov ebx, esp /* load ESP into EBX */
sub ebx, 4 /* reserve space on stack for old value of ESP */
and ebx, -32 /* align EBX along a 32 byte boundary */
mov [ebx], esp /* save old value of ESP in stack, behind the bndry */
mov esp, ebx /* align ESP along a 32 byte boundary */
}
#else
asm volatile
( /* --- stack alignment --- */
"mov %%esp, %%ebx \n\t" /* load ESP into EBX */
"sub $4, %%ebx \n\t" /* reserve space on stack for old value of ESP */
"and $-32, %%ebx \n\t" /* align EBX along a 32 byte boundary */
"mov %%esp, (%%ebx) \n\t" /* save old value of ESP in stack, behind the bndry */
"mov %%ebx, %%esp \n\t" /* align ESP along a 32 byte boundary */
::);
#endif
#endif
}
/*!
\brief Restore previously aligned stack.
*/
void SDL_imageFilterRestoreStack(void)
{
#ifdef USE_MMX
#if !defined(GCC__)
__asm
{ /* --- restoring old stack --- */
mov ebx, [esp] /* load old value of ESP */
mov esp, ebx /* restore old value of ESP */
}
#else
asm volatile
( /* --- restoring old stack --- */
"mov (%%esp), %%ebx \n\t" /* load old value of ESP */
"mov %%ebx, %%esp \n\t" /* restore old value of ESP */
::);
#endif
#endif
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/SDL_imageFilter.c | C | apache-2.0 | 311,696 |
/*
SDL_imageFilter.h: byte-image "filter" routines
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
#ifndef _SDL_imageFilter_h
#define _SDL_imageFilter_h
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* ---- Function Prototypes */
#ifdef _MSC_VER
# if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
# define SDL_IMAGEFILTER_SCOPE __declspec(dllexport)
# else
# ifdef LIBSDL_GFX_DLL_IMPORT
# define SDL_IMAGEFILTER_SCOPE __declspec(dllimport)
# endif
# endif
#endif
#ifndef SDL_IMAGEFILTER_SCOPE
# define SDL_IMAGEFILTER_SCOPE extern
#endif
/* Comments: */
/* 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. */
/* 2.) Data that is not within an 8 byte boundary is processed using the C routine. */
/* 3.) Convolution routines do not have C routines at this time. */
// Detect MMX capability in CPU
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMMXdetect(void);
// Force use of MMX off (or turn possible use back on)
SDL_IMAGEFILTER_SCOPE void SDL_imageFilterMMXoff(void);
SDL_IMAGEFILTER_SCOPE void SDL_imageFilterMMXon(void);
//
// All routines return:
// 0 OK
// -1 Error (internal error, parameter error)
//
// SDL_imageFilterAdd: D = saturation255(S1 + S2)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAdd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
// SDL_imageFilterMean: D = S1/2 + S2/2
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMean(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
// SDL_imageFilterSub: D = saturation0(S1 - S2)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSub(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
// SDL_imageFilterAbsDiff: D = | S1 - S2 |
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAbsDiff(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
// SDL_imageFilterMult: D = saturation(S1 * S2)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMult(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
// SDL_imageFilterMultNor: D = S1 * S2 (non-MMX)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultNor(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
// SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby2(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest,
unsigned int length);
// SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby4(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest,
unsigned int length);
// SDL_imageFilterBitAnd: D = S1 & S2
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitAnd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
// SDL_imageFilterBitOr: D = S1 | S2
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitOr(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
// SDL_imageFilterDiv: D = S1 / S2 (non-MMX)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length);
// SDL_imageFilterBitNegation: D = !S
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBitNegation(unsigned char *Src1, unsigned char *Dest, unsigned int length);
// SDL_imageFilterAddByte: D = saturation255(S + C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
// SDL_imageFilterAddUint: D = saturation255(S + (uint)C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C);
// SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterAddByteToHalf(unsigned char *Src1, unsigned char *Dest, unsigned int length,
unsigned char C);
// SDL_imageFilterSubByte: D = saturation0(S - C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSubByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
// SDL_imageFilterSubUint: D = saturation0(S - (uint)C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSubUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C);
// SDL_imageFilterShiftRight: D = saturation0(S >> N)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRight(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
// SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
// SDL_imageFilterMultByByte: D = saturation255(S * C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C);
// SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightAndMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length,
unsigned char N, unsigned char C);
// SDL_imageFilterShiftLeftByte: D = (S << N)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftByte(unsigned char *Src1, unsigned char *Dest, unsigned int length,
unsigned char N);
// SDL_imageFilterShiftLeftUint: D = ((uint)S << N)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftUint(unsigned char *Src1, unsigned char *Dest, unsigned int length,
unsigned char N);
// SDL_imageFilterShiftLeft: D = saturation255(S << N)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeft(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N);
// SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterBinarizeUsingThreshold(unsigned char *Src1, unsigned char *Dest, unsigned int length,
unsigned char T);
// SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterClipToRange(unsigned char *Src1, unsigned char *Dest, unsigned int length,
unsigned char Tmin, unsigned char Tmax);
// SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterNormalizeLinear(unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin,
int Cmax, int Nmin, int Nmax);
/* !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!! */
// SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel3x3Divide(unsigned char *Src, unsigned char *Dest, int rows,
int columns, signed short *Kernel, unsigned char Divisor);
// SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel5x5Divide(unsigned char *Src, unsigned char *Dest, int rows,
int columns, signed short *Kernel, unsigned char Divisor);
// SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel7x7Divide(unsigned char *Src, unsigned char *Dest, int rows,
int columns, signed short *Kernel, unsigned char Divisor);
// SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel9x9Divide(unsigned char *Src, unsigned char *Dest, int rows,
int columns, signed short *Kernel, unsigned char Divisor);
// SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel3x3ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
int columns, signed short *Kernel,
unsigned char NRightShift);
// SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel5x5ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
int columns, signed short *Kernel,
unsigned char NRightShift);
// SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel7x7ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
int columns, signed short *Kernel,
unsigned char NRightShift);
// SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterConvolveKernel9x9ShiftRight(unsigned char *Src, unsigned char *Dest, int rows,
int columns, signed short *Kernel,
unsigned char NRightShift);
// SDL_imageFilterSobelX: Dij = saturation255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSobelX(unsigned char *Src, unsigned char *Dest, int rows, int columns);
// SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... )
SDL_IMAGEFILTER_SCOPE int SDL_imageFilterSobelXShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns,
unsigned char NRightShift);
// Align/restore stack to 32 byte boundary -- Functionality untested! --
SDL_IMAGEFILTER_SCOPE void SDL_imageFilterAlignStack(void);
SDL_IMAGEFILTER_SCOPE void SDL_imageFilterRestoreStack(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#endif /* _SDL_imageFilter_h */
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/SDL_imageFilter.h | C | apache-2.0 | 10,318 |
/*
SDL_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
#ifdef WIN32
#include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "SDL_rotozoom.h"
/* ---- Internally used structures */
/*!
\brief A 32 bit RGBA pixel.
*/
typedef struct tColorRGBA {
Uint8 r;
Uint8 g;
Uint8 b;
Uint8 a;
} tColorRGBA;
/*!
\brief A 8bit Y/palette pixel.
*/
typedef struct tColorY {
Uint8 y;
} tColorY;
/*!
\brief Returns maximum of two numbers a and b.
*/
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
/*!
\brief Number of guard rows added to destination surfaces.
This is a simple but effective workaround for observed issues.
These rows allocate extra memory and are then hidden from the surface.
Rows are added to the end of destination surfaces when they are allocated.
This catches any potential overflows which seem to happen with
just the right src image dimensions and scale/rotation and can lead
to a situation where the program can segfault.
*/
#define GUARD_ROWS (2)
/*!
\brief Lower limit of absolute zoom factor or rotation degrees.
*/
#define VALUE_LIMIT 0.001
/*!
\brief Returns colorkey info for a surface
*/
Uint32 _colorkey(SDL_Surface *src)
{
Uint32 key = 0;
#if (SDL_MINOR_VERSION == 3)
SDL_GetColorKey(src, &key);
#else
if (src)
{
key = src->format->colorkey;
}
#endif
return key;
}
/*!
\brief Internal 32 bit integer-factor averaging Shrinker.
Shrinks 32 bit RGBA/ABGR 'src' surface to 'dst' surface.
Averages color and alpha values values of src pixels to calculate dst pixels.
Assumes src and dst surfaces are of 32 bit depth.
Assumes dst surface was allocated with the correct dimensions.
\param src The surface to shrink (input).
\param dst The shrunken surface (output).
\param factorx The horizontal shrinking ratio.
\param factory The vertical shrinking ratio.
\return 0 for success or -1 for error.
*/
int _shrinkSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int factorx, int factory)
{
int x, y, dx, dy, sgap, dgap, ra, ga, ba, aa;
int n_average;
tColorRGBA *sp, *osp, *oosp;
tColorRGBA *dp;
/*
* Averaging integer shrink
*/
/* Precalculate division factor */
n_average = factorx*factory;
/*
* Scan destination
*/
sp = (tColorRGBA *) src->pixels;
sgap = src->pitch - src->w * 4;
dp = (tColorRGBA *) dst->pixels;
dgap = dst->pitch - dst->w * 4;
for (y = 0; y < dst->h; y++) {
osp=sp;
for (x = 0; x < dst->w; x++) {
/* Trace out source box and accumulate */
oosp=sp;
ra=ga=ba=aa=0;
for (dy=0; dy < factory; dy++) {
for (dx=0; dx < factorx; dx++) {
ra += sp->r;
ga += sp->g;
ba += sp->b;
aa += sp->a;
sp++;
}
/* src dx loop */
sp = (tColorRGBA *)((Uint8*)sp + (src->pitch - 4*factorx)); // next y
}
/* src dy loop */
/* next box-x */
sp = (tColorRGBA *)((Uint8*)oosp + 4*factorx);
/* Store result in destination */
dp->r = ra/n_average;
dp->g = ga/n_average;
dp->b = ba/n_average;
dp->a = aa/n_average;
/*
* Advance destination pointer
*/
dp++;
}
/* dst x loop */
/* next box-y */
sp = (tColorRGBA *)((Uint8*)osp + src->pitch*factory);
/*
* Advance destination pointers
*/
dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
}
/* dst y loop */
return (0);
}
/*!
\brief Internal 8 bit integer-factor averaging shrinker.
Shrinks 8bit Y 'src' surface to 'dst' surface.
Averages color (brightness) values values of src pixels to calculate dst pixels.
Assumes src and dst surfaces are of 8 bit depth.
Assumes dst surface was allocated with the correct dimensions.
\param src The surface to shrink (input).
\param dst The shrunken surface (output).
\param factorx The horizontal shrinking ratio.
\param factory The vertical shrinking ratio.
\return 0 for success or -1 for error.
*/
int _shrinkSurfaceY(SDL_Surface * src, SDL_Surface * dst, int factorx, int factory)
{
int x, y, dx, dy, sgap, dgap, a;
int n_average;
Uint8 *sp, *osp, *oosp;
Uint8 *dp;
/*
* Averaging integer shrink
*/
/* Precalculate division factor */
n_average = factorx*factory;
/*
* Scan destination
*/
sp = (Uint8 *) src->pixels;
sgap = src->pitch - src->w;
dp = (Uint8 *) dst->pixels;
dgap = dst->pitch - dst->w;
for (y = 0; y < dst->h; y++) {
osp=sp;
for (x = 0; x < dst->w; x++) {
/* Trace out source box and accumulate */
oosp=sp;
a=0;
for (dy=0; dy < factory; dy++) {
for (dx=0; dx < factorx; dx++) {
a += (*sp);
/* next x */
sp++;
}
/* end src dx loop */
/* next y */
sp = (Uint8 *)((Uint8*)sp + (src->pitch - factorx));
}
/* end src dy loop */
/* next box-x */
sp = (Uint8 *)((Uint8*)oosp + factorx);
/* Store result in destination */
*dp = a/n_average;
/*
* Advance destination pointer
*/
dp++;
}
/* end dst x loop */
/* next box-y */
sp = (Uint8 *)((Uint8*)osp + src->pitch*factory);
/*
* Advance destination pointers
*/
dp = (Uint8 *)((Uint8 *)dp + dgap);
}
/* end dst y loop */
return (0);
}
/*!
\brief Internal 32 bit Zoomer with optional anti-aliasing by bilinear interpolation.
Zooms 32 bit RGBA/ABGR 'src' surface to 'dst' surface.
Assumes src and dst surfaces are of 32 bit depth.
Assumes dst surface was allocated with the correct dimensions.
\param src The surface to zoom (input).
\param dst The zoomed surface (output).
\param flipx Flag indicating if the image should be horizontally flipped.
\param flipy Flag indicating if the image should be vertically flipped.
\param smooth Antialiasing flag; set to SMOOTHING_ON to enable.
\return 0 for success or -1 for error.
*/
int _zoomSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy, int smooth)
{
int x, y, sx, sy, ssx, ssy, *sax, *say, *csax, *csay, *salast, csx, csy, ex, ey, cx, cy, sstep, sstepx, sstepy;
tColorRGBA *c00, *c01, *c10, *c11;
tColorRGBA *sp, *csp, *dp;
int spixelgap, spixelw, spixelh, dgap, t1, t2;
/*
* Allocate memory for row/column increments
*/
if ((sax = (int *) malloc((dst->w + 1) * sizeof(Uint32))) == NULL) {
return (-1);
}
if ((say = (int *) malloc((dst->h + 1) * sizeof(Uint32))) == NULL) {
free(sax);
return (-1);
}
/*
* Precalculate row increments
*/
spixelw = (src->w - 1);
spixelh = (src->h - 1);
if (smooth) {
sx = (int) (65536.0 * (float) spixelw / (float) (dst->w - 1));
sy = (int) (65536.0 * (float) spixelh / (float) (dst->h - 1));
} else {
sx = (int) (65536.0 * (float) (src->w) / (float) (dst->w));
sy = (int) (65536.0 * (float) (src->h) / (float) (dst->h));
}
/* Maximum scaled source size */
ssx = (src->w << 16) - 1;
ssy = (src->h << 16) - 1;
/* Precalculate horizontal row increments */
csx = 0;
csax = sax;
for (x = 0; x <= dst->w; x++) {
*csax = csx;
csax++;
csx += sx;
/* Guard from overflows */
if (csx > ssx) {
csx = ssx;
}
}
/* Precalculate vertical row increments */
csy = 0;
csay = say;
for (y = 0; y <= dst->h; y++) {
*csay = csy;
csay++;
csy += sy;
/* Guard from overflows */
if (csy > ssy) {
csy = ssy;
}
}
sp = (tColorRGBA *) src->pixels;
dp = (tColorRGBA *) dst->pixels;
dgap = dst->pitch - dst->w * 4;
spixelgap = src->pitch/4;
if (flipx) sp += spixelw;
if (flipy) sp += (spixelgap * spixelh);
/*
* Switch between interpolating and non-interpolating code
*/
if (smooth) {
/*
* Interpolating Zoom
*/
csay = say;
for (y = 0; y < dst->h; y++) {
csp = sp;
csax = sax;
for (x = 0; x < dst->w; x++) {
/*
* Setup color source pointers
*/
ex = (*csax & 0xffff);
ey = (*csay & 0xffff);
cx = (*csax >> 16);
cy = (*csay >> 16);
sstepx = cx < spixelw;
sstepy = cy < spixelh;
c00 = sp;
c01 = sp;
c10 = sp;
if (sstepy) {
if (flipy) {
c10 -= spixelgap;
} else {
c10 += spixelgap;
}
}
c11 = c10;
if (sstepx) {
if (flipx) {
c01--;
c11--;
} else {
c01++;
c11++;
}
}
/*
* Draw and interpolate colors
*/
t1 = ((((c01->r - c00->r) * ex) >> 16) + c00->r) & 0xff;
t2 = ((((c11->r - c10->r) * ex) >> 16) + c10->r) & 0xff;
dp->r = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->g - c00->g) * ex) >> 16) + c00->g) & 0xff;
t2 = ((((c11->g - c10->g) * ex) >> 16) + c10->g) & 0xff;
dp->g = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->b - c00->b) * ex) >> 16) + c00->b) & 0xff;
t2 = ((((c11->b - c10->b) * ex) >> 16) + c10->b) & 0xff;
dp->b = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->a - c00->a) * ex) >> 16) + c00->a) & 0xff;
t2 = ((((c11->a - c10->a) * ex) >> 16) + c10->a) & 0xff;
dp->a = (((t2 - t1) * ey) >> 16) + t1;
/*
* Advance source pointer x
*/
salast = csax;
csax++;
sstep = (*csax >> 16) - (*salast >> 16);
if (flipx) {
sp -= sstep;
} else {
sp += sstep;
}
/*
* Advance destination pointer x
*/
dp++;
}
/*
* Advance source pointer y
*/
salast = csay;
csay++;
sstep = (*csay >> 16) - (*salast >> 16);
sstep *= spixelgap;
if (flipy) {
sp = csp - sstep;
} else {
sp = csp + sstep;
}
/*
* Advance destination pointer y
*/
dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
}
} else {
/*
* Non-Interpolating Zoom
*/
csay = say;
for (y = 0; y < dst->h; y++) {
csp = sp;
csax = sax;
for (x = 0; x < dst->w; x++) {
/*
* Draw
*/
*dp = *sp;
/*
* Advance source pointer x
*/
salast = csax;
csax++;
sstep = (*csax >> 16) - (*salast >> 16);
if (flipx) sstep = -sstep;
sp += sstep;
/*
* Advance destination pointer x
*/
dp++;
}
/*
* Advance source pointer y
*/
salast = csay;
csay++;
sstep = (*csay >> 16) - (*salast >> 16);
sstep *= spixelgap;
if (flipy) sstep = -sstep;
sp = csp + sstep;
/*
* Advance destination pointer y
*/
dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
}
}
/*
* Remove temp arrays
*/
free(sax);
free(say);
return (0);
}
/*!
\brief Internal 8 bit Zoomer without smoothing.
Zooms 8bit palette/Y 'src' surface to 'dst' surface.
Assumes src and dst surfaces are of 8 bit depth.
Assumes dst surface was allocated with the correct dimensions.
\param src The surface to zoom (input).
\param dst The zoomed surface (output).
\param flipx Flag indicating if the image should be horizontally flipped.
\param flipy Flag indicating if the image should be vertically flipped.
\return 0 for success or -1 for error.
*/
int _zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy)
{
int x, y;
Uint32 *sax, *say, *csax, *csay;
int csx, csy;
Uint8 *sp, *dp, *csp;
int dgap;
/*
* Allocate memory for row increments
*/
if ((sax = (Uint32 *) malloc((dst->w + 1) * sizeof(Uint32))) == NULL) {
return (-1);
}
if ((say = (Uint32 *) malloc((dst->h + 1) * sizeof(Uint32))) == NULL) {
free(sax);
return (-1);
}
/*
* Pointer setup
*/
sp = csp = (Uint8 *) src->pixels;
dp = (Uint8 *) dst->pixels;
dgap = dst->pitch - dst->w;
if (flipx) csp += (src->w-1);
if (flipy) csp = ( (Uint8*)csp + src->pitch*(src->h-1) );
/*
* Precalculate row increments
*/
csx = 0;
csax = sax;
for (x = 0; x < dst->w; x++) {
csx += src->w;
*csax = 0;
while (csx >= dst->w) {
csx -= dst->w;
(*csax)++;
}
(*csax) = (*csax) * (flipx ? -1 : 1);
csax++;
}
csy = 0;
csay = say;
for (y = 0; y < dst->h; y++) {
csy += src->h;
*csay = 0;
while (csy >= dst->h) {
csy -= dst->h;
(*csay)++;
}
(*csay) = (*csay) * (flipy ? -1 : 1);
csay++;
}
/*
* Draw
*/
csay = say;
for (y = 0; y < dst->h; y++) {
csax = sax;
sp = csp;
for (x = 0; x < dst->w; x++) {
/*
* Draw
*/
*dp = *sp;
/*
* Advance source pointers
*/
sp += (*csax);
csax++;
/*
* Advance destination pointer
*/
dp++;
}
/*
* Advance source pointer (for row)
*/
csp += ((*csay) * src->pitch);
csay++;
/*
* Advance destination pointers
*/
dp += dgap;
}
/*
* Remove temp arrays
*/
free(sax);
free(say);
return (0);
}
/*!
\brief Internal 32 bit rotozoomer with optional anti-aliasing.
Rotates and zooms 32 bit RGBA/ABGR 'src' surface to 'dst' surface based on the control
parameters by scanning the destination surface and applying optionally anti-aliasing
by bilinear interpolation.
Assumes src and dst surfaces are of 32 bit depth.
Assumes dst surface was allocated with the correct dimensions.
\param src Source surface.
\param dst Destination surface.
\param cx Horizontal center coordinate.
\param cy Vertical center coordinate.
\param isin Integer version of sine of angle.
\param icos Integer version of cosine of angle.
\param flipx Flag indicating horizontal mirroring should be applied.
\param flipy Flag indicating vertical mirroring should be applied.
\param smooth Flag indicating anti-aliasing should be used.
*/
void _transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
{
int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
tColorRGBA c00, c01, c10, c11, cswap;
tColorRGBA *pc, *sp;
int gap;
/*
* Variable setup
*/
xd = ((src->w - dst->w) << 15);
yd = ((src->h - dst->h) << 15);
ax = (cx << 16) - (icos * cx);
ay = (cy << 16) - (isin * cx);
sw = src->w - 1;
sh = src->h - 1;
pc = (tColorRGBA*) dst->pixels;
gap = dst->pitch - dst->w * 4;
/*
* Switch between interpolating and non-interpolating code
*/
if (smooth) {
for (y = 0; y < dst->h; y++) {
dy = cy - y;
sdx = (ax + (isin * dy)) + xd;
sdy = (ay - (icos * dy)) + yd;
for (x = 0; x < dst->w; x++) {
dx = (sdx >> 16);
dy = (sdy >> 16);
if (flipx) dx = sw - dx;
if (flipy) dy = sh - dy;
if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) {
sp = (tColorRGBA *)src->pixels;;
sp += ((src->pitch/4) * dy);
sp += dx;
c00 = *sp;
sp += 1;
c01 = *sp;
sp += (src->pitch/4);
c11 = *sp;
sp -= 1;
c10 = *sp;
if (flipx) {
cswap = c00; c00=c01; c01=cswap;
cswap = c10; c10=c11; c11=cswap;
}
if (flipy) {
cswap = c00; c00=c10; c10=cswap;
cswap = c01; c01=c11; c11=cswap;
}
/*
* Interpolate colors
*/
ex = (sdx & 0xffff);
ey = (sdy & 0xffff);
t1 = ((((c01.r - c00.r) * ex) >> 16) + c00.r) & 0xff;
t2 = ((((c11.r - c10.r) * ex) >> 16) + c10.r) & 0xff;
pc->r = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01.g - c00.g) * ex) >> 16) + c00.g) & 0xff;
t2 = ((((c11.g - c10.g) * ex) >> 16) + c10.g) & 0xff;
pc->g = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01.b - c00.b) * ex) >> 16) + c00.b) & 0xff;
t2 = ((((c11.b - c10.b) * ex) >> 16) + c10.b) & 0xff;
pc->b = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01.a - c00.a) * ex) >> 16) + c00.a) & 0xff;
t2 = ((((c11.a - c10.a) * ex) >> 16) + c10.a) & 0xff;
pc->a = (((t2 - t1) * ey) >> 16) + t1;
}
sdx += icos;
sdy += isin;
pc++;
}
pc = (tColorRGBA *) ((Uint8 *) pc + gap);
}
} else {
for (y = 0; y < dst->h; y++) {
dy = cy - y;
sdx = (ax + (isin * dy)) + xd;
sdy = (ay - (icos * dy)) + yd;
for (x = 0; x < dst->w; x++) {
dx = (short) (sdx >> 16);
dy = (short) (sdy >> 16);
if (flipx) dx = (src->w-1)-dx;
if (flipy) dy = (src->h-1)-dy;
if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) {
sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy);
sp += dx;
*pc = *sp;
}
sdx += icos;
sdy += isin;
pc++;
}
pc = (tColorRGBA *) ((Uint8 *) pc + gap);
}
}
}
/*!
\brief Rotates and zooms 8 bit palette/Y 'src' surface to 'dst' surface without smoothing.
Rotates and zooms 8 bit RGBA/ABGR 'src' surface to 'dst' surface based on the control
parameters by scanning the destination surface.
Assumes src and dst surfaces are of 8 bit depth.
Assumes dst surface was allocated with the correct dimensions.
\param src Source surface.
\param dst Destination surface.
\param cx Horizontal center coordinate.
\param cy Vertical center coordinate.
\param isin Integer version of sine of angle.
\param icos Integer version of cosine of angle.
\param flipx Flag indicating horizontal mirroring should be applied.
\param flipy Flag indicating vertical mirroring should be applied.
*/
void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
{
int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay, sw, sh;
tColorY *pc, *sp;
int gap;
/*
* Variable setup
*/
xd = ((src->w - dst->w) << 15);
yd = ((src->h - dst->h) << 15);
ax = (cx << 16) - (icos * cx);
ay = (cy << 16) - (isin * cx);
sw = src->w - 1;
sh = src->h - 1;
pc = (tColorY*) dst->pixels;
gap = dst->pitch - dst->w;
/*
* Clear surface to colorkey
*/
memset(pc, (int)(_colorkey(src) & 0xff), dst->pitch * dst->h);
/*
* Iterate through destination surface
*/
for (y = 0; y < dst->h; y++) {
dy = cy - y;
sdx = (ax + (isin * dy)) + xd;
sdy = (ay - (icos * dy)) + yd;
for (x = 0; x < dst->w; x++) {
dx = (short) (sdx >> 16);
dy = (short) (sdy >> 16);
if (flipx) dx = (src->w-1)-dx;
if (flipy) dy = (src->h-1)-dy;
if ((dx >= 0) && (dy >= 0) && (dx < src->w) && (dy < src->h)) {
sp = (tColorY *) (src->pixels);
sp += (src->pitch * dy + dx);
*pc = *sp;
}
sdx += icos;
sdy += isin;
pc++;
}
pc += gap;
}
}
/*!
\brief Rotates a 32 bit surface in increments of 90 degrees.
Specialized 90 degree rotator which rotates a 'src' surface in 90 degree
increments clockwise returning a new surface. Faster than rotozoomer since
not scanning or interpolation takes place. Input surface must be 32 bit.
(code contributed by J. Schiller, improved by C. Allport and A. Schiffler)
\param src Source surface to rotate.
\param numClockwiseTurns Number of clockwise 90 degree turns to apply to the source.
\returns The new, rotated surface; or NULL for surfaces with incorrect input format.
*/
SDL_Surface* rotateSurface90Degrees(SDL_Surface* src, int numClockwiseTurns)
{
int row, col, newWidth, newHeight;
int bpp, src_ipr, dst_ipr;
SDL_Surface* dst;
Uint32* srcBuf;
Uint32* dstBuf;
/* Has to be a valid surface pointer and only 32-bit surfaces (for now) */
if (!src || src->format->BitsPerPixel != 32) { return NULL; }
/* normalize numClockwiseTurns */
while(numClockwiseTurns < 0) { numClockwiseTurns += 4; }
numClockwiseTurns = (numClockwiseTurns % 4);
/* if it's even, our new width will be the same as the source surface */
newWidth = (numClockwiseTurns % 2) ? (src->h) : (src->w);
newHeight = (numClockwiseTurns % 2) ? (src->w) : (src->h);
dst = SDL_CreateRGBSurface( src->flags, newWidth, newHeight, src->format->BitsPerPixel,
src->format->Rmask,
src->format->Gmask,
src->format->Bmask,
src->format->Amask);
if(!dst) {
return NULL;
}
if (SDL_MUSTLOCK(dst)) {
SDL_LockSurface(dst);
}
if (SDL_MUSTLOCK(dst)) {
SDL_LockSurface(dst);
}
/* Calculate int-per-row */
bpp = src->format->BitsPerPixel / 8;
src_ipr = src->pitch / bpp;
dst_ipr = dst->pitch / bpp;
switch(numClockwiseTurns) {
case 0: /* Make a copy of the surface */
{
/* Unfortunately SDL_BlitSurface cannot be used to make a copy of the surface
since it does not preserve alpha. */
if (src->pitch == dst->pitch) {
/* If the pitch is the same for both surfaces, the memory can be copied all at once. */
memcpy(dst->pixels, src->pixels, (src->h * src->pitch));
}
else
{
/* If the pitch differs, copy each row separately */
srcBuf = (Uint32*)(src->pixels);
dstBuf = (Uint32*)(dst->pixels);
for (row = 0; row < src->h; row++) {
memcpy(dstBuf, srcBuf, dst->w * bpp);
srcBuf += src_ipr;
dstBuf += dst_ipr;
} /* end for(col) */
} /* end for(row) */
}
break;
/* rotate clockwise */
case 1: /* rotated 90 degrees clockwise */
{
for (row = 0; row < src->h; ++row) {
srcBuf = (Uint32*)(src->pixels) + (row * src_ipr);
dstBuf = (Uint32*)(dst->pixels) + (dst->w - row - 1);
for (col = 0; col < src->w; ++col) {
*dstBuf = *srcBuf;
++srcBuf;
dstBuf += dst_ipr;
}
/* end for(col) */
}
/* end for(row) */
}
break;
case 2: /* rotated 180 degrees clockwise */
{
for (row = 0; row < src->h; ++row) {
srcBuf = (Uint32*)(src->pixels) + (row * src_ipr);
dstBuf = (Uint32*)(dst->pixels) + ((dst->h - row - 1) * dst_ipr) + (dst->w - 1);
for (col = 0; col < src->w; ++col) {
*dstBuf = *srcBuf;
++srcBuf;
--dstBuf;
}
}
}
break;
case 3:
{
for (row = 0; row < src->h; ++row) {
srcBuf = (Uint32*)(src->pixels) + (row * src_ipr);
dstBuf = (Uint32*)(dst->pixels) + row + ((dst->h - 1) * dst_ipr);
for (col = 0; col < src->w; ++col) {
*dstBuf = *srcBuf;
++srcBuf;
dstBuf -= dst_ipr;
}
}
}
break;
}
/* end switch */
if (SDL_MUSTLOCK(src)) {
SDL_UnlockSurface(src);
}
if (SDL_MUSTLOCK(dst)) {
SDL_UnlockSurface(dst);
}
return dst;
}
/*!
\brief Internal target surface sizing function for rotozooms with trig result return.
\param width The source surface width.
\param height The source surface height.
\param angle The angle to rotate in degrees.
\param zoomx The horizontal scaling factor.
\param zoomy The vertical scaling factor.
\param dstwidth The calculated width of the destination surface.
\param dstheight The calculated height of the destination surface.
\param canglezoom The sine of the angle adjusted by the zoom factor.
\param sanglezoom The cosine of the angle adjusted by the zoom factor.
*/
void _rotozoomSurfaceSizeTrig(int width, int height, double angle, double zoomx, double zoomy,
int *dstwidth, int *dstheight,
double *canglezoom, double *sanglezoom)
{
double x, y, cx, cy, sx, sy;
double radangle;
int dstwidthhalf, dstheighthalf;
/*
* Determine destination width and height by rotating a centered source box
*/
radangle = angle * (M_PI / 180.0);
*sanglezoom = sin(radangle);
*canglezoom = cos(radangle);
*sanglezoom *= zoomx;
*canglezoom *= zoomx;
x = (double)(width / 2);
y = (double)(height / 2);
cx = *canglezoom * x;
cy = *canglezoom * y;
sx = *sanglezoom * x;
sy = *sanglezoom * y;
dstwidthhalf = MAX((int)
ceil(MAX(MAX(MAX(fabs(cx + sy), fabs(cx - sy)), fabs(-cx + sy)), fabs(-cx - sy))), 1);
dstheighthalf = MAX((int)
ceil(MAX(MAX(MAX(fabs(sx + cy), fabs(sx - cy)), fabs(-sx + cy)), fabs(-sx - cy))), 1);
*dstwidth = 2 * dstwidthhalf;
*dstheight = 2 * dstheighthalf;
}
/*!
\brief Returns the size of the resulting target surface for a rotozoomSurfaceXY() call.
\param width The source surface width.
\param height The source surface height.
\param angle The angle to rotate in degrees.
\param zoomx The horizontal scaling factor.
\param zoomy The vertical scaling factor.
\param dstwidth The calculated width of the rotozoomed destination surface.
\param dstheight The calculated height of the rotozoomed destination surface.
*/
void rotozoomSurfaceSizeXY(int width, int height, double angle, double zoomx, double zoomy, int *dstwidth, int *dstheight)
{
double dummy_sanglezoom, dummy_canglezoom;
_rotozoomSurfaceSizeTrig(width, height, angle, zoomx, zoomy, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
}
/*!
\brief Returns the size of the resulting target surface for a rotozoomSurface() call.
\param width The source surface width.
\param height The source surface height.
\param angle The angle to rotate in degrees.
\param zoom The scaling factor.
\param dstwidth The calculated width of the rotozoomed destination surface.
\param dstheight The calculated height of the rotozoomed destination surface.
*/
void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth, int *dstheight)
{
double dummy_sanglezoom, dummy_canglezoom;
_rotozoomSurfaceSizeTrig(width, height, angle, zoom, zoom, dstwidth, dstheight, &dummy_sanglezoom, &dummy_canglezoom);
}
/*!
\brief Rotates and zooms a surface and optional anti-aliasing.
Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
'angle' is the rotation in degrees and 'zoom' a scaling factor. If 'smooth' is set
then the destination 32bit surface is anti-aliased. If the surface is not 8bit
or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
\param src The surface to rotozoom.
\param angle The angle to rotate in degrees.
\param zoom The scaling factor.
\param smooth Antialiasing flag; set to SMOOTHING_ON to enable.
\return The new rotozoomed surface.
*/
SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth)
{
return rotozoomSurfaceXY(src, angle, zoom, zoom, smooth);
}
/*!
\brief Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.
Rotates and zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface.
'angle' is the rotation in degrees, 'zoomx and 'zoomy' scaling factors. If 'smooth' is set
then the destination 32bit surface is anti-aliased. If the surface is not 8bit
or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
\param src The surface to rotozoom.
\param angle The angle to rotate in degrees.
\param zoomx The horizontal scaling factor.
\param zoomy The vertical scaling factor.
\param smooth Antialiasing flag; set to SMOOTHING_ON to enable.
\return The new rotozoomed surface.
*/
SDL_Surface *rotozoomSurfaceXY(SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth)
{
SDL_Surface *rz_src;
SDL_Surface *rz_dst;
double zoominv;
double sanglezoom, canglezoom, sanglezoominv, canglezoominv;
int dstwidthhalf, dstwidth, dstheighthalf, dstheight;
int is32bit;
int i, src_converted;
int flipx,flipy;
Uint8 r,g,b;
Uint32 colorkey = 0;
int colorKeyAvailable = 0;
/*
* Sanity check
*/
if (src == NULL)
return (NULL);
if (src->flags & SDL_SRCCOLORKEY)
{
colorkey = _colorkey(src);
SDL_GetRGB(colorkey, src->format, &r, &g, &b);
colorKeyAvailable = 1;
}
/*
* Determine if source surface is 32bit or 8bit
*/
is32bit = (src->format->BitsPerPixel == 32);
if ((is32bit) || (src->format->BitsPerPixel == 8)) {
/*
* Use source surface 'as is'
*/
rz_src = src;
src_converted = 0;
} else {
/*
* New source surface is 32bit with a defined RGBA ordering
*/
rz_src =
SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
#else
0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
#endif
);
if(colorKeyAvailable)
SDL_SetColorKey(src, 0, 0);
SDL_BlitSurface(src, NULL, rz_src, NULL);
if(colorKeyAvailable)
SDL_SetColorKey(src, SDL_SRCCOLORKEY, colorkey);
src_converted = 1;
is32bit = 1;
}
/*
* Sanity check zoom factor
*/
flipx = (zoomx<0.0);
if (flipx) zoomx=-zoomx;
flipy = (zoomy<0.0);
if (flipy) zoomy=-zoomy;
if (zoomx < VALUE_LIMIT) zoomx = VALUE_LIMIT;
if (zoomy < VALUE_LIMIT) zoomy = VALUE_LIMIT;
zoominv = 65536.0 / (zoomx * zoomx);
/*
* Check if we have a rotozoom or just a zoom
*/
if (fabs(angle) > VALUE_LIMIT) {
/*
* Angle!=0: full rotozoom
*/
/*
* -----------------------
*/
/* Determine target size */
_rotozoomSurfaceSizeTrig(rz_src->w, rz_src->h, angle, zoomx, zoomy, &dstwidth, &dstheight, &canglezoom, &sanglezoom);
/*
* Calculate target factors from sin/cos and zoom
*/
sanglezoominv = sanglezoom;
canglezoominv = canglezoom;
sanglezoominv *= zoominv;
canglezoominv *= zoominv;
/* Calculate half size */
dstwidthhalf = dstwidth / 2;
dstheighthalf = dstheight / 2;
/*
* Alloc space to completely contain the rotated surface
*/
rz_dst = NULL;
if (is32bit) {
/*
* Target surface is 32bit with source RGBA/ABGR ordering
*/
rz_dst =
SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
rz_src->format->Rmask, rz_src->format->Gmask,
rz_src->format->Bmask, rz_src->format->Amask);
} else {
/*
* Target surface is 8bit
*/
rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
}
/* Check target */
if (rz_dst == NULL)
return NULL;
/* Adjust for guard rows */
rz_dst->h = dstheight;
if (colorKeyAvailable == 1){
colorkey = SDL_MapRGB(rz_dst->format, r, g, b);
SDL_FillRect(rz_dst, NULL, colorkey );
}
/*
* Lock source surface
*/
if (SDL_MUSTLOCK(rz_src)) {
SDL_LockSurface(rz_src);
}
/*
* Check which kind of surface we have
*/
if (is32bit) {
/*
* Call the 32bit transformation routine to do the rotation (using alpha)
*/
_transformSurfaceRGBA(rz_src, rz_dst, dstwidthhalf, dstheighthalf,
(int) (sanglezoominv), (int) (canglezoominv),
flipx, flipy,
smooth);
/*
* Turn on source-alpha support
*/
SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
} else {
/*
* Copy palette and colorkey info
*/
for (i = 0; i < rz_src->format->palette->ncolors; i++) {
rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
}
rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
/*
* Call the 8bit transformation routine to do the rotation
*/
transformSurfaceY(rz_src, rz_dst, dstwidthhalf, dstheighthalf,
(int) (sanglezoominv), (int) (canglezoominv),
flipx, flipy);
SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
}
/*
* Unlock source surface
*/
if (SDL_MUSTLOCK(rz_src)) {
SDL_UnlockSurface(rz_src);
}
} else {
/*
* Angle=0: Just a zoom
*/
/*
* --------------------
*/
/*
* Calculate target size
*/
zoomSurfaceSize(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight);
/*
* Alloc space to completely contain the zoomed surface
*/
rz_dst = NULL;
if (is32bit) {
/*
* Target surface is 32bit with source RGBA/ABGR ordering
*/
rz_dst =
SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
rz_src->format->Rmask, rz_src->format->Gmask,
rz_src->format->Bmask, rz_src->format->Amask);
} else {
/*
* Target surface is 8bit
*/
rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
}
/* Check target */
if (rz_dst == NULL)
return NULL;
/* Adjust for guard rows */
rz_dst->h = dstheight;
if (colorKeyAvailable == 1){
colorkey = SDL_MapRGB(rz_dst->format, r, g, b);
SDL_FillRect(rz_dst, NULL, colorkey );
}
/*
* Lock source surface
*/
if (SDL_MUSTLOCK(rz_src)) {
SDL_LockSurface(rz_src);
}
/*
* Check which kind of surface we have
*/
if (is32bit) {
/*
* Call the 32bit transformation routine to do the zooming (using alpha)
*/
_zoomSurfaceRGBA(rz_src, rz_dst, flipx, flipy, smooth);
/*
* Turn on source-alpha support
*/
SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
} else {
/*
* Copy palette and colorkey info
*/
for (i = 0; i < rz_src->format->palette->ncolors; i++) {
rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
}
rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
/*
* Call the 8bit transformation routine to do the zooming
*/
_zoomSurfaceY(rz_src, rz_dst, flipx, flipy);
SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
}
/*
* Unlock source surface
*/
if (SDL_MUSTLOCK(rz_src)) {
SDL_UnlockSurface(rz_src);
}
}
/*
* Cleanup temp surface
*/
if (src_converted) {
SDL_FreeSurface(rz_src);
}
/*
* Return destination surface
*/
return (rz_dst);
}
/*!
\brief Calculates the size of the target surface for a zoomSurface() call.
The minimum size of the target surface is 1. The input factors can be positive or negative.
\param width The width of the source surface to zoom.
\param height The height of the source surface to zoom.
\param zoomx The horizontal zoom factor.
\param zoomy The vertical zoom factor.
\param dstwidth Pointer to an integer to store the calculated width of the zoomed target surface.
\param dstheight Pointer to an integer to store the calculated height of the zoomed target surface.
*/
void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)
{
/*
* Make zoom factors positive
*/
int flipx, flipy;
flipx = (zoomx<0.0);
if (flipx) zoomx = -zoomx;
flipy = (zoomy<0.0);
if (flipy) zoomy = -zoomy;
/*
* Sanity check zoom factors
*/
if (zoomx < VALUE_LIMIT) {
zoomx = VALUE_LIMIT;
}
if (zoomy < VALUE_LIMIT) {
zoomy = VALUE_LIMIT;
}
/*
* Calculate target size
*/
*dstwidth = (int) floor(((double) width * zoomx) + 0.5);
*dstheight = (int) floor(((double) height * zoomy) + 0.5);
if (*dstwidth < 1) {
*dstwidth = 1;
}
if (*dstheight < 1) {
*dstheight = 1;
}
}
/*!
\brief Zoom a surface by independent horizontal and vertical factors with optional smoothing.
Zooms a 32bit or 8bit 'src' surface to newly created 'dst' surface.
'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is on
then the destination 32bit surface is anti-aliased. If the surface is not 8bit
or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
If zoom factors are negative, the image is flipped on the axes.
\param src The surface to zoom.
\param zoomx The horizontal zoom factor.
\param zoomy The vertical zoom factor.
\param smooth Antialiasing flag; set to SMOOTHING_ON to enable.
\return The new, zoomed surface.
*/
SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth)
{
SDL_Surface *rz_src;
SDL_Surface *rz_dst;
int dstwidth, dstheight;
int is32bit;
int i, src_converted;
int flipx, flipy;
/*
* Sanity check
*/
if (src == NULL)
return (NULL);
/*
* Determine if source surface is 32bit or 8bit
*/
is32bit = (src->format->BitsPerPixel == 32);
if ((is32bit) || (src->format->BitsPerPixel == 8)) {
/*
* Use source surface 'as is'
*/
rz_src = src;
src_converted = 0;
} else {
/*
* New source surface is 32bit with a defined RGBA ordering
*/
rz_src =
SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
#else
0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
#endif
);
if (rz_src == NULL) {
return NULL;
}
SDL_BlitSurface(src, NULL, rz_src, NULL);
src_converted = 1;
is32bit = 1;
}
flipx = (zoomx<0.0);
if (flipx) zoomx = -zoomx;
flipy = (zoomy<0.0);
if (flipy) zoomy = -zoomy;
/* Get size if target */
zoomSurfaceSize(rz_src->w, rz_src->h, zoomx, zoomy, &dstwidth, &dstheight);
/*
* Alloc space to completely contain the zoomed surface
*/
rz_dst = NULL;
if (is32bit) {
/*
* Target surface is 32bit with source RGBA/ABGR ordering
*/
rz_dst =
SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
rz_src->format->Rmask, rz_src->format->Gmask,
rz_src->format->Bmask, rz_src->format->Amask);
} else {
/*
* Target surface is 8bit
*/
rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
}
/* Check target */
if (rz_dst == NULL) {
/*
* Cleanup temp surface
*/
if (src_converted) {
SDL_FreeSurface(rz_src);
}
return NULL;
}
/* Adjust for guard rows */
rz_dst->h = dstheight;
/*
* Lock source surface
*/
if (SDL_MUSTLOCK(rz_src)) {
SDL_LockSurface(rz_src);
}
/*
* Check which kind of surface we have
*/
if (is32bit) {
/*
* Call the 32bit transformation routine to do the zooming (using alpha)
*/
_zoomSurfaceRGBA(rz_src, rz_dst, flipx, flipy, smooth);
/*
* Turn on source-alpha support
*/
SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
} else {
/*
* Copy palette and colorkey info
*/
for (i = 0; i < rz_src->format->palette->ncolors; i++) {
rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
}
rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
/*
* Call the 8bit transformation routine to do the zooming
*/
_zoomSurfaceY(rz_src, rz_dst, flipx, flipy);
SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
}
/*
* Unlock source surface
*/
if (SDL_MUSTLOCK(rz_src)) {
SDL_UnlockSurface(rz_src);
}
/*
* Cleanup temp surface
*/
if (src_converted) {
SDL_FreeSurface(rz_src);
}
/*
* Return destination surface
*/
return (rz_dst);
}
/*!
\brief Shrink a surface by an integer ratio using averaging.
Shrinks a 32bit or 8bit 'src' surface to a newly created 'dst' surface.
'factorx' and 'factory' are the shrinking ratios (i.e. 2=1/2 the size,
3=1/3 the size, etc.) The destination surface is antialiased by averaging
the source box RGBA or Y information. If the surface is not 8bit
or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
The input surface is not modified. The output surface is newly allocated.
\param src The surface to shrink.
\param factorx The horizontal shrinking ratio.
\param factory The vertical shrinking ratio.
\return The new, shrunken surface.
*/
/*@null@*/
SDL_Surface *shrinkSurface(SDL_Surface *src, int factorx, int factory)
{
int result;
SDL_Surface *rz_src;
SDL_Surface *rz_dst = NULL;
int dstwidth, dstheight;
int is32bit;
int i, src_converted;
int haveError = 0;
/*
* Sanity check
*/
if (src == NULL) {
return (NULL);
}
/*
* Determine if source surface is 32bit or 8bit
*/
is32bit = (src->format->BitsPerPixel == 32);
if ((is32bit) || (src->format->BitsPerPixel == 8)) {
/*
* Use source surface 'as is'
*/
rz_src = src;
src_converted = 0;
} else {
/*
* New source surface is 32bit with a defined RGBA ordering
*/
rz_src = SDL_CreateRGBSurface(SDL_SWSURFACE, src->w, src->h, 32,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
#else
0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
#endif
);
if (rz_src==NULL) {
haveError = 1;
goto exitShrinkSurface;
}
SDL_BlitSurface(src, NULL, rz_src, NULL);
src_converted = 1;
is32bit = 1;
}
/*
* Lock the surface
*/
if (SDL_MUSTLOCK(rz_src)) {
if (SDL_LockSurface(rz_src) < 0) {
haveError = 1;
goto exitShrinkSurface;
}
}
/* Get size for target */
dstwidth=rz_src->w/factorx;
while (dstwidth*factorx>rz_src->w) { dstwidth--; }
dstheight=rz_src->h/factory;
while (dstheight*factory>rz_src->h) { dstheight--; }
/*
* Alloc space to completely contain the shrunken surface
* (with added guard rows)
*/
if (is32bit==1) {
/*
* Target surface is 32bit with source RGBA/ABGR ordering
*/
rz_dst =
SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32,
rz_src->format->Rmask, rz_src->format->Gmask,
rz_src->format->Bmask, rz_src->format->Amask);
} else {
/*
* Target surface is 8bit
*/
rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0);
}
/* Check target */
if (rz_dst == NULL) {
haveError = 1;
goto exitShrinkSurface;
}
/* Adjust for guard rows */
rz_dst->h = dstheight;
/*
* Check which kind of surface we have
*/
if (is32bit==1) {
/*
* Call the 32bit transformation routine to do the shrinking (using alpha)
*/
result = _shrinkSurfaceRGBA(rz_src, rz_dst, factorx, factory);
if ((result!=0) || (rz_dst==NULL)) {
haveError = 1;
goto exitShrinkSurface;
}
/*
* Turn on source-alpha support
*/
result = SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255);
if (result!=0) {
haveError = 1;
goto exitShrinkSurface;
}
} else {
/*
* Copy palette and colorkey info
*/
for (i = 0; i < rz_src->format->palette->ncolors; i++) {
rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i];
}
rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors;
/*
* Call the 8bit transformation routine to do the shrinking
*/
result = _shrinkSurfaceY(rz_src, rz_dst, factorx, factory);
if (result!=0) {
haveError = 1;
goto exitShrinkSurface;
}
/*
* Set colorkey on target
*/
result = SDL_SetColorKey(rz_dst, SDL_SRCCOLORKEY | SDL_RLEACCEL, _colorkey(rz_src));
if (result!=0) {
haveError = 1;
goto exitShrinkSurface;
}
}
exitShrinkSurface:
if (rz_src!=NULL) {
/*
* Unlock source surface
*/
if (SDL_MUSTLOCK(rz_src)) {
SDL_UnlockSurface(rz_src);
}
/*
* Cleanup temp surface
*/
if (src_converted==1) {
SDL_FreeSurface(rz_src);
}
}
/* Check error state; maybe need to cleanup destination */
if (haveError==1) {
if (rz_dst!=NULL) {
SDL_FreeSurface(rz_dst);
}
rz_dst=NULL;
}
/*
* Return destination surface
*/
return (rz_dst);
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/SDL_rotozoom.c | C | apache-2.0 | 42,104 |
/*
SDL_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
#ifndef _SDL_rotozoom_h
#define _SDL_rotozoom_h
#include <math.h>
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef M_PI
#define M_PI 3.141592654
#endif
#include "SDL.h"
/* ---- Defines */
/*!
\brief Disable anti-aliasing (no smoothing).
*/
#define SMOOTHING_OFF 0
/*!
\brief Enable anti-aliasing (smoothing).
*/
#define SMOOTHING_ON 1
/* ---- Function Prototypes */
#ifdef _MSC_VER
# if defined(DLL_EXPORT) && !defined(LIBSDL_GFX_DLL_IMPORT)
# define SDL_ROTOZOOM_SCOPE __declspec(dllexport)
# else
# ifdef LIBSDL_GFX_DLL_IMPORT
# define SDL_ROTOZOOM_SCOPE __declspec(dllimport)
# endif
# endif
#endif
#ifndef SDL_ROTOZOOM_SCOPE
# define SDL_ROTOZOOM_SCOPE extern
#endif
/*
Rotozoom functions
*/
SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth);
SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurfaceXY
(SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth);
SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth,
int *dstheight);
SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY
(int width, int height, double angle, double zoomx, double zoomy,
int *dstwidth, int *dstheight);
/*
Zooming functions
*/
SDL_ROTOZOOM_SCOPE SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth);
SDL_ROTOZOOM_SCOPE void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight);
/*
Shrinking functions
*/
SDL_ROTOZOOM_SCOPE SDL_Surface *shrinkSurface(SDL_Surface * src, int factorx, int factory);
/*
Specialized rotation functions
*/
SDL_ROTOZOOM_SCOPE SDL_Surface* rotateSurface90Degrees(SDL_Surface* src, int numClockwiseTurns);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#endif /* _SDL_rotozoom_h */
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/SDL_rotozoom.h | C | apache-2.0 | 2,960 |
#!/usr/bin/perl
# Cleans up C++ style comments and converts them to C
while (<>) {
$line = $_;
$line =~ s/\/\/([^;]*)(\n)$/\/\*$1 \*\/\n/;
print $line;
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Scripts/clean-c++.pl | Perl | apache-2.0 | 159 |
#
# Splint based static code analysis
# http://www.splint.org/
#
splint -I/usr/local/include/SDL -exportlocal SDL_framerate.c
# splint -I/usr/local/include/SDL -weak +matchanyintegral SDL_gfxBlitFunc.c
splint -I/usr/local/include/SDL -exportlocal +matchanyintegral -shiftimplementation -boolops +boolint -predboolint -shadow -casebreak -dependenttrans -nullstate -compdestroy -compmempass SDL_gfxBlitFunc.c
# splint -I/usr/local/include/SDL -weak +matchanyintegral SDL_rotozoom.c
splint -I/usr/local/include/SDL -exportlocal +matchanyintegral -shiftimplementation -boolops +boolint -retvalint -predboolint -branchstate -nullret -paramuse -compdef -nullpass -usedef -mustfreefresh -incondefs SDL_rotozoom.c
# splint -I/usr/local/include/SDL -weak +matchanyintegral SDL_gfxPrimitives.c
splint -I/usr/local/include/SDL -exportlocal +matchanyintegral -shiftimplementation -boolops -type -retvalint -shiftnegative -predboolint -nullassign -branchstate -globstate -usereleased -nullstate -nullpass -compdef -usedef -evalorder -compdestroy SDL_gfxPrimitives.c
# splint -I/usr/local/include/SDL -weak +matchanyintegral SDL_imageFilter.c
splint -I/usr/local/include/SDL -exportlocal +matchanyintegral -shiftimplementation -boolops +boolint -paramuse -retvalint +charint -mayaliasunique SDL_imageFilter.c
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Scripts/splint.sh | Shell | apache-2.0 | 1,300 |
/*
LaplaceRelaxation.c : Laplacian relaxation demo
Demo Program that
- loads an image
- converts it to a brightness map
- binarize brightness map
- performs a Laplace relaxation on it
- displays the solution using a sinusoidally modulated lookup table
Very slow! :-) TODO: use imagefilter MMX routines
(C) A. Schiffler, Sep 2010, zlib License
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "SDL.h"
#ifdef WIN32
#include <windows.h>
#include "SDL_gfxPrimitives.h"
#include "SDL_rotozoom.h"
#include "SDL_imageFilter.h"
#ifndef bcmp
#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
#endif
#else
#include "SDL/SDL_gfxPrimitives.h"
#include "SDL/SDL_rotozoom.h"
#include "SDL/SDL_imageFilter.h"
#endif
int iterations = 400;
int contours = 20;
int threshold = 4;
int w = 640, h = 480;
void HandleEvent()
{
SDL_Event event;
/* Check for events */
SDL_PollEvent(&event);
switch (event.type) {
case SDL_KEYDOWN:
case SDL_QUIT:
exit(0);
break;
}
}
void ClearScreen(SDL_Surface *screen)
{
int i;
/* Set the screen to black */
if ( SDL_LockSurface(screen) == 0 ) {
Uint8 *pixels;
pixels = (Uint8 *)screen->pixels;
for ( i=0; i<screen->h; ++i ) {
memset(pixels, 0,
screen->w*screen->format->BytesPerPixel);
pixels += screen->pitch;
}
SDL_UnlockSurface(screen);
}
}
/*
Returns a potential value from either the static or the dynamic charge map based
on the binarized map at coordinates x,y for a grid of size w,h clamping to 0 at the edges.
*/
double GetPotential(Uint8 *map, Uint8 *greyscale, double *relaxed, int x, int y, int w, int h)
{
int offset;
double v;
if ((x<0) || (y<0) || (x>(w-1)) || (y>(h-1))) {
v = 0.0;
} else {
offset = x+w*y;
if ((Uint8)map[offset]!=0) {
v = (double)greyscale[offset];
} else {
v = relaxed[offset];
}
}
return v;
}
/*
* Return the pixel value at (x, y)
*/
Uint32 getPixel(SDL_Surface *surface, int x, int y)
{
int bpp = surface->format->BytesPerPixel;
/* Here p is the address to the pixel we want to retrieve */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
switch (bpp) {
case 1:
return *p;
case 2:
return *(Uint16 *)p;
case 3:
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
return p[0] << 16 | p[1] << 8 | p[2];
else
return p[0] | p[1] << 8 | p[2] << 16;
case 4:
return *(Uint32 *)p;
default:
return 0; /* shouldn't happen, but avoids warnings */
} // switch
}
void Draw (SDL_Surface *screen, char *bmpfile)
{
char messageText[128];
Uint32 rmask, gmask, bmask, amask;
SDL_Surface *picture;
SDL_Surface *mapped_picture;
SDL_Surface *rotozoom_picture;
SDL_PixelFormat *pixelFormat;
Uint8 *grayscale, *map, *curmap;
double *unrelaxed, *relaxed, *currelax;
int mapsize, relaxsize;
int rowskip;
char *pixel;
Uint32 p;
int x, y;
Uint8 r, g, b, a;
double dy;
double t, s;
int i;
double c1, c2, c3, c4, ca;
Uint8 lookupTable[256];
double zw, zh, zf;
/* SDL interprets each pixel as a 32-bit number, so our masks must depend
on the endianness (byte order) of the machine */
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
rmask = 0xff000000;
gmask = 0x00ff0000;
bmask = 0x0000ff00;
amask = 0x000000ff;
#else
rmask = 0x000000ff;
gmask = 0x0000ff00;
bmask = 0x00ff0000;
amask = 0xff000000;
#endif
/* Load the image into a surface */
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
/* Convert image to a brightness map */
printf("Allocating workbuffers\n");
mapsize = picture->w * picture->h;
relaxsize = mapsize * sizeof(double);
grayscale = (Uint8 *)malloc(mapsize);
map = (Uint8 *)malloc(mapsize);
unrelaxed = (double *)malloc(relaxsize);
relaxed = (double *)malloc(relaxsize);
if ((grayscale == NULL) || (map == NULL) || (unrelaxed == NULL) || (relaxed == NULL))
{
fprintf(stderr, "Out of memory\n");
return;
}
memset(grayscale, 0, mapsize);
memset(map, 0, mapsize);
memset(unrelaxed, 0, relaxsize);
memset(relaxed, 0, relaxsize);
printf("Converting image to brightness map\n");
pixel = picture->pixels;
pixelFormat = picture->format;
rowskip = (picture->pitch - picture->w * picture->format->BytesPerPixel);
curmap = grayscale;
for (y=0; y < picture->h; y++) {
for (x=0; x < picture->w; x++) {
// Get RGB
p = getPixel(picture, x, y);
SDL_GetRGBA(p, pixelFormat, &r, &g, &b, &a);
// Calculate luminance (Y = 0.3R + 0.59G + 0.11B;)
dy = (0.30 * r) + (0.59 * g) + (0.11 * b);
if (dy<0.0) {
dy=0.0;
} else if (dy>255.0) {
dy=255.0;
}
*curmap = (Uint8)dy;
// Next pixel
pixel += picture->format->BytesPerPixel;
curmap++;
}
// Next row
pixel += rowskip;
}
/* --- Prepare relaxation loop --- */
/* Binarize luminance map */
SDL_imageFilterBinarizeUsingThreshold(grayscale, map, mapsize, threshold);
/* Create cos^5 based lookup table */
t = 0.0;
for (i = 0; i < 256; i++)
{
s = 1.0 - 0.5 * (1.0 + cos(t));
s = 255.0 * s * s * s * s * s;
lookupTable[i] = (Uint8)s;
t += ((double)contours*2.0*3.141592653589/128.0);
}
/* Create new surface for relaxed image */
mapped_picture = SDL_CreateRGBSurface(SDL_SWSURFACE, picture->w, picture->h, 32,
rmask, gmask, bmask, amask);
if (mapped_picture == NULL) {
fprintf(stderr, "CreateRGBSurface failed: %s\n", SDL_GetError());
return;
}
/* Apply relaxation algorithm */
printf("Applying Laplacian relaxation: %i iterations\n", iterations);
// Iterate to relax
for (i = 0; i <= iterations; i++)
{
// Backup original
memcpy(unrelaxed, relaxed, relaxsize);
// Average into relaxed
for (x=0; x < picture->w; x++) {
for (y=0; y < picture->h; y++) {
// up
c1 = GetPotential(map, grayscale, unrelaxed, x, y-1, picture->w, picture->h);
// down
c2 = GetPotential(map, grayscale, unrelaxed, x, y+1, picture->w, picture->h);
// left
c3 = GetPotential(map, grayscale, unrelaxed, x-1, y, picture->w, picture->h);
// right
c4 = GetPotential(map, grayscale, unrelaxed, x+1, y, picture->w, picture->h);
// average and store
ca = ((c1 + c2 + c3 + c4)/4.0);
relaxed[x+y*picture->w] = ca;
}
}
// Draw only sometimes
if (((i % 10)==0) || (i==iterations)) {
/* --- Create image with contour map --- */
/* Fill output surface via colormap */
currelax = relaxed;
for (y=0; y<mapped_picture->h; y++) {
for (x=0; x<mapped_picture->w; x++) {
if (map[x+y*picture->w]!=0) {
r = g = b = grayscale[x+y*picture->w];
} else {
r = g = b = lookupTable[(Uint8)*currelax];
}
pixelRGBA(mapped_picture, x, y, r, g, b, 255);
currelax++;
}
}
/* --- Scale and draw to screen --- */
/* Scale to screen size */
zw = (double)screen->w/(double)mapped_picture->w;
zh = (double)screen->h/(double)mapped_picture->h;
zf = (zw < zh) ? zw : zh;
if ((rotozoom_picture=zoomSurface(mapped_picture, zf, zf, 1))==NULL) {
fprintf(stderr, "Rotozoom failed: %s\n", SDL_GetError());
return;
}
/* Draw surface to screen */
if ( SDL_BlitSurface(rotozoom_picture, NULL, screen, NULL) < 0 ) {
fprintf(stderr, "Blit failed: %s\n", SDL_GetError());
return;
}
SDL_FreeSurface(rotozoom_picture);
/* Info */
if (i != iterations) {
sprintf(messageText,"%i", i);
stringRGBA(screen, 8, 8, messageText, 255, 255, 255, 255);
}
/* Display by flipping screens */
SDL_Flip(screen);
}
/* Maybe quit */
HandleEvent();
}
/* Save final picture */
if (SDL_SaveBMP(mapped_picture, "result.bmp") <0) {
fprintf(stderr, "Save BMP failed: %s\n", SDL_GetError());
return;
}
free(map);
free(grayscale);
free(unrelaxed);
free(relaxed);
SDL_FreeSurface(picture);
SDL_FreeSurface(mapped_picture);
return;
}
int main ( int argc, char *argv[] )
{
SDL_Surface *screen;
int desired_bpp;
Uint32 video_flags;
char *bmpfile = NULL;
/* Title */
fprintf(stderr,"Laplace relaxation demo\n");
/* Set default options and check command-line */
desired_bpp = 32;
video_flags = SDL_SWSURFACE | SDL_SRCALPHA | SDL_RESIZABLE | SDL_DOUBLEBUF;
while ( argc > 1 ) {
if ( strcmp(argv[1], "-iterations") == 0 ) {
if ( argv[2] && ((iterations = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -iterations option requires an argument\n");
exit(1);
}
} else if ( strcmp(argv[1], "-contours") == 0 ) {
if ( argv[2] && ((contours = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -contours option requires an argument\n");
exit(1);
}
} else if ( strcmp(argv[1], "-threshold") == 0 ) {
if ( argv[2] && ((threshold = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -threshold option requires an argument\n");
exit(1);
}
} else if (( strcmp(argv[1], "-help") == 0 ) || (strcmp(argv[1], "--help") == 0)) {
printf ("Usage:\n%s [options] filename\n");
printf ("Options:\n");
printf (" -iterations # Number of relaxation iterations to perform, default: 400\n");
printf (" -contours # Number of contours over range, default: 8\n");
printf (" -threshold # Binarization threshold for Y, default: 20\n");
exit(0);
} else {
bmpfile = argv[1];
break;
}
}
/* Initialize SDL */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr,
"Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
atexit(SDL_Quit); /* Clean up on exit */
/* Initialize the display */
screen = SDL_SetVideoMode(w, h, desired_bpp, video_flags);
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n",
w, h, desired_bpp, SDL_GetError());
exit(1);
}
/* Show some info */
printf("Set %dx%dx%d mode\n",
screen->w, screen->h, screen->format->BitsPerPixel);
printf("Video surface located in %s memory.\n",
(screen->flags & SDL_HWSURFACE) ? "video" : "system");
/* Check for double buffering */
if ( screen->flags & SDL_DOUBLEBUF ) {
printf("Double-buffering enabled - good!\n");
}
/* Set the window manager title bar */
SDL_WM_SetCaption("Laplace relaxation demo", "laplacerelaxation");
/* Do all the drawing work */
Draw(screen, bmpfile);
/* Wait for keypress */
while(1) {
HandleEvent();
SDL_Delay(100);
}
return(0);
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/LaplaceRelaxation.c | C | apache-2.0 | 10,449 |
AUTOMAKE_OPTIONS = no-dependencies
ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS = \
TestGfxPrimitives \
TestRotozoom \
TestFramerate \
TestImageFilter \
TestFonts \
TestABGR \
TestShrink \
TestGfxTexture \
TestGfxBlit
TestGfxPrimitives_SOURCES = TestGfxPrimitives.c
TestRotozoom_SOURCES = TestRotozoom.c
TestFramerate_SOURCES = TestFramerate.c
TestImageFilter_SOURCES = TestImageFilter.c
TestFonts_SOURCES = TestFonts.c
TestABGR_SOURCES = TestABGR.c
TestShrink_SOURCES = TestShrink.c
TestGfxTexture_SOURCES = TestGfxTexture.c
TestGfxBlit_SOURCES = TestGfxBlit.c
DISTCLEANFILES = *~ *~c *~h *.cross.cache inc
distclean-local:
-rm -rf autom4te.cache
-rm -f *.user
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/Makefile.am | Makefile | apache-2.0 | 671 |
/*
TestABGR.c: test GFX behavior on byteordering
(C) A. Schiffler, 2005, zlib License
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "SDL.h"
#ifdef WIN32
#include <windows.h>
#include "SDL_gfxPrimitives.h"
#else
#include "SDL/SDL_gfxPrimitives.h"
#endif
#define WIDTH 400
#define HEIGHT 424
void WaitForEvent()
{
int done;
SDL_Event event;
/* Check for events */
done = 0;
while (!done) {
SDL_PollEvent(&event);
switch (event.type) {
case SDL_KEYDOWN:
case SDL_QUIT:
done = 1;
break;
}
SDL_Delay(100);
}
}
int main(int argc, char *argv[])
{
SDL_Surface *screen;
Uint8 video_bpp;
Uint32 videoflags;
char title[64];
char message[64];
SDL_Rect r;
int y;
SDL_Surface* s;
/* Define masking bytes */
Uint32 mask1 = 0xff000000;
Uint32 mask2 = 0x00ff0000;
Uint32 mask3 = 0x0000ff00;
Uint32 mask4 = 0x000000ff;
/* Generate title+message strings */
sprintf (title, "TestABGR - v%i.%i.%i", SDL_GFXPRIMITIVES_MAJOR, SDL_GFXPRIMITIVES_MINOR, SDL_GFXPRIMITIVES_MICRO);
sprintf (message, "%s", "Left:RGBA Right:ABGR Top:Solid Bottom:Transparent");
/* Initialize SDL */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
video_bpp = 32;
videoflags = SDL_SWSURFACE | SDL_SRCALPHA | SDL_RESIZABLE;
while ( argc > 1 ) {
--argc;
if ( strcmp(argv[argc-1], "-bpp") == 0 ) {
video_bpp = atoi(argv[argc]);
--argc;
} else
if ( strcmp(argv[argc], "-hw") == 0 ) {
videoflags |= SDL_HWSURFACE;
} else
if ( strcmp(argv[argc], "-warp") == 0 ) {
videoflags |= SDL_HWPALETTE;
} else
if ( strcmp(argv[argc], "-fullscreen") == 0 ) {
videoflags |= SDL_FULLSCREEN;
} else {
fprintf(stderr,
"Usage: %s [-bpp N] [-warp] [-hw] [-fullscreen]\n",
argv[0]);
exit(1);
}
}
/* Set video mode */
if ( (screen=SDL_SetVideoMode(WIDTH, HEIGHT, video_bpp, videoflags)) == NULL ) {
fprintf(stderr, "Couldn't set %ix%i %i bpp video mode: %s\n",WIDTH,HEIGHT,video_bpp,SDL_GetError());
exit(2);
}
/* Use alpha blending */
SDL_SetAlpha(screen, SDL_SRCALPHA, 0);
/* Set title for window */
SDL_WM_SetCaption(title,title);
/* Draw some white stripes as background */
for (y=0; y<400; y += 20) {
boxRGBA(SDL_GetVideoSurface(), 0, y+10, 400, y+20, 255, 255, 255, 255);
}
/* Solid color test */
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask1, mask2, mask3, mask4);
filledEllipseRGBA(s, 0, 0, 100, 100, 255, 0, 0, 255); // red
r.x = 0; r.y = 0;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask1, mask2, mask3, mask4);
filledEllipseRGBA(s, 0, 0, 100, 100, 0, 255, 0, 255); // green
r.x = 0; r.y = 100;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask1, mask2, mask3, mask4);
filledEllipseRGBA(s, 0, 0, 100, 100, 0, 0, 255, 255); // blue
r.x = 100; r.y = 0;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask1, mask2, mask3, mask4);
filledEllipseRGBA(s, 0, 0, 100, 100, 255, 255, 255, 255); // white
r.x = 100; r.y = 100;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask4, mask3, mask2, mask1);
filledEllipseRGBA(s, 0, 0, 100, 100, 255, 0, 0, 255); // red
r.x = 200; r.y = 0;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask4, mask3, mask2, mask1);
filledEllipseRGBA(s, 0, 0, 100, 100, 0, 255, 0, 255); // green
r.x = 200; r.y = 100;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask4, mask3, mask2, mask1);
filledEllipseRGBA(s, 0, 0, 100, 100, 0, 0, 255, 255); // blue
r.x = 300; r.y = 0;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask4, mask3, mask2, mask1);
filledEllipseRGBA(s, 0, 0, 100, 100, 255, 255, 255, 255); // white
r.x = 300; r.y = 100;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
/* Transparent color test */
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask1, mask2, mask3, mask4);
filledEllipseRGBA(s, 0, 0, 100, 100, 255, 0, 0, 200); // red+trans
r.x = 0; r.y = 200;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask1, mask2, mask3, mask4);
filledEllipseRGBA(s, 0, 0, 100, 100, 0, 255, 0, 200); // green+trans
r.x = 0; r.y = 300;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask1, mask2, mask3, mask4);
filledEllipseRGBA(s, 0, 0, 100, 100, 0, 0, 255, 200); // blue+trans
r.x = 100; r.y = 200;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask1, mask2, mask3, mask4);
filledEllipseRGBA(s, 0, 0, 100, 100, 255, 255, 255, 200); // white+trans
r.x = 100; r.y = 300;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask4, mask3, mask2, mask1);
filledEllipseRGBA(s, 0, 0, 100, 100, 255, 0, 0, 200); // red+trans
r.x = 200; r.y = 200;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask4, mask3, mask2, mask1);
filledEllipseRGBA(s, 0, 0, 100, 100, 0, 255, 0, 200); // green+trans
r.x = 200; r.y = 300;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask4, mask3, mask2, mask1);
filledEllipseRGBA(s, 0, 0, 100, 100, 0, 0, 255, 200); // blue+trans
r.x = 300; r.y = 200;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
s = SDL_CreateRGBSurface(0, 200, 200, 32, mask4, mask3, mask2, mask1);
filledEllipseRGBA(s, 0, 0, 100, 100, 255, 255, 255, 200); // white+trans
r.x = 300; r.y = 300;
SDL_BlitSurface(s, 0, SDL_GetVideoSurface(), &r);
stringRGBA (screen, WIDTH/2-4*strlen(message),HEIGHT-12,message,255,255,255,255);
SDL_Flip(SDL_GetVideoSurface());
WaitForEvent();
return 0;
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/TestABGR.c | C | apache-2.0 | 6,059 |
/*
TestFonts.c: test dynamic font loading code
(C) A. Schiffler, August 2001, zlib License
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "SDL.h"
#ifdef WIN32
#include <windows.h>
#include "SDL_gfxPrimitives.h"
#else
#include "SDL/SDL_gfxPrimitives.h"
#endif
#define WIDTH 1024
#define HEIGHT 768
void WaitForEvent()
{
int done;
SDL_Event event;
/* Check for events */
done = 0;
while (!done) {
SDL_PollEvent(&event);
switch (event.type) {
case SDL_KEYDOWN:
case SDL_QUIT:
done = 1;
break;
}
SDL_Delay(100);
}
}
void ClearScreen(SDL_Surface *screen)
{
int i;
/* Set the screen to black */
if ( SDL_LockSurface(screen) == 0 ) {
Uint32 black;
Uint8 *pixels;
black = SDL_MapRGB(screen->format, 0, 0, 0);
pixels = (Uint8 *)screen->pixels;
for ( i=0; i<screen->h; ++i ) {
memset(pixels, black,
screen->w*screen->format->BytesPerPixel);
pixels += screen->pitch;
}
SDL_UnlockSurface(screen);
}
}
int FileExists(const char * filename)
{
FILE *file;
if (file = fopen(filename, "r"))
{
fclose(file);
return 1;
}
return 0;
}
#define NUM_SDLGFX_FONTS 7
/* Filenames of font files */
static char *fontfile[NUM_SDLGFX_FONTS] = {
"",
"5x7.fnt",
"7x13.fnt",
"7x13B.fnt",
"7x13O.fnt",
"9x18.fnt",
"9x18B.fnt",
};
/* Width of font characters */
static int fontw[NUM_SDLGFX_FONTS] = {
8,
5,
7,
7,
7,
9,
9,
};
/* Height of fonts characters */
static int fonth[NUM_SDLGFX_FONTS] = {
8,
7,
13,
13,
13,
18,
18,
};
/* Bytes of fontfiles */
static int fontsize[NUM_SDLGFX_FONTS] = {
0,
1792,
3328,
3328,
3328,
9216,
9216,
};
/* Helper that searches and loads a fontfile */
char *LoadFontFile(int i)
{
char *myfont;
char filename[128];
FILE *file;
int bytesRead;
/* Check index */
if (i==0)
{
return NULL;
}
/* Allocate memory for font data */
myfont=(char *)malloc(fontsize[i]);
if (myfont) {
if (strcmp(fontfile[i],"default")) {
/* Load a font data */
sprintf(filename,"../Fonts/%s",fontfile[i]);
if (!FileExists(filename))
{
sprintf(filename,"..\\Fonts\\%s",fontfile[i]);
if (!FileExists(filename))
{
sprintf(filename,"..\\..\\Fonts\\%s",fontfile[i]);
if (!FileExists(filename))
{
sprintf(filename,"..\\..\\..\\Fonts\\%s",fontfile[i]);
if (!FileExists(filename))
{
fprintf(stderr,"Cannot find fontfile: %s\n", fontfile[i]);
exit(-1);
}
}
}
}
file = fopen(filename,"r");
bytesRead = fread(myfont,fontsize[i],1,file);
fclose(file);
}
}
return myfont;
}
void Draw(SDL_Surface *screen)
{
int i, rotation;
char *myfont;
char mytext[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int x,y,yold;
/* Black screen */
ClearScreen(screen);
y=0;
/* Try all horizontal rotations */
rotation = 0;
gfxPrimitivesSetFontRotation(rotation);
/* Render all fonts */
for (i=0; i<NUM_SDLGFX_FONTS; i++) {
fprintf(stderr,"Drawing Font: size %ix%i, file '%s', %i bytes, rotation %i\n",fontw[i], fonth[i], fontfile[i],fontsize[i], rotation);
/* Reset line pos */
x=4;
myfont = NULL;
if (i>0) {
myfont=LoadFontFile(i);
}
/* Set font data and use it */
gfxPrimitivesSetFont(myfont,fontw[i],fonth[i]);
y += fonth[i];
stringRGBA(screen,x,y,fontfile[i],255,255,255,255);
x += 100;
stringRGBA(screen,x,y,mytext,255,255,255,255);
y += 10;
if (i>0)
{
/* Clean up font-data */
free(myfont);
}
}
y += 20;
yold = y;
rotation = 2;
gfxPrimitivesSetFontRotation(rotation);
/* Render all fonts */
for (i=0; i<NUM_SDLGFX_FONTS; i++) {
fprintf(stderr,"Drawing Font: size %ix%i, file '%s', %i bytes, rotation %i\n",fontw[i], fonth[i], fontfile[i],fontsize[i], rotation);
/* Reset line pos */
x=WIDTH - 14;
myfont = NULL;
if (i>0) {
myfont=LoadFontFile(i);
}
/* Set font data and use it */
gfxPrimitivesSetFont(myfont,fontw[i],fonth[i]);
y += fonth[i];
stringRGBA(screen,x,y,fontfile[i],255,255,255,255);
x -= 100;
stringRGBA(screen,x,y,mytext,255,255,255,255);
y += 10;
if (i>0)
{
/* Clean up font-data */
free(myfont);
}
}
y += 20;
/* Try all vertical rotations */
rotation = 1;
gfxPrimitivesSetFontRotation(rotation);
x = 14;
/* Render all fonts */
for (i=0; i<NUM_SDLGFX_FONTS; i++) {
fprintf(stderr,"Drawing Font: size %ix%i, file '%s', %i bytes, rotation %i\n",fontw[i], fonth[i], fontfile[i],fontsize[i], rotation);
/* Reset line pos */
y=yold;
myfont = NULL;
if (i>0) {
myfont=LoadFontFile(i);
}
/* Set font data and use it */
gfxPrimitivesSetFont(myfont,fontw[i],fonth[i]);
x += fonth[i];
stringRGBA(screen,x,y,fontfile[i],255,255,255,255);
y += 100;
stringRGBA(screen,x,y,mytext,255,255,255,255);
x += 10;
if (i>0)
{
/* Clean up font-data */
free(myfont);
}
}
x += 20;
rotation = 3;
gfxPrimitivesSetFontRotation(rotation);
/* Render all fonts */
for (i=0; i<NUM_SDLGFX_FONTS; i++) {
fprintf(stderr,"Drawing Font: size %ix%i, file '%s', %i bytes, rotation %i\n",fontw[i], fonth[i], fontfile[i],fontsize[i], rotation);
/* Reset line pos */
y=HEIGHT - 14;
myfont = NULL;
if (i>0) {
if (i>0) {
myfont=LoadFontFile(i);
}
/* Set font data and use it */
gfxPrimitivesSetFont(myfont,fontw[i],fonth[i]);
x += fonth[i];
stringRGBA(screen,x,y,fontfile[i],255,255,255,255);
y -= 100;
stringRGBA(screen,x,y,mytext,255,255,255,255);
x += 10;
if (i>0)
{
/* Clean up font-data */
free(myfont);
}
}
/* Display by flipping screens */
SDL_Flip(screen);
}
}
/* ======== */
int main(int argc, char *argv[])
{
SDL_Surface *screen;
Uint8 video_bpp;
Uint32 videoflags;
char title[64];
/* Generate title strings */
sprintf (title, "TestFonts - v%i.%i.%i", SDL_GFXPRIMITIVES_MAJOR, SDL_GFXPRIMITIVES_MINOR, SDL_GFXPRIMITIVES_MICRO);
/* Initialize SDL */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
video_bpp = 32;
videoflags = SDL_SWSURFACE | SDL_SRCALPHA | SDL_RESIZABLE;
while ( argc > 1 ) {
--argc;
if ( strcmp(argv[argc-1], "-bpp") == 0 ) {
video_bpp = atoi(argv[argc]);
--argc;
} else
if ( strcmp(argv[argc], "-hw") == 0 ) {
videoflags |= SDL_HWSURFACE;
} else
if ( strcmp(argv[argc], "-warp") == 0 ) {
videoflags |= SDL_HWPALETTE;
} else
if ( strcmp(argv[argc], "-fullscreen") == 0 ) {
videoflags |= SDL_FULLSCREEN;
} else {
fprintf(stderr,
"Usage: %s [-bpp N] [-warp] [-hw] [-fullscreen]\n",
argv[0]);
exit(1);
}
}
/* Force double buffering */
videoflags |= SDL_DOUBLEBUF;
/* Set video mode */
if ( (screen=SDL_SetVideoMode(WIDTH, HEIGHT, video_bpp, videoflags)) == NULL ) {
fprintf(stderr, "Couldn't set %ix%i %i bpp video mode: %s\n",WIDTH,HEIGHT,video_bpp,SDL_GetError());
exit(2);
}
/* Use alpha blending */
SDL_SetAlpha(screen, SDL_SRCALPHA, 0);
/* Set title for window */
SDL_WM_SetCaption(title,title);
/* Do all the drawing work */
Draw(screen);
WaitForEvent();
return(0);
} | YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/TestFonts.c | C | apache-2.0 | 7,191 |
/*
TestFramerate.c: test/sample program for framerate manager
(C) A. Schiffler, August 2001, zlib License
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "SDL.h"
#ifdef WIN32
#include <windows.h>
#include "SDL_framerate.h"
#include "SDL_gfxPrimitives.h"
#else
#include "SDL/SDL_framerate.h"
#include "SDL/SDL_gfxPrimitives.h"
#endif
#define WIDTH 640
#define HEIGHT 480
void HandleEvent()
{
SDL_Event event;
/* Check for events */
while ( SDL_PollEvent(&event) ) {
switch (event.type) {
case SDL_KEYDOWN:
case SDL_QUIT:
exit(0);
break;
}
}
}
void ClearScreen(SDL_Surface *screen)
{
int i;
/* Set the screen to black */
if ( SDL_LockSurface(screen) == 0 ) {
Uint32 black;
Uint8 *pixels;
black = SDL_MapRGB(screen->format, 0, 0, 0);
pixels = (Uint8 *)screen->pixels;
for ( i=0; i<screen->h; ++i ) {
memset(pixels, black,
screen->w*screen->format->BytesPerPixel);
pixels += screen->pitch;
}
SDL_UnlockSurface(screen);
}
}
void Draw(SDL_Surface *screen)
{
int i,rate,x,y,dx,dy,r,g,b;
Uint32 time_passed = 0;
FPSmanager fpsm;
char message[64];
char message2[64];
/* Initialize variables */
srand((int)time(NULL));
i=0;
x=screen->w/2;
y=screen->h/2;
dx=7;
dy=5;
r=g=b=255;
SDL_initFramerate(&fpsm);
rate = SDL_getFramerate(&fpsm);
sprintf(message, "Framerate set to %i Hz ...",rate);
while (1) {
/* Set/switch framerate */
i -= 1;
if (i<0) {
/* Set new rate */
rate=5+5*(rand() % 10);
SDL_setFramerate(&fpsm,rate);
sprintf(message, "Framerate set to %i Hz ...",rate);
/* New timeout */
i=2*rate;
/* New Color */
r=rand() & 255;
g=rand() & 255;
b=rand() & 255;
}
/* Black screen */
ClearScreen(screen);
/* Messages */
stringRGBA (screen, WIDTH/2-4*strlen(message),HEIGHT-12,message,255,255,255,255);
if (time_passed > 0) {
sprintf(message2, "Delay is %i ms / Measured framerate %i Hz ...", time_passed, 1000 / time_passed);
stringRGBA (screen, WIDTH/2-4*strlen(message2),HEIGHT-24,message2,255,255,255,255);
}
/* Move */
x += dx;
y += dy;
/* Reflect */
if ((x<0) || (x>screen->w)) { dx=-dx; }
if ((y<0) || (y>screen->h)) { dy=-dy; }
/* Draw */
filledCircleRGBA (screen,x,y,30,r,g,b,255);
circleRGBA(screen,x,y,30,255,255,255,255);
/* Display by flipping screens */
SDL_Flip(screen);
/* Check events */
HandleEvent();
/* Delay to fix rate */
time_passed = SDL_framerateDelay(&fpsm);
}
}
int main(int argc, char *argv[])
{
SDL_Surface *screen;
Uint8 video_bpp;
Uint32 videoflags;
char title[64];
/* Generate title strings */
sprintf (title, "TestFramerate - v%i.%i.%i", SDL_GFXPRIMITIVES_MAJOR, SDL_GFXPRIMITIVES_MINOR, SDL_GFXPRIMITIVES_MICRO);
/* Initialize SDL */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
video_bpp = 32;
videoflags = SDL_SWSURFACE | SDL_SRCALPHA | SDL_RESIZABLE;
while ( argc > 1 ) {
--argc;
if ( strcmp(argv[argc-1], "-bpp") == 0 ) {
video_bpp = atoi(argv[argc]);
--argc;
} else
if ( strcmp(argv[argc], "-hw") == 0 ) {
videoflags |= SDL_HWSURFACE;
} else
if ( strcmp(argv[argc], "-warp") == 0 ) {
videoflags |= SDL_HWPALETTE;
} else
if ( strcmp(argv[argc], "-fullscreen") == 0 ) {
videoflags |= SDL_FULLSCREEN;
} else {
fprintf(stderr,
"Usage: %s [-bpp N] [-warp] [-hw] [-fullscreen]\n",
argv[0]);
exit(1);
}
}
/* Force double buffering */
videoflags |= SDL_DOUBLEBUF;
/* Set video mode */
if ( (screen=SDL_SetVideoMode(WIDTH, HEIGHT, video_bpp, videoflags)) == NULL ) {
fprintf(stderr, "Couldn't set %ix%i %i bpp video mode: %s\n",WIDTH,HEIGHT,video_bpp,SDL_GetError());
exit(2);
}
/* Use alpha blending */
SDL_SetAlpha(screen, SDL_SRCALPHA, 0);
/* Set title for window */
SDL_WM_SetCaption(title, title);
/* Do all the drawing work */
Draw (screen);
return(0);
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/TestFramerate.c | C | apache-2.0 | 4,065 |
/*
TestGfxBlit.c: test program to check custom RGBA blitter
(C) A. Schiffler, December 2007, zlib License
*/
#ifdef WIN32
#include <windows.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "SDL.h"
#ifdef WIN32
#include <windows.h>
#include "SDL_framerate.h"
#include "SDL_gfxPrimitives.h"
#include "SDL_gfxBlitFunc.h"
#else
#include "SDL/SDL_framerate.h"
#include "SDL/SDL_gfxPrimitives.h"
#include "SDL/SDL_gfxBlitFunc.h"
#endif
void HandleEvent()
{
SDL_Event event;
/* Check for events */
while ( SDL_PollEvent(&event) ) {
switch (event.type) {
case SDL_KEYDOWN:
case SDL_QUIT:
exit(0);
break;
}
}
}
void ClearScreen(SDL_Surface *screen)
{
int i;
/* Set the screen to gray */
if ( SDL_LockSurface(screen) == 0 ) {
Uint32 gray1, gray2;
Uint8 *pixels;
gray1 = SDL_MapRGB(screen->format, 64, 64, 64);
gray2 = SDL_MapRGB(screen->format, 32, 32, 32);
pixels = (Uint8 *)screen->pixels;
for ( i=0; i<screen->h; ++i ) {
if ((i % 32)<16) {
memset(pixels, gray1, screen->w*screen->format->BytesPerPixel);
} else {
memset(pixels, gray2, screen->w*screen->format->BytesPerPixel);
}
pixels += screen->pitch;
}
SDL_UnlockSurface(screen);
}
}
void Draw(SDL_Surface *screen)
{
int rate,x,y,s;
SDL_Rect dest,clip;
SDL_Surface *texture_image;
SDL_Surface *texture_target1;
SDL_Surface *texture_target2;
FPSmanager fpsm;
Uint32 rmask, gmask, bmask, amask;
int width_half = screen->w/2;
int height_half = screen->h/2;
Uint32 text_color = 0xffffffff;
/* Define masks for 32bit surface */
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
rmask = 0xff000000;
gmask = 0x00ff0000;
bmask = 0x0000ff00;
amask = 0x000000ff;
#else
rmask = 0x000000ff;
gmask = 0x0000ff00;
bmask = 0x00ff0000;
amask = 0xff000000;
#endif
/* Create semi-transparent textured surface */
s=64;
texture_image = SDL_DisplayFormatAlpha(SDL_CreateRGBSurface(SDL_SWSURFACE, s, s, 32, rmask, gmask, bmask, amask));
/* Add some color */
boxRGBA(texture_image, 0, 0, s/2, s/2, 255, 0, 0, 255);
boxRGBA(texture_image, s/2, 0, s, s/2, 0, 255, 0, 255);
boxRGBA(texture_image, 0, s/2, s/2, s, 0, 0, 255, 255);
boxRGBA(texture_image, s/2, s/2, s, s, 255, 255, 255, 255);
/* Make 75%-transparent */
SDL_gfxSetAlpha(texture_image, 96);
/* Set alpha channel use to per-pixel blending */
SDL_SetAlpha(texture_image, SDL_SRCALPHA, 255);
/* Create an all transparent surface */
texture_target1 = SDL_DisplayFormatAlpha(SDL_CreateRGBSurface(SDL_SWSURFACE, 256, 256, 32, rmask, gmask, bmask, amask));
/* Make 75%-transparent */
SDL_gfxSetAlpha(texture_target1, 64);
/* Set alpha channel use to per-pixel blending */
SDL_SetAlpha(texture_target1, SDL_SRCALPHA, 255);
/* Create an all transparent surface (2) */
texture_target2 = SDL_DisplayFormatAlpha(SDL_CreateRGBSurface(SDL_SWSURFACE, 256, 256, 32, rmask, gmask, bmask, amask));
/* Make 75%-transparent */
SDL_gfxSetAlpha(texture_target2, 64);
/* Set alpha channel use to per-pixel blending */
SDL_SetAlpha(texture_target2, SDL_SRCALPHA, 255);
/* Define clipping region for left box */
clip.x = width_half-256-10 ;
clip.y = height_half-256/2 ;
clip.w = 256;
clip.h = 256;
/* Initialize Framerate manager */
SDL_initFramerate(&fpsm);
/* Set/switch framerate */
rate=5;
SDL_setFramerate(&fpsm,rate);
/* --- Drawing loop */
while (1) {
/* Event handler */
HandleEvent();
/* Black screen */
ClearScreen(screen);
/* Random position of new texture */
x=(rand() % (256+2*s))-s;
y=(rand() % (256+2*s))-s;
/* Same for comparison texture */
dest.x = x;
dest.y = y;
dest.w = texture_image->w;
dest.h = texture_image->h;
SDL_BlitSurface(texture_image, NULL, texture_target1, &dest);
/* Blit image into the target using custom Blit function. */
dest.x = x;
dest.y = y;
dest.w = texture_image->w;
dest.h = texture_image->h;
SDL_gfxBlitRGBA(texture_image, NULL, texture_target2, &dest);
/* Draw comparison target on screen (left) */
dest.x = width_half-256-10;
dest.y = height_half-256/2;
dest.w = 256;
dest.h = 256;
SDL_BlitSurface(texture_target1, NULL, screen, &dest);
/* Draw combiner target on screen (right) */
dest.x = width_half+10;
dest.y = height_half-256/2;
dest.w = 256;
dest.h = 256;
SDL_BlitSurface(texture_target2, NULL, screen, &dest);
/* Draw some frames with titles */
rectangleColor(screen, width_half-256-10-1, height_half-256/2-1, width_half-256-10-1+257, height_half-256/2-1+257, text_color);
rectangleColor(screen, width_half+10-1, height_half-256/2-1, width_half+10-1+257, height_half-256/2-1+257, text_color);
stringColor(screen, width_half-256-10-1, height_half-256/2-1-36, " SDL Standard Blitter ", text_color);
stringColor(screen, width_half-256-10-1, height_half-256/2-1-24, "Image --sdlBlit--> Target1", text_color);
stringColor(screen, width_half-256-10-1, height_half-256/2-1-12, "Target1 --sdlBlit--> Screen", text_color);
stringColor(screen, width_half+10-1, height_half-256/2-1-36, " SDL_gfx Compositing Blitter", text_color);
stringColor(screen, width_half+10-1, height_half-256/2-1-24, "Image --gfxBlit--> Target2", text_color);
stringColor(screen, width_half+10-1, height_half-256/2-1-12, "Target2 --sdlBlit--> Screen", text_color);
stringColor(screen, width_half-256-10-1, height_half-256/2-1-60, "gfxBlitRGBA Demo: Target1/2 A=64 (25%), Image A=96 (37%)", text_color);
/* Display by flipping screens */
SDL_Flip(screen);
/* Delay to fix rate */
SDL_framerateDelay(&fpsm);
}
}
/* ======== */
int main(int argc, char *argv[])
{
SDL_Surface *screen;
int w, h;
int desired_bpp;
Uint32 video_flags;
/* Title */
fprintf (stderr,"gfxBlitRGBA test\n");
/* Set default options and check command-line */
w = 640;
h = 480;
desired_bpp = 0;
video_flags = 0;
while ( argc > 1 ) {
if ( strcmp(argv[1], "-width") == 0 ) {
if ( argv[2] && ((w = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -width option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-height") == 0 ) {
if ( argv[2] && ((h = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -height option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-bpp") == 0 ) {
if ( argv[2] ) {
desired_bpp = atoi(argv[2]);
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -bpp option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-warp") == 0 ) {
video_flags |= SDL_HWPALETTE;
argv += 1;
argc -= 1;
} else
if ( strcmp(argv[1], "-hw") == 0 ) {
video_flags |= SDL_HWSURFACE;
argv += 1;
argc -= 1;
} else
if ( strcmp(argv[1], "-fullscreen") == 0 ) {
video_flags |= SDL_FULLSCREEN;
argv += 1;
argc -= 1;
} else
break;
}
/* Force double buffering */
video_flags |= SDL_DOUBLEBUF;
/* Initialize SDL */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr,
"Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
atexit(SDL_Quit); /* Clean up on exit */
/* Initialize the display */
screen = SDL_SetVideoMode(w, h, desired_bpp, video_flags);
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n",
w, h, desired_bpp, SDL_GetError());
exit(1);
}
/* Show some info */
printf("Set %dx%dx%d mode\n",
screen->w, screen->h, screen->format->BitsPerPixel);
printf("Video surface located in %s memory.\n",
(screen->flags&SDL_HWSURFACE) ? "video" : "system");
/* Check for double buffering */
if ( screen->flags & SDL_DOUBLEBUF ) {
printf("Double-buffering enabled - good!\n");
}
/* Set the window manager title bar */
SDL_WM_SetCaption("gfxBlitRGBA", "gfxBlitRGBA");
/* Do all the drawing work */
Draw (screen);
return(0);
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/TestGfxBlit.c | C | apache-2.0 | 8,074 |
/*
TestGfxPrimitives.c: test graphics primitive routines for
accuracy (visual) and speed.
(C) A. Schiffler, June 2001, zlib License
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "SDL.h"
#ifdef WIN32
#include "SDL_gfxPrimitives.h"
#else
#include "SDL/SDL_gfxPrimitives.h"
#endif
#define WIDTH 640
#define HEIGHT 480
#define NUM_RANDOM 512
/* Coordinates */
static Sint16 rx1[NUM_RANDOM], rx2[NUM_RANDOM], ry1[NUM_RANDOM], ry2[NUM_RANDOM];
/* Triangles */
static Sint16 tx1[NUM_RANDOM][3], tx2[NUM_RANDOM][3], ty1[NUM_RANDOM][3], ty2[NUM_RANDOM][3];
/* Squares (made of 2 triangles) */
static Sint16 sx1[NUM_RANDOM][6], sx2[NUM_RANDOM][6], sy1[NUM_RANDOM][6], sy2[NUM_RANDOM][6];
/* Line widths */
static Uint8 lw[NUM_RANDOM];
/* Radii and offsets */
static Sint16 rr1[NUM_RANDOM], rr2[NUM_RANDOM];
/* Start and stop angles */
static Sint16 a1[NUM_RANDOM], a2[NUM_RANDOM];
/* RGB colors and alpha */
static char rr[NUM_RANDOM], rg[NUM_RANDOM], rb[NUM_RANDOM], ra[NUM_RANDOM];
/* Generate an array of random screen coordinates and RGBA values with an offset */
void InitRandomPoints()
{
int i;
float af;
for (i=0; i<NUM_RANDOM; i++) {
/* Random points in the 4 quadrants */
rx1[i]=rand() % (WIDTH/2);
rx2[i]=WIDTH/2+rx1[i];
ry1[i]=60+(rand() % ((HEIGHT-80)/2));
ry2[i]=20+((HEIGHT-80)/2)+ry1[i];
/* 5-Pixel Triangle */
tx1[i][0]=rx1[i];
tx2[i][0]=rx2[i];
ty1[i][0]=ry1[i];
ty2[i][0]=ry2[i];
tx1[i][1]=rx1[i]+1;
tx2[i][1]=rx2[i]+1;
ty1[i][1]=ry1[i]+2;
ty2[i][1]=ry2[i]+2;
tx1[i][2]=rx1[i]+2;
tx2[i][2]=rx2[i]+2;
ty1[i][2]=ry1[i]+1;
ty2[i][2]=ry2[i]+1;
/* 10x10 square made from 3 triangles */
sx1[i][0]=rx1[i];
sx2[i][0]=rx2[i];
sy1[i][0]=ry1[i];
sy2[i][0]=ry2[i];
sx1[i][1]=rx1[i]+10;
sx2[i][1]=rx2[i]+10;
sy1[i][1]=ry1[i];
sy2[i][1]=ry2[i];
sx1[i][2]=rx1[i];
sx2[i][2]=rx2[i];
sy1[i][2]=ry1[i]+10;
sy2[i][2]=ry2[i]+10;
sx1[i][3]=rx1[i];
sx2[i][3]=rx2[i];
sy1[i][3]=ry1[i]+10;
sy2[i][3]=ry2[i]+10;
sx1[i][4]=rx1[i]+10;
sx2[i][4]=rx2[i]+10;
sy1[i][4]=ry1[i];
sy2[i][4]=ry2[i];
sx1[i][5]=rx1[i]+10;
sx2[i][5]=rx2[i]+10;
sy1[i][5]=ry1[i]+10;
sy2[i][5]=ry2[i]+10;
/* Line widths */
lw[i]=2 + (rand() % 7);
/* Random Radii */
rr1[i]=rand() % 32;
rr2[i]=rand() % 32;
/* Random Angles */
a1[i]=rand() % 360;
a2[i]=rand() % 360;
/* Random Colors */
rr[i]=rand() & 255;
rg[i]=rand() & 255;
rb[i]=rand() & 255;
/* X-position dependent Alpha */
af=((float)rx1[i]/(float)(WIDTH/2));
ra[i]=(int)(255.0*af);
}
}
#define BORDER 10
/* Set a clipping rectangle based on a rect with a border */
void SetClip (SDL_Surface *screen, int x1, int y1, int x2, int y2)
{
SDL_Rect clip;
clip.x = x1+BORDER;
clip.y = y1+BORDER;
clip.w = x2-x1-2*BORDER;
clip.h = y2-y1-2*BORDER;
SDL_SetClipRect(screen, &clip);
}
void SetClipNoBorder (SDL_Surface *screen, int x1, int y1, int x2, int y2)
{
SDL_Rect clip;
clip.x = x1;
clip.y = y1;
clip.w = x2-x1;
clip.h = y2-y1;
SDL_SetClipRect(screen, &clip);
}
void ClearScreen(SDL_Surface *screen, char *title)
{
int x,y;
float stepx, stepy, fx, fy, fxy;
char titletext[257];
Uint32 color;
/* Setup clear color color */
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
color=SDL_MapRGBA(screen->format, 0,0,0,0);
} else {
color=SDL_MapRGBA(screen->format, 0,0,0,0);
}
/* Clear the screen */
SetClipNoBorder (screen,0,0,WIDTH-1,HEIGHT-1);
SDL_FillRect (screen, NULL, color);
/* Draw the colored area */
stepx=1.0f/(WIDTH/2);
stepy=1.0f/((HEIGHT-80)/2);
fx=0.0;
for (x=WIDTH/2; x<WIDTH; x++) {
fy=0.0;
for (y=(HEIGHT-40)/2+60; y<HEIGHT; y++) {
fxy=1.0f-fx*fy;
pixelRGBA(screen,x,y,(int)(128.0*fx*fx),(int)(128.0*fxy*fxy),(int)(128.0*fy*fy),255);
fy += stepy;
}
fx += stepx;
}
/* Segment and titles */
hlineRGBA(screen, 0, WIDTH, 20-1, 255,255,255,255);
hlineRGBA(screen, 0, WIDTH, 60-1, 255,255,255,255);
hlineRGBA(screen, 0, WIDTH, (HEIGHT-40)/2+40+1, 255,255,255,255);
hlineRGBA(screen, 0, WIDTH, (HEIGHT-40)/2+60-1, 255,255,255,255);
vlineRGBA(screen, WIDTH/2, 20, HEIGHT, 255,255,255,255);
strncpy(titletext,"Current Primitive: ",256);
strncat(titletext,title,256);
strncat(titletext," - Click to continue. Key to Quit.",256);
stringRGBA (screen, WIDTH/2-4*strlen(titletext),10-4,titletext,255,255,255,255);
strncpy(titletext,"A=255 on Black",256);
stringRGBA (screen, WIDTH/4-4*strlen(titletext),50-4,titletext,255,255,255,255);
strncpy(titletext,"A=0-254 on Black",256);
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),50-4,titletext,255,255,255,255);
strncpy(titletext,"A=255, Color Test",256);
stringRGBA (screen, WIDTH/4-4*strlen(titletext),(HEIGHT-40)/2+50-4,titletext,255,255,255,255);
strncpy(titletext,"A=0-254 on Color",256);
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),(HEIGHT-40)/2+50-4,titletext,255,255,255,255);
}
/* ======== Test and Benchmark routines ======= */
void TestPixel(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
pixelRGBA(screen, rx1[i], ry1[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
pixelRGBA(screen, rx2[i], ry1[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
pixelRGBA(screen, rx2[i], ry2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
pixelRGBA(screen, rx1[i], ry2[i], r, g, b, 255);
}
}
void BenchmarkPixel(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=200;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
pixelRGBA(screen, rx1[i], ry1[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=100;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
pixelRGBA(screen, rx2[i], ry1[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestHline(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
hlineRGBA(screen, rx1[i], rx1[i+1], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
hlineRGBA(screen, rx2[i], rx2[i+1], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
hlineRGBA(screen, rx2[i], rx2[i+1], ry2[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
hlineRGBA(screen, rx1[i], rx1[i]+rr1[i], ry2[i+1], r, g, b, 255);
}
}
void BenchmarkHline(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=200;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
hlineRGBA(screen, rx1[i], rx1[i+1], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=100;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
hlineRGBA(screen, rx2[i], rx2[i+1], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestVline(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
vlineRGBA(screen, rx1[i], ry1[i], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
vlineRGBA(screen, rx2[i], ry1[i], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
vlineRGBA(screen, rx2[i], ry2[i], ry2[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
vlineRGBA(screen, rx1[i], ry2[i], ry2[i]+rr1[i], r, g, b, 255);
}
}
void BenchmarkVline(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=200;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
vlineRGBA(screen, rx1[i], ry1[i], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=100;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
vlineRGBA(screen, rx2[i], ry1[i], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestRectangle(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
rectangleRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
rectangleRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
rectangleRGBA(screen, rx2[i], ry2[i], rx2[i+1], ry2[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
rectangleRGBA(screen, rx1[i], ry2[i], rx1[i]+rr1[i], ry2[i]+rr2[i], r, g, b, 255);
}
}
void BenchmarkRectangle(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=200;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 2) {
rectangleRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 2) {
rectangleRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestRoundedRectangle(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
roundedRectangleRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], 4, rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
roundedRectangleRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], 4, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
roundedRectangleRGBA(screen, rx2[i], ry2[i], rx2[i+1], ry2[i+1], 4, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
roundedRectangleRGBA(screen, rx1[i], ry2[i], rx1[i]+rr1[i], ry2[i]+rr2[i], 4, r, g, b, 255);
}
}
void BenchmarkRoundedRectangle(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=200;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 2) {
roundedRectangleRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], 4, rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 2) {
roundedRectangleRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], 4, rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestRoundedBox(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 4) {
roundedBoxRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], 4, rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 4) {
roundedBoxRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], 4, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 4) {
roundedBoxRGBA(screen, rx2[i], ry2[i], rx2[i+1], ry2[i+1], 4, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 4) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
roundedBoxRGBA(screen, rx1[i], ry2[i], rx1[i]+rr1[i], ry2[i]+rr2[i], 4, r, g, b, 255);
}
}
void BenchmarkRoundedBox(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=200;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 4) {
roundedBoxRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], 4, rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 4) {
roundedBoxRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], 4, rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/4)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestBoxTwo(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
boxRGBA(screen, rx1[i], ry1[i], rx1[i]+1, ry1[i]+1, rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
boxRGBA(screen, rx2[i], ry1[i], rx2[i]+1, ry1[i]+1, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
boxRGBA(screen, rx2[i], ry2[i], rx2[i]+1, ry2[i]+1, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
boxRGBA(screen, rx1[i], ry2[i], rx1[i]+1, ry2[i]+1, r, g, b, 255);
}
}
void BenchmarkBoxTwo(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=50;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
boxRGBA(screen, rx1[i], ry1[i], rx1[i]+1, ry1[i]+1, rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=50;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
boxRGBA(screen, rx2[i], ry1[i], rx2[i]+1, ry1[i]+1, rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestBox(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
boxRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
boxRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
boxRGBA(screen, rx2[i], ry2[i], rx2[i+1], ry2[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
boxRGBA(screen, rx1[i], ry2[i], rx1[i]+rr1[i], ry2[i]+rr2[i], r, g, b, 255);
}
}
void BenchmarkBox(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=10;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 2) {
boxRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=1;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 2) {
boxRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestLine(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
lineRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
lineRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
lineRGBA(screen, rx2[i], ry2[i], rx2[i+1], ry2[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
lineRGBA(screen, rx1[i], ry2[i], rx1[i]+rr1[i], ry2[i]+rr2[i], r, g, b, 255);
}
}
void BenchmarkLine(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=100;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 2) {
lineRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 2) {
lineRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestAALine(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
aalineRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 2) {
aalineRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
aalineRGBA(screen, rx2[i], ry2[i], rx2[i+1], ry2[i+1], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 2) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
aalineRGBA(screen, rx1[i], ry2[i], rx1[i]+rr1[i], ry2[i]+rr2[i], r, g, b, 255);
}
}
void BenchmarkAALine(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=5;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 2) {
aalineRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 2) {
aalineRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/2)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestThickLine(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 5) {
thickLineRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], lw[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i += 5) {
thickLineRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], lw[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 5) {
thickLineRGBA(screen, rx2[i], ry2[i], rx2[i+1], ry2[i+1], lw[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i += 5) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
thickLineRGBA(screen, rx1[i], ry2[i], rx1[i]+rr1[i], ry2[i]+rr2[i], lw[i], r, g, b, 255);
}
}
void BenchmarkThickLine(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=10;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 5) {
thickLineRGBA(screen, rx1[i], ry1[i], rx1[i+1], ry1[i+1], lw[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/5)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 5) {
thickLineRGBA(screen, rx2[i], ry1[i], rx2[i+1], ry1[i+1], lw[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)((NUM_RANDOM/5)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestThickLineAccuracy(SDL_Surface *screen)
{
int i;
char r,g,b;
int cx, cy;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
cx = WIDTH/4;
cy = 60+(HEIGHT-80)/4;
for (i=0; i<NUM_RANDOM; i += 10) {
thickLineRGBA(screen, cx, cy, rx1[i], ry1[i], lw[i], rr[i], rg[i], rb[i], 255);
pixelRGBA(screen, rx1[i], ry1[i], 255, 255, 255, 255);
}
pixelRGBA(screen, cx, cy, 255, 255, 255, 255);
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
cx = WIDTH/2 + WIDTH/4;
cy = 60+(HEIGHT-80)/4;
for (i=0; i<NUM_RANDOM; i += 10) {
thickLineRGBA(screen, cx, cy, rx2[i], ry1[i], lw[i], rr[i], rg[i], rb[i], ra[i]);
pixelRGBA(screen, rx2[i], ry1[i], 255, 255, 255, 255);
}
pixelRGBA(screen, cx, cy, 255, 255, 255, 255);
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
cx = WIDTH/2 + WIDTH/4;
cy = 80 + (HEIGHT-80)/2 + (HEIGHT-80)/4;
for (i=0; i<NUM_RANDOM; i += 10) {
thickLineRGBA(screen, cx, cy, rx2[i], ry2[i], lw[i], rr[i], rg[i], rb[i], ra[i]);
pixelRGBA(screen, rx2[i], ry2[i], 255, 255, 255, 255);
}
pixelRGBA(screen, cx, cy, 255, 255, 255, 255);
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
cx = WIDTH/4;
cy = 80 + (HEIGHT-80)/2 + (HEIGHT-80)/4;
for (i=0; i<NUM_RANDOM; i += 10) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
thickLineRGBA(screen, cx, cy, rx1[i], ry2[i], lw[i], r, g, b, 255);
pixelRGBA(screen, rx1[i], ry2[i], 255, 255, 255, 255);
}
pixelRGBA(screen, cx, cy, 255, 255, 255, 255);
}
void TestCircle(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
circleRGBA(screen, rx1[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
circleRGBA(screen, rx2[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
circleRGBA(screen, rx2[i], ry2[i], rr1[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
circleRGBA(screen, rx1[i], ry2[i], rr1[i], r, g, b, 255);
}
}
void BenchmarkCircle(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=20;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
circleRGBA(screen, rx1[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
circleRGBA(screen, rx2[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestAACircle(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
aacircleRGBA(screen, rx1[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
aacircleRGBA(screen, rx2[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
aacircleRGBA(screen, rx2[i], ry2[i], rr1[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
aacircleRGBA(screen, rx1[i], ry2[i], rr1[i], r, g, b, 255);
}
}
void BenchmarkAACircle(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=20;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
aacircleRGBA(screen, rx1[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
aacircleRGBA(screen, rx2[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestFilledCircle(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
filledCircleRGBA(screen, rx1[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
filledCircleRGBA(screen, rx2[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
filledCircleRGBA(screen, rx2[i], ry2[i], rr1[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
filledCircleRGBA(screen, rx1[i], ry2[i], rr1[i], r, g, b, 255);
}
}
void BenchmarkFilledCircle(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=20;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
filledCircleRGBA(screen, rx1[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
filledCircleRGBA(screen, rx2[i], ry1[i], rr1[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestEllipse(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
ellipseRGBA(screen, rx1[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
ellipseRGBA(screen, rx2[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
ellipseRGBA(screen, rx2[i], ry2[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
ellipseRGBA(screen, rx1[i], ry2[i], rr1[i], rr2[i], r, g, b, 255);
}
}
void BenchmarkEllipse(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=20;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
ellipseRGBA(screen, rx1[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
ellipseRGBA(screen, rx2[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestAAEllipse(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
aaellipseRGBA(screen, rx1[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
aaellipseRGBA(screen, rx2[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
aaellipseRGBA(screen, rx2[i], ry2[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
aaellipseRGBA(screen, rx1[i], ry2[i], rr1[i], rr2[i], r, g, b, 255);
}
}
void BenchmarkAAEllipse(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=20;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
ellipseRGBA(screen, rx1[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
aaellipseRGBA(screen, rx2[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestFilledEllipse(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
filledEllipseRGBA(screen, rx1[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
filledEllipseRGBA(screen, rx2[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
filledEllipseRGBA(screen, rx2[i], ry2[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
filledEllipseRGBA(screen, rx1[i], ry2[i], rr1[i], rr2[i], r, g, b, 255);
}
}
void BenchmarkFilledEllipse(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=20;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
filledEllipseRGBA(screen, rx1[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
filledEllipseRGBA(screen, rx2[i], ry1[i], rr1[i], rr2[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestArc(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
arcRGBA(screen, rx1[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
arcRGBA(screen, rx2[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
arcRGBA(screen, rx2[i], ry2[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
arcRGBA(screen, rx1[i], ry2[i], rr1[i], a1[i], a2[i], r, g, b, 255);
}
}
void BenchmarkArc(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=50;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
arcRGBA(screen, rx1[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
arcRGBA(screen, rx2[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestPie(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
pieRGBA(screen, rx1[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
pieRGBA(screen, rx2[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
pieRGBA(screen, rx2[i], ry2[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
pieRGBA(screen, rx1[i], ry2[i], rr1[i], a1[i], a2[i], r, g, b, 255);
}
}
void BenchmarkPie(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=20;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
pieRGBA(screen, rx1[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
pieRGBA(screen, rx2[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestFilledPie(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
filledPieRGBA(screen, rx1[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
filledPieRGBA(screen, rx2[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
filledPieRGBA(screen, rx2[i], ry2[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
filledPieRGBA(screen, rx1[i], ry2[i], rr1[i], a1[i], a2[i], r, g, b, 255);
}
}
void BenchmarkFilledPie(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Draw A=255 */
repeat=20;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
filledPieRGBA(screen, rx1[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
filledPieRGBA(screen, rx2[i], ry1[i], rr1[i], a1[i], a2[i], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestTrigon(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
trigonRGBA(screen, tx1[i][0], ty1[i][0], tx1[i][1], ty1[i][1], tx1[i][2], ty1[i][2], rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
trigonRGBA(screen, tx2[i][0], ty1[i][0], tx2[i][1], ty1[i][1], tx2[i][2], ty1[i][2], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
trigonRGBA(screen, tx2[i][0], ty2[i][0], tx2[i][1], ty2[i][1], tx2[i][2], ty2[i][2], rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
trigonRGBA(screen, tx1[i][0], ty2[i][0], tx1[i][1], ty2[i][1], tx1[i][2], ty2[i][2], r, g, b, 255);
}
}
void BenchmarkTrigon(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
repeat=50;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
trigonRGBA(screen, tx1[i][0], ty1[i][0], tx1[i][1], ty1[i][1], tx1[i][2], ty1[i][2], rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
trigonRGBA(screen, tx2[i][0], ty1[i][0], tx2[i][1], ty1[i][1], tx2[i][2], ty1[i][2], rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestTexturedTrigon(SDL_Surface *screen)
{
int i;
char r,g,b;
SDL_Surface *texture;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Create texture */
texture = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_HWSURFACE | SDL_SRCALPHA,
2, 2, 32,
0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
/* Draw A=255 */
boxRGBA(texture,0,0,1,1,255,255,255,255);
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
texturedPolygon(screen, &tx1[i][0], &ty1[i][0], 3, texture, 0, 0);
}
/* Draw A=various */
boxRGBA(texture,0,0,1,1,255,255,255,ra[i]);
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
texturedPolygon(screen, &tx2[i][0], &ty1[i][0], 3, texture, 0, 0);
}
/* Draw A=various */
boxRGBA(texture,0,0,1,1,255,255,255,ra[i]);
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
texturedPolygon(screen, &tx2[i][0], &ty2[i][0], 3, texture, 0, 0);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
boxRGBA(texture,0,0,1,1,r,g,b,255);
texturedPolygon(screen, &tx1[i][0], &ty2[i][0], 3, texture, 0, 0);
}
SDL_FreeSurface(texture);
}
void BenchmarkTexturedTrigon(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
SDL_Surface *texture;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Create texture */
texture = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_HWSURFACE | SDL_SRCALPHA,
2, 2, 32,
0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
/* Draw A=255 */
boxRGBA(texture,0,0,1,1,255,255,255,255);
repeat=50;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
texturedPolygon(screen, &tx1[i][0], &ty1[i][0], 3, texture, 0, 0);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=255 */
boxRGBA(texture,0,0,1,1,255,255,255,255);
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
texturedPolygon(screen, &tx2[i][0], &ty1[i][0], 3, texture, 0, 0);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
SDL_FreeSurface(texture);
}
void TestSquarePolygon(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
polygonRGBA(screen, &sx1[i][0], &sy1[i][0], 3, rr[i], rg[i], rb[i], 255);
polygonRGBA(screen, &sx1[i][3], &sy1[i][3], 3, rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
polygonRGBA(screen, &sx2[i][0], &sy1[i][0], 3, rr[i], rg[i], rb[i], ra[i]);
polygonRGBA(screen, &sx2[i][3], &sy1[i][3], 3, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
polygonRGBA(screen, &sx2[i][0], &sy2[i][0], 3, rr[i], rg[i], rb[i], ra[i]);
polygonRGBA(screen, &sx2[i][3], &sy2[i][3], 3, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
polygonRGBA(screen, &sx1[i][0], &sy2[i][0], 3, r, g, b, 255);
polygonRGBA(screen, &sx1[i][3], &sy2[i][3], 3, r, g, b, 255);
}
}
void BenchmarkSquarePolygon(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
repeat=50;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
polygonRGBA(screen, &sx1[i][0], &sy1[i][0], 6, rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
polygonRGBA(screen, &sx2[i][0], &sy1[i][0], 6, rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestPolygon(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
polygonRGBA(screen, &rx1[i], &ry1[i], 3, rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
polygonRGBA(screen, &rx2[i], &ry1[i], 3, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
polygonRGBA(screen, &rx2[i], &ry2[i], 3, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
rx1[i+1]=rx1[i]+rr1[i];
rx1[i+2]=rx1[i];
ry2[i+1]=ry2[i];
ry2[i+2]=ry2[i]+rr2[i];
polygonRGBA(screen, &rx1[i], &ry2[i], 3, r, g, b, 255);
}
}
void BenchmarkPolygon(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
repeat=50;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 3) {
polygonRGBA(screen, &rx1[i], &ry1[i], 3, rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 3) {
polygonRGBA(screen, &rx2[i], &ry1[i], 3, rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestAAPolygon(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
aapolygonRGBA(screen, &rx1[i], &ry1[i], 3, rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
aapolygonRGBA(screen, &rx2[i], &ry1[i], 3, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
aapolygonRGBA(screen, &rx2[i], &ry2[i], 3, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
rx1[i+1]=rx1[i]+rr1[i];
rx1[i+2]=rx1[i];
ry2[i+1]=ry2[i];
ry2[i+2]=ry2[i]+rr2[i];
aapolygonRGBA(screen, &rx1[i], &ry2[i], 3, r, g, b, 255);
}
}
void BenchmarkAAPolygon(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
repeat=5;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 3) {
aapolygonRGBA(screen, &rx1[i], &ry1[i], 3, rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=2;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 3) {
aapolygonRGBA(screen, &rx2[i], &ry1[i], 3, rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestFilledPolygon(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
filledPolygonRGBA(screen, &rx1[i], &ry1[i], 3, rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
filledPolygonRGBA(screen, &rx2[i], &ry1[i], 3, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
filledPolygonRGBA(screen, &rx2[i], &ry2[i], 3, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
rx1[i+1]=rx1[i]+rr1[i];
rx1[i+2]=rx1[i];
ry2[i+1]=ry2[i];
ry2[i+2]=ry2[i]+rr2[i];
filledPolygonRGBA(screen, &rx1[i], &ry2[i], 3, r, g, b, 255);
}
}
void BenchmarkFilledPolygon(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
repeat=20;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 3) {
filledPolygonRGBA(screen, &rx1[i], &ry1[i], 3, rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 3) {
filledPolygonRGBA(screen, &rx2[i], &ry1[i], 3, rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestFilledSquarePolygon(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
filledPolygonRGBA(screen, &sx1[i][0], &sy1[i][0], 3, rr[i], rg[i], rb[i], 255);
filledPolygonRGBA(screen, &sx1[i][3], &sy1[i][3], 3, rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
filledPolygonRGBA(screen, &sx2[i][0], &sy1[i][0], 3, rr[i], rg[i], rb[i], ra[i]);
filledPolygonRGBA(screen, &sx2[i][3], &sy1[i][3], 3, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
filledPolygonRGBA(screen, &sx2[i][0], &sy2[i][0], 3, rr[i], rg[i], rb[i], ra[i]);
filledPolygonRGBA(screen, &sx2[i][3], &sy2[i][3], 3, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
filledPolygonRGBA(screen, &sx1[i][0], &sy2[i][0], 3, r, g, b, 255);
filledPolygonRGBA(screen, &sx1[i][3], &sy2[i][3], 3, r, g, b, 255);
}
}
void BenchmarkFilledSquarePolygon(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
repeat=50;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
filledPolygonRGBA(screen, &sx1[i][0], &sy1[i][0], 3, rr[i], rg[i], rb[i], 255);
filledPolygonRGBA(screen, &sx1[i][3], &sy1[i][3], 3, rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
filledPolygonRGBA(screen, &sx2[i][0], &sy1[i][0], 3, rr[i], rg[i], rb[i], ra[i]);
filledPolygonRGBA(screen, &sx2[i][3], &sy1[i][3], 3, rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
void TestTexturedPolygon(SDL_Surface *screen)
{
int i;
SDL_Surface *texture;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Load texture surface */
texture = SDL_LoadBMP("texture.bmp");
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
SDL_SetAlpha(texture, SDL_SRCALPHA, 255);
for (i=0; i<(NUM_RANDOM/2-3); i += 3) {
SDL_SetAlpha(texture, SDL_SRCALPHA, 255);
texturedPolygon(screen, &rx1[i], &ry1[i], 3, texture, rr1[i], rr2[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<(NUM_RANDOM/2-3); i += 3) {
SDL_SetAlpha(texture, SDL_SRCALPHA, ra[i]);
texturedPolygon(screen, &rx2[i], &ry1[i], 3, texture, rr1[i], rr2[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<(NUM_RANDOM/2-3); i += 3) {
SDL_SetAlpha(texture, SDL_SRCALPHA, ra[i]);
texturedPolygon(screen, &rx2[i], &ry2[i], 3, texture, rr1[i], rr2[i]);
}
/* Draw Colortest */
SDL_SetAlpha(texture, SDL_SRCALPHA, 255);
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<(NUM_RANDOM/2-3); i += 3) {
rx1[i+1]=rx1[i]+rr1[i];
rx1[i+2]=rx1[i];
ry2[i+1]=ry2[i];
ry2[i+2]=ry2[i]+rr2[i];
texturedPolygon(screen, &rx1[i], &ry2[i], 3, texture, 0, 0);
}
SDL_FreeSurface(texture);
}
void BenchmarkTexturedPolygon(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
SDL_Surface *texture;
/* Load texture surface */
texture = SDL_LoadBMP("texture.bmp");
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
repeat=20;
SDL_SetAlpha(texture, SDL_SRCALPHA, 255);
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<(NUM_RANDOM/2-3); i += 3) {
texturedPolygon(screen, &rx1[i], &ry1[i], 3, texture, rr1[i], rr2[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM/2-3)/3)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=5;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<(NUM_RANDOM/2-3); i += 3) {
SDL_SetAlpha(texture, SDL_SRCALPHA, ra[i]);
texturedPolygon(screen, &rx2[i], &ry1[i], 3, texture, rr1[i], rr2[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM/2-3)/3)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
SDL_FreeSurface(texture);
}
void TestTexturedSquarePolygon(SDL_Surface *screen)
{
int i;
char r,g,b;
SDL_Surface *texture;
/* Load texture surface */
texture = SDL_LoadBMP("texture.bmp");
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SDL_SetAlpha(texture, SDL_SRCALPHA, 255);
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
texturedPolygon(screen, &sx1[i][0], &sy1[i][0], 3, texture, rr1[i], rr2[i]);
texturedPolygon(screen, &sx1[i][3], &sy1[i][3], 3, texture, rr1[i], rr2[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<NUM_RANDOM; i++) {
SDL_SetAlpha(texture, SDL_SRCALPHA, ra[i]);
texturedPolygon(screen, &sx2[i][0], &sy1[i][0], 3, texture, rr1[i], rr2[i]);
texturedPolygon(screen, &sx2[i][3], &sy1[i][3], 3, texture, rr1[i], rr2[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
SDL_SetAlpha(texture, SDL_SRCALPHA, ra[i]);
texturedPolygon(screen, &sx2[i][0], &sy2[i][0], 3, texture, rr1[i], rr2[i]);
texturedPolygon(screen, &sx2[i][3], &sy2[i][3], 3, texture, rr1[i], rr2[i]);
}
/* Create texture */
SDL_FreeSurface(texture);
texture = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_HWSURFACE | SDL_SRCALPHA,
2, 2, 32,
0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<NUM_RANDOM; i++) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
boxRGBA(texture,0,0,1,1,r,g,b,255);
texturedPolygon(screen, &sx1[i][0], &sy2[i][0], 3, texture, 0, 0);
texturedPolygon(screen, &sx1[i][3], &sy2[i][3], 3, texture, 0, 0);
}
SDL_FreeSurface(texture);
}
void BenchmarkTexturedSquarePolygon(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
SDL_Surface *texture;
/* Load texture surface */
texture = SDL_LoadBMP("texture.bmp");
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw shift */
repeat=50;
SDL_SetAlpha(texture, SDL_SRCALPHA, 255);
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
texturedPolygon(screen, &sx1[i][0], &sy1[i][0], 3, texture, rr1[i], rr2[i]);
texturedPolygon(screen, &sx1[i][3], &sy1[i][3], 3, texture, rr1[i], rr2[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw no shift */
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i++) {
texturedPolygon(screen, &sx2[i][0], &sy1[i][0], 3, texture, 0, 0);
texturedPolygon(screen, &sx2[i][3], &sy1[i][3], 3, texture, 0, 0);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(NUM_RANDOM*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
SDL_FreeSurface(texture);
}
void TestBezier(SDL_Surface *screen)
{
int i;
char r,g,b;
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
bezierRGBA(screen, &rx1[i], &ry1[i], 3, 100, rr[i], rg[i], rb[i], 255);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
bezierRGBA(screen, &rx2[i], &ry1[i], 3, 100, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw A=various */
SetClip(screen,WIDTH/2,80+(HEIGHT-80)/2,WIDTH,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
bezierRGBA(screen, &rx2[i], &ry2[i], 3, 100, rr[i], rg[i], rb[i], ra[i]);
}
/* Draw Colortest */
SetClip(screen,0,80+(HEIGHT-80)/2,WIDTH/2,HEIGHT);
for (i=0; i<(NUM_RANDOM-3); i += 3) {
if (rx1[i] < (WIDTH/6)) {
r=255; g=0; b=0;
} else if (rx1[i] < (WIDTH/3) ) {
r=0; g=255; b=0;
} else {
r=0; g=0; b=255;
}
rx1[i+1]=rx1[i]+rr1[i];
rx1[i+2]=rx1[i];
ry2[i+1]=ry2[i];
ry2[i+2]=ry2[i]+rr2[i];
bezierRGBA(screen, &rx1[i], &ry2[i], 3, 100, r, g, b, 255);
}
}
void BenchmarkBezier(SDL_Surface *screen)
{
int i,j;
int repeat;
Uint32 time1, time2;
char titletext[256];
/* Create random points */
srand((int)time(NULL));
InitRandomPoints();
/* Draw A=255 */
repeat=20;
SetClip(screen,0,60,WIDTH/2,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 3) {
bezierRGBA(screen, &rx1[i], &ry1[i], 3, 100, rr[i], rg[i], rb[i], 255);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
stringRGBA (screen, WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
/* Draw A=various */
repeat=10;
SetClip(screen,WIDTH/2,60,WIDTH,60+(HEIGHT-80)/2);
time1=SDL_GetTicks();
for (j=0; j<repeat; j++) {
for (i=0; i<NUM_RANDOM; i += 3) {
bezierRGBA(screen, &rx2[i], &ry1[i], 3, 100, rr[i], rg[i], rb[i], ra[i]);
}
}
time2=SDL_GetTicks();
/* Results */
SetClip(screen,0,0,WIDTH-1,HEIGHT-1);
sprintf (titletext, "%.0f per sec",1000.0*(float)(((NUM_RANDOM-3)/3)*repeat)/(float)(time2-time1));
stringRGBA (screen, 3*WIDTH/4-4*strlen(titletext),30-4,titletext,255,255,255,255);
}
/* ======== Main Program ======= */
int main(int argc, char *argv[])
{
const SDL_VideoInfo *info;
SDL_Surface *screen;
Uint8 video_bpp;
Uint32 videoflags;
int done;
SDL_Event event;
int oldprim, curprim;
char title[64];
/* Generate title string */
sprintf (title,"TestGfxPrimitives - v%i.%i.%i",SDL_GFXPRIMITIVES_MAJOR, SDL_GFXPRIMITIVES_MINOR, SDL_GFXPRIMITIVES_MICRO);
/* Initialize SDL */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
/* Alpha blending doesn't work well at 8-bit color */
info = SDL_GetVideoInfo();
if ( info->vfmt->BitsPerPixel > 8 ) {
video_bpp = info->vfmt->BitsPerPixel;
} else {
video_bpp = 16;
}
videoflags = SDL_SWSURFACE | SDL_SRCALPHA | SDL_RESIZABLE;
while ( argc > 1 ) {
--argc;
if ( strcmp(argv[argc-1], "-bpp") == 0 ) {
video_bpp = atoi(argv[argc]);
--argc;
} else
if ( strcmp(argv[argc], "-hw") == 0 ) {
videoflags |= SDL_HWSURFACE;
} else
if ( strcmp(argv[argc], "-warp") == 0 ) {
videoflags |= SDL_HWPALETTE;
} else
if ( strcmp(argv[argc], "-fullscreen") == 0 ) {
videoflags |= SDL_FULLSCREEN;
} else {
fprintf(stderr,
"Usage: %s [-bpp N] [-warp] [-hw] [-fullscreen]\n",
argv[0]);
exit(1);
}
}
/* Set video mode */
if ( (screen=SDL_SetVideoMode(WIDTH,HEIGHT,video_bpp,videoflags)) == NULL ) {
fprintf(stderr, "Couldn't set %ix%i %i bpp video mode: %s\n",WIDTH,HEIGHT,video_bpp,SDL_GetError());
exit(2);
}
/* Use alpha blending */
SDL_SetAlpha(screen, SDL_SRCALPHA, 0);
/* Set title for window */
SDL_WM_SetCaption(title,title);
/* Wait for a keystroke */
done = 0;
oldprim = 0;
curprim = 1;
while ( !done ) {
/* Draw on screen if primitive changes */
if (curprim != oldprim) {
ClearScreen(screen, "TestGfxPrimitives");
/* Draw according to curprim setting */
switch (curprim) {
/* Pixels */
case 1:
ClearScreen(screen, "Pixel");
TestPixel(screen);
BenchmarkPixel(screen);
/* Next primitive */
oldprim=curprim;
break;
/* Horizontal Lines */
case 2:
ClearScreen(screen, "Hline");
TestHline(screen);
BenchmarkHline(screen);
/* Next primitive */
oldprim=curprim;
break;
/* Vertical Lines */
case 3:
ClearScreen(screen, "Vline");
TestVline(screen);
BenchmarkVline(screen);
/* Next primitive */
oldprim=curprim;
break;
/* Rectangles */
case 4:
ClearScreen(screen, "Rectangle");
TestRectangle(screen);
BenchmarkRectangle(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Box */
case 5:
ClearScreen(screen, "Box");
TestBox(screen);
BenchmarkBox(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- 2x2 Box */
case 6:
ClearScreen(screen, "2x2 Box");
TestBoxTwo(screen);
BenchmarkBoxTwo(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Lines */
case 7:
ClearScreen(screen, "Line");
TestLine(screen);
BenchmarkLine(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- AA Line */
case 8:
ClearScreen(screen, "Anti-Aliased Line");
TestAALine(screen);
BenchmarkAALine(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Circle */
case 9:
ClearScreen(screen, "Circle");
TestCircle(screen);
BenchmarkCircle(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- AA Circle */
case 10:
ClearScreen(screen, "AA Circle");
TestAACircle(screen);
BenchmarkAACircle(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Filled Circle */
case 11:
ClearScreen(screen, "Filled Circle");
TestFilledCircle(screen);
BenchmarkFilledCircle(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Ellipse */
case 12:
ClearScreen(screen, "Ellipse");
TestEllipse(screen);
BenchmarkEllipse(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- AA Ellipse */
case 13:
ClearScreen(screen, "AA Ellipse");
TestAAEllipse(screen);
BenchmarkAAEllipse(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Filled Ellipse */
case 14:
ClearScreen(screen, "Filled Ellipse");
TestFilledEllipse(screen);
BenchmarkFilledEllipse(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Arc */
case 15:
ClearScreen(screen, "Arc");
TestArc(screen);
BenchmarkArc(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Pie */
case 16:
ClearScreen(screen, "Pie");
TestPie(screen);
BenchmarkPie(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Filled Pie */
case 17:
ClearScreen(screen, "Filled Pie");
TestFilledPie(screen);
BenchmarkFilledPie(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- 3-Pixel Trigon */
case 18:
ClearScreen(screen, "5-Pixel Trigon");
TestTrigon(screen);
BenchmarkTrigon(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- 3-Pixel Textured Trigon */
case 19:
ClearScreen(screen, "5-Pixel Textured Trigon");
TestTexturedTrigon(screen);
BenchmarkTexturedTrigon(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Square Polygon */
case 20:
ClearScreen(screen, "Square Polygon");
TestSquarePolygon(screen);
BenchmarkSquarePolygon(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Polygon */
case 21:
ClearScreen(screen, "Polygon");
TestPolygon(screen);
BenchmarkPolygon(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- AA-Polygon */
case 22:
ClearScreen(screen, "AA-Polygon");
TestAAPolygon(screen);
BenchmarkAAPolygon(screen);
/* Next primitive */
oldprim=curprim;
break;
/* ---- Filled Polygon */
case 23:
ClearScreen(screen, "Filled Polygon");
TestFilledPolygon(screen);
BenchmarkFilledPolygon(screen);
/* Next primitive */
oldprim=curprim;
break;
/* ---- Filled Square Polygon */
case 24:
ClearScreen(screen, "Square from 2 Filled Polygons");
TestFilledSquarePolygon(screen);
BenchmarkFilledSquarePolygon(screen);
/* Next primitive */
oldprim=curprim;
break;
/* ---- Textured Polygon */
case 25:
ClearScreen(screen, "Textured Polygon");
TestTexturedPolygon(screen);
BenchmarkTexturedPolygon(screen);
/* Next primitive */
oldprim=curprim;
break;
/* ---- Textured Square Polygon */
case 26:
ClearScreen(screen, "Textured Square Polygon");
TestTexturedSquarePolygon(screen);
BenchmarkTexturedSquarePolygon(screen);
/* Next primitive */
oldprim=curprim;
break;
/* ---- Bezier Curve */
case 27:
ClearScreen(screen, "Bezier Curve");
TestBezier(screen);
BenchmarkBezier(screen);
/* Next primitive */
oldprim=curprim;
break;
/* ---- Rounded Rectangle */
case 28:
ClearScreen(screen, "Rounded Rectangle");
TestRoundedRectangle(screen);
BenchmarkRoundedRectangle(screen);
/* Next primitive */
oldprim=curprim;
break;
/* ---- Rounded Box */
case 29:
ClearScreen(screen, "Rounded Box");
TestRoundedBox(screen);
BenchmarkRoundedBox(screen);
/* Next primitive */
oldprim=curprim;
break;
/* ---- Thick Line */
case 30:
ClearScreen(screen, "Thick Line");
TestThickLine(screen);
BenchmarkThickLine(screen);
/* Next primitive */
oldprim=curprim;
break;
/* ---- Thick Line (accuracy) */
case 31:
ClearScreen(screen, "Thick Line (Accuracy)");
TestThickLineAccuracy(screen);
/* Next primitive */
oldprim=curprim;
break;
/* --- Wrap start*/
case 0:
oldprim=0;
curprim=31;
break;
/* --- Wrap end */
default:
oldprim=0;
curprim=1;
break;
}
/* Show */
SDL_UpdateRect(screen, 0, 0, 0, 0);
SDL_Flip(screen);
}
/* Slow down polling */
SDL_Delay(100);
/* Check for events */
while ( SDL_PollEvent(&event) ) {
switch (event.type) {
case SDL_MOUSEBUTTONDOWN:
if ( event.button.button == SDL_BUTTON_LEFT ) {
/* Switch to next graphics */
curprim++;
} else if ( event.button.button == SDL_BUTTON_RIGHT ) {
/* Switch to prev graphics */
curprim--;
}
break;
case SDL_KEYDOWN:
/* Any keypress quits the app... */
case SDL_QUIT:
done = 1;
break;
default:
break;
}
}
}
return(0);
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/TestGfxPrimitives.c | C | apache-2.0 | 85,837 |
/*
TestGfxTexture.c: test program for textured polygon routine
(Contributed by Kees Jongenburger)
(C) A. Schiffler, December 2006, zlib license
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "SDL.h"
#ifdef WIN32
#include <windows.h>
#include "SDL_gfxPrimitives.h"
#include "SDL_framerate.h"
#else
#include "SDL/SDL_gfxPrimitives.h"
#include "SDL/SDL_framerate.h"
#endif
void HandleEvent()
{
SDL_Event event;
/* Check for events */
while ( SDL_PollEvent(&event) ) {
switch (event.type) {
case SDL_KEYDOWN:
case SDL_QUIT:
exit(0);
break;
}
}
}
void ClearScreen(SDL_Surface *screen)
{
int i;
/* Set the screen to black */
if ( SDL_LockSurface(screen) == 0 ) {
Uint32 black;
Uint8 *pixels;
black = SDL_MapRGB(screen->format, 0, 0, 0);
pixels = (Uint8 *)screen->pixels;
for ( i=0; i<screen->h; ++i ) {
memset(pixels, black,
screen->w*screen->format->BytesPerPixel);
pixels += screen->pitch;
}
SDL_UnlockSurface(screen);
}
}
#define NUM_POINTS 150
void Draw(SDL_Surface *screen)
{
int i,rate,x,y,dx,dy;
int psize = NUM_POINTS;
double sin_start = 0;
double sin_amp = 100;
Sint16 polygon_x[NUM_POINTS], polygon_y[NUM_POINTS];
Sint16 polygon_alpha_x[4], polygon_alpha_y[4];
SDL_Surface *texture;
SDL_Surface *texture_alpha;
FPSmanager fpsm;
int width_half = screen->w/2;
int height_half = screen->h/2;
/* Load texture surfaces */
texture = SDL_LoadBMP("texture.bmp");
texture_alpha = SDL_LoadBMP("texture_alpha.bmp");
SDL_SetAlpha(texture_alpha, SDL_SRCALPHA, 128);
/* Initialize variables */
srand((int)time(NULL));
i=0;
x=width_half;
y=height_half;
dx=7;
dy=5;
/* Initialize Framerate manager */
SDL_initFramerate(&fpsm);
/* Polygon for blended texture */
polygon_alpha_x[0]= 0;
polygon_alpha_y[0]= 0;
polygon_alpha_x[1]= width_half;
polygon_alpha_y[1]= 0;
polygon_alpha_x[2]= screen->w*2 / 3;
polygon_alpha_y[2]= screen->h;
polygon_alpha_x[3]= 0;
polygon_alpha_y[3]= screen->h;
/* Set/switch framerate */
rate=25;
SDL_setFramerate(&fpsm,rate);
/* Drawing loop */
while (1) {
/* Generate wave polygon */
sin_start++;
polygon_x[0]= 0;
polygon_y[0]= screen->h;
polygon_x[1]= 0;
polygon_y[1]= height_half;
for (i=2; i < psize -2 ; i++){
polygon_x[i]= (screen->w * (i-2)) / (psize -5) ;
polygon_y[i]= (Sint16)(sin(sin_start/100) * 200) + height_half - (Sint16)(sin((i + sin_start) / 20) * sin_amp);
}
polygon_x[psize-2]= screen->w;
polygon_y[psize-2]= height_half;
polygon_x[psize-1]= screen->w;
polygon_y[psize-1]= screen->h;
/* Event handler */
HandleEvent();
/* Black screen */
ClearScreen(screen);
/* Move */
x += dx;
y += dy;
/* Reflect */
if ((x<0) || (x>screen->w)) { dx=-dx; }
if ((y<0) || (y>screen->h)) { dy=-dy; }
/* Draw */
texturedPolygon(screen,polygon_x,polygon_y,psize,texture, -(screen->w * (Sint16)(sin_start-2)) / (psize - 5), -(Sint16)(sin(sin_start/100) * 200));
texturedPolygon(screen,polygon_alpha_x,polygon_alpha_y,4,texture_alpha,(Sint16)sin_start,-(Sint16)sin_start);
/* Display by flipping screens */
SDL_Flip(screen);
/* Delay to fix rate */
SDL_framerateDelay(&fpsm);
}
}
/* ======== */
int main ( int argc, char *argv[] )
{
SDL_Surface *screen;
int w, h;
int desired_bpp;
Uint32 video_flags;
/* Title */
fprintf (stderr,"texturedPolygon test\n");
/* Set default options and check command-line */
w = 640;
h = 480;
desired_bpp = 0;
video_flags = 0;
while ( argc > 1 ) {
if ( strcmp(argv[1], "-width") == 0 ) {
if ( argv[2] && ((w = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -width option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-height") == 0 ) {
if ( argv[2] && ((h = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -height option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-bpp") == 0 ) {
if ( argv[2] ) {
desired_bpp = atoi(argv[2]);
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -bpp option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-warp") == 0 ) {
video_flags |= SDL_HWPALETTE;
argv += 1;
argc -= 1;
} else
if ( strcmp(argv[1], "-hw") == 0 ) {
video_flags |= SDL_HWSURFACE;
argv += 1;
argc -= 1;
} else
if ( strcmp(argv[1], "-fullscreen") == 0 ) {
video_flags |= SDL_FULLSCREEN;
argv += 1;
argc -= 1;
} else
break;
}
/* Force double buffering */
video_flags |= SDL_DOUBLEBUF;
/* Initialize SDL */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr,
"Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
atexit(SDL_Quit); /* Clean up on exit */
/* Initialize the display */
screen = SDL_SetVideoMode(w, h, desired_bpp, video_flags);
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n",
w, h, desired_bpp, SDL_GetError());
exit(1);
}
/* Show some info */
printf("Set %dx%dx%d mode\n",
screen->w, screen->h, screen->format->BitsPerPixel);
printf("Video surface located in %s memory.\n",
(screen->flags&SDL_HWSURFACE) ? "video" : "system");
/* Check for double buffering */
if ( screen->flags & SDL_DOUBLEBUF ) {
printf("Double-buffering enabled - good!\n");
}
/* Set the window manager title bar */
SDL_WM_SetCaption("texturedPolygon test", "texturedPolygon");
/* Do all the drawing work */
Draw (screen);
return(0);
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/TestGfxTexture.c | C | apache-2.0 | 5,707 |
/*
TestImageFilter.c: test program for MMX filter routines
(C) A. Schiffler, 2006, zlib license
(C) Sylvain Beucler, 2013, zlib license
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "SDL.h"
#ifdef WIN32
#include <windows.h>
#include "SDL_imageFilter.h"
#ifndef bcmp
#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
#endif
#else
#include "SDL/SDL_imageFilter.h"
#endif
#define SRC_SIZE 23
int total_count = 0;
int ok_count = 0;
void setup_src(unsigned char *src1, unsigned char *src2)
{
int i;
src1[0]=1;
src1[2]=1;
src1[1]=4;
src1[3]=3;
src1[4]=33;
for (i=5; i<14; i++) src1[i]=i;
src1[14]=8;
for (i=15; i<SRC_SIZE; i++) src1[i]=rand();
src2[0]=1;
src2[1]=3;
src2[2]=3;
src2[3]=2;
src2[4]=44;
for (i=5; i<14; i++) src2[i]=14-i;
src2[14]=10;
for (i=15; i<SRC_SIZE; i++) src2[i]=src1[i];
}
void print_result(int mmx, char *label, unsigned char *src1, unsigned char *src2, unsigned char *dst)
{
char blabel[80];
int i;
memset((void *)blabel, ' ', 80);
blabel[strlen(label)+4]=0;
printf("\n");
printf ("%s pos ", blabel);
for (i = 0; i < SRC_SIZE; i++)
printf("%2d ", i);
printf("\n");
printf ("%s src1 ", blabel);
for (i = 0; i < SRC_SIZE; i++)
printf("%02x ", src1[i]);
printf("\n");
if (src2) {
printf ("%s src2 ", blabel);
for (i = 0; i < SRC_SIZE; i++)
printf("%02x ", src2[i]);
}
printf("\n");
printf ("%s %s dest ",mmx?"MMX":" C ",label);
for (i = 0; i < SRC_SIZE; i++)
printf("%02x ", dst[i]);
printf("\n");
}
void print_compare(unsigned char *dst1, unsigned char *dst2)
{
total_count++;
if (bcmp(dst1,dst2,SRC_SIZE)==0) {
printf ("OK\n");
ok_count++;
} else {
printf ("ERROR\n");
}
}
void print_line()
{
printf ("------------------------------------------------------------------------\n\n\n");
}
void pause()
{
char ch;
do {
ch = getchar();
putchar('.');
} while (ch != '\n');
}
/* ----------- main ---------- */
int main(int argc, char *argv[])
{
unsigned char src1[SRC_SIZE], src2[SRC_SIZE], dstm[SRC_SIZE], dstc[SRC_SIZE];
int size = 2*1024*1024;
unsigned char *t1 = (unsigned char *)malloc(size), *t2 = (unsigned char *)malloc(size), *d = (unsigned char *)malloc(size);
int i;
// Interestingly, C tests are about 4x faster
// on malloc(size) than on char[size]
printf("src1:\t%s (%p)\tsrc2:\t%s (%p)\tdstm:\t%s (%p)\tdstc:\t%s (%p)\n",
((long long)src1%8) ? "not aligned" : "aligned", src1,
((long long)src2%8) ? "not aligned" : "aligned", src2,
((long long)dstm%8) ? "not aligned" : "aligned", dstm,
((long long)dstc%8) ? "not aligned" : "aligned", dstc);
printf("t1:\t%s (%p)\tt2:\t%s (%p)\td:\t%s (%p)\n",
((long long)t1%8) ? "not aligned" : "aligned", t1,
((long long)t2%8) ? "not aligned" : "aligned", t2,
((long long) d%8) ? "not aligned" : "aligned", d);
{
/* Initialize to make valgrind happy */
srand((unsigned int)time(NULL));
for (i = 0; i < size; i++) {
/* use more random lower-order bits (int->char) */
t1[i] = rand(); t2[i] = rand(); d[i] = rand();
}
}
SDL_Init(SDL_INIT_TIMER);
/* SDL_imageFilter Test */
printf ("TestImageFilter\n\n");
printf ("Testing an array of 23 bytes - first 16 bytes should be processed\n");
printf ("by MMX or C code, the last 7 bytes only by C code.\n\n");
print_line();
#define TEST_C 0
#define TEST_MMX 1
{
#define FUNC(f) { #f, SDL_imageFilter ## f }
struct func {
char* name;
int (*f)(unsigned char*, unsigned char*, unsigned char*, unsigned int);
};
struct func funcs[] = {
FUNC(BitAnd),
FUNC(BitOr),
FUNC(Add),
FUNC(AbsDiff),
FUNC(Mean),
FUNC(Sub),
FUNC(Mult),
FUNC(MultNor),
FUNC(MultDivby2),
FUNC(MultDivby4),
FUNC(Div),
};
int k;
for (k = 0; k < sizeof(funcs)/sizeof(struct func); k++) {
Uint32 start;
int i;
setup_src(src1, src2);
SDL_imageFilterMMXon();
funcs[k].f(src1, src2, dstm, SRC_SIZE);
print_result(TEST_MMX, funcs[k].name, src1, src2, dstm);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
funcs[k].f(t1, t2, d, size);
}
printf("MMX %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
SDL_imageFilterMMXoff();
funcs[k].f(src1, src2, dstc, SRC_SIZE);
print_result(TEST_C, funcs[k].name, src1, src2, dstc);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
funcs[k].f(t1, t2, d, size);
}
printf(" C %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
print_compare(dstm,dstc);
print_line();
}
}
{
Uint32 start;
int i;
char call[1024];
sprintf(call, "BitNegation");
setup_src(src1, src2);
SDL_imageFilterMMXon();
SDL_imageFilterBitNegation(src1, dstm, SRC_SIZE);
print_result(TEST_MMX, call, src1, NULL, dstm);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
SDL_imageFilterBitNegation(t1, d, size);
}
printf("MMX %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
SDL_imageFilterMMXoff();
SDL_imageFilterBitNegation(src1, dstc, SRC_SIZE);
print_result(TEST_C, call, src1, NULL, dstc);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
SDL_imageFilterBitNegation(t1, d, size);
}
printf(" C %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
print_compare(dstm,dstc);
print_line();
}
{
#undef FUNC
#define FUNC(f, c) { #f, SDL_imageFilter ## f, c }
struct func {
char* name;
int (*f)(unsigned char*, unsigned char*, unsigned int, unsigned char);
unsigned char arg;
};
struct func funcs[] = {
FUNC(AddByte, 3),
FUNC(AddByteToHalf, 3),
FUNC(SubByte, 3),
FUNC(ShiftRight, 1),
FUNC(ShiftRightUint, 4),
FUNC(MultByByte, 3),
FUNC(ShiftLeftByte, 3),
FUNC(ShiftLeft, 3),
FUNC(ShiftLeftUint, 4),
FUNC(BinarizeUsingThreshold, 9),
};
int k;
for (k = 0; k < sizeof(funcs)/sizeof(struct func); k++) {
Uint32 start;
int i;
char call[1024];
sprintf(call, "%s(%u)", funcs[k].name, funcs[k].arg);
setup_src(src1, src2);
SDL_imageFilterMMXon();
funcs[k].f(src1, dstm, SRC_SIZE, funcs[k].arg);
print_result(TEST_MMX, call, src1, NULL, dstm);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
funcs[k].f(t1, d, size, funcs[k].arg);
}
printf("MMX %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
SDL_imageFilterMMXoff();
funcs[k].f(src1, dstc, SRC_SIZE, funcs[k].arg);
print_result(TEST_C, call, src1, NULL, dstc);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
funcs[k].f(t1, d, size, funcs[k].arg);
}
printf(" C %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
print_compare(dstm,dstc);
print_line();
}
}
{
#undef FUNC
#define FUNC(f, c1, c2) { #f, SDL_imageFilter ## f, c1, c2 }
struct func {
char* name;
int (*f)(unsigned char*, unsigned char*, unsigned int, unsigned char, unsigned char);
unsigned char arg1, arg2;
};
struct func funcs[] = {
FUNC(ShiftRightAndMultByByte, 1, 3),
FUNC(ClipToRange, 3, 8),
};
int k;
for (k = 0; k < sizeof(funcs)/sizeof(struct func); k++) {
Uint32 start;
int i;
char call[1024];
sprintf(call, "%s(%u,%u)", funcs[k].name, funcs[k].arg1, funcs[k].arg2);
setup_src(src1, src2);
SDL_imageFilterMMXon();
funcs[k].f(src1, dstm, SRC_SIZE, funcs[k].arg1, funcs[k].arg2);
print_result(TEST_MMX, call, src1, NULL, dstm);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
funcs[k].f(t1, d, size, funcs[k].arg1, funcs[k].arg2);
}
printf("MMX %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
SDL_imageFilterMMXoff();
funcs[k].f(src1, dstc, SRC_SIZE, funcs[k].arg1, funcs[k].arg2);
print_result(TEST_C, call, src1, NULL, dstc);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
funcs[k].f(t1, d, size, funcs[k].arg1, funcs[k].arg2);
}
printf(" C %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
print_compare(dstm,dstc);
print_line();
}
}
{
Uint32 start;
int i;
char call[1024];
sprintf(call, "NormalizeLinear(0,33,0,255)");
setup_src(src1, src2);
SDL_imageFilterMMXon();
SDL_imageFilterNormalizeLinear(src1, dstm, SRC_SIZE, 0,33, 0,255);
print_result(TEST_MMX, call, src1, NULL, dstm);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
SDL_imageFilterNormalizeLinear(t1, d, size, 0,33, 0,255);
}
printf("MMX %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
SDL_imageFilterMMXoff();
SDL_imageFilterNormalizeLinear(src1, dstc, SRC_SIZE, 0,33, 0,255);
print_result(TEST_C, call, src1, NULL, dstc);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
SDL_imageFilterNormalizeLinear(t1, d, size, 0,33, 0,255);
}
printf(" C %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
print_compare(dstm,dstc);
print_line();
}
/* Uint functions */
/* Disabled, since broken *//* ??? */
{
#undef FUNC
#define FUNC(f, c) { #f, SDL_imageFilter ## f, c }
struct func {
char* name;
int (*f)(unsigned char*, unsigned char*, unsigned int, unsigned int);
unsigned int arg;
};
struct func funcs[] = {
FUNC(AddUint, 0x01020304),
FUNC(SubUint, 0x01020304),
};
int k;
for (k = 0; k < sizeof(funcs)/sizeof(struct func); k++) {
Uint32 start;
int i;
char call[1024];
sprintf(call, "%s(%u)", funcs[k].name, funcs[k].arg);
setup_src(src1, src2);
SDL_imageFilterMMXon();
funcs[k].f(src1, dstm, SRC_SIZE, funcs[k].arg);
print_result(TEST_MMX, call, src1, NULL, dstm);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
funcs[k].f(t1, d, size, funcs[k].arg);
}
printf("MMX %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
SDL_imageFilterMMXoff();
funcs[k].f(src1, dstc, SRC_SIZE, funcs[k].arg);
print_result(TEST_C, call, src1, NULL, dstc);
start = SDL_GetTicks();
for (i = 0; i < 50; i++) {
funcs[k].f(t1, d, size, funcs[k].arg);
}
printf(" C %dx%dk: %dms\n", i, size/1024, SDL_GetTicks() - start);
print_compare(dstm,dstc);
print_line();
}
}
SDL_imageFilterMMXon();
if (SDL_imageFilterMMXdetect())
{
printf("MMX was detected\n\n");
}
else
{
printf("MMX was NOT detected\n\n");
}
printf ("Result: %i of %i passed OK.\n", ok_count, total_count);
#ifdef WIN32
printf("Press Enter to continue ...");
pause();
#endif
SDL_Quit();
free(d);
free(t2);
free(t1);
exit(0);
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/TestImageFilter.c | C | apache-2.0 | 10,421 |
/*
TestRotozoom.c: test program for rotozoom routines
(C) A. Schiffler, 2001-2011, zlib License
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "SDL.h"
#ifdef WIN32
#include <windows.h>
#include "SDL_gfxPrimitives.h"
#include "SDL_rotozoom.h"
#else
#include "SDL/SDL_gfxPrimitives.h"
#include "SDL/SDL_rotozoom.h"
#endif
/* Pause flag */
int pause = 0;
/* Custom rotation setup */
double custom_angle=0.0;
double custom_fx=1.0;
double custom_fy=1.0;
int custom_smooth=0;
/* Delay between frames */
int delay;
/* Curren message */
char *messageText;
void HandleEvent()
{
SDL_Event event;
/* Check for events */
while ( SDL_PollEvent(&event) || pause ) {
switch (event.type) {
case SDL_KEYDOWN:
/* Space pauses/unpauses */
if ((event.key.state==SDL_PRESSED) &&
(event.key.keysym.sym==SDLK_SPACE)) {
pause = !pause;
if (pause) {
printf ("Paused ...\n");
}
} else {
exit(0);
}
break;
case SDL_QUIT:
exit(0);
break;
}
if (pause) {
SDL_Delay(100);
}
}
}
void ClearScreen(SDL_Surface *screen)
{
int i;
/* Set the screen to black */
if ( SDL_LockSurface(screen) == 0 ) {
Uint8 *pixels;
pixels = (Uint8 *)screen->pixels;
for ( i=0; i<screen->h; ++i ) {
memset(pixels, 0,
screen->w*screen->format->BytesPerPixel);
pixels += screen->pitch;
}
SDL_UnlockSurface(screen);
}
}
#define POSITION_CENTER 1
#define POSITION_BOTTOMRIGHT 2
void RotatePicture (SDL_Surface *screen, SDL_Surface *picture, int rotate, int flip, int smooth, int position)
{
SDL_Surface *rotozoom_picture;
SDL_Rect dest;
int framecount, framemax, frameinc;
double angle, zoomf, zoomfx, zoomfy;
printf("%s\n", messageText);
/* Rotate and display the picture */
framemax=4*360;
frameinc=1;
for (framecount=-360; framecount<framemax; framecount += frameinc) {
if ((framecount % 360)==0) frameinc++;
HandleEvent();
ClearScreen(screen);
zoomf=(float)(framecount+2*360)/(float)framemax;
zoomf=1.5*zoomf*zoomf;
/* Are we in flipping mode? */
if (flip) {
/* Flip X factor */
if (flip & 1) {
zoomfx=-zoomf;
} else {
zoomfx=zoomf;
}
/* Flip Y factor */
if (flip & 2) {
zoomfy=-zoomf;
} else {
zoomfy=zoomf;
}
angle=framecount*rotate;
if (((framecount % 120)==0) || (delay>0)) {
printf (" Frame: %i Rotate: angle=%.2f Zoom: x=%.2f y=%.2f\n",framecount,angle,zoomfx,zoomfy);
}
if ((rotozoom_picture=rotozoomSurfaceXY (picture, angle, zoomfx, zoomfy, smooth))!=NULL) {
switch (position) {
case POSITION_CENTER:
dest.x = (screen->w - rotozoom_picture->w)/2;
dest.y = (screen->h - rotozoom_picture->h)/2;
break;
case POSITION_BOTTOMRIGHT:
dest.x = (screen->w/2) - rotozoom_picture->w;
dest.y = (screen->h/2) - rotozoom_picture->h;
break;
}
dest.w = rotozoom_picture->w;
dest.h = rotozoom_picture->h;
if ( SDL_BlitSurface(rotozoom_picture, NULL, screen, &dest) < 0 ) {
fprintf(stderr, "Blit failed: %s\n", SDL_GetError());
break;
}
SDL_FreeSurface(rotozoom_picture);
}
} else {
angle=framecount*rotate;
if ((framecount % 120)==0) {
printf (" Frame: %i Rotate: angle=%.2f Zoom: f=%.2f \n",framecount,angle,zoomf);
}
if ((rotozoom_picture=rotozoomSurface (picture, angle, zoomf, smooth))!=NULL) {
switch (position) {
case POSITION_CENTER:
dest.x = (screen->w - rotozoom_picture->w)/2;
dest.y = (screen->h - rotozoom_picture->h)/2;
break;
case POSITION_BOTTOMRIGHT:
dest.x = (screen->w/2) - rotozoom_picture->w;
dest.y = (screen->h/2) - rotozoom_picture->h;
break;
}
dest.w = rotozoom_picture->w;
dest.h = rotozoom_picture->h;
if ( SDL_BlitSurface(rotozoom_picture, NULL, screen, &dest) < 0 ) {
fprintf(stderr, "Blit failed: %s\n", SDL_GetError());
break;
}
SDL_FreeSurface(rotozoom_picture);
}
}
stringRGBA(screen, 8, 8, messageText, 255, 255, 255, 255);
/* Display by flipping screens */
SDL_Flip(screen);
/* Maybe delay */
if (delay>0) {
SDL_Delay(delay);
}
}
if (rotate) {
/* Final display with angle=0 */
HandleEvent();
ClearScreen(screen);
if (flip) {
if ((rotozoom_picture=rotozoomSurfaceXY (picture, 0.01, zoomfx, zoomfy, smooth))!=NULL) {
dest.x = (screen->w - rotozoom_picture->w)/2;;
dest.y = (screen->h - rotozoom_picture->h)/2;
dest.w = rotozoom_picture->w;
dest.h = rotozoom_picture->h;
if ( SDL_BlitSurface(rotozoom_picture, NULL, screen, &dest) < 0 ) {
fprintf(stderr, "Blit failed: %s\n", SDL_GetError());
return;
}
SDL_FreeSurface(rotozoom_picture);
}
} else {
if ((rotozoom_picture=rotozoomSurface (picture, 0.01, zoomf, smooth))!=NULL) {
dest.x = (screen->w - rotozoom_picture->w)/2;;
dest.y = (screen->h - rotozoom_picture->h)/2;
dest.w = rotozoom_picture->w;
dest.h = rotozoom_picture->h;
if ( SDL_BlitSurface(rotozoom_picture, NULL, screen, &dest) < 0 ) {
fprintf(stderr, "Blit failed: %s\n", SDL_GetError());
return;
}
SDL_FreeSurface(rotozoom_picture);
}
}
stringRGBA(screen, 8, 8, messageText, 255, 255, 255, 255);
/* Display by flipping screens */
SDL_Flip(screen);
/* Maybe delay */
if (delay>0) {
SDL_Delay(delay);
}
}
/* Pause for a sec */
SDL_Delay(1000);
}
void ZoomPicture (SDL_Surface *screen, SDL_Surface *picture, int smooth)
{
SDL_Surface *rotozoom_picture;
SDL_Rect dest;
int framecount, framemax, frameinc;
double zoomxf,zoomyf;
printf("%s\n", messageText);
/* Zoom and display the picture */
framemax=4*360; frameinc=1;
for (framecount=360; framecount<framemax; framecount += frameinc) {
if ((framecount % 360)==0) frameinc++;
HandleEvent();
ClearScreen(screen);
zoomxf=(float)framecount/(float)framemax;
zoomxf=1.5*zoomxf*zoomxf;
zoomyf=0.5+fabs(1.0*sin((double)framecount/80.0));
if ((framecount % 120)==0) {
printf (" Frame: %i Zoom: x=%.2f y=%.2f\n",framecount,zoomxf,zoomyf);
}
if ((rotozoom_picture=zoomSurface (picture, zoomxf, zoomyf, smooth))!=NULL) {
dest.x = (screen->w - rotozoom_picture->w)/2;;
dest.y = (screen->h - rotozoom_picture->h)/2;
dest.w = rotozoom_picture->w;
dest.h = rotozoom_picture->h;
if ( SDL_BlitSurface(rotozoom_picture, NULL, screen, &dest) < 0 ) {
fprintf(stderr, "Blit failed: %s\n", SDL_GetError());
break;
}
SDL_FreeSurface(rotozoom_picture);
}
stringRGBA(screen, 8, 8, messageText, 255, 255, 255, 255);
/* Display by flipping screens */
SDL_Flip(screen);
/* Maybe delay */
if (delay>0) {
SDL_Delay(delay);
}
}
/* Pause for a sec */
SDL_Delay(1000);
}
void RotatePicture90Degrees (SDL_Surface *screen, SDL_Surface *picture)
{
SDL_Surface *rotozoom_picture;
SDL_Rect dest;
int framecount, framemax, frameinc;
int numClockwiseTurns;
printf("%s\n", messageText);
/* Rotate and display the picture */
framemax = 21;
frameinc = 1;
numClockwiseTurns = -4;
for (framecount=0; framecount<framemax; framecount += frameinc) {
HandleEvent();
ClearScreen(screen);
printf (" Frame: %i Rotate90: %i clockwise turns\n",framecount,numClockwiseTurns+4);
if ((rotozoom_picture=rotateSurface90Degrees(picture, numClockwiseTurns))!=NULL) {
dest.x = (screen->w - rotozoom_picture->w)/2;;
dest.y = (screen->h - rotozoom_picture->h)/2;
dest.w = rotozoom_picture->w;
dest.h = rotozoom_picture->h;
if (SDL_BlitSurface(rotozoom_picture, NULL, screen, &dest) < 0 ) {
fprintf(stderr, "Blit failed: %s\n", SDL_GetError());
break;
}
SDL_FreeSurface(rotozoom_picture);
}
stringRGBA(screen, 8, 8, messageText, 255, 255, 255, 255);
/* Display by flipping screens */
SDL_Flip(screen);
/* Always delay */
SDL_Delay(333);
if (delay>0) {
SDL_Delay(delay);
}
numClockwiseTurns++;
}
/* Pause for a sec */
SDL_Delay(1000);
}
#define ROTATE_OFF 0
#define ROTATE_ON 1
#define FLIP_OFF 0
#define FLIP_X 1
#define FLIP_Y 2
#define FLIP_XY 3
void CustomTest(SDL_Surface *screen, SDL_Surface *picture, double a, double x, double y, int smooth){
SDL_Surface *rotozoom_picture;
SDL_Rect dest;
printf("%s\n", messageText);
printf (" Frame: C Rotate: angle=%.2f Zoom: fx=%.2f fy=%.2f \n",a,x,y);
HandleEvent();
ClearScreen(screen);
if ((rotozoom_picture=rotozoomSurfaceXY (picture, a, x, y, smooth))!=NULL) {
dest.x = (screen->w - rotozoom_picture->w)/2;;
dest.y = (screen->h - rotozoom_picture->h)/2;
dest.w = rotozoom_picture->w;
dest.h = rotozoom_picture->h;
if ( SDL_BlitSurface(rotozoom_picture, NULL, screen, &dest) < 0 ) {
fprintf(stderr, "Blit failed: %s\n", SDL_GetError());
return;
}
SDL_FreeSurface(rotozoom_picture);
}
/* Display by flipping screens */
SDL_Flip(screen);
/* Maybe delay */
if (delay>0) {
SDL_Delay(delay);
}
SDL_Delay(1000);
}
void AccuracyTest1(SDL_Surface *screen)
{
SDL_Surface* testx1;
SDL_Surface* testx2;
SDL_Rect r;
SDL_Rect target;
SDL_Surface* ref;
int size, halfsize, doublesize;
printf("%s\n", messageText);
for (size = 10; size < 200; size += 2)
{
HandleEvent();
ClearScreen(screen);
stringRGBA(screen, 8, 8, messageText, 255, 255, 255, 255);
halfsize = size / 2;
doublesize = size * 2;
printf (" zoom from %i to %i\n", size, doublesize);
// Set up test surfaces
testx1 = SDL_CreateRGBSurface(SDL_SWSURFACE, size, size, 24, 0, 0, 0, 0);
r.x = 0;
r.y = 0;
r.w = halfsize;
r.h = halfsize;
SDL_FillRect(testx1, &r, 0x339933);
r.x = halfsize;
r.y = halfsize;
SDL_FillRect(testx1, &r, 0x993399);
r.x = 0;
r.y = halfsize;
SDL_FillRect(testx1, &r, 0x999933);
r.x = halfsize;
r.y = 0;
SDL_FillRect(testx1, &r, 0x333399);
testx2 = zoomSurface(testx1, 2.0, 2.0, 0);
ref = SDL_CreateRGBSurface(SDL_SWSURFACE, size, size, 24, 0, 0, 0, 0);
r.w = size;
r.h = size;
r.x = 0;
r.y = 0;
SDL_FillRect(ref, &r, 0xFFFFFF);
/* Validation display */
target.x = 0;
target.y = 20;
target.w = 0;
target.h = 0;
SDL_BlitSurface(testx1, 0, screen, &target);
target.x = size;
target.y = 20;
SDL_BlitSurface(ref, 0, screen, &target);
target.x = 0;
target.y = 20 + size;
SDL_BlitSurface(ref, 0, screen, &target);
target.x = doublesize + 20;
target.y = 20;
SDL_BlitSurface(testx2, 0, screen, &target);
target.x = doublesize + doublesize + 20;
target.y = 20;
SDL_BlitSurface(ref, 0, screen, &target);
target.x = doublesize + 20;
target.y = 20 + doublesize;
SDL_BlitSurface(ref, 0, screen, &target);
SDL_FreeSurface(testx1);
SDL_FreeSurface(testx2);
SDL_FreeSurface(ref);
/* Display by flipping screens */
SDL_Flip(screen);
/* Always delay */
SDL_Delay(250);
/* Maybe add extra delay */
if (delay>0) {
SDL_Delay(delay);
}
}
SDL_Delay(1000);
}
void AccuracyTest2(SDL_Surface *screen, SDL_Surface *picture)
{
SDL_Surface *zoomed1, *zoomed2, *zoomed3, *zoomed4;
int factor;
int neww, newh;
SDL_Rect target;
printf("%s\n", messageText);
for (factor = 2; factor < 64; factor += 1)
{
HandleEvent();
ClearScreen(screen);
stringRGBA(screen, 8, 8, messageText, 255, 255, 255, 255);
neww = picture->w * factor;
newh = picture->h * factor;
printf (" zoom %ix%i to %ix%i\n", picture->w, picture->h, neww, newh);
zoomed1 = zoomSurface(picture, (float)factor, (float)factor, 0);
zoomed2 = zoomSurface(picture, (float)factor, (float)factor, 1);
zoomed3 = zoomSurface(picture, (float)factor, -(float)factor, 1);
zoomed4 = zoomSurface(picture, -(float)factor, (float)factor, 1);
target.x = screen->w/2 - zoomed1->w;
target.y = screen->h/2 - zoomed1->h;
target.w = zoomed1->w;
target.h = zoomed1->h;
SDL_BlitSurface(zoomed1, 0, screen, &target);
target.x = screen->w/2;
target.y = screen->h/2;
SDL_BlitSurface(zoomed2, 0, screen, &target);
target.x = screen->w/2 - zoomed3->w;
target.y = screen->h/2;
SDL_BlitSurface(zoomed4, 0, screen, &target);
target.x = screen->w/2;
target.y = screen->h/2 - zoomed4->h;
SDL_BlitSurface(zoomed3, 0, screen, &target);
SDL_FreeSurface(zoomed1);
SDL_FreeSurface(zoomed2);
SDL_FreeSurface(zoomed3);
SDL_FreeSurface(zoomed4);
/* Display by flipping screens */
SDL_Flip(screen);
/* Always delay */
SDL_Delay(250);
/* Maybe add extra delay */
if (delay>0) {
SDL_Delay(delay);
}
}
SDL_Delay(1000);
}
void Draw (SDL_Surface *screen, int start, int end)
{
SDL_Surface *picture, *picture_again;
char *bmpfile;
/* Define masking bytes */
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
Uint32 rmask = 0xff000000;
Uint32 gmask = 0x00ff0000;
Uint32 bmask = 0x0000ff00;
Uint32 amask = 0x000000ff;
#else
Uint32 amask = 0xff000000;
Uint32 bmask = 0x00ff0000;
Uint32 gmask = 0x0000ff00;
Uint32 rmask = 0x000000ff;
#endif
/* --------- 8 bit tests -------- */
if (start<=6) {
/* Message */
printf("8 bit tests ...\n");
/* Load the image into a surface */
bmpfile = "sample8.bmp";
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
/* Add white frame */
rectangleColor(picture, 0, 0, picture->w-1, picture->h-1, 0xffffffff);
if (start <= 1) {
sprintf(messageText, "1. rotozoom: Rotating and zooming");
RotatePicture(screen,picture,ROTATE_ON,FLIP_OFF,SMOOTHING_OFF,POSITION_CENTER);
}
if (end == 1) goto done8bit;
if (start <= 2) {
sprintf(messageText, "2. rotozoom: Just zooming (angle=0)");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_OFF,SMOOTHING_OFF,POSITION_CENTER);
RotatePicture(screen,picture,ROTATE_OFF,FLIP_OFF,SMOOTHING_OFF,POSITION_BOTTOMRIGHT);
}
if (end == 2) goto done8bit;
if (start <= 3) {
sprintf(messageText, "3. zoom: Just zooming");
ZoomPicture(screen,picture,SMOOTHING_OFF);
}
if (end == 3) goto done8bit;
if (start <= 4) {
sprintf(messageText, "4. rotozoom: Rotating and zooming, interpolation on but unused");
RotatePicture(screen,picture,ROTATE_ON,FLIP_OFF,SMOOTHING_ON,POSITION_CENTER);
}
if (end == 4) goto done8bit;
if (start <= 5) {
sprintf(messageText, "5. rotozoom: Just zooming (angle=0), interpolation on but unused");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_OFF,SMOOTHING_ON,POSITION_CENTER);
RotatePicture(screen,picture,ROTATE_OFF,FLIP_OFF,SMOOTHING_ON,POSITION_BOTTOMRIGHT);
}
if (end == 5) goto done8bit;
if (start <= 6) {
sprintf(messageText, "6. zoom: Just zooming, interpolation on but unused");
ZoomPicture(screen,picture,SMOOTHING_ON);
}
if (end == 6) goto done8bit;
done8bit:
/* Free the picture */
SDL_FreeSurface(picture);
if (end <= 6) return;
}
/* -------- 24 bit test --------- */
if (start<=12) {
/* Message */
printf("24 bit tests ...\n");
/* Load the image into a surface */
bmpfile = "sample24.bmp";
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
/* Add white frame */
rectangleColor(picture, 0, 0, picture->w-1, picture->h-1, 0xffffffff);
if (start <= 7) {
sprintf(messageText, "7. rotozoom: Rotating and zooming, no interpolation");
RotatePicture(screen,picture,ROTATE_ON,FLIP_OFF,SMOOTHING_OFF,POSITION_CENTER);
}
if (end == 7) goto done24bit;
if (start <= 8) {
sprintf(messageText, "8a. rotozoom: Just zooming (angle=0), no interpolation, centered");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_OFF,SMOOTHING_OFF,POSITION_CENTER);
sprintf(messageText, "8b. rotozoom: Just zooming (angle=0), no interpolation, corner");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_OFF,SMOOTHING_OFF,POSITION_BOTTOMRIGHT);
sprintf(messageText, "8c. rotozoom: Just zooming (angle=0), X flip, no interpolation, centered");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_X,SMOOTHING_OFF,POSITION_CENTER);
sprintf(messageText, "8d. rotozoom: Just zooming (angle=0), Y flip, no interpolation, centered");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_Y,SMOOTHING_OFF,POSITION_CENTER);
sprintf(messageText, "8e. rotozoom: Just zooming (angle=0), XY flip, no interpolation, centered");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_XY,SMOOTHING_OFF,POSITION_CENTER);
}
if (end == 8) goto done24bit;
if (start <= 9) {
sprintf(messageText, "9. zoom: Just zooming, no interpolation");
ZoomPicture(screen,picture,SMOOTHING_OFF);
}
if (end == 9) goto done24bit;
if (start <= 10) {
sprintf(messageText, "10. rotozoom: Rotating and zooming, with interpolation");
RotatePicture(screen,picture,ROTATE_ON,FLIP_OFF,SMOOTHING_ON,POSITION_CENTER);
}
if (end == 10) goto done24bit;
if (start <= 11) {
sprintf(messageText, "11a. rotozoom: Just zooming (angle=0), with interpolation, centered");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_OFF,SMOOTHING_ON,POSITION_CENTER);
sprintf(messageText, "11b. rotozoom: Just zooming (angle=0), with interpolation, corner");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_OFF,SMOOTHING_ON,POSITION_BOTTOMRIGHT);
sprintf(messageText, "11c. rotozoom: Just zooming (angle=0), X flip, with interpolation, corner");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_X,SMOOTHING_ON,POSITION_CENTER);
sprintf(messageText, "11d. rotozoom: Just zooming (angle=0), Y flip, with interpolation, corner");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_Y,SMOOTHING_ON,POSITION_CENTER);
sprintf(messageText, "11e. rotozoom: Just zooming (angle=0), XY flip, with interpolation, corner");
RotatePicture(screen,picture,ROTATE_OFF,FLIP_XY,SMOOTHING_ON,POSITION_CENTER);
}
if (end == 11) goto done24bit;
if (start <= 12) {
sprintf(messageText, "12. zoom: Just zooming, with interpolation");
ZoomPicture(screen,picture,SMOOTHING_ON);
}
if (end == 12) goto done24bit;
done24bit:
/* Free the picture */
SDL_FreeSurface(picture);
if (end <= 12) return;
}
/* -------- 32 bit test --------- */
if (start<=16) {
/* Message */
printf("32 bit tests ...\n");
/* Load the image into a surface */
bmpfile = "sample24.bmp";
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
/* Add white frame */
rectangleColor(picture, 0, 0, picture->w-1, picture->h-1, 0xffffffff);
/* New source surface is 32bit with defined RGBA ordering */
/* Much faster to do this once rather than the routine on the fly */
fprintf(stderr,"Converting 24bit image into 32bit RGBA surface ...\n");
picture_again = SDL_CreateRGBSurface(SDL_SWSURFACE, picture->w, picture->h, 32, rmask, gmask, bmask, amask);
if (picture_again == NULL) goto done32bit;
SDL_BlitSurface(picture,NULL,picture_again,NULL);
if (start <= 13) {
sprintf(messageText, "13. Rotating and zooming, with interpolation (RGBA source)");
RotatePicture(screen,picture_again,ROTATE_ON,FLIP_OFF,SMOOTHING_ON,POSITION_CENTER);
}
if (end == 13) goto done32bit;
if (start <= 14) {
sprintf(messageText, "14. Just zooming (angle=0), with interpolation (RGBA source)");
RotatePicture(screen,picture_again,ROTATE_OFF,FLIP_OFF,SMOOTHING_ON,POSITION_CENTER);
RotatePicture(screen,picture_again,ROTATE_OFF,FLIP_OFF,SMOOTHING_ON,POSITION_BOTTOMRIGHT);
}
if (end == 14) goto done32bit;
SDL_FreeSurface(picture_again);
picture_again=NULL;
/* New source surface is 32bit with defined ABGR ordering */
/* Much faster to do this once rather than the routine on the fly */
fprintf(stderr,"Converting 24bit image into 32bit ABGR surface ...\n");
picture_again = SDL_CreateRGBSurface(SDL_SWSURFACE, picture->w, picture->h, 32, amask, bmask, gmask, rmask);
if (picture_again == NULL) goto done32bit;
SDL_BlitSurface(picture,NULL,picture_again,NULL);
if (start <= 14) {
sprintf(messageText, "15. Rotating and zooming, with interpolation (ABGR source)");
RotatePicture(screen,picture_again,ROTATE_ON,FLIP_OFF,SMOOTHING_ON,POSITION_CENTER);
}
if (end == 14) goto done32bit;
if (start <= 14) {
sprintf(messageText, "16. Just zooming (angle=0), with interpolation (ABGR source)");
RotatePicture(screen,picture_again,ROTATE_OFF,FLIP_OFF,SMOOTHING_ON,POSITION_CENTER);
RotatePicture(screen,picture_again,ROTATE_OFF,FLIP_OFF,SMOOTHING_ON,POSITION_BOTTOMRIGHT);
}
if (end == 14) goto done32bit;
done32bit:
/* Free the picture */
SDL_FreeSurface(picture);
if (picture_again) SDL_FreeSurface(picture_again);
if (end <= 16) return;
}
/* -------- 32 bit flip test --------- */
if (start<=22) {
/* Message */
printf("32 bit flip tests ...\n");
/* Load the image into a surface */
bmpfile = "sample24.bmp";
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
/* Add white frame */
rectangleColor(picture, 0, 0, picture->w-1, picture->h-1, 0xffffffff);
/* Excercise flipping functions on 32bit RGBA */
printf("Converting 24bit image into 32bit RGBA surface ...\n");
picture_again = SDL_CreateRGBSurface(SDL_SWSURFACE, picture->w, picture->h, 32, rmask, gmask, bmask, amask);
if (picture_again == NULL) goto doneflip;
SDL_BlitSurface(picture,NULL,picture_again,NULL);
if (start <= 17) {
sprintf(messageText, "17. Rotating with x-flip, no interpolation (RGBA source)");
RotatePicture(screen,picture_again,ROTATE_ON,FLIP_X,SMOOTHING_OFF,POSITION_CENTER);
}
if (end == 17) goto doneflip;
if (start <= 18) {
sprintf(messageText, "18. Rotating with y-flip, no interpolation");
RotatePicture(screen,picture_again,ROTATE_ON,FLIP_Y,SMOOTHING_OFF,POSITION_CENTER);
}
if (end == 18) goto doneflip;
if (start <= 19) {
sprintf(messageText, "19. Rotating with xy-flip, no interpolation");
RotatePicture(screen,picture_again,ROTATE_ON,FLIP_XY,SMOOTHING_OFF,POSITION_CENTER);
}
if (end == 19) goto doneflip;
if (start <= 20) {
sprintf(messageText, "20. Rotating with x-flip, with interpolation");
RotatePicture(screen,picture_again,ROTATE_ON,FLIP_X,SMOOTHING_ON,POSITION_CENTER);
}
if (end == 20) goto doneflip;
if (start <= 21) {
sprintf(messageText, "21. Rotating with y-flip, with interpolation");
RotatePicture(screen,picture_again,ROTATE_ON,FLIP_Y,SMOOTHING_ON,POSITION_CENTER);
}
if (end == 21) goto doneflip;
if (start <= 22) {
sprintf(messageText, "22. Rotating with xy-flip, with interpolation");
RotatePicture(screen,picture_again,ROTATE_ON,FLIP_XY,SMOOTHING_ON,POSITION_CENTER);
}
if (end == 22) goto doneflip;
doneflip:
/* Free the pictures */
SDL_FreeSurface(picture);
if (picture_again) SDL_FreeSurface(picture_again);
if (end <= 22) return;
}
if (start<=24) {
/* Message */
printf("Loading 24bit image\n");
/* Load the image into a surface */
bmpfile = "sample24.bmp";
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
/* Add white frame */
rectangleColor(picture, 0, 0, picture->w-1, picture->h-1, 0xffffffff);
/* Excercise flipping functions on 32bit RGBA */
fprintf(stderr,"Converting 24bit image into 32bit RGBA surface ...\n");
picture_again = SDL_CreateRGBSurface(SDL_SWSURFACE, picture->w, picture->h, 32, rmask, gmask, bmask, amask);
SDL_BlitSurface(picture,NULL,picture_again,NULL);
sprintf(messageText, "23. CustomTest, values from commandline (32bit)");
CustomTest(screen, picture_again, custom_angle, custom_fx, custom_fy, custom_smooth);
SDL_FreeSurface(picture_again);
/* Free the picture */
SDL_FreeSurface(picture);
/* Message */
printf("Loading 8bit image\n");
/* Load the image into a surface */
bmpfile = "sample8.bmp";
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
sprintf(messageText, "24. CustomTest, values from commandline (8bit)");
CustomTest(screen, picture, custom_angle, custom_fx, custom_fy, custom_smooth);
/* Free the picture */
SDL_FreeSurface(picture);
if (end <= 24) return;
}
if (start<=25) {
/* Message */
printf("Loading 24bit image\n");
/* Load the image into a surface */
bmpfile = "sample24.bmp";
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
/* Add white frame */
rectangleColor(picture, 0, 0, picture->w-1, picture->h-1, 0xffffffff);
/* New source surface is 32bit with defined RGBA ordering */
printf("Converting 24bit image into 32bit RGBA surface ...\n");
picture_again = SDL_CreateRGBSurface(SDL_SWSURFACE, picture->w, picture->h, 32, rmask, gmask, bmask, amask);
if (picture_again == NULL) goto donerotate90;
SDL_BlitSurface(picture,NULL,picture_again,NULL);
/* Excercise rotate90 function on 32bit RGBA */
sprintf(messageText, "25. rotate90: Rotate 90 degrees clockwise (32bit)");
RotatePicture90Degrees(screen, picture_again);
donerotate90:
/* Free the pictures */
SDL_FreeSurface(picture);
if (picture_again) SDL_FreeSurface(picture_again);
if (end <= 25) return;
}
if (start<=26) {
/* Run accuracy test */
sprintf(messageText, "26. accuracy: zoom by factor of 2");
AccuracyTest1(screen);
if (end <= 26) return;
}
if (start <= 27) {
/* Load the image into a surface */
bmpfile = "sample2x2.bmp";
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
sprintf(messageText, "27a. zoom accuracy: zoom 2x2 bitmap");
AccuracyTest2(screen, picture);
/* Free the pictures */
SDL_FreeSurface(picture);
/* Load the image into a surface */
bmpfile = "sample3x3.bmp";
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
sprintf(messageText, "27b. zoom accuracy: zoom 3x3 bitmap");
AccuracyTest2(screen, picture);
/* Free the pictures */
SDL_FreeSurface(picture);
/* Load the image into a surface */
bmpfile = "sample16x16.bmp";
printf("Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
sprintf(messageText, "27c. zoom accuracy: zoom 16x16 bitmap");
AccuracyTest2(screen, picture);
/* Free the pictures */
SDL_FreeSurface(picture);
if (end <= 27) return;
}
return;
}
/*!
\brief SDL_rotozoom test
*/
int main ( int argc, char *argv[] )
{
SDL_Surface *screen;
int w, h;
int desired_bpp;
Uint32 video_flags;
int start, end;
/* Title */
fprintf(stderr,"SDL_rotozoom test\n");
messageText = (char *)malloc(128);
/* Set default options and check command-line */
w = 640;
h = 480;
desired_bpp = 0;
video_flags = 0;
start = 1;
end = 9999;
delay = 0;
while ( argc > 1 ) {
if ( strcmp(argv[1], "-start") == 0 ) {
if ( argv[2] && ((start = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -start option requires a numeric argument\n");
exit(1);
}
}
else if ( strcmp(argv[1], "-end") == 0 ) {
if ( argv[2] && ((end = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -end option requires a numeric argument\n");
exit(1);
}
}
else
if ( strcmp(argv[1], "-delay") == 0 ) {
if ( argv[2] && ((delay = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -delay option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-width") == 0 ) {
if ( argv[2] && ((w = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -width option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-height") == 0 ) {
if ( argv[2] && ((h = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -height option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-bpp") == 0 ) {
if ( argv[2] ) {
desired_bpp = atoi(argv[2]);
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -bpp option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-warp") == 0 ) {
video_flags |= SDL_HWPALETTE;
argv += 1;
argc -= 1;
} else
if ( strcmp(argv[1], "-hw") == 0 ) {
video_flags |= SDL_HWSURFACE;
argv += 1;
argc -= 1;
} else
if ( strcmp(argv[1], "-fullscreen") == 0 ) {
video_flags |= SDL_FULLSCREEN;
argv += 1;
argc -= 1;
} else
if ( strcmp(argv[1], "-custom") == 0 ) {
if (( argv[2] ) && ( argv[3] ) && ( argv[4] ) && (argv[5] )) {
custom_angle = atof(argv[2]);
custom_fx = atof(argv[3]);
custom_fy = atof(argv[4]);
custom_smooth = atoi(argv[5]);
argv += 5;
argc -= 5;
} else {
fprintf(stderr,
"The -custom option requires 4 arguments\n");
exit(1);
}
} else
if (( strcmp(argv[1], "-help") == 0 ) || (strcmp(argv[1], "--help") == 0)) {
printf ("Usage:\n");
printf (" -start # Set starting test number\n");
printf (" 1=8bit, 7=24bit, 13=32bit, 19=32bit flip, 23=custom, 25=rotate90\n");
printf (" 26=zoom accuracy\n");
printf (" -delay # Set delay between frames in ms (default: 0=off)\n");
printf (" (if >0, enables verbose frame logging\n");
printf (" -width # Screen width (Default: %i)\n",w);
printf (" -height # Screen height (Default: %i)\n",h);
printf (" -bpp # Screen bpp\n");
printf (" -warp Enable hardware palette\n");
printf (" -hw Enable hardware surface\n");
printf (" -fullscreen Enable fullscreen mode\n");
printf (" -custom # # # # Custom: angle scalex scaley smooth\n");
printf (" scalex/scaley<0, enables flip on axis\n");
printf (" smooth=0/1\n");
exit(0);
} else
break;
}
/* Force double buffering */
video_flags |= SDL_DOUBLEBUF;
/* Initialize SDL */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr,
"Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
atexit(SDL_Quit); /* Clean up on exit */
/* Initialize the display */
screen = SDL_SetVideoMode(w, h, desired_bpp, video_flags);
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n",
w, h, desired_bpp, SDL_GetError());
exit(1);
}
/* Show some info */
printf("Set %dx%dx%d mode\n",
screen->w, screen->h, screen->format->BitsPerPixel);
printf("Video surface located in %s memory.\n",
(screen->flags&SDL_HWSURFACE) ? "video" : "system");
/* Check for double buffering */
if ( screen->flags & SDL_DOUBLEBUF ) {
printf("Double-buffering enabled - good!\n");
}
/* Set the window manager title bar */
SDL_WM_SetCaption("SDL_rotozoom test", "rotozoom");
/* Do all the drawing work */
Draw(screen, start, end);
free(messageText);
return(0);
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/TestRotozoom.c | C | apache-2.0 | 32,476 |
/*
TestShrink.c: test program for shrink routines
(C) A. Schiffler, July 2006, zlib License
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "SDL.h"
#ifdef WIN32
#include <windows.h>
#include "SDL_rotozoom.h"
#else
#include "SDL/SDL_rotozoom.h"
#endif
void HandleEvent()
{
SDL_Event event;
/* Check for events */
while ( SDL_PollEvent(&event) ) {
switch (event.type) {
case SDL_KEYDOWN:
case SDL_QUIT:
exit(0);
break;
}
}
}
void ClearScreen(SDL_Surface *screen)
{
int i;
/* Set the screen to black */
if ( SDL_LockSurface(screen) == 0 ) {
Uint8 *pixels;
pixels = (Uint8 *)screen->pixels;
for ( i=0; i<screen->h; ++i ) {
memset(pixels, 0,
screen->w*screen->format->BytesPerPixel);
pixels += screen->pitch;
}
SDL_UnlockSurface(screen);
}
}
void ShrinkPicture (SDL_Surface *screen, SDL_Surface *picture)
{
SDL_Surface *shrink_picture;
SDL_Rect dest;
int factorx, factory;
for (factorx=1; factorx<6; factorx++) {
for (factory=1; factory<6; factory++) {
HandleEvent();
ClearScreen(screen);
if ((shrink_picture=shrinkSurface (picture, factorx, factory))!=NULL) {
dest.x = (screen->w - shrink_picture->w)/2;;
dest.y = (screen->h - shrink_picture->h)/2;
dest.w = shrink_picture->w;
dest.h = shrink_picture->h;
if ( SDL_BlitSurface(shrink_picture, NULL, screen, &dest) < 0 ) {
fprintf(stderr, "Blit failed: %s\n", SDL_GetError());
break;
}
SDL_FreeSurface(shrink_picture);
}
/* Display by flipping screens */
SDL_Flip(screen);
/* Pause for 0.25 sec */
SDL_Delay(250);
}
}
}
void Draw (SDL_Surface *screen, int start)
{
SDL_Surface *picture, *picture_again;
char *bmpfile;
/* --------- 8 bit test -------- */
if (start<=1) {
/* Message */
fprintf (stderr,"Loading 8bit square image\n");
/* Load the image into a surface */
bmpfile = "sample8-box.bmp";
fprintf(stderr, "Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
fprintf (stderr,"1. shrink 8bit\n");
ShrinkPicture(screen,picture);
/* Free the picture */
SDL_FreeSurface(picture);
}
if (start<=2) {
/* Message */
fprintf (stderr,"Loading 8bit image\n");
/* Load the image into a surface */
bmpfile = "sample8.bmp";
fprintf(stderr, "Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
fprintf (stderr,"1. shrink 8bit\n");
ShrinkPicture(screen,picture);
/* Free the picture */
SDL_FreeSurface(picture);
}
/* -------- 24 bit test --------- */
if (start<=3) {
/* Message */
fprintf (stderr,"Loading 24bit square image\n");
/* Load the image into a surface */
bmpfile = "sample24-box.bmp";
fprintf(stderr, "Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
fprintf (stderr,"2. shrink 24bit\n");
ShrinkPicture(screen,picture);
/* Free the picture */
SDL_FreeSurface(picture);
}
if (start<=4) {
/* Message */
fprintf (stderr,"Loading 24bit image\n");
/* Load the image into a surface */
bmpfile = "sample24.bmp";
fprintf(stderr, "Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
fprintf (stderr,"2. shrink 24bit\n");
ShrinkPicture(screen,picture);
/* Free the picture */
SDL_FreeSurface(picture);
}
/* -------- 32 bit test --------- */
if (start<=5) {
/* Message */
fprintf (stderr,"Loading 24bit square image\n");
/* Load the image into a surface */
bmpfile = "sample24-box.bmp";
fprintf(stderr, "Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
/* New source surface is 32bit with defined RGBA ordering */
/* Much faster to do this once rather than the routine on the fly */
fprintf (stderr,"Converting 24bit image into 32bit RGBA surface ...\n");
picture_again = SDL_CreateRGBSurface(SDL_SWSURFACE, picture->w, picture->h, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000);
SDL_BlitSurface(picture,NULL,picture_again,NULL);
/* Message */
fprintf (stderr,"3. shrink 32bit \n");
ShrinkPicture(screen,picture_again);
/* Free the picture2 */
SDL_FreeSurface(picture_again);
SDL_FreeSurface(picture);
}
if (start<=6) {
/* Message */
fprintf (stderr,"Loading 24bit image\n");
/* Load the image into a surface */
bmpfile = "sample24.bmp";
fprintf(stderr, "Loading picture: %s\n", bmpfile);
picture = SDL_LoadBMP(bmpfile);
if ( picture == NULL ) {
fprintf(stderr, "Couldn't load %s: %s\n", bmpfile, SDL_GetError());
return;
}
/* New source surface is 32bit with defined RGBA ordering */
/* Much faster to do this once rather than the routine on the fly */
fprintf (stderr,"Converting 24bit image into 32bit RGBA surface ...\n");
picture_again = SDL_CreateRGBSurface(SDL_SWSURFACE, picture->w, picture->h, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000);
SDL_BlitSurface(picture,NULL,picture_again,NULL);
/* Message */
fprintf (stderr,"3. shrink 32bit \n");
ShrinkPicture(screen,picture_again);
/* Free the picture2 */
SDL_FreeSurface(picture_again);
SDL_FreeSurface(picture);
}
return;
}
int main ( int argc, char *argv[] )
{
SDL_Surface *screen;
int w, h;
int desired_bpp;
Uint32 video_flags;
int start;
/* Title */
fprintf (stderr,"SDL_rotozoom test\n");
/* Set default options and check command-line */
w = 640;
h = 480;
desired_bpp = 0;
video_flags = 0;
start = 1;
while ( argc > 1 ) {
if ( strcmp(argv[1], "-start") == 0 ) {
if ( argv[2] && ((start = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -start option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-width") == 0 ) {
if ( argv[2] && ((w = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -width option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-height") == 0 ) {
if ( argv[2] && ((h = atoi(argv[2])) > 0) ) {
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -height option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-bpp") == 0 ) {
if ( argv[2] ) {
desired_bpp = atoi(argv[2]);
argv += 2;
argc -= 2;
} else {
fprintf(stderr,
"The -bpp option requires an argument\n");
exit(1);
}
} else
if ( strcmp(argv[1], "-warp") == 0 ) {
video_flags |= SDL_HWPALETTE;
argv += 1;
argc -= 1;
} else
if ( strcmp(argv[1], "-hw") == 0 ) {
video_flags |= SDL_HWSURFACE;
argv += 1;
argc -= 1;
} else
if ( strcmp(argv[1], "-fullscreen") == 0 ) {
video_flags |= SDL_FULLSCREEN;
argv += 1;
argc -= 1;
} else
if (( strcmp(argv[1], "-help") == 0 ) || (strcmp(argv[1], "--help") == 0)) {
printf ("Usage:\n");
printf (" -start # Set starting test number (1=8bit, 3=24bit, 5=32bit)\n");
printf (" -width # Screen width (Default: %i)\n",w);
printf (" -height # Screen height (Default: %i)\n",h);
printf (" -bpp # Screen bpp\n");
printf (" -warp Enable hardware palette\n");
printf (" -hw Enable hardware surface\n");
printf (" -fullscreen Enable fullscreen mode\n");
} else
break;
}
/* Force double buffering */
video_flags |= SDL_DOUBLEBUF;
/* Initialize SDL */
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr,
"Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
atexit(SDL_Quit); /* Clean up on exit */
/* Initialize the display */
screen = SDL_SetVideoMode(w, h, desired_bpp, video_flags);
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set %dx%dx%d video mode: %s\n",
w, h, desired_bpp, SDL_GetError());
exit(1);
}
/* Show some info */
printf("Set %dx%dx%d mode\n",
screen->w, screen->h, screen->format->BitsPerPixel);
printf("Video surface located in %s memory.\n",
(screen->flags&SDL_HWSURFACE) ? "video" : "system");
/* Check for double buffering */
if ( screen->flags & SDL_DOUBLEBUF ) {
printf("Double-buffering enabled - good!\n");
}
/* Set the window manager title bar */
SDL_WM_SetCaption("SDL_rotozoom shrink test", "shrink");
/* Do all the drawing work */
Draw (screen, start);
return(0);
}
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/TestShrink.c | C | apache-2.0 | 8,951 |
#!/bin/sh
#
# Hack for MacPorts
cp /usr/local/share/aclocal/sdl.m4 m4
# Prep
make distclean
aclocal --force -I /usr/local/share/aclocal
libtoolize --force --copy
autoreconf -fvi
rm -rf autom4te.cache
# Setup
aclocal -I /usr/local/share/aclocal
autoheader
automake --foreign
autoconf
#./configure $*
echo "Now you are ready to run ./configure"
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/autogen.sh | Shell | apache-2.0 | 347 |
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-01-19.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for `test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/install-sh | Shell | apache-2.0 | 13,998 |
#! /bin/sh
# ltconfig - Create a system-specific libtool.
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# A lot of this script is taken from autoconf-2.10.
# Check that we are running under the correct shell.
SHELL=${CONFIG_SHELL-/bin/sh}
echo=echo
if test "X$1" = X--no-reexec; then
# Discard the --no-reexec flag, and continue.
shift
elif test "X$1" = X--fallback-echo; then
# Avoid inline document here, it may be left over
:
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
# Yippee, $echo works!
:
else
# Restart under the correct shell.
exec "$SHELL" "$0" --no-reexec ${1+"$@"}
fi
if test "X$1" = X--fallback-echo; then
# used as fallback echo
shift
cat <<EOF
$*
EOF
exit 0
fi
# Find the correct PATH separator. Usually this is `:', but
# DJGPP uses `;' like DOS.
if test "X${PATH_SEPARATOR+set}" != Xset; then
UNAME=${UNAME-`uname 2>/dev/null`}
case X$UNAME in
*-DOS) PATH_SEPARATOR=';' ;;
*) PATH_SEPARATOR=':' ;;
esac
fi
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
if test "X${echo_test_string+set}" != Xset; then
# find a string as large as possible, as long as the shell can cope with it
for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
# expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
if (echo_test_string="`eval $cmd`") 2>/dev/null &&
echo_test_string="`eval $cmd`" &&
(test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
break
fi
done
fi
if test "X`($echo '\t') 2>/dev/null`" != 'X\t' ||
test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then
# The Solaris, AIX, and Digital Unix default echo programs unquote
# backslashes. This makes it impossible to quote backslashes using
# echo "$something" | sed 's/\\/\\\\/g'
#
# So, first we look for a working echo in the user's PATH.
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
for dir in $PATH /usr/ucb; do
if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
echo="$dir/echo"
break
fi
done
IFS="$save_ifs"
if test "X$echo" = Xecho; then
# We didn't find a better echo, so look for alternatives.
if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
# This shell has a builtin print -r that does the trick.
echo='print -r'
elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
test "X$CONFIG_SHELL" != X/bin/ksh; then
# If we have ksh, try running ltconfig again with it.
ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
export ORIGINAL_CONFIG_SHELL
CONFIG_SHELL=/bin/ksh
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
else
# Try using printf.
echo='printf "%s\n"'
if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
# Cool, printf works
:
elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
export CONFIG_SHELL
SHELL="$CONFIG_SHELL"
export SHELL
echo="$CONFIG_SHELL $0 --fallback-echo"
elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
echo="$CONFIG_SHELL $0 --fallback-echo"
else
# maybe with a smaller string...
prev=:
for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
break
fi
prev="$cmd"
done
if test "$prev" != 'sed 50q "$0"'; then
echo_test_string=`eval $prev`
export echo_test_string
exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"}
else
# Oops. We lost completely, so just stick with echo.
echo=echo
fi
fi
fi
fi
fi
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed='sed -e s/^X//'
sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
# Sed substitution to delay expansion of an escaped shell variable in a
# double_quote_subst'ed string.
delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
# The name of this program.
progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
# Constants:
PROGRAM=ltconfig
PACKAGE=libtool
VERSION=1.3.5
TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
rm="rm -f"
help="Try \`$progname --help' for more information."
# Global variables:
default_ofile=libtool
can_build_shared=yes
enable_shared=yes
# All known linkers require a `.a' archive for static linking (except M$VC,
# which needs '.lib').
enable_static=yes
enable_fast_install=yes
enable_dlopen=unknown
enable_win32_dll=no
ltmain=
silent=
srcdir=
ac_config_guess=
ac_config_sub=
host=
nonopt=
ofile="$default_ofile"
verify_host=yes
with_gcc=no
with_gnu_ld=no
need_locks=yes
ac_ext=c
objext=o
libext=a
exeext=
cache_file=
old_AR="$AR"
old_CC="$CC"
old_CFLAGS="$CFLAGS"
old_CPPFLAGS="$CPPFLAGS"
old_LDFLAGS="$LDFLAGS"
old_LD="$LD"
old_LN_S="$LN_S"
old_LIBS="$LIBS"
old_NM="$NM"
old_RANLIB="$RANLIB"
old_DLLTOOL="$DLLTOOL"
old_OBJDUMP="$OBJDUMP"
old_AS="$AS"
# Parse the command line options.
args=
prev=
for option
do
case "$option" in
-*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
# If the previous option needs an argument, assign it.
if test -n "$prev"; then
eval "$prev=\$option"
prev=
continue
fi
case "$option" in
--help) cat <<EOM
Usage: $progname [OPTION]... [HOST [LTMAIN]]
Generate a system-specific libtool script.
--debug enable verbose shell tracing
--disable-shared do not build shared libraries
--disable-static do not build static libraries
--disable-fast-install do not optimize for fast installation
--enable-dlopen enable dlopen support
--enable-win32-dll enable building dlls on win32 hosts
--help display this help and exit
--no-verify do not verify that HOST is a valid host type
-o, --output=FILE specify the output file [default=$default_ofile]
--quiet same as \`--silent'
--silent do not print informational messages
--srcdir=DIR find \`config.guess' in DIR
--version output version information and exit
--with-gcc assume that the GNU C compiler will be used
--with-gnu-ld assume that the C compiler uses the GNU linker
--disable-lock disable file locking
--cache-file=FILE configure cache file
LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
that provides basic libtool functionality.
HOST is the canonical host system name [default=guessed].
EOM
exit 0
;;
--debug)
echo "$progname: enabling shell trace mode"
set -x
;;
--disable-shared) enable_shared=no ;;
--disable-static) enable_static=no ;;
--disable-fast-install) enable_fast_install=no ;;
--enable-dlopen) enable_dlopen=yes ;;
--enable-win32-dll) enable_win32_dll=yes ;;
--quiet | --silent) silent=yes ;;
--srcdir) prev=srcdir ;;
--srcdir=*) srcdir="$optarg" ;;
--no-verify) verify_host=no ;;
--output | -o) prev=ofile ;;
--output=*) ofile="$optarg" ;;
--version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
--with-gcc) with_gcc=yes ;;
--with-gnu-ld) with_gnu_ld=yes ;;
--disable-lock) need_locks=no ;;
--cache-file=*) cache_file="$optarg" ;;
-*)
echo "$progname: unrecognized option \`$option'" 1>&2
echo "$help" 1>&2
exit 1
;;
*)
if test -z "$ltmain"; then
ltmain="$option"
elif test -z "$host"; then
# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
# echo "$progname: warning \`$option' is not a valid host type" 1>&2
# fi
host="$option"
else
echo "$progname: too many arguments" 1>&2
echo "$help" 1>&2
exit 1
fi ;;
esac
done
if test -z "$ltmain"; then
echo "$progname: you must specify a LTMAIN file" 1>&2
echo "$help" 1>&2
exit 1
fi
if test ! -f "$ltmain"; then
echo "$progname: \`$ltmain' does not exist" 1>&2
echo "$help" 1>&2
exit 1
fi
# Quote any args containing shell metacharacters.
ltconfig_args=
for arg
do
case "$arg" in
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
ltconfig_args="$ltconfig_args '$arg'" ;;
*) ltconfig_args="$ltconfig_args $arg" ;;
esac
done
# A relevant subset of AC_INIT.
# File descriptor usage:
# 0 standard input
# 1 file creation
# 2 errors and warnings
# 3 some systems may open it to /dev/tty
# 4 used on the Kubota Titan
# 5 compiler messages saved in config.log
# 6 checking for... messages and results
if test "$silent" = yes; then
exec 6>/dev/null
else
exec 6>&1
fi
exec 5>>./config.log
# NLS nuisances.
# Only set LANG and LC_ALL to C if already set.
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi
if test -n "$cache_file" && test -r "$cache_file"; then
echo "loading cache $cache_file within ltconfig"
. $cache_file
fi
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi
if test -z "$srcdir"; then
# Assume the source directory is the same one as the path to LTMAIN.
srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
test "$srcdir" = "$ltmain" && srcdir=.
fi
trap "$rm conftest*; exit 1" 1 2 15
if test "$verify_host" = yes; then
# Check for config.guess and config.sub.
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/config.guess; then
ac_aux_dir=$ac_dir
break
fi
done
if test -z "$ac_aux_dir"; then
echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
echo "$help" 1>&2
exit 1
fi
ac_config_guess=$ac_aux_dir/config.guess
ac_config_sub=$ac_aux_dir/config.sub
# Make sure we can run config.sub.
if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then :
else
echo "$progname: cannot run $ac_config_sub" 1>&2
echo "$help" 1>&2
exit 1
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
host_alias=$host
case "$host_alias" in
"")
if host_alias=`$SHELL $ac_config_guess`; then :
else
echo "$progname: cannot guess host type; you must specify one" 1>&2
echo "$help" 1>&2
exit 1
fi ;;
esac
host=`$SHELL $ac_config_sub $host_alias`
echo "$ac_t$host" 1>&6
# Make sure the host verified.
test -z "$host" && exit 1
elif test -z "$host"; then
echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
echo "$help" 1>&2
exit 1
else
host_alias=$host
fi
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case "$host_os" in
linux-gnu*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
case "$host_os" in
aix3*)
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test "X${COLLECT_NAMES+set}" != Xset; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
;;
esac
# Determine commands to create old-style static archives.
old_archive_cmds='$AR cru $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib'
old_postuninstall_cmds=
# Set a sane default for `AR'.
test -z "$AR" && AR=ar
# Set a sane default for `OBJDUMP'.
test -z "$OBJDUMP" && OBJDUMP=objdump
# If RANLIB is not set, then run the test.
if test "${RANLIB+set}" != "set"; then
result=no
echo $ac_n "checking for ranlib... $ac_c" 1>&6
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then
RANLIB="ranlib"
result="ranlib"
break
fi
done
IFS="$save_ifs"
echo "$ac_t$result" 1>&6
fi
if test -n "$RANLIB"; then
old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
fi
# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin.
test -z "$DLLTOOL" && DLLTOOL=dlltool
test -z "$OBJDUMP" && OBJDUMP=objdump
test -z "$AS" && AS=as
# Check to see if we are using GCC.
if test "$with_gcc" != yes || test -z "$CC"; then
# If CC is not set, then try to find GCC or a usable CC.
if test -z "$CC"; then
echo $ac_n "checking for gcc... $ac_c" 1>&6
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then
CC="gcc"
break
fi
done
IFS="$save_ifs"
if test -n "$CC"; then
echo "$ac_t$CC" 1>&6
else
echo "$ac_t"no 1>&6
fi
fi
# Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
if test -z "$CC"; then
echo $ac_n "checking for cc... $ac_c" 1>&6
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
cc_rejected=no
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/cc || test -f $dir/cc$ac_exeext; then
if test "$dir/cc" = "/usr/ucb/cc"; then
cc_rejected=yes
continue
fi
CC="cc"
break
fi
done
IFS="$save_ifs"
if test $cc_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $CC
shift
if test $# -gt 0; then
# We chose a different compiler from the bogus one.
# However, it has the same name, so the bogon will be chosen
# first if we set CC to just the name; use the full file name.
shift
set dummy "$dir/cc" "$@"
shift
CC="$@"
fi
fi
if test -n "$CC"; then
echo "$ac_t$CC" 1>&6
else
echo "$ac_t"no 1>&6
fi
if test -z "$CC"; then
echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
exit 1
fi
fi
# Now see if the compiler is really GCC.
with_gcc=no
echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
echo "$progname:581: checking whether we are using GNU C" >&5
$rm conftest.c
cat > conftest.c <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
with_gcc=yes
fi
$rm conftest.c
echo "$ac_t$with_gcc" 1>&6
fi
# Allow CC to be a program name with arguments.
set dummy $CC
compiler="$2"
echo $ac_n "checking for object suffix... $ac_c" 1>&6
$rm conftest*
echo 'int i = 1;' > conftest.c
echo "$progname:603: checking for object suffix" >& 5
if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
# Append any warnings to the config.log.
cat conftest.err 1>&5
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
*) objext=`echo $ac_file | sed -e s/conftest.//` ;;
esac
done
else
cat conftest.err 1>&5
echo "$progname: failed program was:" >&5
cat conftest.c >&5
fi
$rm conftest*
echo "$ac_t$objext" 1>&6
echo $ac_n "checking for executable suffix... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_exeext="no"
$rm conftest*
echo 'main () { return 0; }' > conftest.c
echo "$progname:629: checking for executable suffix" >& 5
if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then
# Append any warnings to the config.log.
cat conftest.err 1>&5
for ac_file in conftest.*; do
case $ac_file in
*.c | *.err | *.$objext ) ;;
*) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;;
esac
done
else
cat conftest.err 1>&5
echo "$progname: failed program was:" >&5
cat conftest.c >&5
fi
$rm conftest*
fi
if test "X$ac_cv_exeext" = Xno; then
exeext=""
else
exeext="$ac_cv_exeext"
fi
echo "$ac_t$ac_cv_exeext" 1>&6
echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
pic_flag=
special_shlib_compile_flags=
wl=
link_static_flag=
no_builtin_flag=
if test "$with_gcc" = yes; then
wl='-Wl,'
link_static_flag='-static'
case "$host_os" in
beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
aix*)
# Below there is a dirty hack to force normal static linking with -ldl
# The problem is because libdl dynamically linked with both libc and
# libC (AIX C++ library), which obviously doesn't included in libraries
# list by gcc. This cause undefined symbols with -static flags.
# This hack allows C programs to be linked with "-static -ldl", but
# we not sure about C++ programs.
link_static_flag="$link_static_flag ${wl}-lC"
;;
cygwin* | mingw* | os2*)
# We can build DLLs from non-PIC.
;;
amigaos*)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better,
# like `-m68040'.
pic_flag='-m68020 -resident32 -malways-restore-a4'
;;
sysv4*MP*)
if test -d /usr/nec; then
pic_flag=-Kconform_pic
fi
;;
*)
pic_flag='-fPIC'
;;
esac
else
# PORTME Check for PIC flags for the system compiler.
case "$host_os" in
aix3* | aix4*)
# All AIX code is PIC.
link_static_flag='-bnso -bI:/lib/syscalls.exp'
;;
hpux9* | hpux10* | hpux11*)
# Is there a better link_static_flag that works with the bundled CC?
wl='-Wl,'
link_static_flag="${wl}-a ${wl}archive"
pic_flag='+Z'
;;
irix5* | irix6*)
wl='-Wl,'
link_static_flag='-non_shared'
# PIC (with -KPIC) is the default.
;;
cygwin* | mingw* | os2*)
# We can build DLLs from non-PIC.
;;
osf3* | osf4* | osf5*)
# All OSF/1 code is PIC.
wl='-Wl,'
link_static_flag='-non_shared'
;;
sco3.2v5*)
pic_flag='-Kpic'
link_static_flag='-dn'
special_shlib_compile_flags='-belf'
;;
solaris*)
pic_flag='-KPIC'
link_static_flag='-Bstatic'
wl='-Wl,'
;;
sunos4*)
pic_flag='-PIC'
link_static_flag='-Bstatic'
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
pic_flag='-KPIC'
link_static_flag='-Bstatic'
wl='-Wl,'
;;
uts4*)
pic_flag='-pic'
link_static_flag='-Bstatic'
;;
sysv4*MP*)
if test -d /usr/nec ;then
pic_flag='-Kconform_pic'
link_static_flag='-Bstatic'
fi
;;
*)
can_build_shared=no
;;
esac
fi
if test -n "$pic_flag"; then
echo "$ac_t$pic_flag" 1>&6
# Check to make sure the pic_flag actually works.
echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
$rm conftest*
echo "int some_variable = 0;" > conftest.c
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $pic_flag -DPIC"
echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5
if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
# Append any warnings to the config.log.
cat conftest.err 1>&5
case "$host_os" in
hpux9* | hpux10* | hpux11*)
# On HP-UX, both CC and GCC only warn that PIC is supported... then they
# create non-PIC objects. So, if there were any warnings, we assume that
# PIC is not supported.
if test -s conftest.err; then
echo "$ac_t"no 1>&6
can_build_shared=no
pic_flag=
else
echo "$ac_t"yes 1>&6
pic_flag=" $pic_flag"
fi
;;
*)
echo "$ac_t"yes 1>&6
pic_flag=" $pic_flag"
;;
esac
else
# Append any errors to the config.log.
cat conftest.err 1>&5
can_build_shared=no
pic_flag=
echo "$ac_t"no 1>&6
fi
CFLAGS="$save_CFLAGS"
$rm conftest*
else
echo "$ac_t"none 1>&6
fi
# Check to see if options -o and -c are simultaneously supported by compiler
echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6
$rm -r conftest 2>/dev/null
mkdir conftest
cd conftest
$rm conftest*
echo "int some_variable = 0;" > conftest.c
mkdir out
# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
# that will create temporary files in the current directory regardless of
# the output directory. Thus, making CWD read-only will cause this test
# to fail, enabling locking or at least warning the user not to do parallel
# builds.
chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.o"
echo "$progname:829: checking if $compiler supports -c -o file.o" >&5
if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
echo "$ac_t"no 1>&6
compiler_c_o=no
else
echo "$ac_t"yes 1>&6
compiler_c_o=yes
fi
else
# Append any errors to the config.log.
cat out/conftest.err 1>&5
compiler_c_o=no
echo "$ac_t"no 1>&6
fi
CFLAGS="$save_CFLAGS"
chmod u+w .
$rm conftest* out/*
rmdir out
cd ..
rmdir conftest
$rm -r conftest 2>/dev/null
if test x"$compiler_c_o" = x"yes"; then
# Check to see if we can write to a .lo
echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
$rm conftest*
echo "int some_variable = 0;" > conftest.c
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -c -o conftest.lo"
echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5
if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s conftest.err; then
echo "$ac_t"no 1>&6
compiler_o_lo=no
else
echo "$ac_t"yes 1>&6
compiler_o_lo=yes
fi
else
# Append any errors to the config.log.
cat conftest.err 1>&5
compiler_o_lo=no
echo "$ac_t"no 1>&6
fi
CFLAGS="$save_CFLAGS"
$rm conftest*
else
compiler_o_lo=no
fi
# Check to see if we can do hard links to lock some files if needed
hard_links="nottested"
if test "$compiler_c_o" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
hard_links=yes
$rm conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
echo "$ac_t$hard_links" 1>&6
$rm conftest*
if test "$hard_links" = no; then
echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
need_locks=warn
fi
else
need_locks=no
fi
if test "$with_gcc" = yes; then
# Check to see if options -fno-rtti -fno-exceptions are supported by compiler
echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
$rm conftest*
echo "int some_variable = 0;" > conftest.c
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s conftest.err; then
echo "$ac_t"no 1>&6
compiler_rtti_exceptions=no
else
echo "$ac_t"yes 1>&6
compiler_rtti_exceptions=yes
fi
else
# Append any errors to the config.log.
cat conftest.err 1>&5
compiler_rtti_exceptions=no
echo "$ac_t"no 1>&6
fi
CFLAGS="$save_CFLAGS"
$rm conftest*
if test "$compiler_rtti_exceptions" = "yes"; then
no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
else
no_builtin_flag=' -fno-builtin'
fi
fi
# Check for any special shared library compilation flags.
if test -n "$special_shlib_compile_flags"; then
echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then :
else
echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
can_build_shared=no
fi
fi
echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
$rm conftest*
echo 'main(){return(0);}' > conftest.c
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $link_static_flag"
echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5
if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
echo "$ac_t$link_static_flag" 1>&6
else
echo "$ac_t"none 1>&6
link_static_flag=
fi
LDFLAGS="$save_LDFLAGS"
$rm conftest*
if test -z "$LN_S"; then
# Check to see if we can use ln -s, or we need hard links.
echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
$rm conftest.dat
if ln -s X conftest.dat 2>/dev/null; then
$rm conftest.dat
LN_S="ln -s"
else
LN_S=ln
fi
if test "$LN_S" = "ln -s"; then
echo "$ac_t"yes 1>&6
else
echo "$ac_t"no 1>&6
fi
fi
# Make sure LD is an absolute path.
if test -z "$LD"; then
ac_prog=ld
if test "$with_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
echo "$progname:991: checking for ld used by GCC" >&5
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
[\\/]* | [A-Za-z]:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we are not using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld... $ac_c" 1>&6
echo "$progname:1015: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
echo "$progname:1018: checking for non-GNU ld" >&5
fi
if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
fi
if test -n "$LD"; then
echo "$ac_t$LD" 1>&6
else
echo "$ac_t"no 1>&6
fi
if test -z "$LD"; then
echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
exit 1
fi
fi
# Check to see if it really is or is not GNU ld.
echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
with_gnu_ld=yes
else
with_gnu_ld=no
fi
echo "$ac_t$with_gnu_ld" 1>&6
# See if the linker supports building shared libraries.
echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
allow_undefined_flag=
no_undefined_flag=
need_lib_prefix=unknown
need_version=unknown
# when you set need_version to no, make sure it does not cause -set_version
# flags to be left without arguments
archive_cmds=
archive_expsym_cmds=
old_archive_from_new_cmds=
export_dynamic_flag_spec=
whole_archive_flag_spec=
thread_safe_flag_spec=
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
hardcode_shlibpath_var=unsupported
runpath_var=
always_export_symbols=no
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
include_expsyms=
# exclude_expsyms can be an egrep regular expression of symbols to exclude
# it will be wrapped by ` (' and `)$', so one must not match beginning or
# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
# as well as any symbol that contains `d'.
exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
# platforms (ab)use it in PIC code, but their linkers get confused if
# the symbol is explicitly referenced. Since portable code cannot
# rely on this symbol name, it's probably fine to never include it in
# preloaded symbol tables.
case "$host_os" in
cygwin* | mingw*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$with_gcc" != yes; then
with_gnu_ld=no
fi
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# If archive_cmds runs LD, not CC, wlarc should be empty
wlarc='${wl}'
# See if GNU ld supports shared libraries.
case "$host_os" in
aix3* | aix4*)
# On AIX, the GNU linker is very broken
ld_shlibs=no
cat <<EOF 1>&2
*** Warning: the GNU linker, at least up to release 2.9.1, is reported
*** to be unable to reliably create shared libraries on AIX.
*** Therefore, libtool is disabling shared libraries support. If you
*** really care for shared libraries, you may want to modify your PATH
*** so that a non-GNU linker is found, and then restart.
EOF
;;
amigaos*)
archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we can use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
#allow_undefined_flag=unsupported
# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
else
ld_shlibs=no
fi
;;
cygwin* | mingw*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
# allow_undefined_flag=unsupported
always_export_symbols=yes
# Extract the symbol export list from an `--export-all' def file,
# then regenerate the def file from the symbol export list, so that
# the compiled dll only exports the symbol export list.
# Be careful not to strip the DATA tag left by newer dlltools.
export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
$DLLTOOL --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~
sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols'
# If DATA tags from a recent dlltool are present, honour them!
archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
_lt_hint=1;
cat $export_symbols | while read symbol; do
set dummy \$symbol;
case \$# in
2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;;
*) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;;
esac;
_lt_hint=`expr 1 + \$_lt_hint`;
done~
test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
$CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
$CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
$CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
: strip_is_broken_with_dlls_on_win95B - strip $lib'
old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a'
;;
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
# can we support soname and/or expsyms with a.out? -oliva
fi
;;
solaris* | sysv5*)
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
cat <<EOF 1>&2
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.9.1 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
EOF
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
sunos4*)
archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts'
wlarc=
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = yes; then
runpath_var=LD_RUN_PATH
hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
export_dynamic_flag_spec='${wl}--export-dynamic'
case $host_os in
cygwin* | mingw*)
# dlltool doesn't understand --whole-archive et. al.
whole_archive_flag_spec=
;;
*)
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
else
whole_archive_flag_spec=
fi
;;
esac
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
case "$host_os" in
aix3*)
allow_undefined_flag=unsupported
always_export_symbols=yes
archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$with_gcc" = yes && test -z "$link_static_flag"; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4*)
hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
hardcode_libdir_separator=':'
if test "$with_gcc" = yes; then
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
hardcode_direct=yes
else
# We have old collect2
hardcode_direct=unsupported
# It fails to find uninstalled libraries when the uninstalled
# path is not listed in the libpath. Setting hardcode_minus_L
# to unsupported forces relinking
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
shared_flag='-shared'
else
shared_flag='${wl}-bM:SRE'
hardcode_direct=yes
fi
allow_undefined_flag=' ${wl}-berok'
archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
case "$host_os" in aix4.[01]|aix4.[01].*)
# According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
always_export_symbols=yes ;;
esac
;;
amigaos*)
archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
cygwin* | mingw*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
# allow_undefined_flag=unsupported
# Tell ltmain to make .lib files, not .a files.
libext=lib
# FIXME: Setting linknames here is a bad hack.
archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
# The linker will automatically build a .lib file if we build a DLL.
old_archive_from_new_cmds='true'
# FIXME: Should let the user specify the lib program.
old_archive_cmds='lib /OUT:$oldlib$oldobjs'
fix_srcfile_path='`cygpath -w $srcfile`'
;;
freebsd1*)
ld_shlibs=no
;;
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# does not break anything, and helps significantly (at the cost of a little
# extra space).
freebsd2.2*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
freebsd2*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd*)
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
hpux9* | hpux10* | hpux11*)
case "$host_os" in
hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
*) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;;
esac
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
hardcode_minus_L=yes # Not in the search PATH, but as the default
# location of the library.
export_dynamic_flag_spec='${wl}-E'
;;
irix5* | irix6*)
if test "$with_gcc" = yes; then
archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
else
archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
fi
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out
else
archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF
fi
hardcode_libdir_flag_spec='${wl}-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
openbsd*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
allow_undefined_flag=unsupported
archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
;;
osf3*)
if test "$with_gcc" = yes; then
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
else
allow_undefined_flag=' -expect_unresolved \*'
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
fi
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*) # As osf3* with the addition of the -msym flag
if test "$with_gcc" = yes; then
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
else
allow_undefined_flag=' -expect_unresolved \*'
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
fi
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
rhapsody*)
archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flags_spec='-L$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
sco3.2v5*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_shlibpath_var=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
;;
solaris*)
no_undefined_flag=' -z text'
# $CC -shared without GNU ld will not create a library from C++
# object files and a static libstdc++, better avoid it by now
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
case "$host_os" in
solaris2.[0-5] | solaris2.[0-5].*) ;;
*) # Supported since Solaris 2.6 (maybe 2.5.1?)
whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
esac
;;
sunos4*)
archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
sysv4)
if test "x$host_vendor" = xsequent; then
# Use $CC to link under sequent, because it throws in some extra .o
# files that make .init and .fini sections work.
archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts'
else
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
fi
runpath_var='LD_RUN_PATH'
hardcode_shlibpath_var=no
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
sysv4.3*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_shlibpath_var=no
export_dynamic_flag_spec='-Bexport'
;;
sysv5*)
no_undefined_flag=' -z text'
# $CC -shared without GNU ld will not create a library from C++
# object files and a static libstdc++, better avoid it by now
archive_cmds='$LD -G${allow_undefined_flag} -h $rpath/$soname -o $lib $libobjs $deplibs $linkopts'
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
hardcode_libdir_flag_spec=
hardcode_shlibpath_var=no
runpath_var='LD_RUN_PATH'
;;
uts4*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_shlibpath_var=no
;;
dgux*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_shlibpath_var=no
;;
sysv4*MP*)
if test -d /usr/nec; then
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_shlibpath_var=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
ld_shlibs=yes
fi
;;
sysv4.2uw2*)
archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts'
hardcode_direct=yes
hardcode_minus_L=no
hardcode_shlibpath_var=no
hardcode_runpath_var=yes
runpath_var=LD_RUN_PATH
;;
unixware7*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
runpath_var='LD_RUN_PATH'
hardcode_shlibpath_var=no
;;
*)
ld_shlibs=no
;;
esac
fi
echo "$ac_t$ld_shlibs" 1>&6
test "$ld_shlibs" = no && can_build_shared=no
if test -z "$NM"; then
echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
case "$NM" in
[\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path.
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
NM="$ac_dir/nm -B"
break
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
NM="$ac_dir/nm -p"
break
else
NM=${NM="$ac_dir/nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
done
IFS="$ac_save_ifs"
test -z "$NM" && NM=nm
;;
esac
echo "$ac_t$NM" 1>&6
fi
# Check for command to grab the raw symbol name followed by C symbol from nm.
echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
# These are sane defaults that work on at least a few old systems.
# [They come from Ultrix. What could be older than Ultrix?!! ;)]
# Character class describing NM global symbol codes.
symcode='[BCDEGRST]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
# Transform the above into a raw symbol and a C symbol.
symxfrm='\1 \2\3 \3'
# Transform an extracted symbol line into a proper C declaration
global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
# Define system-specific variables.
case "$host_os" in
aix*)
symcode='[BCDT]'
;;
cygwin* | mingw*)
symcode='[ABCDGISTW]'
;;
hpux*) # Its linker distinguishes data from code symbols
global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
;;
irix*)
symcode='[BCDEGRST]'
;;
solaris*)
symcode='[BDT]'
;;
sysv4)
symcode='[DFNSTU]'
;;
esac
# If we're using GNU nm, then use its standard symbol codes.
if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
symcode='[ABCDGISTW]'
fi
# Try without a prefix undercore, then with it.
for ac_symprfx in "" "_"; do
# Write the raw and C identifiers.
global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'"
# Check to see that the pipe works correctly.
pipe_works=no
$rm conftest*
cat > conftest.c <<EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(){}
#ifdef __cplusplus
}
#endif
main(){nm_test_var='a';nm_test_func();return(0);}
EOF
echo "$progname:1653: checking if global_symbol_pipe works" >&5
if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
# Now try to grab the symbols.
nlist=conftest.nm
if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
else
rm -f "$nlist"T
fi
# Make sure that we snagged all the symbols we need.
if egrep ' nm_test_var$' "$nlist" >/dev/null; then
if egrep ' nm_test_func$' "$nlist" >/dev/null; then
cat <<EOF > conftest.c
#ifdef __cplusplus
extern "C" {
#endif
EOF
# Now generate the symbol file.
eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c'
cat <<EOF >> conftest.c
#if defined (__STDC__) && __STDC__
# define lt_ptr_t void *
#else
# define lt_ptr_t char *
# define const
#endif
/* The mapping between symbol names and symbols. */
const struct {
const char *name;
lt_ptr_t address;
}
lt_preloaded_symbols[] =
{
EOF
sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
cat <<\EOF >> conftest.c
{0, (lt_ptr_t) 0}
};
#ifdef __cplusplus
}
#endif
EOF
# Now try linking the two files.
mv conftest.$objext conftstm.$objext
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="conftstm.$objext"
CFLAGS="$CFLAGS$no_builtin_flag"
if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
pipe_works=yes
else
echo "$progname: failed program was:" >&5
cat conftest.c >&5
fi
LIBS="$save_LIBS"
else
echo "cannot find nm_test_func in $nlist" >&5
fi
else
echo "cannot find nm_test_var in $nlist" >&5
fi
else
echo "cannot run $global_symbol_pipe" >&5
fi
else
echo "$progname: failed program was:" >&5
cat conftest.c >&5
fi
$rm conftest* conftst*
# Do not use the global_symbol_pipe unless it works.
if test "$pipe_works" = yes; then
break
else
global_symbol_pipe=
fi
done
if test "$pipe_works" = yes; then
echo "${ac_t}ok" 1>&6
else
echo "${ac_t}failed" 1>&6
fi
if test -z "$global_symbol_pipe"; then
global_symbol_to_cdecl=
fi
# Check hardcoding attributes.
echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
hardcode_action=
if test -n "$hardcode_libdir_flag_spec" || \
test -n "$runpath_var"; then
# We can hardcode non-existant directories.
if test "$hardcode_direct" != no &&
# If the only mechanism to avoid hardcoding is shlibpath_var, we
# have to relink, otherwise we might link with an installed library
# when we should be linking with a yet-to-be-installed one
## test "$hardcode_shlibpath_var" != no &&
test "$hardcode_minus_L" != no; then
# Linking always hardcodes the temporary library directory.
hardcode_action=relink
else
# We can link without hardcoding, and we can hardcode nonexisting dirs.
hardcode_action=immediate
fi
else
# We cannot hardcode anything, or else we can only hardcode existing
# directories.
hardcode_action=unsupported
fi
echo "$ac_t$hardcode_action" 1>&6
reload_flag=
reload_cmds='$LD$reload_flag -o $output$reload_objs'
echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
# PORTME Some linkers may need a different reload flag.
reload_flag='-r'
echo "$ac_t$reload_flag" 1>&6
test -n "$reload_flag" && reload_flag=" $reload_flag"
# PORTME Fill in your ld.so characteristics
library_names_spec=
libname_spec='lib$name'
soname_spec=
postinstall_cmds=
postuninstall_cmds=
finish_cmds=
finish_eval=
shlibpath_var=
shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
file_magic_cmd=
file_magic_test_file=
deplibs_check_method='unknown'
# Need to set the preceding variable on all platforms that support
# interlibrary dependencies.
# 'none' -- dependencies not supported.
# `unknown' -- same as none, but documents that we really don't know.
# 'pass_all' -- all dependencies passed with no checks.
# 'test_compile' -- check by making test program.
# 'file_magic [regex]' -- check by looking for files in library path
# which responds to the $file_magic_cmd with a given egrep regex.
# If you have `file' or equivalent on your system and you're not sure
# whether `pass_all' will *always* work, you probably want this one.
echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
case "$host_os" in
aix3*)
version_type=linux
library_names_spec='${libname}${release}.so$versuffix $libname.a'
shlibpath_var=LIBPATH
# AIX has no versioning support, so we append a major version to the name.
soname_spec='${libname}${release}.so$major'
;;
aix4*)
version_type=linux
# AIX has no versioning support, so currently we can not hardcode correct
# soname into executable. Probably we can add versioning support to
# collect2, so additional links can be useful in future.
# We preserve .a as extension for shared libraries though AIX4.2
# and later linker supports .so
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a'
shlibpath_var=LIBPATH
deplibs_check_method=pass_all
;;
amigaos*)
library_names_spec='$libname.ixlibrary $libname.a'
# Create ${libname}_ixlibrary.a entries in /sys/libs.
finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
;;
beos*)
library_names_spec='${libname}.so'
dynamic_linker="$host_os ld.so"
shlibpath_var=LIBRARY_PATH
deplibs_check_method=pass_all
lt_cv_dlopen="load_add_on"
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
;;
bsdi4*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
file_magic_cmd=/usr/bin/file
file_magic_test_file=/shlib/libc.so
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
export_dynamic_flag_spec=-rdynamic
# the default ld.so.conf also contains /usr/contrib/lib and
# /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
# libtool to hard-code these into programs
;;
cygwin* | mingw*)
version_type=windows
need_version=no
need_lib_prefix=no
if test "$with_gcc" = yes; then
library_names_spec='`echo ${libname} | sed -e 's/^lib//g'`.dll $libname.a'
else
library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
fi
dynamic_linker='Win32 ld.exe'
deplibs_check_method='file_magic file format pe-i386(.*architecture: i386)?'
file_magic_cmd='${OBJDUMP} -f'
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
if test "$with_gcc" = yes; then
# See where the system libraries really are - /usr/lib won't cut it
libuser32=`$CC --print-file-name=libuser32.a`
win32libs=`expr $libuser32 : '\(.*\)/.*'`
sys_lib_search_path_spec="$sys_lib_search_path $win32libs"
fi
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
;;
freebsd1*)
dynamic_linker=no
;;
freebsd*)
objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
version_type=freebsd-$objformat
case "$version_type" in
freebsd-elf*)
deplibs_check_method='pass_all'
file_magic_cmd=/usr/bin/file
file_magic_test_file=`echo /usr/lib/libc.so*`
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
need_version=no
need_lib_prefix=no
;;
freebsd-*)
deplibs_check_method=unknown
library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
need_version=yes
;;
esac
shlibpath_var=LD_LIBRARY_PATH
case "$host_os" in
freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*)
shlibpath_overrides_runpath=yes
;;
*) # from 3.2 on
shlibpath_overrides_runpath=no
;;
esac
;;
gnu*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
;;
hpux9* | hpux10* | hpux11*)
# Give a soname corresponding to the major version so that dld.sl refuses to
# link against other versions.
dynamic_linker="$host_os dld.sl"
version_type=sunos
need_lib_prefix=no
need_version=no
shlibpath_var=SHLIB_PATH
shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
soname_spec='${libname}${release}.sl$major'
# HP-UX runs *really* slowly unless shared libraries are mode 555.
postinstall_cmds='chmod 555 $lib'
case "$host_os" in
hpux10.20*)
# TODO: Does this work for hpux-11 too?
deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
file_magic_cmd=/usr/bin/file
file_magic_test_file=/usr/lib/libc.sl
;;
esac
;;
irix5* | irix6*)
version_type=irix
need_lib_prefix=no
need_version=no
soname_spec='${libname}${release}.so.$major'
library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so'
case "$host_os" in
irix5*)
libsuff= shlibsuff=
# this will be overridden with pass_all, but let us keep it just in case
deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
;;
*)
case "$LD" in # libtool.m4 will add one of these switches to LD
*-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
*-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
*-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
*) libsuff= shlibsuff= libmagic=never-match;;
esac
;;
esac
shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
shlibpath_overrides_runpath=no
sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
file_magic_cmd=/usr/bin/file
file_magic_test_file=`echo /lib${libsuff}/libc.so*`
deplibs_check_method='pass_all'
;;
# No shared lib support for Linux oldld, aout, or coff.
linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
dynamic_linker=no
;;
# This must be Linux ELF.
linux-gnu*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
deplibs_check_method=pass_all
if test -f /lib/ld.so.1; then
dynamic_linker='GNU ld.so'
else
# Only the GNU ld.so supports shared libraries on MkLinux.
case "$host_cpu" in
powerpc*) dynamic_linker=no ;;
*) dynamic_linker='Linux ld.so' ;;
esac
fi
;;
netbsd*)
version_type=sunos
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
soname_spec='${libname}${release}.so$major'
dynamic_linker='NetBSD ld.elf_so'
fi
shlibpath_var=LD_LIBRARY_PATH
;;
openbsd*)
version_type=sunos
if test "$with_gnu_ld" = yes; then
need_lib_prefix=no
need_version=no
fi
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
;;
os2*)
libname_spec='$name'
need_lib_prefix=no
library_names_spec='$libname.dll $libname.a'
dynamic_linker='OS/2 ld.exe'
shlibpath_var=LIBPATH
;;
osf3* | osf4* | osf5*)
version_type=osf
need_version=no
soname_spec='${libname}${release}.so'
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
shlibpath_var=LD_LIBRARY_PATH
# this will be overridden with pass_all, but let us keep it just in case
deplibs_check_method='file_magic COFF format alpha shared library'
file_magic_cmd=/usr/bin/file
file_magic_test_file=/shlib/libc.so
deplibs_check_method='pass_all'
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
;;
rhapsody*)
version_type=sunos
library_names_spec='${libname}.so'
soname_spec='${libname}.so'
shlibpath_var=DYLD_LIBRARY_PATH
deplibs_check_method=pass_all
;;
sco3.2v5*)
version_type=osf
soname_spec='${libname}${release}.so$major'
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
shlibpath_var=LD_LIBRARY_PATH
;;
solaris*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
# ldd complains unless libraries are executable
postinstall_cmds='chmod +x $lib'
deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
file_magic_cmd=/usr/bin/file
file_magic_test_file=/lib/libc.so
;;
sunos4*)
version_type=sunos
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
if test "$with_gnu_ld" = yes; then
need_lib_prefix=no
fi
need_version=yes
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
version_type=linux
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
case "$host_vendor" in
sequent)
file_magic_cmd='/bin/file'
deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
;;
ncr)
deplibs_check_method='pass_all'
;;
motorola)
need_lib_prefix=no
need_version=no
shlibpath_overrides_runpath=no
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
file_magic_cmd=/usr/bin/file
file_magic_test_file=`echo /usr/lib/libc.so*`
;;
esac
;;
uts4*)
version_type=linux
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
;;
dgux*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
;;
sysv4*MP*)
if test -d /usr/nec ;then
version_type=linux
library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
soname_spec='$libname.so.$major'
shlibpath_var=LD_LIBRARY_PATH
fi
;;
*)
dynamic_linker=no
;;
esac
echo "$ac_t$dynamic_linker" 1>&6
test "$dynamic_linker" = no && can_build_shared=no
# Report the final consequences.
echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in
# configure.in, otherwise build static only libraries.
case "$host_os" in
cygwin* | mingw* | os2*)
if test x$can_build_shared = xyes; then
test x$enable_win32_dll = xno && can_build_shared=no
echo "checking if package supports dlls... $can_build_shared" 1>&6
fi
;;
esac
if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then
case "$deplibs_check_method" in
"file_magic "*)
file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
egrep "$file_magic_regex" > /dev/null; then
:
else
cat <<EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
*** The result is that libtool may fail to recognize shared libraries
*** as such. This will affect the creation of libtool libraries that
*** depend on shared libraries, but programs linked with such libtool
*** libraries will work regardless of this problem. Nevertheless, you
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
EOF
fi ;;
esac
fi
echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case "$host_os" in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix4*)
test "$enable_shared" = yes && enable_static=no
;;
esac
echo "$ac_t$enable_shared" 1>&6
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
echo "checking whether to build static libraries... $enable_static" 1>&6
if test "$hardcode_action" = relink; then
# Fast installation is not supported
enable_fast_install=no
elif test "$shlibpath_overrides_runpath" = yes ||
test "$enable_shared" = no; then
# Fast installation is not necessary
enable_fast_install=needless
fi
echo $ac_n "checking for objdir... $ac_c" 1>&6
rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
if test -d .libs; then
objdir=.libs
else
# MS-DOS does not allow filenames that begin with a dot.
objdir=_libs
fi
rmdir .libs 2>/dev/null
echo "$ac_t$objdir" 1>&6
if test "x$enable_dlopen" != xyes; then
enable_dlopen=unknown
enable_dlopen_self=unknown
enable_dlopen_self_static=unknown
else
if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then
lt_cv_dlopen=no lt_cv_dlopen_libs=
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
echo "$progname:2248: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2256 "ltconfig"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen();
int main() {
dlopen()
; return 0; }
EOF
if { (eval echo $progname:2269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen""... $ac_c" 1>&6
echo "$progname:2288: checking for dlopen" >&5
if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2293 "ltconfig"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dlopen(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_dlopen) || defined (__stub___dlopen)
choke me
#else
dlopen();
#endif
; return 0; }
EOF
if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dlopen=yes"
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_dlopen=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
echo "$ac_t""yes" 1>&6
lt_cv_dlopen="dlopen"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
echo "$progname:2335: checking for dld_link in -ldld" >&5
ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2343 "ltconfig"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dld_link();
int main() {
dld_link()
; return 0; }
EOF
if { (eval echo $progname:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for shl_load""... $ac_c" 1>&6
echo "$progname:2375: checking for shl_load" >&5
if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2380 "ltconfig"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shl_load(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char shl_load();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_shl_load) || defined (__stub___shl_load)
choke me
#else
shl_load();
#endif
; return 0; }
EOF
if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_shl_load=yes"
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_shl_load=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
echo "$ac_t""yes" 1>&6
lt_cv_dlopen="shl_load"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
echo "$progname:2423: checking for shl_load in -ldld" >&5
ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2431 "ltconfig"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char shl_load();
int main() {
shl_load()
; return 0; }
EOF
if { (eval echo $progname:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
else
echo "$ac_t""no" 1>&6
fi
fi
fi
fi
fi
fi
if test "x$lt_cv_dlopen" != xno; then
enable_dlopen=yes
fi
case "$lt_cv_dlopen" in
dlopen)
for ac_hdr in dlfcn.h; do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "$progname:2488: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2493 "ltconfig"
#include <$ac_hdr>
int fnord = 0;
EOF
ac_try="$ac_compile >/dev/null 2>conftest.out"
{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
fi
done
if test "x$ac_cv_header_dlfcn_h" = xyes; then
CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
fi
eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
LIBS="$lt_cv_dlopen_libs $LIBS"
echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
echo "$progname:2526: checking whether a program can dlopen itself" >&5
if test "${lt_cv_dlopen_self+set}" = set; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
lt_cv_dlopen_self=cross
else
cat > conftest.c <<EOF
#line 2534 "ltconfig"
#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include <stdio.h>
#ifdef RTLD_GLOBAL
# define LTDL_GLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LTDL_GLOBAL DL_GLOBAL
# else
# define LTDL_GLOBAL 0
# endif
#endif
/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
find out it does not work in some platform. */
#ifndef LTDL_LAZY_OR_NOW
# ifdef RTLD_LAZY
# define LTDL_LAZY_OR_NOW RTLD_LAZY
# else
# ifdef DL_LAZY
# define LTDL_LAZY_OR_NOW DL_LAZY
# else
# ifdef RTLD_NOW
# define LTDL_LAZY_OR_NOW RTLD_NOW
# else
# ifdef DL_NOW
# define LTDL_LAZY_OR_NOW DL_NOW
# else
# define LTDL_LAZY_OR_NOW 0
# endif
# endif
# endif
# endif
#endif
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
EOF
if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
lt_cv_dlopen_self=yes
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
lt_cv_dlopen_self=no
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$lt_cv_dlopen_self" 1>&6
if test "$lt_cv_dlopen_self" = yes; then
LDFLAGS="$LDFLAGS $link_static_flag"
echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5
if test "${lt_cv_dlopen_self_static+set}" = set; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
lt_cv_dlopen_self_static=cross
else
cat > conftest.c <<EOF
#line 2607 "ltconfig"
#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include <stdio.h>
#ifdef RTLD_GLOBAL
# define LTDL_GLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LTDL_GLOBAL DL_GLOBAL
# else
# define LTDL_GLOBAL 0
# endif
#endif
/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
find out it does not work in some platform. */
#ifndef LTDL_LAZY_OR_NOW
# ifdef RTLD_LAZY
# define LTDL_LAZY_OR_NOW RTLD_LAZY
# else
# ifdef DL_LAZY
# define LTDL_LAZY_OR_NOW DL_LAZY
# else
# ifdef RTLD_NOW
# define LTDL_LAZY_OR_NOW RTLD_NOW
# else
# ifdef DL_NOW
# define LTDL_LAZY_OR_NOW DL_NOW
# else
# define LTDL_LAZY_OR_NOW 0
# endif
# endif
# endif
# endif
#endif
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
EOF
if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
lt_cv_dlopen_self_static=yes
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
lt_cv_dlopen_self_static=no
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
fi
;;
esac
case "$lt_cv_dlopen_self" in
yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
*) enable_dlopen_self=unknown ;;
esac
case "$lt_cv_dlopen_self_static" in
yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
*) enable_dlopen_self_static=unknown ;;
esac
fi
# Copy echo and quote the copy, instead of the original, because it is
# used later.
ltecho="$echo"
if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then
ltecho="$CONFIG_SHELL \$0 --fallback-echo"
fi
LTSHELL="$SHELL"
LTCONFIG_VERSION="$VERSION"
# Only quote variables if we're using ltmain.sh.
case "$ltmain" in
*.sh)
# Now quote all the things that may contain metacharacters.
for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \
old_LD old_LDFLAGS old_LIBS \
old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \
AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \
reload_flag reload_cmds wl \
pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
thread_safe_flag_spec whole_archive_flag_spec libname_spec \
library_names_spec soname_spec \
RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \
finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
hardcode_libdir_flag_spec hardcode_libdir_separator \
sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
case "$var" in
reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
old_postinstall_cmds | old_postuninstall_cmds | \
export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
postinstall_cmds | postuninstall_cmds | \
finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
# Double-quote double-evaled strings.
eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
;;
*)
eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
;;
esac
done
case "$ltecho" in
*'\$0 --fallback-echo"')
ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
;;
esac
trap "$rm \"$ofile\"; exit 1" 1 2 15
echo "creating $ofile"
$rm "$ofile"
cat <<EOF > "$ofile"
#! $SHELL
# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
#
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
Xsed="sed -e s/^X//"
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
### BEGIN LIBTOOL CONFIG
EOF
cfgfile="$ofile"
;;
*)
# Double-quote the variables that need it (for aesthetics).
for var in old_CC old_CFLAGS old_CPPFLAGS \
old_LD old_LDFLAGS old_LIBS \
old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do
eval "$var=\\\"\$var\\\""
done
# Just create a config file.
cfgfile="$ofile.cfg"
trap "$rm \"$cfgfile\"; exit 1" 1 2 15
echo "creating $cfgfile"
$rm "$cfgfile"
cat <<EOF > "$cfgfile"
# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
EOF
;;
esac
cat <<EOF >> "$cfgfile"
# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
#
# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\
# $0$ltconfig_args
#
# Compiler and other test output produced by $progname, useful for
# debugging $progname, is in ./config.log if it exists.
# The version of $progname that generated this script.
LTCONFIG_VERSION=$LTCONFIG_VERSION
# Shell to use when invoking shell scripts.
SHELL=$LTSHELL
# Whether or not to build shared libraries.
build_libtool_libs=$enable_shared
# Whether or not to build static libraries.
build_old_libs=$enable_static
# Whether or not to optimize for fast installation.
fast_install=$enable_fast_install
# The host system.
host_alias=$host_alias
host=$host
# An echo program that does not interpret backslashes.
echo=$ltecho
# The archiver.
AR=$AR
# The default C compiler.
CC=$CC
# The linker used to build libraries.
LD=$LD
# Whether we need hard or soft links.
LN_S=$LN_S
# A BSD-compatible nm program.
NM=$NM
# Used on cygwin: DLL creation program.
DLLTOOL="$DLLTOOL"
# Used on cygwin: object dumper.
OBJDUMP="$OBJDUMP"
# Used on cygwin: assembler.
AS="$AS"
# The name of the directory that contains temporary libtool files.
objdir=$objdir
# How to create reloadable object files.
reload_flag=$reload_flag
reload_cmds=$reload_cmds
# How to pass a linker flag through the compiler.
wl=$wl
# Object file suffix (normally "o").
objext="$objext"
# Old archive suffix (normally "a").
libext="$libext"
# Executable file suffix (normally "").
exeext="$exeext"
# Additional compiler flags for building library objects.
pic_flag=$pic_flag
# Does compiler simultaneously support -c and -o options?
compiler_c_o=$compiler_c_o
# Can we write directly to a .lo ?
compiler_o_lo=$compiler_o_lo
# Must we lock files when doing compilation ?
need_locks=$need_locks
# Do we need the lib prefix for modules?
need_lib_prefix=$need_lib_prefix
# Do we need a version for libraries?
need_version=$need_version
# Whether dlopen is supported.
dlopen=$enable_dlopen
# Whether dlopen of programs is supported.
dlopen_self=$enable_dlopen_self
# Whether dlopen of statically linked programs is supported.
dlopen_self_static=$enable_dlopen_self_static
# Compiler flag to prevent dynamic linking.
link_static_flag=$link_static_flag
# Compiler flag to turn off builtin functions.
no_builtin_flag=$no_builtin_flag
# Compiler flag to allow reflexive dlopens.
export_dynamic_flag_spec=$export_dynamic_flag_spec
# Compiler flag to generate shared objects directly from archives.
whole_archive_flag_spec=$whole_archive_flag_spec
# Compiler flag to generate thread-safe objects.
thread_safe_flag_spec=$thread_safe_flag_spec
# Library versioning type.
version_type=$version_type
# Format of library name prefix.
libname_spec=$libname_spec
# List of archive names. First name is the real one, the rest are links.
# The last name is the one that the linker finds with -lNAME.
library_names_spec=$library_names_spec
# The coded name of the library, if different from the real name.
soname_spec=$soname_spec
# Commands used to build and install an old-style archive.
RANLIB=$RANLIB
old_archive_cmds=$old_archive_cmds
old_postinstall_cmds=$old_postinstall_cmds
old_postuninstall_cmds=$old_postuninstall_cmds
# Create an old-style archive from a shared archive.
old_archive_from_new_cmds=$old_archive_from_new_cmds
# Commands used to build and install a shared archive.
archive_cmds=$archive_cmds
archive_expsym_cmds=$archive_expsym_cmds
postinstall_cmds=$postinstall_cmds
postuninstall_cmds=$postuninstall_cmds
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$deplibs_check_method
# Command to use when deplibs_check_method == file_magic.
file_magic_cmd=$file_magic_cmd
# Flag that allows shared libraries with undefined symbols to be built.
allow_undefined_flag=$allow_undefined_flag
# Flag that forces no undefined symbols.
no_undefined_flag=$no_undefined_flag
# Commands used to finish a libtool library installation in a directory.
finish_cmds=$finish_cmds
# Same as above, but a single script fragment to be evaled but not shown.
finish_eval=$finish_eval
# Take the output of nm and produce a listing of raw symbols and C names.
global_symbol_pipe=$global_symbol_pipe
# Transform the output of nm in a proper C declaration
global_symbol_to_cdecl=$global_symbol_to_cdecl
# This is the shared library runtime path variable.
runpath_var=$runpath_var
# This is the shared library path variable.
shlibpath_var=$shlibpath_var
# Is shlibpath searched before the hard-coded library search path?
shlibpath_overrides_runpath=$shlibpath_overrides_runpath
# How to hardcode a shared library path into an executable.
hardcode_action=$hardcode_action
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator=$hardcode_libdir_separator
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct=$hardcode_direct
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L=$hardcode_minus_L
# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
# the resulting binary.
hardcode_shlibpath_var=$hardcode_shlibpath_var
# Compile-time system search path for libraries
sys_lib_search_path_spec=$sys_lib_search_path_spec
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec
# Fix the shell variable \$srcfile for the compiler.
fix_srcfile_path="$fix_srcfile_path"
# Set to yes if exported symbols are required.
always_export_symbols=$always_export_symbols
# The commands to list exported symbols.
export_symbols_cmds=$export_symbols_cmds
# Symbols that should not be listed in the preloaded symbols.
exclude_expsyms=$exclude_expsyms
# Symbols that must always be exported.
include_expsyms=$include_expsyms
EOF
case "$ltmain" in
*.sh)
echo '### END LIBTOOL CONFIG' >> "$ofile"
echo >> "$ofile"
case "$host_os" in
aix3*)
cat <<\EOF >> "$ofile"
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test "X${COLLECT_NAMES+set}" != Xset; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
EOF
;;
esac
# Append the ltmain.sh script.
sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
# We use sed instead of cat because bash on DJGPP gets confused if
# if finds mixed CR/LF and LF-only lines. Since sed operates in
# text mode, it properly converts lines to CR/LF. This bash problem
# is reportedly fixed, but why not run on old versions too?
chmod +x "$ofile"
;;
*)
# Compile the libtool program.
echo "FIXME: would compile $ltmain"
;;
esac
test -n "$cache_file" || exit 0
# AC_CACHE_SAVE
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
EOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
sed -n \
-e "s/'/'\\\\''/g" \
-e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
;;
esac >> confcache
if cmp -s $cache_file confcache; then
:
else
if test -w $cache_file; then
echo "updating cache $cache_file"
cat confcache > $cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
exit 0
# Local Variables:
# mode:shell-script
# sh-indentation:2
# End:
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/ltconfig | Shell | apache-2.0 | 97,947 |
# libtool (GNU libtool) 2.4.2
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# GNU Libtool is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# As a special exception to the GNU General Public License,
# if you distribute this file as part of a program or library that
# is built using GNU Libtool, you may include this file under the
# same distribution terms that you use for the rest of that program.
#
# GNU Libtool is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Usage: $progname [OPTION]... [MODE-ARG]...
#
# Provide generalized library-building support services.
#
# --config show all configuration variables
# --debug enable verbose shell tracing
# -n, --dry-run display commands without modifying any files
# --features display basic configuration information and exit
# --mode=MODE use operation mode MODE
# --preserve-dup-deps don't remove duplicate dependency libraries
# --quiet, --silent don't print informational messages
# --no-quiet, --no-silent
# print informational messages (default)
# --no-warn don't display warning messages
# --tag=TAG use configuration variables from tag TAG
# -v, --verbose print more informational messages than default
# --no-verbose don't print the extra informational messages
# --version print version information
# -h, --help, --help-all print short, long, or detailed help message
#
# MODE must be one of the following:
#
# clean remove files from the build directory
# compile compile a source file into a libtool object
# execute automatically set library path, then run a program
# finish complete the installation of libtool libraries
# install install libraries or executables
# link create a library or an executable
# uninstall remove libraries from an installed directory
#
# MODE-ARGS vary depending on the MODE. When passed as first option,
# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
#
# When reporting a bug, please describe a test case to reproduce it and
# include the following information:
#
# host-triplet: $host
# shell: $SHELL
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.1
# automake: $automake_version
# autoconf: $autoconf_version
#
# Report bugs to <bug-libtool@gnu.org>.
# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
# General help using GNU software: <http://www.gnu.org/gethelp/>.
PROGRAM=libtool
PACKAGE=libtool
VERSION="2.4.2 Debian-2.4.2-1.1"
TIMESTAMP=""
package_revision=1.3337
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
# A function that is used when there is no print builtin or printf.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
$1
_LTECHO_EOF'
}
# NLS nuisances: We save the old values to restore during execute mode.
lt_user_locale=
lt_safe_locale=
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${$lt_var+set}\" = set; then
save_$lt_var=\$$lt_var
$lt_var=C
export $lt_var
lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
fi"
done
LC_ALL=C
LANGUAGE=C
export LANGUAGE LC_ALL
$lt_unset CDPATH
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
# is ksh but when the shell is invoked as "sh" and the current value of
# the _XPG environment variable is not equal to 1 (one), the special
# positional parameter $0, within a function call, is the name of the
# function.
progpath="$0"
: ${CP="cp -f"}
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
: ${MAKE="make"}
: ${MKDIR="mkdir"}
: ${MV="mv -f"}
: ${RM="rm -f"}
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
: ${Xsed="$SED -e 1s/^X//"}
# Global variables:
EXIT_SUCCESS=0
EXIT_FAILURE=1
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
exit_status=$EXIT_SUCCESS
# Make sure IFS has a sensible default
lt_nl='
'
IFS=" $lt_nl"
dirname="s,/[^/]*$,,"
basename="s,^.*/,,"
# func_dirname file append nondir_replacement
# Compute the dirname of FILE. If nonempty, add APPEND to the result,
# otherwise set result to NONDIR_REPLACEMENT.
func_dirname ()
{
func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
if test "X$func_dirname_result" = "X${1}"; then
func_dirname_result="${3}"
else
func_dirname_result="$func_dirname_result${2}"
fi
} # func_dirname may be replaced by extended shell implementation
# func_basename file
func_basename ()
{
func_basename_result=`$ECHO "${1}" | $SED "$basename"`
} # func_basename may be replaced by extended shell implementation
# func_dirname_and_basename file append nondir_replacement
# perform func_basename and func_dirname in a single function
# call:
# dirname: Compute the dirname of FILE. If nonempty,
# add APPEND to the result, otherwise set result
# to NONDIR_REPLACEMENT.
# value returned in "$func_dirname_result"
# basename: Compute filename of FILE.
# value retuned in "$func_basename_result"
# Implementation must be kept synchronized with func_dirname
# and func_basename. For efficiency, we do not delegate to
# those functions but instead duplicate the functionality here.
func_dirname_and_basename ()
{
# Extract subdirectory from the argument.
func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
if test "X$func_dirname_result" = "X${1}"; then
func_dirname_result="${3}"
else
func_dirname_result="$func_dirname_result${2}"
fi
func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
} # func_dirname_and_basename may be replaced by extended shell implementation
# func_stripname prefix suffix name
# strip PREFIX and SUFFIX off of NAME.
# PREFIX and SUFFIX must not contain globbing or regex special
# characters, hashes, percent signs, but SUFFIX may contain a leading
# dot (in which case that matches only a dot).
# func_strip_suffix prefix name
func_stripname ()
{
case ${2} in
.*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
esac
} # func_stripname may be replaced by extended shell implementation
# These SED scripts presuppose an absolute path with a trailing slash.
pathcar='s,^/\([^/]*\).*$,\1,'
pathcdr='s,^/[^/]*,,'
removedotparts=':dotsl
s@/\./@/@g
t dotsl
s,/\.$,/,'
collapseslashes='s@/\{1,\}@/@g'
finalslash='s,/*$,/,'
# func_normal_abspath PATH
# Remove doubled-up and trailing slashes, "." path components,
# and cancel out any ".." path components in PATH after making
# it an absolute path.
# value returned in "$func_normal_abspath_result"
func_normal_abspath ()
{
# Start from root dir and reassemble the path.
func_normal_abspath_result=
func_normal_abspath_tpath=$1
func_normal_abspath_altnamespace=
case $func_normal_abspath_tpath in
"")
# Empty path, that just means $cwd.
func_stripname '' '/' "`pwd`"
func_normal_abspath_result=$func_stripname_result
return
;;
# The next three entries are used to spot a run of precisely
# two leading slashes without using negated character classes;
# we take advantage of case's first-match behaviour.
///*)
# Unusual form of absolute path, do nothing.
;;
//*)
# Not necessarily an ordinary path; POSIX reserves leading '//'
# and for example Cygwin uses it to access remote file shares
# over CIFS/SMB, so we conserve a leading double slash if found.
func_normal_abspath_altnamespace=/
;;
/*)
# Absolute path, do nothing.
;;
*)
# Relative path, prepend $cwd.
func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
;;
esac
# Cancel out all the simple stuff to save iterations. We also want
# the path to end with a slash for ease of parsing, so make sure
# there is one (and only one) here.
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
while :; do
# Processed it all yet?
if test "$func_normal_abspath_tpath" = / ; then
# If we ascended to the root using ".." the result may be empty now.
if test -z "$func_normal_abspath_result" ; then
func_normal_abspath_result=/
fi
break
fi
func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$pathcar"`
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$pathcdr"`
# Figure out what to do with it
case $func_normal_abspath_tcomponent in
"")
# Trailing empty path component, ignore it.
;;
..)
# Parent dir; strip last assembled component from result.
func_dirname "$func_normal_abspath_result"
func_normal_abspath_result=$func_dirname_result
;;
*)
# Actual path component, append it.
func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
;;
esac
done
# Restore leading double-slash if one was found on entry.
func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
}
# func_relative_path SRCDIR DSTDIR
# generates a relative path from SRCDIR to DSTDIR, with a trailing
# slash if non-empty, suitable for immediately appending a filename
# without needing to append a separator.
# value returned in "$func_relative_path_result"
func_relative_path ()
{
func_relative_path_result=
func_normal_abspath "$1"
func_relative_path_tlibdir=$func_normal_abspath_result
func_normal_abspath "$2"
func_relative_path_tbindir=$func_normal_abspath_result
# Ascend the tree starting from libdir
while :; do
# check if we have found a prefix of bindir
case $func_relative_path_tbindir in
$func_relative_path_tlibdir)
# found an exact match
func_relative_path_tcancelled=
break
;;
$func_relative_path_tlibdir*)
# found a matching prefix
func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
func_relative_path_tcancelled=$func_stripname_result
if test -z "$func_relative_path_result"; then
func_relative_path_result=.
fi
break
;;
*)
func_dirname $func_relative_path_tlibdir
func_relative_path_tlibdir=${func_dirname_result}
if test "x$func_relative_path_tlibdir" = x ; then
# Have to descend all the way to the root!
func_relative_path_result=../$func_relative_path_result
func_relative_path_tcancelled=$func_relative_path_tbindir
break
fi
func_relative_path_result=../$func_relative_path_result
;;
esac
done
# Now calculate path; take care to avoid doubling-up slashes.
func_stripname '' '/' "$func_relative_path_result"
func_relative_path_result=$func_stripname_result
func_stripname '/' '/' "$func_relative_path_tcancelled"
if test "x$func_stripname_result" != x ; then
func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
fi
# Normalisation. If bindir is libdir, return empty string,
# else relative path ending with a slash; either way, target
# file name can be directly appended.
if test ! -z "$func_relative_path_result"; then
func_stripname './' '' "$func_relative_path_result/"
func_relative_path_result=$func_stripname_result
fi
}
# The name of this program:
func_dirname_and_basename "$progpath"
progname=$func_basename_result
# Make sure we have an absolute path for reexecution:
case $progpath in
[\\/]*|[A-Za-z]:\\*) ;;
*[\\/]*)
progdir=$func_dirname_result
progdir=`cd "$progdir" && pwd`
progpath="$progdir/$progname"
;;
*)
save_IFS="$IFS"
IFS=${PATH_SEPARATOR-:}
for progdir in $PATH; do
IFS="$save_IFS"
test -x "$progdir/$progname" && break
done
IFS="$save_IFS"
test -n "$progdir" || progdir=`pwd`
progpath="$progdir/$progname"
;;
esac
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed="${SED}"' -e 1s/^X//'
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\(["`\\]\)/\\\1/g'
# Sed substitution that turns a string into a regex matching for the
# string literally.
sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
# Sed substitution that converts a w32 file name or path
# which contains forward slashes, into one that contains
# (escaped) backslashes. A very naive implementation.
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
# Re-`\' parameter expansions in output of double_quote_subst that were
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
# in input to double_quote_subst, that '$' was protected from expansion.
# Since each input `\' is now two `\'s, look for any number of runs of
# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
bs='\\'
bs2='\\\\'
bs4='\\\\\\\\'
dollar='\$'
sed_double_backslash="\
s/$bs4/&\\
/g
s/^$bs2$dollar/$bs&/
s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
s/\n//g"
# Standard options:
opt_dry_run=false
opt_help=false
opt_quiet=false
opt_verbose=false
opt_warning=:
# func_echo arg...
# Echo program name prefixed message, along with the current mode
# name if it has been set yet.
func_echo ()
{
$ECHO "$progname: ${opt_mode+$opt_mode: }$*"
}
# func_verbose arg...
# Echo program name prefixed message in verbose mode only.
func_verbose ()
{
$opt_verbose && func_echo ${1+"$@"}
# A bug in bash halts the script if the last line of a function
# fails when set -e is in force, so we need another command to
# work around that:
:
}
# func_echo_all arg...
# Invoke $ECHO with all args, space-separated.
func_echo_all ()
{
$ECHO "$*"
}
# func_error arg...
# Echo program name prefixed message to standard error.
func_error ()
{
$ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
}
# func_warning arg...
# Echo program name prefixed warning message to standard error.
func_warning ()
{
$opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
# bash bug again:
:
}
# func_fatal_error arg...
# Echo program name prefixed message to standard error, and exit.
func_fatal_error ()
{
func_error ${1+"$@"}
exit $EXIT_FAILURE
}
# func_fatal_help arg...
# Echo program name prefixed message to standard error, followed by
# a help hint, and exit.
func_fatal_help ()
{
func_error ${1+"$@"}
func_fatal_error "$help"
}
help="Try \`$progname --help' for more information." ## default
# func_grep expression filename
# Check whether EXPRESSION matches any line of FILENAME, without output.
func_grep ()
{
$GREP "$1" "$2" >/dev/null 2>&1
}
# func_mkdir_p directory-path
# Make sure the entire path to DIRECTORY-PATH is available.
func_mkdir_p ()
{
my_directory_path="$1"
my_dir_list=
if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
# Protect directory names starting with `-'
case $my_directory_path in
-*) my_directory_path="./$my_directory_path" ;;
esac
# While some portion of DIR does not yet exist...
while test ! -d "$my_directory_path"; do
# ...make a list in topmost first order. Use a colon delimited
# list incase some portion of path contains whitespace.
my_dir_list="$my_directory_path:$my_dir_list"
# If the last portion added has no slash in it, the list is done
case $my_directory_path in */*) ;; *) break ;; esac
# ...otherwise throw away the child directory and loop
my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
done
my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
save_mkdir_p_IFS="$IFS"; IFS=':'
for my_dir in $my_dir_list; do
IFS="$save_mkdir_p_IFS"
# mkdir can fail with a `File exist' error if two processes
# try to create one of the directories concurrently. Don't
# stop in that case!
$MKDIR "$my_dir" 2>/dev/null || :
done
IFS="$save_mkdir_p_IFS"
# Bail out if we (or some other process) failed to create a directory.
test -d "$my_directory_path" || \
func_fatal_error "Failed to create \`$1'"
fi
}
# func_mktempdir [string]
# Make a temporary directory that won't clash with other running
# libtool processes, and avoids race conditions if possible. If
# given, STRING is the basename for that directory.
func_mktempdir ()
{
my_template="${TMPDIR-/tmp}/${1-$progname}"
if test "$opt_dry_run" = ":"; then
# Return a directory name, but don't create it in dry-run mode
my_tmpdir="${my_template}-$$"
else
# If mktemp works, use that first and foremost
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
# Failing that, at least try and use $RANDOM to avoid a race
my_tmpdir="${my_template}-${RANDOM-0}$$"
save_mktempdir_umask=`umask`
umask 0077
$MKDIR "$my_tmpdir"
umask $save_mktempdir_umask
fi
# If we're not in dry-run mode, bomb out on failure
test -d "$my_tmpdir" || \
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
fi
$ECHO "$my_tmpdir"
}
# func_quote_for_eval arg
# Aesthetically quote ARG to be evaled later.
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
# is double-quoted, suitable for a subsequent eval, whereas
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
# which are still active within double quotes backslashified.
func_quote_for_eval ()
{
case $1 in
*[\\\`\"\$]*)
func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
*)
func_quote_for_eval_unquoted_result="$1" ;;
esac
case $func_quote_for_eval_unquoted_result in
# Double-quote args containing shell metacharacters to delay
# word splitting, command substitution and and variable
# expansion for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
;;
*)
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
esac
}
# func_quote_for_expand arg
# Aesthetically quote ARG to be evaled later; same as above,
# but do not quote variable references.
func_quote_for_expand ()
{
case $1 in
*[\\\`\"]*)
my_arg=`$ECHO "$1" | $SED \
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
*)
my_arg="$1" ;;
esac
case $my_arg in
# Double-quote args containing shell metacharacters to delay
# word splitting and command substitution for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
my_arg="\"$my_arg\""
;;
esac
func_quote_for_expand_result="$my_arg"
}
# func_show_eval cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it.
func_show_eval ()
{
my_cmd="$1"
my_fail_exp="${2-:}"
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$my_cmd"
my_status=$?
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
fi
fi
}
# func_show_eval_locale cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it. Use the saved locale for evaluation.
func_show_eval_locale ()
{
my_cmd="$1"
my_fail_exp="${2-:}"
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$lt_user_locale
$my_cmd"
my_status=$?
eval "$lt_safe_locale"
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
fi
fi
}
# func_tr_sh
# Turn $1 into a string suitable for a shell variable name.
# Result is stored in $func_tr_sh_result. All characters
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
# if $1 begins with a digit, a '_' is prepended as well.
func_tr_sh ()
{
case $1 in
[0-9]* | *[!a-zA-Z0-9_]*)
func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
;;
* )
func_tr_sh_result=$1
;;
esac
}
# func_version
# Echo version message to standard output and exit.
func_version ()
{
$opt_debug
$SED -n '/(C)/!b go
:more
/\./!{
N
s/\n# / /
b more
}
:go
/^# '$PROGRAM' (GNU /,/# warranty; / {
s/^# //
s/^# *$//
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
p
}' < "$progpath"
exit $?
}
# func_usage
# Echo short help message to standard output and exit.
func_usage ()
{
$opt_debug
$SED -n '/^# Usage:/,/^# *.*--help/ {
s/^# //
s/^# *$//
s/\$progname/'$progname'/
p
}' < "$progpath"
echo
$ECHO "run \`$progname --help | more' for full usage"
exit $?
}
# func_help [NOEXIT]
# Echo long help message to standard output and exit,
# unless 'noexit' is passed as argument.
func_help ()
{
$opt_debug
$SED -n '/^# Usage:/,/# Report bugs to/ {
:print
s/^# //
s/^# *$//
s*\$progname*'$progname'*
s*\$host*'"$host"'*
s*\$SHELL*'"$SHELL"'*
s*\$LTCC*'"$LTCC"'*
s*\$LTCFLAGS*'"$LTCFLAGS"'*
s*\$LD*'"$LD"'*
s/\$with_gnu_ld/'"$with_gnu_ld"'/
s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
p
d
}
/^# .* home page:/b print
/^# General help using/b print
' < "$progpath"
ret=$?
if test -z "$1"; then
exit $ret
fi
}
# func_missing_arg argname
# Echo program name prefixed message to standard error and set global
# exit_cmd.
func_missing_arg ()
{
$opt_debug
func_error "missing argument for $1."
exit_cmd=exit
}
# func_split_short_opt shortopt
# Set func_split_short_opt_name and func_split_short_opt_arg shell
# variables after splitting SHORTOPT after the 2nd character.
func_split_short_opt ()
{
my_sed_short_opt='1s/^\(..\).*$/\1/;q'
my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
} # func_split_short_opt may be replaced by extended shell implementation
# func_split_long_opt longopt
# Set func_split_long_opt_name and func_split_long_opt_arg shell
# variables after splitting LONGOPT at the `=' sign.
func_split_long_opt ()
{
my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
my_sed_long_arg='1s/^--[^=]*=//'
func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
} # func_split_long_opt may be replaced by extended shell implementation
exit_cmd=:
magic="%%%MAGIC variable%%%"
magic_exe="%%%MAGIC EXE variable%%%"
# Global variables.
nonopt=
preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
extracted_archives=
extracted_serial=0
# If this variable is set in any of the actions, the command in it
# will be execed at the end. This prevents here-documents from being
# left over by shells.
exec_cmd=
# func_append var value
# Append VALUE to the end of shell variable VAR.
func_append ()
{
eval "${1}=\$${1}\${2}"
} # func_append may be replaced by extended shell implementation
# func_append_quoted var value
# Quote VALUE and append to the end of shell variable VAR, separated
# by a space.
func_append_quoted ()
{
func_quote_for_eval "${2}"
eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
} # func_append_quoted may be replaced by extended shell implementation
# func_arith arithmetic-term...
func_arith ()
{
func_arith_result=`expr "${@}"`
} # func_arith may be replaced by extended shell implementation
# func_len string
# STRING may not start with a hyphen.
func_len ()
{
func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
} # func_len may be replaced by extended shell implementation
# func_lo2o object
func_lo2o ()
{
func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
} # func_lo2o may be replaced by extended shell implementation
# func_xform libobj-or-source
func_xform ()
{
func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
} # func_xform may be replaced by extended shell implementation
# func_fatal_configuration arg...
# Echo program name prefixed message to standard error, followed by
# a configuration failure hint, and exit.
func_fatal_configuration ()
{
func_error ${1+"$@"}
func_error "See the $PACKAGE documentation for more information."
func_fatal_error "Fatal configuration error."
}
# func_config
# Display the configuration for all the tags in this script.
func_config ()
{
re_begincf='^# ### BEGIN LIBTOOL'
re_endcf='^# ### END LIBTOOL'
# Default configuration.
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
# Now print the configurations for the tags.
for tagname in $taglist; do
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
done
exit $?
}
# func_features
# Display the features supported by this script.
func_features ()
{
echo "host: $host"
if test "$build_libtool_libs" = yes; then
echo "enable shared libraries"
else
echo "disable shared libraries"
fi
if test "$build_old_libs" = yes; then
echo "enable static libraries"
else
echo "disable static libraries"
fi
exit $?
}
# func_enable_tag tagname
# Verify that TAGNAME is valid, and either flag an error and exit, or
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
# variable here.
func_enable_tag ()
{
# Global variable:
tagname="$1"
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
sed_extractcf="/$re_begincf/,/$re_endcf/p"
# Validate tagname.
case $tagname in
*[!-_A-Za-z0-9,/]*)
func_fatal_error "invalid tag name: $tagname"
;;
esac
# Don't test for the "default" C tag, as we know it's
# there but not specially marked.
case $tagname in
CC) ;;
*)
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
taglist="$taglist $tagname"
# Evaluate the configuration. Be careful to quote the path
# and the sed script, to avoid splitting on whitespace, but
# also don't use non-portable quotes within backquotes within
# quotes we have to do it in 2 steps:
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
eval "$extractedcf"
else
func_error "ignoring unknown tag $tagname"
fi
;;
esac
}
# func_check_version_match
# Ensure that we are using m4 macros, and libtool script from the same
# release of libtool.
func_check_version_match ()
{
if test "$package_revision" != "$macro_revision"; then
if test "$VERSION" != "$macro_version"; then
if test -z "$macro_version"; then
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from an older release.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
fi
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
$progname: of $PACKAGE $VERSION and run autoconf again.
_LT_EOF
fi
exit $EXIT_MISMATCH
fi
}
# Shorthand for --mode=foo, only valid as the first argument
case $1 in
clean|clea|cle|cl)
shift; set dummy --mode clean ${1+"$@"}; shift
;;
compile|compil|compi|comp|com|co|c)
shift; set dummy --mode compile ${1+"$@"}; shift
;;
execute|execut|execu|exec|exe|ex|e)
shift; set dummy --mode execute ${1+"$@"}; shift
;;
finish|finis|fini|fin|fi|f)
shift; set dummy --mode finish ${1+"$@"}; shift
;;
install|instal|insta|inst|ins|in|i)
shift; set dummy --mode install ${1+"$@"}; shift
;;
link|lin|li|l)
shift; set dummy --mode link ${1+"$@"}; shift
;;
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
shift; set dummy --mode uninstall ${1+"$@"}; shift
;;
esac
# Option defaults:
opt_debug=:
opt_dry_run=false
opt_config=false
opt_preserve_dup_deps=false
opt_features=false
opt_finish=false
opt_help=false
opt_help_all=false
opt_silent=:
opt_warning=:
opt_verbose=:
opt_silent=false
opt_verbose=false
# Parse options once, thoroughly. This comes as soon as possible in the
# script to make things like `--version' happen as quickly as we can.
{
# this just eases exit handling
while test $# -gt 0; do
opt="$1"
shift
case $opt in
--debug|-x) opt_debug='set -x'
func_echo "enabling shell trace mode"
$opt_debug
;;
--dry-run|--dryrun|-n)
opt_dry_run=:
;;
--config)
opt_config=:
func_config
;;
--dlopen|-dlopen)
optarg="$1"
opt_dlopen="${opt_dlopen+$opt_dlopen
}$optarg"
shift
;;
--preserve-dup-deps)
opt_preserve_dup_deps=:
;;
--features)
opt_features=:
func_features
;;
--finish)
opt_finish=:
set dummy --mode finish ${1+"$@"}; shift
;;
--help)
opt_help=:
;;
--help-all)
opt_help_all=:
opt_help=': help-all'
;;
--mode)
test $# = 0 && func_missing_arg $opt && break
optarg="$1"
opt_mode="$optarg"
case $optarg in
# Valid mode arguments:
clean|compile|execute|finish|install|link|relink|uninstall) ;;
# Catch anything else as an error
*) func_error "invalid argument for $opt"
exit_cmd=exit
break
;;
esac
shift
;;
--no-silent|--no-quiet)
opt_silent=false
func_append preserve_args " $opt"
;;
--no-warning|--no-warn)
opt_warning=false
func_append preserve_args " $opt"
;;
--no-verbose)
opt_verbose=false
func_append preserve_args " $opt"
;;
--silent|--quiet)
opt_silent=:
func_append preserve_args " $opt"
opt_verbose=false
;;
--verbose|-v)
opt_verbose=:
func_append preserve_args " $opt"
opt_silent=false
;;
--tag)
test $# = 0 && func_missing_arg $opt && break
optarg="$1"
opt_tag="$optarg"
func_append preserve_args " $opt $optarg"
func_enable_tag "$optarg"
shift
;;
-\?|-h) func_usage ;;
--help) func_help ;;
--version) func_version ;;
# Separate optargs to long options:
--*=*)
func_split_long_opt "$opt"
set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
shift
;;
# Separate non-argument short options:
-\?*|-h*|-n*|-v*)
func_split_short_opt "$opt"
set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
shift
;;
--) break ;;
-*) func_fatal_help "unrecognized option \`$opt'" ;;
*) set dummy "$opt" ${1+"$@"}; shift; break ;;
esac
done
# Validate options:
# save first non-option argument
if test "$#" -gt 0; then
nonopt="$opt"
shift
fi
# preserve --debug
test "$opt_debug" = : || func_append preserve_args " --debug"
case $host in
*cygwin* | *mingw* | *pw32* | *cegcc*)
# don't eliminate duplications in $postdeps and $predeps
opt_duplicate_compiler_generated_deps=:
;;
*)
opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
;;
esac
$opt_help || {
# Sanity checks first:
func_check_version_match
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
func_fatal_configuration "not configured to build any kind of library"
fi
# Darwin sucks
eval std_shrext=\"$shrext_cmds\"
# Only execute mode is allowed to have -dlopen flags.
if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
func_error "unrecognized option \`-dlopen'"
$ECHO "$help" 1>&2
exit $EXIT_FAILURE
fi
# Change the help message to a mode-specific one.
generic_help="$help"
help="Try \`$progname --help --mode=$opt_mode' for more information."
}
# Bail if the options were screwed
$exit_cmd $EXIT_FAILURE
}
## ----------- ##
## Main. ##
## ----------- ##
# func_lalib_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_lalib_p ()
{
test -f "$1" &&
$SED -e 4q "$1" 2>/dev/null \
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
}
# func_lalib_unsafe_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function implements the same check as func_lalib_p without
# resorting to external programs. To this end, it redirects stdin and
# closes it afterwards, without saving the original file descriptor.
# As a safety measure, use it only where a negative result would be
# fatal anyway. Works if `file' does not exist.
func_lalib_unsafe_p ()
{
lalib_p=no
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
for lalib_p_l in 1 2 3 4
do
read lalib_p_line
case "$lalib_p_line" in
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
esac
done
exec 0<&5 5<&-
fi
test "$lalib_p" = yes
}
# func_ltwrapper_script_p file
# True iff FILE is a libtool wrapper script
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_script_p ()
{
func_lalib_p "$1"
}
# func_ltwrapper_executable_p file
# True iff FILE is a libtool wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_executable_p ()
{
func_ltwrapper_exec_suffix=
case $1 in
*.exe) ;;
*) func_ltwrapper_exec_suffix=.exe ;;
esac
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
}
# func_ltwrapper_scriptname file
# Assumes file is an ltwrapper_executable
# uses $file to determine the appropriate filename for a
# temporary ltwrapper_script.
func_ltwrapper_scriptname ()
{
func_dirname_and_basename "$1" "" "."
func_stripname '' '.exe' "$func_basename_result"
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
}
# func_ltwrapper_p file
# True iff FILE is a libtool wrapper script or wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_p ()
{
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
}
# func_execute_cmds commands fail_cmd
# Execute tilde-delimited COMMANDS.
# If FAIL_CMD is given, eval that upon failure.
# FAIL_CMD may read-access the current command in variable CMD!
func_execute_cmds ()
{
$opt_debug
save_ifs=$IFS; IFS='~'
for cmd in $1; do
IFS=$save_ifs
eval cmd=\"$cmd\"
func_show_eval "$cmd" "${2-:}"
done
IFS=$save_ifs
}
# func_source file
# Source FILE, adding directory component if necessary.
# Note that it is not necessary on cygwin/mingw to append a dot to
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
# behavior happens only for exec(3), not for open(2)! Also, sourcing
# `FILE.' does not work on cygwin managed mounts.
func_source ()
{
$opt_debug
case $1 in
*/* | *\\*) . "$1" ;;
*) . "./$1" ;;
esac
}
# func_resolve_sysroot PATH
# Replace a leading = in PATH with a sysroot. Store the result into
# func_resolve_sysroot_result
func_resolve_sysroot ()
{
func_resolve_sysroot_result=$1
case $func_resolve_sysroot_result in
=*)
func_stripname '=' '' "$func_resolve_sysroot_result"
func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
;;
esac
}
# func_replace_sysroot PATH
# If PATH begins with the sysroot, replace it with = and
# store the result into func_replace_sysroot_result.
func_replace_sysroot ()
{
case "$lt_sysroot:$1" in
?*:"$lt_sysroot"*)
func_stripname "$lt_sysroot" '' "$1"
func_replace_sysroot_result="=$func_stripname_result"
;;
*)
# Including no sysroot.
func_replace_sysroot_result=$1
;;
esac
}
# func_infer_tag arg
# Infer tagged configuration to use if any are available and
# if one wasn't chosen via the "--tag" command line option.
# Only attempt this if the compiler in the base compile
# command doesn't match the default compiler.
# arg is usually of the form 'gcc ...'
func_infer_tag ()
{
$opt_debug
if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted=
for arg in $CC; do
func_append_quoted CC_quoted "$arg"
done
CC_expanded=`func_echo_all $CC`
CC_quoted_expanded=`func_echo_all $CC_quoted`
case $@ in
# Blanks in the command may have been stripped by the calling shell,
# but not from the CC environment variable when configure was run.
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
# Blanks at the start of $base_compile will cause this to fail
# if we don't check for them as well.
*)
for z in $available_tags; do
if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
# Evaluate the configuration.
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
CC_quoted=
for arg in $CC; do
# Double-quote args containing other shell metacharacters.
func_append_quoted CC_quoted "$arg"
done
CC_expanded=`func_echo_all $CC`
CC_quoted_expanded=`func_echo_all $CC_quoted`
case "$@ " in
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
# The compiler in the base compile command matches
# the one in the tagged configuration.
# Assume this is the tagged configuration we want.
tagname=$z
break
;;
esac
fi
done
# If $tagname still isn't set, then no tagged configuration
# was found and let the user know that the "--tag" command
# line option must be used.
if test -z "$tagname"; then
func_echo "unable to infer tagged configuration"
func_fatal_error "specify a tag with \`--tag'"
# else
# func_verbose "using $tagname tagged configuration"
fi
;;
esac
fi
}
# func_write_libtool_object output_name pic_name nonpic_name
# Create a libtool object file (analogous to a ".la" file),
# but don't create it if we're doing a dry run.
func_write_libtool_object ()
{
write_libobj=${1}
if test "$build_libtool_libs" = yes; then
write_lobj=\'${2}\'
else
write_lobj=none
fi
if test "$build_old_libs" = yes; then
write_oldobj=\'${3}\'
else
write_oldobj=none
fi
$opt_dry_run || {
cat >${write_libobj}T <<EOF
# $write_libobj - a libtool object file
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object=$write_lobj
# Name of the non-PIC object
non_pic_object=$write_oldobj
EOF
$MV "${write_libobj}T" "${write_libobj}"
}
}
##################################################
# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
##################################################
# func_convert_core_file_wine_to_w32 ARG
# Helper function used by file name conversion functions when $build is *nix,
# and $host is mingw, cygwin, or some other w32 environment. Relies on a
# correctly configured wine environment available, with the winepath program
# in $build's $PATH.
#
# ARG is the $build file name to be converted to w32 format.
# Result is available in $func_convert_core_file_wine_to_w32_result, and will
# be empty on error (or when ARG is empty)
func_convert_core_file_wine_to_w32 ()
{
$opt_debug
func_convert_core_file_wine_to_w32_result="$1"
if test -n "$1"; then
# Unfortunately, winepath does not exit with a non-zero error code, so we
# are forced to check the contents of stdout. On the other hand, if the
# command is not found, the shell will set an exit code of 127 and print
# *an error message* to stdout. So we must check for both error code of
# zero AND non-empty stdout, which explains the odd construction:
func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
$SED -e "$lt_sed_naive_backslashify"`
else
func_convert_core_file_wine_to_w32_result=
fi
fi
}
# end: func_convert_core_file_wine_to_w32
# func_convert_core_path_wine_to_w32 ARG
# Helper function used by path conversion functions when $build is *nix, and
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
# configured wine environment available, with the winepath program in $build's
# $PATH. Assumes ARG has no leading or trailing path separator characters.
#
# ARG is path to be converted from $build format to win32.
# Result is available in $func_convert_core_path_wine_to_w32_result.
# Unconvertible file (directory) names in ARG are skipped; if no directory names
# are convertible, then the result may be empty.
func_convert_core_path_wine_to_w32 ()
{
$opt_debug
# unfortunately, winepath doesn't convert paths, only file names
func_convert_core_path_wine_to_w32_result=""
if test -n "$1"; then
oldIFS=$IFS
IFS=:
for func_convert_core_path_wine_to_w32_f in $1; do
IFS=$oldIFS
func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
if test -n "$func_convert_core_file_wine_to_w32_result" ; then
if test -z "$func_convert_core_path_wine_to_w32_result"; then
func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
else
func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
fi
fi
done
IFS=$oldIFS
fi
}
# end: func_convert_core_path_wine_to_w32
# func_cygpath ARGS...
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
# (2), returns the Cygwin file name or path in func_cygpath_result (input
# file name or path is assumed to be in w32 format, as previously converted
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
# or path in func_cygpath_result (input file name or path is assumed to be in
# Cygwin format). Returns an empty string on error.
#
# ARGS are passed to cygpath, with the last one being the file name or path to
# be converted.
#
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
# environment variable; do not put it in $PATH.
func_cygpath ()
{
$opt_debug
if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
if test "$?" -ne 0; then
# on failure, ensure result is empty
func_cygpath_result=
fi
else
func_cygpath_result=
func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
fi
}
#end: func_cygpath
# func_convert_core_msys_to_w32 ARG
# Convert file name or path ARG from MSYS format to w32 format. Return
# result in func_convert_core_msys_to_w32_result.
func_convert_core_msys_to_w32 ()
{
$opt_debug
# awkward: cmd appends spaces to result
func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
}
#end: func_convert_core_msys_to_w32
# func_convert_file_check ARG1 ARG2
# Verify that ARG1 (a file name in $build format) was converted to $host
# format in ARG2. Otherwise, emit an error message, but continue (resetting
# func_to_host_file_result to ARG1).
func_convert_file_check ()
{
$opt_debug
if test -z "$2" && test -n "$1" ; then
func_error "Could not determine host file name corresponding to"
func_error " \`$1'"
func_error "Continuing, but uninstalled executables may not work."
# Fallback:
func_to_host_file_result="$1"
fi
}
# end func_convert_file_check
# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
# Verify that FROM_PATH (a path in $build format) was converted to $host
# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
# func_to_host_file_result to a simplistic fallback value (see below).
func_convert_path_check ()
{
$opt_debug
if test -z "$4" && test -n "$3"; then
func_error "Could not determine the host path corresponding to"
func_error " \`$3'"
func_error "Continuing, but uninstalled executables may not work."
# Fallback. This is a deliberately simplistic "conversion" and
# should not be "improved". See libtool.info.
if test "x$1" != "x$2"; then
lt_replace_pathsep_chars="s|$1|$2|g"
func_to_host_path_result=`echo "$3" |
$SED -e "$lt_replace_pathsep_chars"`
else
func_to_host_path_result="$3"
fi
fi
}
# end func_convert_path_check
# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
# and appending REPL if ORIG matches BACKPAT.
func_convert_path_front_back_pathsep ()
{
$opt_debug
case $4 in
$1 ) func_to_host_path_result="$3$func_to_host_path_result"
;;
esac
case $4 in
$2 ) func_append func_to_host_path_result "$3"
;;
esac
}
# end func_convert_path_front_back_pathsep
##################################################
# $build to $host FILE NAME CONVERSION FUNCTIONS #
##################################################
# invoked via `$to_host_file_cmd ARG'
#
# In each case, ARG is the path to be converted from $build to $host format.
# Result will be available in $func_to_host_file_result.
# func_to_host_file ARG
# Converts the file name ARG from $build format to $host format. Return result
# in func_to_host_file_result.
func_to_host_file ()
{
$opt_debug
$to_host_file_cmd "$1"
}
# end func_to_host_file
# func_to_tool_file ARG LAZY
# converts the file name ARG from $build format to toolchain format. Return
# result in func_to_tool_file_result. If the conversion in use is listed
# in (the comma separated) LAZY, no conversion takes place.
func_to_tool_file ()
{
$opt_debug
case ,$2, in
*,"$to_tool_file_cmd",*)
func_to_tool_file_result=$1
;;
*)
$to_tool_file_cmd "$1"
func_to_tool_file_result=$func_to_host_file_result
;;
esac
}
# end func_to_tool_file
# func_convert_file_noop ARG
# Copy ARG to func_to_host_file_result.
func_convert_file_noop ()
{
func_to_host_file_result="$1"
}
# end func_convert_file_noop
# func_convert_file_msys_to_w32 ARG
# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
# conversion to w32 is not available inside the cwrapper. Returns result in
# func_to_host_file_result.
func_convert_file_msys_to_w32 ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
func_convert_core_msys_to_w32 "$1"
func_to_host_file_result="$func_convert_core_msys_to_w32_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_msys_to_w32
# func_convert_file_cygwin_to_w32 ARG
# Convert file name ARG from Cygwin to w32 format. Returns result in
# func_to_host_file_result.
func_convert_file_cygwin_to_w32 ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
# because $build is cygwin, we call "the" cygpath in $PATH; no need to use
# LT_CYGPATH in this case.
func_to_host_file_result=`cygpath -m "$1"`
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_cygwin_to_w32
# func_convert_file_nix_to_w32 ARG
# Convert file name ARG from *nix to w32 format. Requires a wine environment
# and a working winepath. Returns result in func_to_host_file_result.
func_convert_file_nix_to_w32 ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
func_convert_core_file_wine_to_w32 "$1"
func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_nix_to_w32
# func_convert_file_msys_to_cygwin ARG
# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
# Returns result in func_to_host_file_result.
func_convert_file_msys_to_cygwin ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
func_convert_core_msys_to_w32 "$1"
func_cygpath -u "$func_convert_core_msys_to_w32_result"
func_to_host_file_result="$func_cygpath_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_msys_to_cygwin
# func_convert_file_nix_to_cygwin ARG
# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
# in func_to_host_file_result.
func_convert_file_nix_to_cygwin ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
# convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
func_convert_core_file_wine_to_w32 "$1"
func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
func_to_host_file_result="$func_cygpath_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_nix_to_cygwin
#############################################
# $build to $host PATH CONVERSION FUNCTIONS #
#############################################
# invoked via `$to_host_path_cmd ARG'
#
# In each case, ARG is the path to be converted from $build to $host format.
# The result will be available in $func_to_host_path_result.
#
# Path separators are also converted from $build format to $host format. If
# ARG begins or ends with a path separator character, it is preserved (but
# converted to $host format) on output.
#
# All path conversion functions are named using the following convention:
# file name conversion function : func_convert_file_X_to_Y ()
# path conversion function : func_convert_path_X_to_Y ()
# where, for any given $build/$host combination the 'X_to_Y' value is the
# same. If conversion functions are added for new $build/$host combinations,
# the two new functions must follow this pattern, or func_init_to_host_path_cmd
# will break.
# func_init_to_host_path_cmd
# Ensures that function "pointer" variable $to_host_path_cmd is set to the
# appropriate value, based on the value of $to_host_file_cmd.
to_host_path_cmd=
func_init_to_host_path_cmd ()
{
$opt_debug
if test -z "$to_host_path_cmd"; then
func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
to_host_path_cmd="func_convert_path_${func_stripname_result}"
fi
}
# func_to_host_path ARG
# Converts the path ARG from $build format to $host format. Return result
# in func_to_host_path_result.
func_to_host_path ()
{
$opt_debug
func_init_to_host_path_cmd
$to_host_path_cmd "$1"
}
# end func_to_host_path
# func_convert_path_noop ARG
# Copy ARG to func_to_host_path_result.
func_convert_path_noop ()
{
func_to_host_path_result="$1"
}
# end func_convert_path_noop
# func_convert_path_msys_to_w32 ARG
# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
# conversion to w32 is not available inside the cwrapper. Returns result in
# func_to_host_path_result.
func_convert_path_msys_to_w32 ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# Remove leading and trailing path separator characters from ARG. MSYS
# behavior is inconsistent here; cygpath turns them into '.;' and ';.';
# and winepath ignores them completely.
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
func_to_host_path_result="$func_convert_core_msys_to_w32_result"
func_convert_path_check : ";" \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
fi
}
# end func_convert_path_msys_to_w32
# func_convert_path_cygwin_to_w32 ARG
# Convert path ARG from Cygwin to w32 format. Returns result in
# func_to_host_file_result.
func_convert_path_cygwin_to_w32 ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# See func_convert_path_msys_to_w32:
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
func_convert_path_check : ";" \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
fi
}
# end func_convert_path_cygwin_to_w32
# func_convert_path_nix_to_w32 ARG
# Convert path ARG from *nix to w32 format. Requires a wine environment and
# a working winepath. Returns result in func_to_host_file_result.
func_convert_path_nix_to_w32 ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# See func_convert_path_msys_to_w32:
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
func_convert_path_check : ";" \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
fi
}
# end func_convert_path_nix_to_w32
# func_convert_path_msys_to_cygwin ARG
# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
# Returns result in func_to_host_file_result.
func_convert_path_msys_to_cygwin ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# See func_convert_path_msys_to_w32:
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
func_to_host_path_result="$func_cygpath_result"
func_convert_path_check : : \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
fi
}
# end func_convert_path_msys_to_cygwin
# func_convert_path_nix_to_cygwin ARG
# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
# func_to_host_file_result.
func_convert_path_nix_to_cygwin ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# Remove leading and trailing path separator characters from
# ARG. msys behavior is inconsistent here, cygpath turns them
# into '.;' and ';.', and winepath ignores them completely.
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
func_to_host_path_result="$func_cygpath_result"
func_convert_path_check : : \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
fi
}
# end func_convert_path_nix_to_cygwin
# func_mode_compile arg...
func_mode_compile ()
{
$opt_debug
# Get the compilation command and the source file.
base_compile=
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
suppress_opt=yes
suppress_output=
arg_mode=normal
libobj=
later=
pie_flag=
for arg
do
case $arg_mode in
arg )
# do not "continue". Instead, add this to base_compile
lastarg="$arg"
arg_mode=normal
;;
target )
libobj="$arg"
arg_mode=normal
continue
;;
normal )
# Accept any command-line options.
case $arg in
-o)
test -n "$libobj" && \
func_fatal_error "you cannot specify \`-o' more than once"
arg_mode=target
continue
;;
-pie | -fpie | -fPIE)
func_append pie_flag " $arg"
continue
;;
-shared | -static | -prefer-pic | -prefer-non-pic)
func_append later " $arg"
continue
;;
-no-suppress)
suppress_opt=no
continue
;;
-Xcompiler)
arg_mode=arg # the next one goes into the "base_compile" arg list
continue # The current "srcfile" will either be retained or
;; # replaced later. I would guess that would be a bug.
-Wc,*)
func_stripname '-Wc,' '' "$arg"
args=$func_stripname_result
lastarg=
save_ifs="$IFS"; IFS=','
for arg in $args; do
IFS="$save_ifs"
func_append_quoted lastarg "$arg"
done
IFS="$save_ifs"
func_stripname ' ' '' "$lastarg"
lastarg=$func_stripname_result
# Add the arguments to base_compile.
func_append base_compile " $lastarg"
continue
;;
*)
# Accept the current argument as the source file.
# The previous "srcfile" becomes the current argument.
#
lastarg="$srcfile"
srcfile="$arg"
;;
esac # case $arg
;;
esac # case $arg_mode
# Aesthetically quote the previous argument.
func_append_quoted base_compile "$lastarg"
done # for arg
case $arg_mode in
arg)
func_fatal_error "you must specify an argument for -Xcompile"
;;
target)
func_fatal_error "you must specify a target with \`-o'"
;;
*)
# Get the name of the library object.
test -z "$libobj" && {
func_basename "$srcfile"
libobj="$func_basename_result"
}
;;
esac
# Recognize several different file suffixes.
# If the user specifies -o file.o, it is replaced with file.lo
case $libobj in
*.[cCFSifmso] | \
*.ada | *.adb | *.ads | *.asm | \
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
*.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
func_xform "$libobj"
libobj=$func_xform_result
;;
esac
case $libobj in
*.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
*)
func_fatal_error "cannot determine name of library object from \`$libobj'"
;;
esac
func_infer_tag $base_compile
for arg in $later; do
case $arg in
-shared)
test "$build_libtool_libs" != yes && \
func_fatal_configuration "can not build a shared library"
build_old_libs=no
continue
;;
-static)
build_libtool_libs=no
build_old_libs=yes
continue
;;
-prefer-pic)
pic_mode=yes
continue
;;
-prefer-non-pic)
pic_mode=no
continue
;;
esac
done
func_quote_for_eval "$libobj"
test "X$libobj" != "X$func_quote_for_eval_result" \
&& $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
&& func_warning "libobj name \`$libobj' may not contain shell special characters."
func_dirname_and_basename "$obj" "/" ""
objname="$func_basename_result"
xdir="$func_dirname_result"
lobj=${xdir}$objdir/$objname
test -z "$base_compile" && \
func_fatal_help "you must specify a compilation command"
# Delete any leftover library objects.
if test "$build_old_libs" = yes; then
removelist="$obj $lobj $libobj ${libobj}T"
else
removelist="$lobj $libobj ${libobj}T"
fi
# On Cygwin there's no "real" PIC flag so we must build both object types
case $host_os in
cygwin* | mingw* | pw32* | os2* | cegcc*)
pic_mode=default
;;
esac
if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
# non-PIC code in shared libraries is not supported
pic_mode=default
fi
# Calculate the filename of the output object if compiler does
# not support -o with -c
if test "$compiler_c_o" = no; then
output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
lockfile="$output_obj.lock"
else
output_obj=
need_locks=no
lockfile=
fi
# Lock this critical section if it is needed
# We use this script file to make the link, it avoids creating a new file
if test "$need_locks" = yes; then
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
func_echo "Waiting for $lockfile to be removed"
sleep 2
done
elif test "$need_locks" = warn; then
if test -f "$lockfile"; then
$ECHO "\
*** ERROR, $lockfile exists and contains:
`cat $lockfile 2>/dev/null`
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
func_append removelist " $output_obj"
$ECHO "$srcfile" > "$lockfile"
fi
$opt_dry_run || $RM $removelist
func_append removelist " $lockfile"
trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
srcfile=$func_to_tool_file_result
func_quote_for_eval "$srcfile"
qsrcfile=$func_quote_for_eval_result
# Only build a PIC object if we are building libtool libraries.
if test "$build_libtool_libs" = yes; then
# Without this assignment, base_compile gets emptied.
fbsd_hideous_sh_bug=$base_compile
if test "$pic_mode" != no; then
command="$base_compile $qsrcfile $pic_flag"
else
# Don't build PIC code
command="$base_compile $qsrcfile"
fi
func_mkdir_p "$xdir$objdir"
if test -z "$output_obj"; then
# Place PIC objects in $objdir
func_append command " -o $lobj"
fi
func_show_eval_locale "$command" \
'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
$ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
but it should contain:
$srcfile
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
# Just move the object if needed, then go on to compile the next one
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
func_show_eval '$MV "$output_obj" "$lobj"' \
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
# Allow error messages only from the first compilation.
if test "$suppress_opt" = yes; then
suppress_output=' >/dev/null 2>&1'
fi
fi
# Only build a position-dependent object if we build old libraries.
if test "$build_old_libs" = yes; then
if test "$pic_mode" != yes; then
# Don't build PIC code
command="$base_compile $qsrcfile$pie_flag"
else
command="$base_compile $qsrcfile $pic_flag"
fi
if test "$compiler_c_o" = yes; then
func_append command " -o $obj"
fi
# Suppress compiler output if we already did a PIC compilation.
func_append command "$suppress_output"
func_show_eval_locale "$command" \
'$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
$ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
but it should contain:
$srcfile
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
# Just move the object if needed
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
func_show_eval '$MV "$output_obj" "$obj"' \
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
fi
$opt_dry_run || {
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
# Unlock the critical section if it was locked
if test "$need_locks" != no; then
removelist=$lockfile
$RM "$lockfile"
fi
}
exit $EXIT_SUCCESS
}
$opt_help || {
test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
}
func_mode_help ()
{
# We need to display help for each of the modes.
case $opt_mode in
"")
# Generic help is extracted from the usage comments
# at the start of this file.
func_help
;;
clean)
$ECHO \
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
Remove files from the build directory.
RM is the name of the program to use to delete files associated with each FILE
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
to RM.
If FILE is a libtool library, object or program, all the files associated
with it are deleted. Otherwise, only FILE itself is deleted using RM."
;;
compile)
$ECHO \
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
Compile a source file into a libtool library object.
This mode accepts the following additional options:
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
-no-suppress do not suppress compiler output for multiple passes
-prefer-pic try to build PIC objects only
-prefer-non-pic try to build non-PIC objects only
-shared do not build a \`.o' file suitable for static linking
-static only build a \`.o' file suitable for static linking
-Wc,FLAG pass FLAG directly to the compiler
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
from the given SOURCEFILE.
The output file name is determined by removing the directory component from
SOURCEFILE, then substituting the C source code suffix \`.c' with the
library object suffix, \`.lo'."
;;
execute)
$ECHO \
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
Automatically set library path, then run a program.
This mode accepts the following additional options:
-dlopen FILE add the directory containing FILE to the library path
This mode sets the library path environment variable according to \`-dlopen'
flags.
If any of the ARGS are libtool executable wrappers, then they are translated
into their corresponding uninstalled binary, and any of their required library
directories are added to the library path.
Then, COMMAND is executed, with ARGS as arguments."
;;
finish)
$ECHO \
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
Complete the installation of libtool libraries.
Each LIBDIR is a directory that contains libtool libraries.
The commands that this mode executes may require superuser privileges. Use
the \`--dry-run' option if you just want to see what would be executed."
;;
install)
$ECHO \
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
Install executables or libraries.
INSTALL-COMMAND is the installation command. The first component should be
either the \`install' or \`cp' program.
The following components of INSTALL-COMMAND are treated specially:
-inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
The rest of the components are interpreted as arguments to that command (only
BSD-compatible install options are recognized)."
;;
link)
$ECHO \
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
Link object files or libraries together to form another library, or to
create an executable program.
LINK-COMMAND is a command using the C compiler that you would use to create
a program from several object files.
The following components of LINK-COMMAND are treated specially:
-all-static do not do any dynamic linking at all
-avoid-version do not add a version suffix if possible
-bindir BINDIR specify path to binaries directory (for systems where
libraries must be found in the PATH setting at runtime)
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-export-symbols SYMFILE
try to export only the symbols listed in SYMFILE
-export-symbols-regex REGEX
try to export only the symbols matching REGEX
-LLIBDIR search LIBDIR for required installed libraries
-lNAME OUTPUT-FILE requires the installed library libNAME
-module build a library that can dlopened
-no-fast-install disable the fast-install mode
-no-install link a not-installable executable
-no-undefined declare that a library does not refer to external symbols
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
-objectlist FILE Use a list of object files found in FILE to specify objects
-precious-files-regex REGEX
don't remove output files matching REGEX
-release RELEASE specify package release information
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
-shared only do dynamic linking of libtool libraries
-shrext SUFFIX override the standard shared library file extension
-static do not do any dynamic linking of uninstalled libtool libraries
-static-libtool-libs
do not do any dynamic linking of libtool libraries
-version-info CURRENT[:REVISION[:AGE]]
specify library version info [each variable defaults to 0]
-weak LIBNAME declare that the target provides the LIBNAME interface
-Wc,FLAG
-Xcompiler FLAG pass linker-specific FLAG directly to the compiler
-Wl,FLAG
-Xlinker FLAG pass linker-specific FLAG directly to the linker
-XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
All other options (arguments beginning with \`-') are ignored.
Every other argument is treated as a filename. Files ending in \`.la' are
treated as uninstalled libtool libraries, other files are standard or library
object files.
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
only library objects (\`.lo' files) may be specified, and \`-rpath' is
required, except when creating a convenience library.
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
using \`ar' and \`ranlib', or on Windows using \`lib'.
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
is created, otherwise an executable program is created."
;;
uninstall)
$ECHO \
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
Remove libraries from an installation directory.
RM is the name of the program to use to delete files associated with each FILE
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
to RM.
If FILE is a libtool library, all the files associated with it are deleted.
Otherwise, only FILE itself is deleted using RM."
;;
*)
func_fatal_help "invalid operation mode \`$opt_mode'"
;;
esac
echo
$ECHO "Try \`$progname --help' for more information about other modes."
}
# Now that we've collected a possible --mode arg, show help if necessary
if $opt_help; then
if test "$opt_help" = :; then
func_mode_help
else
{
func_help noexit
for opt_mode in compile link execute install finish uninstall clean; do
func_mode_help
done
} | sed -n '1p; 2,$s/^Usage:/ or: /p'
{
func_help noexit
for opt_mode in compile link execute install finish uninstall clean; do
echo
func_mode_help
done
} |
sed '1d
/^When reporting/,/^Report/{
H
d
}
$x
/information about other modes/d
/more detailed .*MODE/d
s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
fi
exit $?
fi
# func_mode_execute arg...
func_mode_execute ()
{
$opt_debug
# The first argument is the command name.
cmd="$nonopt"
test -z "$cmd" && \
func_fatal_help "you must specify a COMMAND"
# Handle -dlopen flags immediately.
for file in $opt_dlopen; do
test -f "$file" \
|| func_fatal_help "\`$file' is not a file"
dir=
case $file in
*.la)
func_resolve_sysroot "$file"
file=$func_resolve_sysroot_result
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$file" \
|| func_fatal_help "\`$lib' is not a valid libtool archive"
# Read the libtool library.
dlname=
library_names=
func_source "$file"
# Skip this library if it cannot be dlopened.
if test -z "$dlname"; then
# Warn if it was a shared library.
test -n "$library_names" && \
func_warning "\`$file' was not linked with \`-export-dynamic'"
continue
fi
func_dirname "$file" "" "."
dir="$func_dirname_result"
if test -f "$dir/$objdir/$dlname"; then
func_append dir "/$objdir"
else
if test ! -f "$dir/$dlname"; then
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
fi
fi
;;
*.lo)
# Just add the directory containing the .lo file.
func_dirname "$file" "" "."
dir="$func_dirname_result"
;;
*)
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
continue
;;
esac
# Get the absolute pathname.
absdir=`cd "$dir" && pwd`
test -n "$absdir" && dir="$absdir"
# Now add the directory to shlibpath_var.
if eval "test -z \"\$$shlibpath_var\""; then
eval "$shlibpath_var=\"\$dir\""
else
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
fi
done
# This variable tells wrapper scripts just to set shlibpath_var
# rather than running their programs.
libtool_execute_magic="$magic"
# Check if any of the arguments is a wrapper script.
args=
for file
do
case $file in
-* | *.la | *.lo ) ;;
*)
# Do a test to see if this is really a libtool program.
if func_ltwrapper_script_p "$file"; then
func_source "$file"
# Transform arg to wrapped name.
file="$progdir/$program"
elif func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
func_source "$func_ltwrapper_scriptname_result"
# Transform arg to wrapped name.
file="$progdir/$program"
fi
;;
esac
# Quote arguments (to preserve shell metacharacters).
func_append_quoted args "$file"
done
if test "X$opt_dry_run" = Xfalse; then
if test -n "$shlibpath_var"; then
# Export the shlibpath_var.
eval "export $shlibpath_var"
fi
# Restore saved environment variables
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${save_$lt_var+set}\" = set; then
$lt_var=\$save_$lt_var; export $lt_var
else
$lt_unset $lt_var
fi"
done
# Now prepare to actually exec the command.
exec_cmd="\$cmd$args"
else
# Display what would be done.
if test -n "$shlibpath_var"; then
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
echo "export $shlibpath_var"
fi
$ECHO "$cmd$args"
exit $EXIT_SUCCESS
fi
}
test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
# func_mode_finish arg...
func_mode_finish ()
{
$opt_debug
libs=
libdirs=
admincmds=
for opt in "$nonopt" ${1+"$@"}
do
if test -d "$opt"; then
func_append libdirs " $opt"
elif test -f "$opt"; then
if func_lalib_unsafe_p "$opt"; then
func_append libs " $opt"
else
func_warning "\`$opt' is not a valid libtool archive"
fi
else
func_fatal_error "invalid argument \`$opt'"
fi
done
if test -n "$libs"; then
if test -n "$lt_sysroot"; then
sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
else
sysroot_cmd=
fi
# Remove sysroot references
if $opt_dry_run; then
for lib in $libs; do
echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
done
else
tmpdir=`func_mktempdir`
for lib in $libs; do
sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
> $tmpdir/tmp-la
mv -f $tmpdir/tmp-la $lib
done
${RM}r "$tmpdir"
fi
fi
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
for libdir in $libdirs; do
if test -n "$finish_cmds"; then
# Do each command in the finish commands.
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
'"$cmd"'"'
fi
if test -n "$finish_eval"; then
# Do the single finish_eval.
eval cmds=\"$finish_eval\"
$opt_dry_run || eval "$cmds" || func_append admincmds "
$cmds"
fi
done
fi
# Exit here if they wanted silent mode.
$opt_silent && exit $EXIT_SUCCESS
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
echo "----------------------------------------------------------------------"
echo "Libraries have been installed in:"
for libdir in $libdirs; do
$ECHO " $libdir"
done
echo
echo "If you ever happen to want to link against installed libraries"
echo "in a given directory, LIBDIR, you must either use libtool, and"
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
echo "flag during linking and do at least one of the following:"
if test -n "$shlibpath_var"; then
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
echo " during execution"
fi
if test -n "$runpath_var"; then
echo " - add LIBDIR to the \`$runpath_var' environment variable"
echo " during linking"
fi
if test -n "$hardcode_libdir_flag_spec"; then
libdir=LIBDIR
eval flag=\"$hardcode_libdir_flag_spec\"
$ECHO " - use the \`$flag' linker flag"
fi
if test -n "$admincmds"; then
$ECHO " - have your system administrator run these commands:$admincmds"
fi
if test -f /etc/ld.so.conf; then
echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
fi
echo
echo "See any operating system documentation about shared libraries for"
case $host in
solaris2.[6789]|solaris2.1[0-9])
echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
echo "pages."
;;
*)
echo "more information, such as the ld(1) and ld.so(8) manual pages."
;;
esac
echo "----------------------------------------------------------------------"
fi
exit $EXIT_SUCCESS
}
test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
# func_mode_install arg...
func_mode_install ()
{
$opt_debug
# There may be an optional sh(1) argument at the beginning of
# install_prog (especially on Windows NT).
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command.
case $nonopt in *shtool*) :;; *) false;; esac; then
# Aesthetically quote it.
func_quote_for_eval "$nonopt"
install_prog="$func_quote_for_eval_result "
arg=$1
shift
else
install_prog=
arg=$nonopt
fi
# The real first argument should be the name of the installation program.
# Aesthetically quote it.
func_quote_for_eval "$arg"
func_append install_prog "$func_quote_for_eval_result"
install_shared_prog=$install_prog
case " $install_prog " in
*[\\\ /]cp\ *) install_cp=: ;;
*) install_cp=false ;;
esac
# We need to accept at least all the BSD install flags.
dest=
files=
opts=
prev=
install_type=
isdir=no
stripme=
no_mode=:
for arg
do
arg2=
if test -n "$dest"; then
func_append files " $dest"
dest=$arg
continue
fi
case $arg in
-d) isdir=yes ;;
-f)
if $install_cp; then :; else
prev=$arg
fi
;;
-g | -m | -o)
prev=$arg
;;
-s)
stripme=" -s"
continue
;;
-*)
;;
*)
# If the previous option needed an argument, then skip it.
if test -n "$prev"; then
if test "x$prev" = x-m && test -n "$install_override_mode"; then
arg2=$install_override_mode
no_mode=false
fi
prev=
else
dest=$arg
continue
fi
;;
esac
# Aesthetically quote the argument.
func_quote_for_eval "$arg"
func_append install_prog " $func_quote_for_eval_result"
if test -n "$arg2"; then
func_quote_for_eval "$arg2"
fi
func_append install_shared_prog " $func_quote_for_eval_result"
done
test -z "$install_prog" && \
func_fatal_help "you must specify an install program"
test -n "$prev" && \
func_fatal_help "the \`$prev' option requires an argument"
if test -n "$install_override_mode" && $no_mode; then
if $install_cp; then :; else
func_quote_for_eval "$install_override_mode"
func_append install_shared_prog " -m $func_quote_for_eval_result"
fi
fi
if test -z "$files"; then
if test -z "$dest"; then
func_fatal_help "no file or destination specified"
else
func_fatal_help "you must specify a destination"
fi
fi
# Strip any trailing slash from the destination.
func_stripname '' '/' "$dest"
dest=$func_stripname_result
# Check to see that the destination is a directory.
test -d "$dest" && isdir=yes
if test "$isdir" = yes; then
destdir="$dest"
destname=
else
func_dirname_and_basename "$dest" "" "."
destdir="$func_dirname_result"
destname="$func_basename_result"
# Not a directory, so check to see that there is only one file specified.
set dummy $files; shift
test "$#" -gt 1 && \
func_fatal_help "\`$dest' is not a directory"
fi
case $destdir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
for file in $files; do
case $file in
*.lo) ;;
*)
func_fatal_help "\`$destdir' must be an absolute directory name"
;;
esac
done
;;
esac
# This variable tells wrapper scripts just to set variables rather
# than running their programs.
libtool_install_magic="$magic"
staticlibs=
future_libdirs=
current_libdirs=
for file in $files; do
# Do each installation.
case $file in
*.$libext)
# Do the static libraries later.
func_append staticlibs " $file"
;;
*.la)
func_resolve_sysroot "$file"
file=$func_resolve_sysroot_result
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$file" \
|| func_fatal_help "\`$file' is not a valid libtool archive"
library_names=
old_library=
relink_command=
func_source "$file"
# Add the libdir to current_libdirs if it is the destination.
if test "X$destdir" = "X$libdir"; then
case "$current_libdirs " in
*" $libdir "*) ;;
*) func_append current_libdirs " $libdir" ;;
esac
else
# Note the libdir as a future libdir.
case "$future_libdirs " in
*" $libdir "*) ;;
*) func_append future_libdirs " $libdir" ;;
esac
fi
func_dirname "$file" "/" ""
dir="$func_dirname_result"
func_append dir "$objdir"
if test -n "$relink_command"; then
# Determine the prefix the user has applied to our future dir.
inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
# Don't allow the user to place us outside of our expected
# location b/c this prevents finding dependent libraries that
# are installed to the same prefix.
# At present, this check doesn't affect windows .dll's that
# are installed into $libdir/../bin (currently, that works fine)
# but it's something to keep an eye on.
test "$inst_prefix_dir" = "$destdir" && \
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
if test -n "$inst_prefix_dir"; then
# Stick the inst_prefix_dir data into the link command.
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
else
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
fi
func_warning "relinking \`$file'"
func_show_eval "$relink_command" \
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
fi
# See the names of the shared library.
set dummy $library_names; shift
if test -n "$1"; then
realname="$1"
shift
srcname="$realname"
test -n "$relink_command" && srcname="$realname"T
# Install the shared library and build the symlinks.
func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
'exit $?'
tstripme="$stripme"
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
case $realname in
*.dll.a)
tstripme=""
;;
esac
;;
esac
if test -n "$tstripme" && test -n "$striplib"; then
func_show_eval "$striplib $destdir/$realname" 'exit $?'
fi
if test "$#" -gt 0; then
# Delete the old symlinks, and create new ones.
# Try `ln -sf' first, because the `ln' binary might depend on
# the symlink we replace! Solaris /bin/ln does not understand -f,
# so we also need to try rm && ln -s.
for linkname
do
test "$linkname" != "$realname" \
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
done
fi
# Do each command in the postinstall commands.
lib="$destdir/$realname"
func_execute_cmds "$postinstall_cmds" 'exit $?'
fi
# Install the pseudo-library for information purposes.
func_basename "$file"
name="$func_basename_result"
instname="$dir/$name"i
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
# Maybe install the static library, too.
test -n "$old_library" && func_append staticlibs " $dir/$old_library"
;;
*.lo)
# Install (i.e. copy) a libtool object.
# Figure out destination file name, if it wasn't already specified.
if test -n "$destname"; then
destfile="$destdir/$destname"
else
func_basename "$file"
destfile="$func_basename_result"
destfile="$destdir/$destfile"
fi
# Deduce the name of the destination old-style object file.
case $destfile in
*.lo)
func_lo2o "$destfile"
staticdest=$func_lo2o_result
;;
*.$objext)
staticdest="$destfile"
destfile=
;;
*)
func_fatal_help "cannot copy a libtool object to \`$destfile'"
;;
esac
# Install the libtool object if requested.
test -n "$destfile" && \
func_show_eval "$install_prog $file $destfile" 'exit $?'
# Install the old object if enabled.
if test "$build_old_libs" = yes; then
# Deduce the name of the old-style object file.
func_lo2o "$file"
staticobj=$func_lo2o_result
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
fi
exit $EXIT_SUCCESS
;;
*)
# Figure out destination file name, if it wasn't already specified.
if test -n "$destname"; then
destfile="$destdir/$destname"
else
func_basename "$file"
destfile="$func_basename_result"
destfile="$destdir/$destfile"
fi
# If the file is missing, and there is a .exe on the end, strip it
# because it is most likely a libtool script we actually want to
# install
stripped_ext=""
case $file in
*.exe)
if test ! -f "$file"; then
func_stripname '' '.exe' "$file"
file=$func_stripname_result
stripped_ext=".exe"
fi
;;
esac
# Do a test to see if this is really a libtool program.
case $host in
*cygwin* | *mingw*)
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
wrapper=$func_ltwrapper_scriptname_result
else
func_stripname '' '.exe' "$file"
wrapper=$func_stripname_result
fi
;;
*)
wrapper=$file
;;
esac
if func_ltwrapper_script_p "$wrapper"; then
notinst_deplibs=
relink_command=
func_source "$wrapper"
# Check the variables that should have been set.
test -z "$generated_by_libtool_version" && \
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
finalize=yes
for lib in $notinst_deplibs; do
# Check to see that each library is installed.
libdir=
if test -f "$lib"; then
func_source "$lib"
fi
libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
if test -n "$libdir" && test ! -f "$libfile"; then
func_warning "\`$lib' has not been installed in \`$libdir'"
finalize=no
fi
done
relink_command=
func_source "$wrapper"
outputname=
if test "$fast_install" = no && test -n "$relink_command"; then
$opt_dry_run || {
if test "$finalize" = yes; then
tmpdir=`func_mktempdir`
func_basename "$file$stripped_ext"
file="$func_basename_result"
outputname="$tmpdir/$file"
# Replace the output file specification.
relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
$opt_silent || {
func_quote_for_expand "$relink_command"
eval "func_echo $func_quote_for_expand_result"
}
if eval "$relink_command"; then :
else
func_error "error: relink \`$file' with the above command before installing it"
$opt_dry_run || ${RM}r "$tmpdir"
continue
fi
file="$outputname"
else
func_warning "cannot relink \`$file'"
fi
}
else
# Install the binary that we compiled earlier.
file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
fi
fi
# remove .exe since cygwin /usr/bin/install will append another
# one anyway
case $install_prog,$host in
*/usr/bin/install*,*cygwin*)
case $file:$destfile in
*.exe:*.exe)
# this is ok
;;
*.exe:*)
destfile=$destfile.exe
;;
*:*.exe)
func_stripname '' '.exe' "$destfile"
destfile=$func_stripname_result
;;
esac
;;
esac
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
$opt_dry_run || if test -n "$outputname"; then
${RM}r "$tmpdir"
fi
;;
esac
done
for file in $staticlibs; do
func_basename "$file"
name="$func_basename_result"
# Set up the ranlib parameters.
oldlib="$destdir/$name"
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
tool_oldlib=$func_to_tool_file_result
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
if test -n "$stripme" && test -n "$old_striplib"; then
func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
fi
# Do each command in the postinstall commands.
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
done
test -n "$future_libdirs" && \
func_warning "remember to run \`$progname --finish$future_libdirs'"
if test -n "$current_libdirs"; then
# Maybe just do a dry run.
$opt_dry_run && current_libdirs=" -n$current_libdirs"
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
else
exit $EXIT_SUCCESS
fi
}
test "$opt_mode" = install && func_mode_install ${1+"$@"}
# func_generate_dlsyms outputname originator pic_p
# Extract symbols from dlprefiles and create ${outputname}S.o with
# a dlpreopen symbol table.
func_generate_dlsyms ()
{
$opt_debug
my_outputname="$1"
my_originator="$2"
my_pic_p="${3-no}"
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
my_dlsyms=
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
if test -n "$NM" && test -n "$global_symbol_pipe"; then
my_dlsyms="${my_outputname}S.c"
else
func_error "not configured to extract global symbols from dlpreopened files"
fi
fi
if test -n "$my_dlsyms"; then
case $my_dlsyms in
"") ;;
*.c)
# Discover the nlist of each of the dlfiles.
nlist="$output_objdir/${my_outputname}.nm"
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
# Parse the name list into a source file.
func_verbose "creating $output_objdir/$my_dlsyms"
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
#ifdef __cplusplus
extern \"C\" {
#endif
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
#endif
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
/* DATA imports from DLLs on WIN32 con't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs. */
# define LT_DLSYM_CONST
#elif defined(__osf__)
/* This system does not cope well with relocations in const data. */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif
/* External symbol declarations for the compiler. */\
"
if test "$dlself" = yes; then
func_verbose "generating symbol list for \`$output'"
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
# Add our own program objects to the symbol list.
progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
for progfile in $progfiles; do
func_to_tool_file "$progfile" func_convert_file_msys_to_w32
func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
$opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
done
if test -n "$exclude_expsyms"; then
$opt_dry_run || {
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
}
fi
if test -n "$export_symbols_regex"; then
$opt_dry_run || {
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
}
fi
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
export_symbols="$output_objdir/$outputname.exp"
$opt_dry_run || {
$RM $export_symbols
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
case $host in
*cygwin* | *mingw* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
;;
esac
}
else
$opt_dry_run || {
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
case $host in
*cygwin* | *mingw* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
;;
esac
}
fi
fi
for dlprefile in $dlprefiles; do
func_verbose "extracting global C symbols from \`$dlprefile'"
func_basename "$dlprefile"
name="$func_basename_result"
case $host in
*cygwin* | *mingw* | *cegcc* )
# if an import library, we need to obtain dlname
if func_win32_import_lib_p "$dlprefile"; then
func_tr_sh "$dlprefile"
eval "curr_lafile=\$libfile_$func_tr_sh_result"
dlprefile_dlbasename=""
if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
# Use subshell, to avoid clobbering current variable values
dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
if test -n "$dlprefile_dlname" ; then
func_basename "$dlprefile_dlname"
dlprefile_dlbasename="$func_basename_result"
else
# no lafile. user explicitly requested -dlpreopen <import library>.
$sharedlib_from_linklib_cmd "$dlprefile"
dlprefile_dlbasename=$sharedlib_from_linklib_result
fi
fi
$opt_dry_run || {
if test -n "$dlprefile_dlbasename" ; then
eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
else
func_warning "Could not compute DLL name from $name"
eval '$ECHO ": $name " >> "$nlist"'
fi
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
$SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
}
else # not an import lib
$opt_dry_run || {
eval '$ECHO ": $name " >> "$nlist"'
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
}
fi
;;
*)
$opt_dry_run || {
eval '$ECHO ": $name " >> "$nlist"'
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
}
;;
esac
done
$opt_dry_run || {
# Make sure we have at least an empty file.
test -f "$nlist" || : > "$nlist"
if test -n "$exclude_expsyms"; then
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
$MV "$nlist"T "$nlist"
fi
# Try sorting and uniquifying the output.
if $GREP -v "^: " < "$nlist" |
if sort -k 3 </dev/null >/dev/null 2>&1; then
sort -k 3
else
sort +2
fi |
uniq > "$nlist"S; then
:
else
$GREP -v "^: " < "$nlist" > "$nlist"S
fi
if test -f "$nlist"S; then
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
else
echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
fi
echo >> "$output_objdir/$my_dlsyms" "\
/* The mapping between symbol names and symbols. */
typedef struct {
const char *name;
void *address;
} lt_dlsymlist;
extern LT_DLSYM_CONST lt_dlsymlist
lt_${my_prefix}_LTX_preloaded_symbols[];
LT_DLSYM_CONST lt_dlsymlist
lt_${my_prefix}_LTX_preloaded_symbols[] =
{\
{ \"$my_originator\", (void *) 0 },"
case $need_lib_prefix in
no)
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
;;
*)
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
;;
esac
echo >> "$output_objdir/$my_dlsyms" "\
{0, (void *) 0}
};
/* This works around a problem in FreeBSD linker */
#ifdef FREEBSD_WORKAROUND
static const void *lt_preloaded_setup() {
return lt_${my_prefix}_LTX_preloaded_symbols;
}
#endif
#ifdef __cplusplus
}
#endif\
"
} # !$opt_dry_run
pic_flag_for_symtable=
case "$compile_command " in
*" -static "*) ;;
*)
case $host in
# compiling the symbol table file with pic_flag works around
# a FreeBSD bug that causes programs to crash when -lm is
# linked before any other PIC object. But we must not use
# pic_flag when linking with -static. The problem exists in
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
*-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
*-*-hpux*)
pic_flag_for_symtable=" $pic_flag" ;;
*)
if test "X$my_pic_p" != Xno; then
pic_flag_for_symtable=" $pic_flag"
fi
;;
esac
;;
esac
symtab_cflags=
for arg in $LTCFLAGS; do
case $arg in
-pie | -fpie | -fPIE) ;;
*) func_append symtab_cflags " $arg" ;;
esac
done
# Now compile the dynamic symbol file.
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
# Clean up the generated files.
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
# Transform the symbol file into the correct name.
symfileobj="$output_objdir/${my_outputname}S.$objext"
case $host in
*cygwin* | *mingw* | *cegcc* )
if test -f "$output_objdir/$my_outputname.def"; then
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
else
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
fi
;;
*)
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
;;
esac
;;
*)
func_fatal_error "unknown suffix for \`$my_dlsyms'"
;;
esac
else
# We keep going just in case the user didn't refer to
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
# really was required.
# Nullify the symbol file.
compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
fi
}
# func_win32_libid arg
# return the library type of file 'arg'
#
# Need a lot of goo to handle *both* DLLs and import libs
# Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called.
# Despite the name, also deal with 64 bit binaries.
func_win32_libid ()
{
$opt_debug
win32_libid_type="unknown"
win32_fileres=`file -L $1 2>/dev/null`
case $win32_fileres in
*ar\ archive\ import\ library*) # definitely import
win32_libid_type="x86 archive import"
;;
*ar\ archive*) # could be an import, or static
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
$EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
func_to_tool_file "$1" func_convert_file_msys_to_w32
win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
$SED -n -e '
1,100{
/ I /{
s,.*,import,
p
q
}
}'`
case $win32_nmres in
import*) win32_libid_type="x86 archive import";;
*) win32_libid_type="x86 archive static";;
esac
fi
;;
*DLL*)
win32_libid_type="x86 DLL"
;;
*executable*) # but shell scripts are "executable" too...
case $win32_fileres in
*MS\ Windows\ PE\ Intel*)
win32_libid_type="x86 DLL"
;;
esac
;;
esac
$ECHO "$win32_libid_type"
}
# func_cygming_dll_for_implib ARG
#
# Platform-specific function to extract the
# name of the DLL associated with the specified
# import library ARG.
# Invoked by eval'ing the libtool variable
# $sharedlib_from_linklib_cmd
# Result is available in the variable
# $sharedlib_from_linklib_result
func_cygming_dll_for_implib ()
{
$opt_debug
sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
}
# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
#
# The is the core of a fallback implementation of a
# platform-specific function to extract the name of the
# DLL associated with the specified import library LIBNAME.
#
# SECTION_NAME is either .idata$6 or .idata$7, depending
# on the platform and compiler that created the implib.
#
# Echos the name of the DLL associated with the
# specified import library.
func_cygming_dll_for_implib_fallback_core ()
{
$opt_debug
match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
$OBJDUMP -s --section "$1" "$2" 2>/dev/null |
$SED '/^Contents of section '"$match_literal"':/{
# Place marker at beginning of archive member dllname section
s/.*/====MARK====/
p
d
}
# These lines can sometimes be longer than 43 characters, but
# are always uninteresting
/:[ ]*file format pe[i]\{,1\}-/d
/^In archive [^:]*:/d
# Ensure marker is printed
/^====MARK====/p
# Remove all lines with less than 43 characters
/^.\{43\}/!d
# From remaining lines, remove first 43 characters
s/^.\{43\}//' |
$SED -n '
# Join marker and all lines until next marker into a single line
/^====MARK====/ b para
H
$ b para
b
:para
x
s/\n//g
# Remove the marker
s/^====MARK====//
# Remove trailing dots and whitespace
s/[\. \t]*$//
# Print
/./p' |
# we now have a list, one entry per line, of the stringified
# contents of the appropriate section of all members of the
# archive which possess that section. Heuristic: eliminate
# all those which have a first or second character that is
# a '.' (that is, objdump's representation of an unprintable
# character.) This should work for all archives with less than
# 0x302f exports -- but will fail for DLLs whose name actually
# begins with a literal '.' or a single character followed by
# a '.'.
#
# Of those that remain, print the first one.
$SED -e '/^\./d;/^.\./d;q'
}
# func_cygming_gnu_implib_p ARG
# This predicate returns with zero status (TRUE) if
# ARG is a GNU/binutils-style import library. Returns
# with nonzero status (FALSE) otherwise.
func_cygming_gnu_implib_p ()
{
$opt_debug
func_to_tool_file "$1" func_convert_file_msys_to_w32
func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
test -n "$func_cygming_gnu_implib_tmp"
}
# func_cygming_ms_implib_p ARG
# This predicate returns with zero status (TRUE) if
# ARG is an MS-style import library. Returns
# with nonzero status (FALSE) otherwise.
func_cygming_ms_implib_p ()
{
$opt_debug
func_to_tool_file "$1" func_convert_file_msys_to_w32
func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
test -n "$func_cygming_ms_implib_tmp"
}
# func_cygming_dll_for_implib_fallback ARG
# Platform-specific function to extract the
# name of the DLL associated with the specified
# import library ARG.
#
# This fallback implementation is for use when $DLLTOOL
# does not support the --identify-strict option.
# Invoked by eval'ing the libtool variable
# $sharedlib_from_linklib_cmd
# Result is available in the variable
# $sharedlib_from_linklib_result
func_cygming_dll_for_implib_fallback ()
{
$opt_debug
if func_cygming_gnu_implib_p "$1" ; then
# binutils import library
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
elif func_cygming_ms_implib_p "$1" ; then
# ms-generated import library
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
else
# unknown
sharedlib_from_linklib_result=""
fi
}
# func_extract_an_archive dir oldlib
func_extract_an_archive ()
{
$opt_debug
f_ex_an_ar_dir="$1"; shift
f_ex_an_ar_oldlib="$1"
if test "$lock_old_archive_extraction" = yes; then
lockfile=$f_ex_an_ar_oldlib.lock
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
func_echo "Waiting for $lockfile to be removed"
sleep 2
done
fi
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
'stat=$?; rm -f "$lockfile"; exit $stat'
if test "$lock_old_archive_extraction" = yes; then
$opt_dry_run || rm -f "$lockfile"
fi
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
:
else
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
fi
}
# func_extract_archives gentop oldlib ...
func_extract_archives ()
{
$opt_debug
my_gentop="$1"; shift
my_oldlibs=${1+"$@"}
my_oldobjs=""
my_xlib=""
my_xabs=""
my_xdir=""
for my_xlib in $my_oldlibs; do
# Extract the objects.
case $my_xlib in
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
*) my_xabs=`pwd`"/$my_xlib" ;;
esac
func_basename "$my_xlib"
my_xlib="$func_basename_result"
my_xlib_u=$my_xlib
while :; do
case " $extracted_archives " in
*" $my_xlib_u "*)
func_arith $extracted_serial + 1
extracted_serial=$func_arith_result
my_xlib_u=lt$extracted_serial-$my_xlib ;;
*) break ;;
esac
done
extracted_archives="$extracted_archives $my_xlib_u"
my_xdir="$my_gentop/$my_xlib_u"
func_mkdir_p "$my_xdir"
case $host in
*-darwin*)
func_verbose "Extracting $my_xabs"
# Do not bother doing anything if just a dry run
$opt_dry_run || {
darwin_orig_dir=`pwd`
cd $my_xdir || exit $?
darwin_archive=$my_xabs
darwin_curdir=`pwd`
darwin_base_archive=`basename "$darwin_archive"`
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
if test -n "$darwin_arches"; then
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
darwin_arch=
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
for darwin_arch in $darwin_arches ; do
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
cd "$darwin_curdir"
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
done # $darwin_arches
## Okay now we've a bunch of thin objects, gotta fatten them up :)
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
darwin_file=
darwin_files=
for darwin_file in $darwin_filelist; do
darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
$LIPO -create -output "$darwin_file" $darwin_files
done # $darwin_filelist
$RM -rf unfat-$$
cd "$darwin_orig_dir"
else
cd $darwin_orig_dir
func_extract_an_archive "$my_xdir" "$my_xabs"
fi # $darwin_arches
} # !$opt_dry_run
;;
*)
func_extract_an_archive "$my_xdir" "$my_xabs"
;;
esac
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
done
func_extract_archives_result="$my_oldobjs"
}
# func_emit_wrapper [arg=no]
#
# Emit a libtool wrapper script on stdout.
# Don't directly open a file because we may want to
# incorporate the script contents within a cygwin/mingw
# wrapper executable. Must ONLY be called from within
# func_mode_link because it depends on a number of variables
# set therein.
#
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
# variable will take. If 'yes', then the emitted script
# will assume that the directory in which it is stored is
# the $objdir directory. This is a cygwin/mingw-specific
# behavior.
func_emit_wrapper ()
{
func_emit_wrapper_arg1=${1-no}
$ECHO "\
#! $SHELL
# $output - temporary wrapper script for $objdir/$outputname
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# The $output program cannot be directly executed until all the libtool
# libraries that it depends on are installed.
#
# This wrapper script should never be moved out of the build directory.
# If it is, it will not operate correctly.
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
sed_quote_subst='$sed_quote_subst'
# Be Bourne compatible
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
relink_command=\"$relink_command\"
# This environment variable determines our operation mode.
if test \"\$libtool_install_magic\" = \"$magic\"; then
# install mode needs the following variables:
generated_by_libtool_version='$macro_version'
notinst_deplibs='$notinst_deplibs'
else
# When we are sourced in execute mode, \$file and \$ECHO are already set.
if test \"\$libtool_execute_magic\" != \"$magic\"; then
file=\"\$0\""
qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
$ECHO "\
# A function that is used when there is no print builtin or printf.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
\$1
_LTECHO_EOF'
}
ECHO=\"$qECHO\"
fi
# Very basic option parsing. These options are (a) specific to
# the libtool wrapper, (b) are identical between the wrapper
# /script/ and the wrapper /executable/ which is used only on
# windows platforms, and (c) all begin with the string "--lt-"
# (application programs are unlikely to have options which match
# this pattern).
#
# There are only two supported options: --lt-debug and
# --lt-dump-script. There is, deliberately, no --lt-help.
#
# The first argument to this parsing function should be the
# script's $0 value, followed by "$@".
lt_option_debug=
func_parse_lt_options ()
{
lt_script_arg0=\$0
shift
for lt_opt
do
case \"\$lt_opt\" in
--lt-debug) lt_option_debug=1 ;;
--lt-dump-script)
lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
cat \"\$lt_dump_D/\$lt_dump_F\"
exit 0
;;
--lt-*)
\$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
exit 1
;;
esac
done
# Print the debug banner immediately:
if test -n \"\$lt_option_debug\"; then
echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
fi
}
# Used when --lt-debug. Prints its arguments to stdout
# (redirection is the responsibility of the caller)
func_lt_dump_args ()
{
lt_dump_args_N=1;
for lt_arg
do
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
done
}
# Core function for launching the target application
func_exec_program_core ()
{
"
case $host in
# Backslashes separate directories on plain windows
*-*-mingw | *-*-os2* | *-cegcc*)
$ECHO "\
if test -n \"\$lt_option_debug\"; then
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
func_lt_dump_args \${1+\"\$@\"} 1>&2
fi
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
"
;;
*)
$ECHO "\
if test -n \"\$lt_option_debug\"; then
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
func_lt_dump_args \${1+\"\$@\"} 1>&2
fi
exec \"\$progdir/\$program\" \${1+\"\$@\"}
"
;;
esac
$ECHO "\
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
exit 1
}
# A function to encapsulate launching the target application
# Strips options in the --lt-* namespace from \$@ and
# launches target application with the remaining arguments.
func_exec_program ()
{
case \" \$* \" in
*\\ --lt-*)
for lt_wr_arg
do
case \$lt_wr_arg in
--lt-*) ;;
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
esac
shift
done ;;
esac
func_exec_program_core \${1+\"\$@\"}
}
# Parse options
func_parse_lt_options \"\$0\" \${1+\"\$@\"}
# Find the directory that this script lives in.
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
# Follow symbolic links until we get to the real thisdir.
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
while test -n \"\$file\"; do
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
# If there was a directory component, then change thisdir.
if test \"x\$destdir\" != \"x\$file\"; then
case \"\$destdir\" in
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
*) thisdir=\"\$thisdir/\$destdir\" ;;
esac
fi
file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
done
# Usually 'no', except on cygwin/mingw when embedded into
# the cwrapper.
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
# special case for '.'
if test \"\$thisdir\" = \".\"; then
thisdir=\`pwd\`
fi
# remove .libs from thisdir
case \"\$thisdir\" in
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
$objdir ) thisdir=. ;;
esac
fi
# Try to get the absolute directory name.
absdir=\`cd \"\$thisdir\" && pwd\`
test -n \"\$absdir\" && thisdir=\"\$absdir\"
"
if test "$fast_install" = yes; then
$ECHO "\
program=lt-'$outputname'$exeext
progdir=\"\$thisdir/$objdir\"
if test ! -f \"\$progdir/\$program\" ||
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
file=\"\$\$-\$program\"
if test ! -d \"\$progdir\"; then
$MKDIR \"\$progdir\"
else
$RM \"\$progdir/\$file\"
fi"
$ECHO "\
# relink executable if necessary
if test -n \"\$relink_command\"; then
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
else
$ECHO \"\$relink_command_output\" >&2
$RM \"\$progdir/\$file\"
exit 1
fi
fi
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
{ $RM \"\$progdir/\$program\";
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
$RM \"\$progdir/\$file\"
fi"
else
$ECHO "\
program='$outputname'
progdir=\"\$thisdir/$objdir\"
"
fi
$ECHO "\
if test -f \"\$progdir/\$program\"; then"
# fixup the dll searchpath if we need to.
#
# Fix the DLL searchpath if we need to. Do this before prepending
# to shlibpath, because on Windows, both are PATH and uninstalled
# libraries must come first.
if test -n "$dllsearchpath"; then
$ECHO "\
# Add the dll search path components to the executable PATH
PATH=$dllsearchpath:\$PATH
"
fi
# Export our shlibpath_var if we have one.
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
$ECHO "\
# Add our own library path to $shlibpath_var
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
# Some systems cannot cope with colon-terminated $shlibpath_var
# The second colon is a workaround for a bug in BeOS R4 sed
$shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
export $shlibpath_var
"
fi
$ECHO "\
if test \"\$libtool_execute_magic\" != \"$magic\"; then
# Run the actual program with our arguments.
func_exec_program \${1+\"\$@\"}
fi
else
# The program doesn't exist.
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
exit 1
fi
fi\
"
}
# func_emit_cwrapperexe_src
# emit the source code for a wrapper executable on stdout
# Must ONLY be called from within func_mode_link because
# it depends on a number of variable set therein.
func_emit_cwrapperexe_src ()
{
cat <<EOF
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
The $output program cannot be directly executed until all the libtool
libraries that it depends on are installed.
This wrapper executable should never be moved out of the build directory.
If it is, it will not operate correctly.
*/
EOF
cat <<"EOF"
#ifdef _MSC_VER
# define _CRT_SECURE_NO_DEPRECATE 1
#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef _MSC_VER
# include <direct.h>
# include <process.h>
# include <io.h>
#else
# include <unistd.h>
# include <stdint.h>
# ifdef __CYGWIN__
# include <io.h>
# endif
#endif
#include <malloc.h>
#include <stdarg.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
/* declarations of non-ANSI functions */
#if defined(__MINGW32__)
# ifdef __STRICT_ANSI__
int _putenv (const char *);
# endif
#elif defined(__CYGWIN__)
# ifdef __STRICT_ANSI__
char *realpath (const char *, char *);
int putenv (char *);
int setenv (const char *, const char *, int);
# endif
/* #elif defined (other platforms) ... */
#endif
/* portability defines, excluding path handling macros */
#if defined(_MSC_VER)
# define setmode _setmode
# define stat _stat
# define chmod _chmod
# define getcwd _getcwd
# define putenv _putenv
# define S_IXUSR _S_IEXEC
# ifndef _INTPTR_T_DEFINED
# define _INTPTR_T_DEFINED
# define intptr_t int
# endif
#elif defined(__MINGW32__)
# define setmode _setmode
# define stat _stat
# define chmod _chmod
# define getcwd _getcwd
# define putenv _putenv
#elif defined(__CYGWIN__)
# define HAVE_SETENV
# define FOPEN_WB "wb"
/* #elif defined (other platforms) ... */
#endif
#if defined(PATH_MAX)
# define LT_PATHMAX PATH_MAX
#elif defined(MAXPATHLEN)
# define LT_PATHMAX MAXPATHLEN
#else
# define LT_PATHMAX 1024
#endif
#ifndef S_IXOTH
# define S_IXOTH 0
#endif
#ifndef S_IXGRP
# define S_IXGRP 0
#endif
/* path handling portability macros */
#ifndef DIR_SEPARATOR
# define DIR_SEPARATOR '/'
# define PATH_SEPARATOR ':'
#endif
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
defined (__OS2__)
# define HAVE_DOS_BASED_FILE_SYSTEM
# define FOPEN_WB "wb"
# ifndef DIR_SEPARATOR_2
# define DIR_SEPARATOR_2 '\\'
# endif
# ifndef PATH_SEPARATOR_2
# define PATH_SEPARATOR_2 ';'
# endif
#endif
#ifndef DIR_SEPARATOR_2
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
#else /* DIR_SEPARATOR_2 */
# define IS_DIR_SEPARATOR(ch) \
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
#endif /* DIR_SEPARATOR_2 */
#ifndef PATH_SEPARATOR_2
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
#else /* PATH_SEPARATOR_2 */
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
#endif /* PATH_SEPARATOR_2 */
#ifndef FOPEN_WB
# define FOPEN_WB "w"
#endif
#ifndef _O_BINARY
# define _O_BINARY 0
#endif
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
#define XFREE(stale) do { \
if (stale) { free ((void *) stale); stale = 0; } \
} while (0)
#if defined(LT_DEBUGWRAPPER)
static int lt_debug = 1;
#else
static int lt_debug = 0;
#endif
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
void *xmalloc (size_t num);
char *xstrdup (const char *string);
const char *base_name (const char *name);
char *find_executable (const char *wrapper);
char *chase_symlinks (const char *pathspec);
int make_executable (const char *path);
int check_executable (const char *path);
char *strendzap (char *str, const char *pat);
void lt_debugprintf (const char *file, int line, const char *fmt, ...);
void lt_fatal (const char *file, int line, const char *message, ...);
static const char *nonnull (const char *s);
static const char *nonempty (const char *s);
void lt_setenv (const char *name, const char *value);
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
void lt_update_exe_path (const char *name, const char *value);
void lt_update_lib_path (const char *name, const char *value);
char **prepare_spawn (char **argv);
void lt_dump_script (FILE *f);
EOF
cat <<EOF
volatile const char * MAGIC_EXE = "$magic_exe";
const char * LIB_PATH_VARNAME = "$shlibpath_var";
EOF
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
func_to_host_path "$temp_rpath"
cat <<EOF
const char * LIB_PATH_VALUE = "$func_to_host_path_result";
EOF
else
cat <<"EOF"
const char * LIB_PATH_VALUE = "";
EOF
fi
if test -n "$dllsearchpath"; then
func_to_host_path "$dllsearchpath:"
cat <<EOF
const char * EXE_PATH_VARNAME = "PATH";
const char * EXE_PATH_VALUE = "$func_to_host_path_result";
EOF
else
cat <<"EOF"
const char * EXE_PATH_VARNAME = "";
const char * EXE_PATH_VALUE = "";
EOF
fi
if test "$fast_install" = yes; then
cat <<EOF
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
EOF
else
cat <<EOF
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
EOF
fi
cat <<"EOF"
#define LTWRAPPER_OPTION_PREFIX "--lt-"
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
int
main (int argc, char *argv[])
{
char **newargz;
int newargc;
char *tmp_pathspec;
char *actual_cwrapper_path;
char *actual_cwrapper_name;
char *target_name;
char *lt_argv_zero;
intptr_t rval = 127;
int i;
program_name = (char *) xstrdup (base_name (argv[0]));
newargz = XMALLOC (char *, argc + 1);
/* very simple arg parsing; don't want to rely on getopt
* also, copy all non cwrapper options to newargz, except
* argz[0], which is handled differently
*/
newargc=0;
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], dumpscript_opt) == 0)
{
EOF
case "$host" in
*mingw* | *cygwin* )
# make stdout use "unix" line endings
echo " setmode(1,_O_BINARY);"
;;
esac
cat <<"EOF"
lt_dump_script (stdout);
return 0;
}
if (strcmp (argv[i], debug_opt) == 0)
{
lt_debug = 1;
continue;
}
if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
{
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
namespace, but it is not one of the ones we know about and
have already dealt with, above (inluding dump-script), then
report an error. Otherwise, targets might begin to believe
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
namespace. The first time any user complains about this, we'll
need to make LTWRAPPER_OPTION_PREFIX a configure-time option
or a configure.ac-settable value.
*/
lt_fatal (__FILE__, __LINE__,
"unrecognized %s option: '%s'",
ltwrapper_option_prefix, argv[i]);
}
/* otherwise ... */
newargz[++newargc] = xstrdup (argv[i]);
}
newargz[++newargc] = NULL;
EOF
cat <<EOF
/* The GNU banner must be the first non-error debug message */
lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
EOF
cat <<"EOF"
lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
tmp_pathspec = find_executable (argv[0]);
if (tmp_pathspec == NULL)
lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
lt_debugprintf (__FILE__, __LINE__,
"(main) found exe (before symlink chase) at: %s\n",
tmp_pathspec);
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
lt_debugprintf (__FILE__, __LINE__,
"(main) found exe (after symlink chase) at: %s\n",
actual_cwrapper_path);
XFREE (tmp_pathspec);
actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
strendzap (actual_cwrapper_path, actual_cwrapper_name);
/* wrapper name transforms */
strendzap (actual_cwrapper_name, ".exe");
tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
XFREE (actual_cwrapper_name);
actual_cwrapper_name = tmp_pathspec;
tmp_pathspec = 0;
/* target_name transforms -- use actual target program name; might have lt- prefix */
target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
strendzap (target_name, ".exe");
tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
XFREE (target_name);
target_name = tmp_pathspec;
tmp_pathspec = 0;
lt_debugprintf (__FILE__, __LINE__,
"(main) libtool target name: %s\n",
target_name);
EOF
cat <<EOF
newargz[0] =
XMALLOC (char, (strlen (actual_cwrapper_path) +
strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
strcpy (newargz[0], actual_cwrapper_path);
strcat (newargz[0], "$objdir");
strcat (newargz[0], "/");
EOF
cat <<"EOF"
/* stop here, and copy so we don't have to do this twice */
tmp_pathspec = xstrdup (newargz[0]);
/* do NOT want the lt- prefix here, so use actual_cwrapper_name */
strcat (newargz[0], actual_cwrapper_name);
/* DO want the lt- prefix here if it exists, so use target_name */
lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
XFREE (tmp_pathspec);
tmp_pathspec = NULL;
EOF
case $host_os in
mingw*)
cat <<"EOF"
{
char* p;
while ((p = strchr (newargz[0], '\\')) != NULL)
{
*p = '/';
}
while ((p = strchr (lt_argv_zero, '\\')) != NULL)
{
*p = '/';
}
}
EOF
;;
esac
cat <<"EOF"
XFREE (target_name);
XFREE (actual_cwrapper_path);
XFREE (actual_cwrapper_name);
lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
lt_setenv ("DUALCASE", "1"); /* for MSK sh */
/* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
because on Windows, both *_VARNAMEs are PATH but uninstalled
libraries must come first. */
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
nonnull (lt_argv_zero));
for (i = 0; i < newargc; i++)
{
lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
i, nonnull (newargz[i]));
}
EOF
case $host_os in
mingw*)
cat <<"EOF"
/* execv doesn't actually work on mingw as expected on unix */
newargz = prepare_spawn (newargz);
rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
if (rval == -1)
{
/* failed to start process */
lt_debugprintf (__FILE__, __LINE__,
"(main) failed to launch target \"%s\": %s\n",
lt_argv_zero, nonnull (strerror (errno)));
return 127;
}
return rval;
EOF
;;
*)
cat <<"EOF"
execv (lt_argv_zero, newargz);
return rval; /* =127, but avoids unused variable warning */
EOF
;;
esac
cat <<"EOF"
}
void *
xmalloc (size_t num)
{
void *p = (void *) malloc (num);
if (!p)
lt_fatal (__FILE__, __LINE__, "memory exhausted");
return p;
}
char *
xstrdup (const char *string)
{
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
string) : NULL;
}
const char *
base_name (const char *name)
{
const char *base;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
/* Skip over the disk name in MSDOS pathnames. */
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
name += 2;
#endif
for (base = name; *name; name++)
if (IS_DIR_SEPARATOR (*name))
base = name + 1;
return base;
}
int
check_executable (const char *path)
{
struct stat st;
lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
nonempty (path));
if ((!path) || (!*path))
return 0;
if ((stat (path, &st) >= 0)
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
return 1;
else
return 0;
}
int
make_executable (const char *path)
{
int rval = 0;
struct stat st;
lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
nonempty (path));
if ((!path) || (!*path))
return 0;
if (stat (path, &st) >= 0)
{
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
}
return rval;
}
/* Searches for the full path of the wrapper. Returns
newly allocated full path name if found, NULL otherwise
Does not chase symlinks, even on platforms that support them.
*/
char *
find_executable (const char *wrapper)
{
int has_slash = 0;
const char *p;
const char *p_next;
/* static buffer for getcwd */
char tmp[LT_PATHMAX + 1];
int tmp_len;
char *concat_name;
lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
nonempty (wrapper));
if ((wrapper == NULL) || (*wrapper == '\0'))
return NULL;
/* Absolute path? */
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
{
concat_name = xstrdup (wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
else
{
#endif
if (IS_DIR_SEPARATOR (wrapper[0]))
{
concat_name = xstrdup (wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
}
#endif
for (p = wrapper; *p; p++)
if (*p == '/')
{
has_slash = 1;
break;
}
if (!has_slash)
{
/* no slashes; search PATH */
const char *path = getenv ("PATH");
if (path != NULL)
{
for (p = path; *p; p = p_next)
{
const char *q;
size_t p_len;
for (q = p; *q; q++)
if (IS_PATH_SEPARATOR (*q))
break;
p_len = q - p;
p_next = (*q == '\0' ? q : q + 1);
if (p_len == 0)
{
/* empty path: current directory */
if (getcwd (tmp, LT_PATHMAX) == NULL)
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
nonnull (strerror (errno)));
tmp_len = strlen (tmp);
concat_name =
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, tmp, tmp_len);
concat_name[tmp_len] = '/';
strcpy (concat_name + tmp_len + 1, wrapper);
}
else
{
concat_name =
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, p, p_len);
concat_name[p_len] = '/';
strcpy (concat_name + p_len + 1, wrapper);
}
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
}
/* not found in PATH; assume curdir */
}
/* Relative path | not found in path: prepend cwd */
if (getcwd (tmp, LT_PATHMAX) == NULL)
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
nonnull (strerror (errno)));
tmp_len = strlen (tmp);
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, tmp, tmp_len);
concat_name[tmp_len] = '/';
strcpy (concat_name + tmp_len + 1, wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
return NULL;
}
char *
chase_symlinks (const char *pathspec)
{
#ifndef S_ISLNK
return xstrdup (pathspec);
#else
char buf[LT_PATHMAX];
struct stat s;
char *tmp_pathspec = xstrdup (pathspec);
char *p;
int has_symlinks = 0;
while (strlen (tmp_pathspec) && !has_symlinks)
{
lt_debugprintf (__FILE__, __LINE__,
"checking path component for symlinks: %s\n",
tmp_pathspec);
if (lstat (tmp_pathspec, &s) == 0)
{
if (S_ISLNK (s.st_mode) != 0)
{
has_symlinks = 1;
break;
}
/* search backwards for last DIR_SEPARATOR */
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
p--;
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
{
/* no more DIR_SEPARATORS left */
break;
}
*p = '\0';
}
else
{
lt_fatal (__FILE__, __LINE__,
"error accessing file \"%s\": %s",
tmp_pathspec, nonnull (strerror (errno)));
}
}
XFREE (tmp_pathspec);
if (!has_symlinks)
{
return xstrdup (pathspec);
}
tmp_pathspec = realpath (pathspec, buf);
if (tmp_pathspec == 0)
{
lt_fatal (__FILE__, __LINE__,
"could not follow symlinks for %s", pathspec);
}
return xstrdup (tmp_pathspec);
#endif
}
char *
strendzap (char *str, const char *pat)
{
size_t len, patlen;
assert (str != NULL);
assert (pat != NULL);
len = strlen (str);
patlen = strlen (pat);
if (patlen <= len)
{
str += len - patlen;
if (strcmp (str, pat) == 0)
*str = '\0';
}
return str;
}
void
lt_debugprintf (const char *file, int line, const char *fmt, ...)
{
va_list args;
if (lt_debug)
{
(void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
va_start (args, fmt);
(void) vfprintf (stderr, fmt, args);
va_end (args);
}
}
static void
lt_error_core (int exit_status, const char *file,
int line, const char *mode,
const char *message, va_list ap)
{
fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
vfprintf (stderr, message, ap);
fprintf (stderr, ".\n");
if (exit_status >= 0)
exit (exit_status);
}
void
lt_fatal (const char *file, int line, const char *message, ...)
{
va_list ap;
va_start (ap, message);
lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
va_end (ap);
}
static const char *
nonnull (const char *s)
{
return s ? s : "(null)";
}
static const char *
nonempty (const char *s)
{
return (s && !*s) ? "(empty)" : nonnull (s);
}
void
lt_setenv (const char *name, const char *value)
{
lt_debugprintf (__FILE__, __LINE__,
"(lt_setenv) setting '%s' to '%s'\n",
nonnull (name), nonnull (value));
{
#ifdef HAVE_SETENV
/* always make a copy, for consistency with !HAVE_SETENV */
char *str = xstrdup (value);
setenv (name, str, 1);
#else
int len = strlen (name) + 1 + strlen (value) + 1;
char *str = XMALLOC (char, len);
sprintf (str, "%s=%s", name, value);
if (putenv (str) != EXIT_SUCCESS)
{
XFREE (str);
}
#endif
}
}
char *
lt_extend_str (const char *orig_value, const char *add, int to_end)
{
char *new_value;
if (orig_value && *orig_value)
{
int orig_value_len = strlen (orig_value);
int add_len = strlen (add);
new_value = XMALLOC (char, add_len + orig_value_len + 1);
if (to_end)
{
strcpy (new_value, orig_value);
strcpy (new_value + orig_value_len, add);
}
else
{
strcpy (new_value, add);
strcpy (new_value + add_len, orig_value);
}
}
else
{
new_value = xstrdup (add);
}
return new_value;
}
void
lt_update_exe_path (const char *name, const char *value)
{
lt_debugprintf (__FILE__, __LINE__,
"(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
nonnull (name), nonnull (value));
if (name && *name && value && *value)
{
char *new_value = lt_extend_str (getenv (name), value, 0);
/* some systems can't cope with a ':'-terminated path #' */
int len = strlen (new_value);
while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
{
new_value[len-1] = '\0';
}
lt_setenv (name, new_value);
XFREE (new_value);
}
}
void
lt_update_lib_path (const char *name, const char *value)
{
lt_debugprintf (__FILE__, __LINE__,
"(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
nonnull (name), nonnull (value));
if (name && *name && value && *value)
{
char *new_value = lt_extend_str (getenv (name), value, 0);
lt_setenv (name, new_value);
XFREE (new_value);
}
}
EOF
case $host_os in
mingw*)
cat <<"EOF"
/* Prepares an argument vector before calling spawn().
Note that spawn() does not by itself call the command interpreter
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&v);
v.dwPlatformId == VER_PLATFORM_WIN32_NT;
}) ? "cmd.exe" : "command.com").
Instead it simply concatenates the arguments, separated by ' ', and calls
CreateProcess(). We must quote the arguments since Win32 CreateProcess()
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
special way:
- Space and tab are interpreted as delimiters. They are not treated as
delimiters if they are surrounded by double quotes: "...".
- Unescaped double quotes are removed from the input. Their only effect is
that within double quotes, space and tab are treated like normal
characters.
- Backslashes not followed by double quotes are not special.
- But 2*n+1 backslashes followed by a double quote become
n backslashes followed by a double quote (n >= 0):
\" -> "
\\\" -> \"
\\\\\" -> \\"
*/
#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
char **
prepare_spawn (char **argv)
{
size_t argc;
char **new_argv;
size_t i;
/* Count number of arguments. */
for (argc = 0; argv[argc] != NULL; argc++)
;
/* Allocate new argument vector. */
new_argv = XMALLOC (char *, argc + 1);
/* Put quoted arguments into the new argument vector. */
for (i = 0; i < argc; i++)
{
const char *string = argv[i];
if (string[0] == '\0')
new_argv[i] = xstrdup ("\"\"");
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
{
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
size_t length;
unsigned int backslashes;
const char *s;
char *quoted_string;
char *p;
length = 0;
backslashes = 0;
if (quote_around)
length++;
for (s = string; *s != '\0'; s++)
{
char c = *s;
if (c == '"')
length += backslashes + 1;
length++;
if (c == '\\')
backslashes++;
else
backslashes = 0;
}
if (quote_around)
length += backslashes + 1;
quoted_string = XMALLOC (char, length + 1);
p = quoted_string;
backslashes = 0;
if (quote_around)
*p++ = '"';
for (s = string; *s != '\0'; s++)
{
char c = *s;
if (c == '"')
{
unsigned int j;
for (j = backslashes + 1; j > 0; j--)
*p++ = '\\';
}
*p++ = c;
if (c == '\\')
backslashes++;
else
backslashes = 0;
}
if (quote_around)
{
unsigned int j;
for (j = backslashes; j > 0; j--)
*p++ = '\\';
*p++ = '"';
}
*p = '\0';
new_argv[i] = quoted_string;
}
else
new_argv[i] = (char *) string;
}
new_argv[argc] = NULL;
return new_argv;
}
EOF
;;
esac
cat <<"EOF"
void lt_dump_script (FILE* f)
{
EOF
func_emit_wrapper yes |
$SED -n -e '
s/^\(.\{79\}\)\(..*\)/\1\
\2/
h
s/\([\\"]\)/\\\1/g
s/$/\\n/
s/\([^\n]*\).*/ fputs ("\1", f);/p
g
D'
cat <<"EOF"
}
EOF
}
# end: func_emit_cwrapperexe_src
# func_win32_import_lib_p ARG
# True if ARG is an import lib, as indicated by $file_magic_cmd
func_win32_import_lib_p ()
{
$opt_debug
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
*import*) : ;;
*) false ;;
esac
}
# func_mode_link arg...
func_mode_link ()
{
$opt_debug
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
# It is impossible to link a dll without this setting, and
# we shouldn't force the makefile maintainer to figure out
# which system we are compiling for in order to pass an extra
# flag for every libtool invocation.
# allow_undefined=no
# FIXME: Unfortunately, there are problems with the above when trying
# to make a dll which has undefined symbols, in which case not
# even a static library is built. For now, we need to specify
# -no-undefined on the libtool link line when we can be certain
# that all symbols are satisfied, otherwise we get a static library.
allow_undefined=yes
;;
*)
allow_undefined=yes
;;
esac
libtool_args=$nonopt
base_compile="$nonopt $@"
compile_command=$nonopt
finalize_command=$nonopt
compile_rpath=
finalize_rpath=
compile_shlibpath=
finalize_shlibpath=
convenience=
old_convenience=
deplibs=
old_deplibs=
compiler_flags=
linker_flags=
dllsearchpath=
lib_search_path=`pwd`
inst_prefix_dir=
new_inherited_linker_flags=
avoid_version=no
bindir=
dlfiles=
dlprefiles=
dlself=no
export_dynamic=no
export_symbols=
export_symbols_regex=
generated=
libobjs=
ltlibs=
module=no
no_install=no
objs=
non_pic_objects=
precious_files_regex=
prefer_static_libs=no
preload=no
prev=
prevarg=
release=
rpath=
xrpath=
perm_rpath=
temp_rpath=
thread_safe=no
vinfo=
vinfo_number=no
weak_libs=
single_module="${wl}-single_module"
func_infer_tag $base_compile
# We need to know -static, to get the right output filenames.
for arg
do
case $arg in
-shared)
test "$build_libtool_libs" != yes && \
func_fatal_configuration "can not build a shared library"
build_old_libs=no
break
;;
-all-static | -static | -static-libtool-libs)
case $arg in
-all-static)
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
func_warning "complete static linking is impossible in this configuration"
fi
if test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=yes
;;
-static)
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=built
;;
-static-libtool-libs)
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=yes
;;
esac
build_libtool_libs=no
build_old_libs=yes
break
;;
esac
done
# See if our shared archives depend on static archives.
test -n "$old_archive_from_new_cmds" && build_old_libs=yes
# Go through the arguments, transforming them on the way.
while test "$#" -gt 0; do
arg="$1"
shift
func_quote_for_eval "$arg"
qarg=$func_quote_for_eval_unquoted_result
func_append libtool_args " $func_quote_for_eval_result"
# If the previous option needs an argument, assign it.
if test -n "$prev"; then
case $prev in
output)
func_append compile_command " @OUTPUT@"
func_append finalize_command " @OUTPUT@"
;;
esac
case $prev in
bindir)
bindir="$arg"
prev=
continue
;;
dlfiles|dlprefiles)
if test "$preload" = no; then
# Add the symbol object into the linking commands.
func_append compile_command " @SYMFILE@"
func_append finalize_command " @SYMFILE@"
preload=yes
fi
case $arg in
*.la | *.lo) ;; # We handle these cases below.
force)
if test "$dlself" = no; then
dlself=needless
export_dynamic=yes
fi
prev=
continue
;;
self)
if test "$prev" = dlprefiles; then
dlself=yes
elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
dlself=yes
else
dlself=needless
export_dynamic=yes
fi
prev=
continue
;;
*)
if test "$prev" = dlfiles; then
func_append dlfiles " $arg"
else
func_append dlprefiles " $arg"
fi
prev=
continue
;;
esac
;;
expsyms)
export_symbols="$arg"
test -f "$arg" \
|| func_fatal_error "symbol file \`$arg' does not exist"
prev=
continue
;;
expsyms_regex)
export_symbols_regex="$arg"
prev=
continue
;;
framework)
case $host in
*-*-darwin*)
case "$deplibs " in
*" $qarg.ltframework "*) ;;
*) func_append deplibs " $qarg.ltframework" # this is fixed later
;;
esac
;;
esac
prev=
continue
;;
inst_prefix)
inst_prefix_dir="$arg"
prev=
continue
;;
objectlist)
if test -f "$arg"; then
save_arg=$arg
moreargs=
for fil in `cat "$save_arg"`
do
# func_append moreargs " $fil"
arg=$fil
# A libtool-controlled object.
# Check to see that this really is a libtool object.
if func_lalib_unsafe_p "$arg"; then
pic_object=
non_pic_object=
# Read the .lo file
func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
test "$pic_object" = none &&
test "$non_pic_object" = none; then
func_fatal_error "cannot find name of object for \`$arg'"
fi
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
pic_object="$xdir$pic_object"
if test "$prev" = dlfiles; then
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
func_append dlfiles " $pic_object"
prev=
continue
else
# If libtool objects are unsupported, then we need to preload.
prev=dlprefiles
fi
fi
# CHECK ME: I think I busted this. -Ossama
if test "$prev" = dlprefiles; then
# Preload the old-style object.
func_append dlprefiles " $pic_object"
prev=
fi
# A PIC object.
func_append libobjs " $pic_object"
arg="$pic_object"
fi
# Non-PIC object.
if test "$non_pic_object" != none; then
# Prepend the subdirectory the object is found in.
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
else
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
func_append non_pic_objects " $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
if $opt_dry_run; then
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
func_lo2o "$arg"
pic_object=$xdir$objdir/$func_lo2o_result
non_pic_object=$xdir$func_lo2o_result
func_append libobjs " $pic_object"
func_append non_pic_objects " $non_pic_object"
else
func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
done
else
func_fatal_error "link input file \`$arg' does not exist"
fi
arg=$save_arg
prev=
continue
;;
precious_regex)
precious_files_regex="$arg"
prev=
continue
;;
release)
release="-$arg"
prev=
continue
;;
rpath | xrpath)
# We need an absolute path.
case $arg in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
func_fatal_error "only absolute run-paths are allowed"
;;
esac
if test "$prev" = rpath; then
case "$rpath " in
*" $arg "*) ;;
*) func_append rpath " $arg" ;;
esac
else
case "$xrpath " in
*" $arg "*) ;;
*) func_append xrpath " $arg" ;;
esac
fi
prev=
continue
;;
shrext)
shrext_cmds="$arg"
prev=
continue
;;
weak)
func_append weak_libs " $arg"
prev=
continue
;;
xcclinker)
func_append linker_flags " $qarg"
func_append compiler_flags " $qarg"
prev=
func_append compile_command " $qarg"
func_append finalize_command " $qarg"
continue
;;
xcompiler)
func_append compiler_flags " $qarg"
prev=
func_append compile_command " $qarg"
func_append finalize_command " $qarg"
continue
;;
xlinker)
func_append linker_flags " $qarg"
func_append compiler_flags " $wl$qarg"
prev=
func_append compile_command " $wl$qarg"
func_append finalize_command " $wl$qarg"
continue
;;
*)
eval "$prev=\"\$arg\""
prev=
continue
;;
esac
fi # test -n "$prev"
prevarg="$arg"
case $arg in
-all-static)
if test -n "$link_static_flag"; then
# See comment for -static flag below, for more details.
func_append compile_command " $link_static_flag"
func_append finalize_command " $link_static_flag"
fi
continue
;;
-allow-undefined)
# FIXME: remove this flag sometime in the future.
func_fatal_error "\`-allow-undefined' must not be used because it is the default"
;;
-avoid-version)
avoid_version=yes
continue
;;
-bindir)
prev=bindir
continue
;;
-dlopen)
prev=dlfiles
continue
;;
-dlpreopen)
prev=dlprefiles
continue
;;
-export-dynamic)
export_dynamic=yes
continue
;;
-export-symbols | -export-symbols-regex)
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
func_fatal_error "more than one -exported-symbols argument is not allowed"
fi
if test "X$arg" = "X-export-symbols"; then
prev=expsyms
else
prev=expsyms_regex
fi
continue
;;
-framework)
prev=framework
continue
;;
-inst-prefix-dir)
prev=inst_prefix
continue
;;
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
# so, if we see these flags be careful not to treat them like -L
-L[A-Z][A-Z]*:*)
case $with_gcc/$host in
no/*-*-irix* | /*-*-irix*)
func_append compile_command " $arg"
func_append finalize_command " $arg"
;;
esac
continue
;;
-L*)
func_stripname "-L" '' "$arg"
if test -z "$func_stripname_result"; then
if test "$#" -gt 0; then
func_fatal_error "require no space between \`-L' and \`$1'"
else
func_fatal_error "need path for \`-L' option"
fi
fi
func_resolve_sysroot "$func_stripname_result"
dir=$func_resolve_sysroot_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
absdir=`cd "$dir" && pwd`
test -z "$absdir" && \
func_fatal_error "cannot determine absolute directory name of \`$dir'"
dir="$absdir"
;;
esac
case "$deplibs " in
*" -L$dir "* | *" $arg "*)
# Will only happen for absolute or sysroot arguments
;;
*)
# Preserve sysroot, but never include relative directories
case $dir in
[\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
*) func_append deplibs " -L$dir" ;;
esac
func_append lib_search_path " $dir"
;;
esac
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
::) dllsearchpath=$dir;;
*) func_append dllsearchpath ":$dir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
::) dllsearchpath=$testbindir;;
*) func_append dllsearchpath ":$testbindir";;
esac
;;
esac
continue
;;
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
# These systems don't actually have a C or math library (as such)
continue
;;
*-*-os2*)
# These systems don't actually have a C library (as such)
test "X$arg" = "X-lc" && continue
;;
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C and math libraries are in the System framework
func_append deplibs " System.ltframework"
continue
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
test "X$arg" = "X-lc" && continue
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
test "X$arg" = "X-lc" && continue
;;
esac
elif test "X$arg" = "X-lc_r"; then
case $host in
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc_r directly, use -pthread flag.
continue
;;
esac
fi
func_append deplibs " $arg"
continue
;;
-module)
module=yes
continue
;;
# Tru64 UNIX uses -model [arg] to determine the layout of C++
# classes, name mangling, and exception handling.
# Darwin uses the -arch flag to determine output architecture.
-model|-arch|-isysroot|--sysroot)
func_append compiler_flags " $arg"
func_append compile_command " $arg"
func_append finalize_command " $arg"
prev=xcompiler
continue
;;
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
func_append compiler_flags " $arg"
func_append compile_command " $arg"
func_append finalize_command " $arg"
case "$new_inherited_linker_flags " in
*" $arg "*) ;;
* ) func_append new_inherited_linker_flags " $arg" ;;
esac
continue
;;
-multi_module)
single_module="${wl}-multi_module"
continue
;;
-no-fast-install)
fast_install=no
continue
;;
-no-install)
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
# The PATH hackery in wrapper scripts is required on Windows
# and Darwin in order for the loader to find any dlls it needs.
func_warning "\`-no-install' is ignored for $host"
func_warning "assuming \`-no-fast-install' instead"
fast_install=no
;;
*) no_install=yes ;;
esac
continue
;;
-no-undefined)
allow_undefined=no
continue
;;
-objectlist)
prev=objectlist
continue
;;
-o) prev=output ;;
-precious-files-regex)
prev=precious_regex
continue
;;
-release)
prev=release
continue
;;
-rpath)
prev=rpath
continue
;;
-R)
prev=xrpath
continue
;;
-R*)
func_stripname '-R' '' "$arg"
dir=$func_stripname_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
=*)
func_stripname '=' '' "$dir"
dir=$lt_sysroot$func_stripname_result
;;
*)
func_fatal_error "only absolute run-paths are allowed"
;;
esac
case "$xrpath " in
*" $dir "*) ;;
*) func_append xrpath " $dir" ;;
esac
continue
;;
-shared)
# The effects of -shared are defined in a previous loop.
continue
;;
-shrext)
prev=shrext
continue
;;
-static | -static-libtool-libs)
# The effects of -static are defined in a previous loop.
# We used to do the same as -all-static on platforms that
# didn't have a PIC flag, but the assumption that the effects
# would be equivalent was wrong. It would break on at least
# Digital Unix and AIX.
continue
;;
-thread-safe)
thread_safe=yes
continue
;;
-version-info)
prev=vinfo
continue
;;
-version-number)
prev=vinfo
vinfo_number=yes
continue
;;
-weak)
prev=weak
continue
;;
-Wc,*)
func_stripname '-Wc,' '' "$arg"
args=$func_stripname_result
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
func_quote_for_eval "$flag"
func_append arg " $func_quote_for_eval_result"
func_append compiler_flags " $func_quote_for_eval_result"
done
IFS="$save_ifs"
func_stripname ' ' '' "$arg"
arg=$func_stripname_result
;;
-Wl,*)
func_stripname '-Wl,' '' "$arg"
args=$func_stripname_result
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
func_quote_for_eval "$flag"
func_append arg " $wl$func_quote_for_eval_result"
func_append compiler_flags " $wl$func_quote_for_eval_result"
func_append linker_flags " $func_quote_for_eval_result"
done
IFS="$save_ifs"
func_stripname ' ' '' "$arg"
arg=$func_stripname_result
;;
-Xcompiler)
prev=xcompiler
continue
;;
-Xlinker)
prev=xlinker
continue
;;
-XCClinker)
prev=xcclinker
continue
;;
# -msg_* for osf cc
-msg_*)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
# Flags to be passed through unchanged, with rationale:
# -64, -mips[0-9] enable 64-bit mode for the SGI compiler
# -r[0-9][0-9]* specify processor for the SGI compiler
# -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
# +DA*, +DD* enable 64-bit mode for the HP compiler
# -q* compiler args for the IBM compiler
# -m*, -t[45]*, -txscale* architecture-specific flags for GCC
# -F/path path to uninstalled frameworks, gcc on darwin
# -p, -pg, --coverage, -fprofile-* profiling flags for GCC
# @file GCC response files
# -tp=* Portland pgcc target processor selection
# --sysroot=* for sysroot support
# -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-O*|-flto*|-fwhopr*|-fuse-linker-plugin)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
func_append compile_command " $arg"
func_append finalize_command " $arg"
func_append compiler_flags " $arg"
continue
;;
# Some other compiler flag.
-* | +*)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
*.$objext)
# A standard object.
func_append objs " $arg"
;;
*.lo)
# A libtool-controlled object.
# Check to see that this really is a libtool object.
if func_lalib_unsafe_p "$arg"; then
pic_object=
non_pic_object=
# Read the .lo file
func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
test "$pic_object" = none &&
test "$non_pic_object" = none; then
func_fatal_error "cannot find name of object for \`$arg'"
fi
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
pic_object="$xdir$pic_object"
if test "$prev" = dlfiles; then
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
func_append dlfiles " $pic_object"
prev=
continue
else
# If libtool objects are unsupported, then we need to preload.
prev=dlprefiles
fi
fi
# CHECK ME: I think I busted this. -Ossama
if test "$prev" = dlprefiles; then
# Preload the old-style object.
func_append dlprefiles " $pic_object"
prev=
fi
# A PIC object.
func_append libobjs " $pic_object"
arg="$pic_object"
fi
# Non-PIC object.
if test "$non_pic_object" != none; then
# Prepend the subdirectory the object is found in.
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
else
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
func_append non_pic_objects " $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
if $opt_dry_run; then
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
func_lo2o "$arg"
pic_object=$xdir$objdir/$func_lo2o_result
non_pic_object=$xdir$func_lo2o_result
func_append libobjs " $pic_object"
func_append non_pic_objects " $non_pic_object"
else
func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
;;
*.$libext)
# An archive.
func_append deplibs " $arg"
func_append old_deplibs " $arg"
continue
;;
*.la)
# A libtool-controlled library.
func_resolve_sysroot "$arg"
if test "$prev" = dlfiles; then
# This library was specified with -dlopen.
func_append dlfiles " $func_resolve_sysroot_result"
prev=
elif test "$prev" = dlprefiles; then
# The library was specified with -dlpreopen.
func_append dlprefiles " $func_resolve_sysroot_result"
prev=
else
func_append deplibs " $func_resolve_sysroot_result"
fi
continue
;;
# Some other compiler argument.
*)
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
esac # arg
# Now actually substitute the argument into the commands.
if test -n "$arg"; then
func_append compile_command " $arg"
func_append finalize_command " $arg"
fi
done # argument parsing loop
test -n "$prev" && \
func_fatal_help "the \`$prevarg' option requires an argument"
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
eval arg=\"$export_dynamic_flag_spec\"
func_append compile_command " $arg"
func_append finalize_command " $arg"
fi
oldlibs=
# calculate the name of the file, without its directory
func_basename "$output"
outputname="$func_basename_result"
libobjs_save="$libobjs"
if test -n "$shlibpath_var"; then
# get the directories listed in $shlibpath_var
eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
else
shlib_search_path=
fi
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
func_dirname "$output" "/" ""
output_objdir="$func_dirname_result$objdir"
func_to_tool_file "$output_objdir/"
tool_output_objdir=$func_to_tool_file_result
# Create the object directory.
func_mkdir_p "$output_objdir"
# Determine the type of output
case $output in
"")
func_fatal_help "you must specify an output file"
;;
*.$libext) linkmode=oldlib ;;
*.lo | *.$objext) linkmode=obj ;;
*.la) linkmode=lib ;;
*) linkmode=prog ;; # Anything else should be a program.
esac
specialdeplibs=
libs=
# Find all interdependent deplibs by searching for libraries
# that are linked more than once (e.g. -la -lb -la)
for deplib in $deplibs; do
if $opt_preserve_dup_deps ; then
case "$libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append libs " $deplib"
done
if test "$linkmode" = lib; then
libs="$predeps $libs $compiler_lib_search_path $postdeps"
# Compute libraries that are listed more than once in $predeps
# $postdeps and mark them as special (i.e., whose duplicates are
# not to be eliminated).
pre_post_deps=
if $opt_duplicate_compiler_generated_deps; then
for pre_post_dep in $predeps $postdeps; do
case "$pre_post_deps " in
*" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
esac
func_append pre_post_deps " $pre_post_dep"
done
fi
pre_post_deps=
fi
deplibs=
newdependency_libs=
newlib_search_path=
need_relink=no # whether we're linking any uninstalled libtool libraries
notinst_deplibs= # not-installed libtool libraries
notinst_path= # paths that contain not-installed libtool libraries
case $linkmode in
lib)
passes="conv dlpreopen link"
for file in $dlfiles $dlprefiles; do
case $file in
*.la) ;;
*)
func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
;;
esac
done
;;
prog)
compile_deplibs=
finalize_deplibs=
alldeplibs=no
newdlfiles=
newdlprefiles=
passes="conv scan dlopen dlpreopen link"
;;
*) passes="conv"
;;
esac
for pass in $passes; do
# The preopen pass in lib mode reverses $deplibs; put it back here
# so that -L comes before libs that need it for instance...
if test "$linkmode,$pass" = "lib,link"; then
## FIXME: Find the place where the list is rebuilt in the wrong
## order, and fix it there properly
tmp_deplibs=
for deplib in $deplibs; do
tmp_deplibs="$deplib $tmp_deplibs"
done
deplibs="$tmp_deplibs"
fi
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan"; then
libs="$deplibs"
deplibs=
fi
if test "$linkmode" = prog; then
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
link)
libs="$deplibs %DEPLIBS%"
test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
;;
esac
fi
if test "$linkmode,$pass" = "lib,dlpreopen"; then
# Collect and forward deplibs of preopened libtool libs
for lib in $dlprefiles; do
# Ignore non-libtool-libs
dependency_libs=
func_resolve_sysroot "$lib"
case $lib in
*.la) func_source "$func_resolve_sysroot_result" ;;
esac
# Collect preopened libtool deplibs, except any this library
# has declared as weak libs
for deplib in $dependency_libs; do
func_basename "$deplib"
deplib_base=$func_basename_result
case " $weak_libs " in
*" $deplib_base "*) ;;
*) func_append deplibs " $deplib" ;;
esac
done
done
libs="$dlprefiles"
fi
if test "$pass" = dlopen; then
# Collect dlpreopened libraries
save_deplibs="$deplibs"
deplibs=
fi
for deplib in $libs; do
lib=
found=no
case $deplib in
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
func_append compiler_flags " $deplib"
if test "$linkmode" = lib ; then
case "$new_inherited_linker_flags " in
*" $deplib "*) ;;
* ) func_append new_inherited_linker_flags " $deplib" ;;
esac
fi
fi
continue
;;
-l*)
if test "$linkmode" != lib && test "$linkmode" != prog; then
func_warning "\`-l' is ignored for archives/objects"
continue
fi
func_stripname '-l' '' "$deplib"
name=$func_stripname_result
if test "$linkmode" = lib; then
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
else
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
fi
for searchdir in $searchdirs; do
for search_ext in .la $std_shrext .so .a; do
# Search the libtool library
lib="$searchdir/lib${name}${search_ext}"
if test -f "$lib"; then
if test "$search_ext" = ".la"; then
found=yes
else
found=no
fi
break 2
fi
done
done
if test "$found" != yes; then
# deplib doesn't seem to be a libtool library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
fi
continue
else # deplib is a libtool library
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
# We need to do some special things here, and not later.
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $deplib "*)
if func_lalib_p "$lib"; then
library_names=
old_library=
func_source "$lib"
for l in $old_library $library_names; do
ll="$l"
done
if test "X$ll" = "X$old_library" ; then # only static version available
found=no
func_dirname "$lib" "" "."
ladir="$func_dirname_result"
lib=$ladir/$old_library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
fi
continue
fi
fi
;;
*) ;;
esac
fi
fi
;; # -l
*.ltframework)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
if test "$linkmode" = lib ; then
case "$new_inherited_linker_flags " in
*" $deplib "*) ;;
* ) func_append new_inherited_linker_flags " $deplib" ;;
esac
fi
fi
continue
;;
-L*)
case $linkmode in
lib)
deplibs="$deplib $deplibs"
test "$pass" = conv && continue
newdependency_libs="$deplib $newdependency_libs"
func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
func_append newlib_search_path " $func_resolve_sysroot_result"
;;
prog)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
if test "$pass" = scan; then
deplibs="$deplib $deplibs"
else
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
func_append newlib_search_path " $func_resolve_sysroot_result"
;;
*)
func_warning "\`-L' is ignored for archives/objects"
;;
esac # linkmode
continue
;; # -L
-R*)
if test "$pass" = link; then
func_stripname '-R' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
dir=$func_resolve_sysroot_result
# Make sure the xrpath contains only unique directories.
case "$xrpath " in
*" $dir "*) ;;
*) func_append xrpath " $dir" ;;
esac
fi
deplibs="$deplib $deplibs"
continue
;;
*.la)
func_resolve_sysroot "$deplib"
lib=$func_resolve_sysroot_result
;;
*.$libext)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
case $linkmode in
lib)
# Linking convenience modules into shared libraries is allowed,
# but linking other static libraries is non-portable.
case " $dlpreconveniencelibs " in
*" $deplib "*) ;;
*)
valid_a_lib=no
case $deplibs_check_method in
match_pattern*)
set dummy $deplibs_check_method; shift
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
| $EGREP "$match_pattern_regex" > /dev/null; then
valid_a_lib=yes
fi
;;
pass_all)
valid_a_lib=yes
;;
esac
if test "$valid_a_lib" != yes; then
echo
$ECHO "*** Warning: Trying to link with static lib archive $deplib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because the file extensions .$libext of this argument makes me believe"
echo "*** that it is just a static archive that I should not use here."
else
echo
$ECHO "*** Warning: Linking the shared library $output against the"
$ECHO "*** static library $deplib is not portable!"
deplibs="$deplib $deplibs"
fi
;;
esac
continue
;;
prog)
if test "$pass" != link; then
deplibs="$deplib $deplibs"
else
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
continue
;;
esac # linkmode
;; # *.$libext
*.lo | *.$objext)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
elif test "$linkmode" = prog; then
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
# If there is no dlopen support or we're linking statically,
# we need to preload.
func_append newdlprefiles " $deplib"
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
func_append newdlfiles " $deplib"
fi
fi
continue
;;
%DEPLIBS%)
alldeplibs=yes
continue
;;
esac # case $deplib
if test "$found" = yes || test -f "$lib"; then :
else
func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
fi
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$lib" \
|| func_fatal_error "\`$lib' is not a valid libtool archive"
func_dirname "$lib" "" "."
ladir="$func_dirname_result"
dlname=
dlopen=
dlpreopen=
libdir=
library_names=
old_library=
inherited_linker_flags=
# If the library was installed with an old release of libtool,
# it will not redefine variables installed, or shouldnotlink
installed=yes
shouldnotlink=no
avoidtemprpath=
# Read the .la file
func_source "$lib"
# Convert "-framework foo" to "foo.ltframework"
if test -n "$inherited_linker_flags"; then
tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
case " $new_inherited_linker_flags " in
*" $tmp_inherited_linker_flag "*) ;;
*) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
esac
done
fi
dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan" ||
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
test -n "$dlopen" && func_append dlfiles " $dlopen"
test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
fi
if test "$pass" = conv; then
# Only check for convenience libraries
deplibs="$lib $deplibs"
if test -z "$libdir"; then
if test -z "$old_library"; then
func_fatal_error "cannot find name of link library for \`$lib'"
fi
# It is a libtool convenience library, so add in its objects.
func_append convenience " $ladir/$objdir/$old_library"
func_append old_convenience " $ladir/$objdir/$old_library"
tmp_libs=
for deplib in $dependency_libs; do
deplibs="$deplib $deplibs"
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append tmp_libs " $deplib"
done
elif test "$linkmode" != prog && test "$linkmode" != lib; then
func_fatal_error "\`$lib' is not a convenience library"
fi
continue
fi # $pass = conv
# Get the name of the library we link against.
linklib=
if test -n "$old_library" &&
{ test "$prefer_static_libs" = yes ||
test "$prefer_static_libs,$installed" = "built,no"; }; then
linklib=$old_library
else
for l in $old_library $library_names; do
linklib="$l"
done
fi
if test -z "$linklib"; then
func_fatal_error "cannot find name of link library for \`$lib'"
fi
# This library was specified with -dlopen.
if test "$pass" = dlopen; then
if test -z "$libdir"; then
func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
fi
if test -z "$dlname" ||
test "$dlopen_support" != yes ||
test "$build_libtool_libs" = no; then
# If there is no dlname, no dlopen support or we're linking
# statically, we need to preload. We also need to preload any
# dependent libraries so libltdl's deplib preloader doesn't
# bomb out in the load deplibs phase.
func_append dlprefiles " $lib $dependency_libs"
else
func_append newdlfiles " $lib"
fi
continue
fi # $pass = dlopen
# We need an absolute path.
case $ladir in
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
*)
abs_ladir=`cd "$ladir" && pwd`
if test -z "$abs_ladir"; then
func_warning "cannot determine absolute directory name of \`$ladir'"
func_warning "passing it literally to the linker, although it might fail"
abs_ladir="$ladir"
fi
;;
esac
func_basename "$lib"
laname="$func_basename_result"
# Find the relevant object directory and library name.
if test "X$installed" = Xyes; then
if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
func_warning "library \`$lib' was moved."
dir="$ladir"
absdir="$abs_ladir"
libdir="$abs_ladir"
else
dir="$lt_sysroot$libdir"
absdir="$lt_sysroot$libdir"
fi
test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
else
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
dir="$ladir"
absdir="$abs_ladir"
# Remove this search path later
func_append notinst_path " $abs_ladir"
else
dir="$ladir/$objdir"
absdir="$abs_ladir/$objdir"
# Remove this search path later
func_append notinst_path " $abs_ladir"
fi
fi # $installed = yes
func_stripname 'lib' '.la' "$laname"
name=$func_stripname_result
# This library was specified with -dlpreopen.
if test "$pass" = dlpreopen; then
if test -z "$libdir" && test "$linkmode" = prog; then
func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
fi
case "$host" in
# special handling for platforms with PE-DLLs.
*cygwin* | *mingw* | *cegcc* )
# Linker will automatically link against shared library if both
# static and shared are present. Therefore, ensure we extract
# symbols from the import library if a shared library is present
# (otherwise, the dlopen module name will be incorrect). We do
# this by putting the import library name into $newdlprefiles.
# We recover the dlopen module name by 'saving' the la file
# name in a special purpose variable, and (later) extracting the
# dlname from the la file.
if test -n "$dlname"; then
func_tr_sh "$dir/$linklib"
eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
func_append newdlprefiles " $dir/$linklib"
else
func_append newdlprefiles " $dir/$old_library"
# Keep a list of preopened convenience libraries to check
# that they are being used correctly in the link pass.
test -z "$libdir" && \
func_append dlpreconveniencelibs " $dir/$old_library"
fi
;;
* )
# Prefer using a static library (so that no silly _DYNAMIC symbols
# are required to link).
if test -n "$old_library"; then
func_append newdlprefiles " $dir/$old_library"
# Keep a list of preopened convenience libraries to check
# that they are being used correctly in the link pass.
test -z "$libdir" && \
func_append dlpreconveniencelibs " $dir/$old_library"
# Otherwise, use the dlname, so that lt_dlopen finds it.
elif test -n "$dlname"; then
func_append newdlprefiles " $dir/$dlname"
else
func_append newdlprefiles " $dir/$linklib"
fi
;;
esac
fi # $pass = dlpreopen
if test -z "$libdir"; then
# Link the convenience library
if test "$linkmode" = lib; then
deplibs="$dir/$old_library $deplibs"
elif test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$dir/$old_library $compile_deplibs"
finalize_deplibs="$dir/$old_library $finalize_deplibs"
else
deplibs="$lib $deplibs" # used for prog,scan pass
fi
continue
fi
if test "$linkmode" = prog && test "$pass" != link; then
func_append newlib_search_path " $ladir"
deplibs="$lib $deplibs"
linkalldeplibs=no
if test "$link_all_deplibs" != no || test -z "$library_names" ||
test "$build_libtool_libs" = no; then
linkalldeplibs=yes
fi
tmp_libs=
for deplib in $dependency_libs; do
case $deplib in
-L*) func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
func_append newlib_search_path " $func_resolve_sysroot_result"
;;
esac
# Need to link against all dependency_libs?
if test "$linkalldeplibs" = yes; then
deplibs="$deplib $deplibs"
else
# Need to hardcode shared library paths
# or/and link against static libraries
newdependency_libs="$deplib $newdependency_libs"
fi
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append tmp_libs " $deplib"
done # for deplib
continue
fi # $linkmode = prog...
if test "$linkmode,$pass" = "prog,link"; then
if test -n "$library_names" &&
{ { test "$prefer_static_libs" = no ||
test "$prefer_static_libs,$installed" = "built,yes"; } ||
test -z "$old_library"; }; then
# We need to hardcode the library path
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
# Make sure the rpath contains only unique directories.
case "$temp_rpath:" in
*"$absdir:"*) ;;
*) func_append temp_rpath "$absdir:" ;;
esac
fi
# Hardcode the library path.
# Skip directories that are in the system default run-time
# search path.
case " $sys_lib_dlsearch_path " in
*" $absdir "*) ;;
*)
case "$compile_rpath " in
*" $absdir "*) ;;
*) func_append compile_rpath " $absdir" ;;
esac
;;
esac
case " $sys_lib_dlsearch_path " in
*" $libdir "*) ;;
*)
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
;;
esac
fi # $linkmode,$pass = prog,link...
if test "$alldeplibs" = yes &&
{ test "$deplibs_check_method" = pass_all ||
{ test "$build_libtool_libs" = yes &&
test -n "$library_names"; }; }; then
# We only need to search for static libraries
continue
fi
fi
link_static=no # Whether the deplib will be linked statically
use_static_libs=$prefer_static_libs
if test "$use_static_libs" = built && test "$installed" = yes; then
use_static_libs=no
fi
if test -n "$library_names" &&
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
case $host in
*cygwin* | *mingw* | *cegcc*)
# No point in relinking DLLs because paths are not encoded
func_append notinst_deplibs " $lib"
need_relink=no
;;
*)
if test "$installed" = no; then
func_append notinst_deplibs " $lib"
need_relink=yes
fi
;;
esac
# This is a shared library
# Warn about portability, can't link against -module's on some
# systems (darwin). Don't bleat about dlopened modules though!
dlopenmodule=""
for dlpremoduletest in $dlprefiles; do
if test "X$dlpremoduletest" = "X$lib"; then
dlopenmodule="$dlpremoduletest"
break
fi
done
if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
echo
if test "$linkmode" = prog; then
$ECHO "*** Warning: Linking the executable $output against the loadable module"
else
$ECHO "*** Warning: Linking the shared library $output against the loadable module"
fi
$ECHO "*** $linklib is not portable!"
fi
if test "$linkmode" = lib &&
test "$hardcode_into_libs" = yes; then
# Hardcode the library path.
# Skip directories that are in the system default run-time
# search path.
case " $sys_lib_dlsearch_path " in
*" $absdir "*) ;;
*)
case "$compile_rpath " in
*" $absdir "*) ;;
*) func_append compile_rpath " $absdir" ;;
esac
;;
esac
case " $sys_lib_dlsearch_path " in
*" $libdir "*) ;;
*)
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
;;
esac
fi
if test -n "$old_archive_from_expsyms_cmds"; then
# figure out the soname
set dummy $library_names
shift
realname="$1"
shift
libname=`eval "\\$ECHO \"$libname_spec\""`
# use dlname if we got it. it's perfectly good, no?
if test -n "$dlname"; then
soname="$dlname"
elif test -n "$soname_spec"; then
# bleh windows
case $host in
*cygwin* | mingw* | *cegcc*)
func_arith $current - $age
major=$func_arith_result
versuffix="-$major"
;;
esac
eval soname=\"$soname_spec\"
else
soname="$realname"
fi
# Make a new name for the extract_expsyms_cmds to use
soroot="$soname"
func_basename "$soroot"
soname="$func_basename_result"
func_stripname 'lib' '.dll' "$soname"
newlib=libimp-$func_stripname_result.a
# If the library has no export list, then create one now
if test -f "$output_objdir/$soname-def"; then :
else
func_verbose "extracting exported symbol list from \`$soname'"
func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
fi
# Create $newlib
if test -f "$output_objdir/$newlib"; then :; else
func_verbose "generating import library for \`$soname'"
func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
fi
# make sure the library variables are pointing to the new library
dir=$output_objdir
linklib=$newlib
fi # test -n "$old_archive_from_expsyms_cmds"
if test "$linkmode" = prog || test "$opt_mode" != relink; then
add_shlibpath=
add_dir=
add=
lib_linked=yes
case $hardcode_action in
immediate | unsupported)
if test "$hardcode_direct" = no; then
add="$dir/$linklib"
case $host in
*-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
*-*-sysv4*uw2*) add_dir="-L$dir" ;;
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
*-*-unixware7*) add_dir="-L$dir" ;;
*-*-darwin* )
# if the lib is a (non-dlopened) module then we can not
# link against it, someone is ignoring the earlier warnings
if /usr/bin/file -L $add 2> /dev/null |
$GREP ": [^:]* bundle" >/dev/null ; then
if test "X$dlopenmodule" != "X$lib"; then
$ECHO "*** Warning: lib $linklib is a module, not a shared library"
if test -z "$old_library" ; then
echo
echo "*** And there doesn't seem to be a static archive available"
echo "*** The link will probably fail, sorry"
else
add="$dir/$old_library"
fi
elif test -n "$old_library"; then
add="$dir/$old_library"
fi
fi
esac
elif test "$hardcode_minus_L" = no; then
case $host in
*-*-sunos*) add_shlibpath="$dir" ;;
esac
add_dir="-L$dir"
add="-l$name"
elif test "$hardcode_shlibpath_var" = no; then
add_shlibpath="$dir"
add="-l$name"
else
lib_linked=no
fi
;;
relink)
if test "$hardcode_direct" = yes &&
test "$hardcode_direct_absolute" = no; then
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$absdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
func_append add_dir " -L$inst_prefix_dir$libdir"
;;
esac
fi
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
add_shlibpath="$dir"
add="-l$name"
else
lib_linked=no
fi
;;
*) lib_linked=no ;;
esac
if test "$lib_linked" != yes; then
func_fatal_configuration "unsupported hardcode properties"
fi
if test -n "$add_shlibpath"; then
case :$compile_shlibpath: in
*":$add_shlibpath:"*) ;;
*) func_append compile_shlibpath "$add_shlibpath:" ;;
esac
fi
if test "$linkmode" = prog; then
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
test -n "$add" && compile_deplibs="$add $compile_deplibs"
else
test -n "$add_dir" && deplibs="$add_dir $deplibs"
test -n "$add" && deplibs="$add $deplibs"
if test "$hardcode_direct" != yes &&
test "$hardcode_minus_L" != yes &&
test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
*) func_append finalize_shlibpath "$libdir:" ;;
esac
fi
fi
fi
if test "$linkmode" = prog || test "$opt_mode" = relink; then
add_shlibpath=
add_dir=
add=
# Finalize command for both is simple: just hardcode it.
if test "$hardcode_direct" = yes &&
test "$hardcode_direct_absolute" = no; then
add="$libdir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$libdir"
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
*) func_append finalize_shlibpath "$libdir:" ;;
esac
add="-l$name"
elif test "$hardcode_automatic" = yes; then
if test -n "$inst_prefix_dir" &&
test -f "$inst_prefix_dir$libdir/$linklib" ; then
add="$inst_prefix_dir$libdir/$linklib"
else
add="$libdir/$linklib"
fi
else
# We cannot seem to hardcode it, guess we'll fake it.
add_dir="-L$libdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
func_append add_dir " -L$inst_prefix_dir$libdir"
;;
esac
fi
add="-l$name"
fi
if test "$linkmode" = prog; then
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
else
test -n "$add_dir" && deplibs="$add_dir $deplibs"
test -n "$add" && deplibs="$add $deplibs"
fi
fi
elif test "$linkmode" = prog; then
# Here we assume that one of hardcode_direct or hardcode_minus_L
# is not unsupported. This is valid on all known static and
# shared platforms.
if test "$hardcode_direct" != unsupported; then
test -n "$old_library" && linklib="$old_library"
compile_deplibs="$dir/$linklib $compile_deplibs"
finalize_deplibs="$dir/$linklib $finalize_deplibs"
else
compile_deplibs="-l$name -L$dir $compile_deplibs"
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
fi
elif test "$build_libtool_libs" = yes; then
# Not a shared library
if test "$deplibs_check_method" != pass_all; then
# We're trying link a shared library against a static one
# but the system doesn't support it.
# Just print a warning and add the library to dependency_libs so
# that the program can be linked against the static library.
echo
$ECHO "*** Warning: This system can not link to static lib archive $lib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have."
if test "$module" = yes; then
echo "*** But as you try to build a module library, libtool will still create "
echo "*** a static module, that should work as long as the dlopening application"
echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
if test -z "$global_symbol_pipe"; then
echo
echo "*** However, this would only work if libtool was able to extract symbol"
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
echo "*** not find such a program. So, this module is probably useless."
echo "*** \`nm' from GNU binutils and a full rebuild may help."
fi
if test "$build_old_libs" = no; then
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
fi
else
deplibs="$dir/$old_library $deplibs"
link_static=yes
fi
fi # link shared/static library?
if test "$linkmode" = lib; then
if test -n "$dependency_libs" &&
{ test "$hardcode_into_libs" != yes ||
test "$build_old_libs" = yes ||
test "$link_static" = yes; }; then
# Extract -R from dependency_libs
temp_deplibs=
for libdir in $dependency_libs; do
case $libdir in
-R*) func_stripname '-R' '' "$libdir"
temp_xrpath=$func_stripname_result
case " $xrpath " in
*" $temp_xrpath "*) ;;
*) func_append xrpath " $temp_xrpath";;
esac;;
*) func_append temp_deplibs " $libdir";;
esac
done
dependency_libs="$temp_deplibs"
fi
func_append newlib_search_path " $absdir"
# Link against this library
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
# ... and its dependency_libs
tmp_libs=
for deplib in $dependency_libs; do
newdependency_libs="$deplib $newdependency_libs"
case $deplib in
-L*) func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result";;
*) func_resolve_sysroot "$deplib" ;;
esac
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $func_resolve_sysroot_result "*)
func_append specialdeplibs " $func_resolve_sysroot_result" ;;
esac
fi
func_append tmp_libs " $func_resolve_sysroot_result"
done
if test "$link_all_deplibs" != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
path=
case $deplib in
-L*) path="$deplib" ;;
*.la)
func_resolve_sysroot "$deplib"
deplib=$func_resolve_sysroot_result
func_dirname "$deplib" "" "."
dir=$func_dirname_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
*)
absdir=`cd "$dir" && pwd`
if test -z "$absdir"; then
func_warning "cannot determine absolute directory name of \`$dir'"
absdir="$dir"
fi
;;
esac
if $GREP "^installed=no" $deplib > /dev/null; then
case $host in
*-*-darwin*)
depdepl=
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
if test -n "$deplibrary_names" ; then
for tmp in $deplibrary_names ; do
depdepl=$tmp
done
if test -f "$absdir/$objdir/$depdepl" ; then
depdepl="$absdir/$objdir/$depdepl"
darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
if test -z "$darwin_install_name"; then
darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
fi
func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
path=
fi
fi
;;
*)
path="-L$absdir/$objdir"
;;
esac
else
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
test -z "$libdir" && \
func_fatal_error "\`$deplib' is not a valid libtool archive"
test "$absdir" != "$libdir" && \
func_warning "\`$deplib' seems to be moved"
path="-L$absdir"
fi
;;
esac
case " $deplibs " in
*" $path "*) ;;
*) deplibs="$path $deplibs" ;;
esac
done
fi # link_all_deplibs != no
fi # linkmode = lib
done # for deplib in $libs
if test "$pass" = link; then
if test "$linkmode" = "prog"; then
compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
else
compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
fi
fi
dependency_libs="$newdependency_libs"
if test "$pass" = dlpreopen; then
# Link the dlpreopened libraries before other libraries
for deplib in $save_deplibs; do
deplibs="$deplib $deplibs"
done
fi
if test "$pass" != dlopen; then
if test "$pass" != conv; then
# Make sure lib_search_path contains only unique directories.
lib_search_path=
for dir in $newlib_search_path; do
case "$lib_search_path " in
*" $dir "*) ;;
*) func_append lib_search_path " $dir" ;;
esac
done
newlib_search_path=
fi
if test "$linkmode,$pass" != "prog,link"; then
vars="deplibs"
else
vars="compile_deplibs finalize_deplibs"
fi
for var in $vars dependency_libs; do
# Add libraries to $var in reverse order
eval tmp_libs=\"\$$var\"
new_libs=
for deplib in $tmp_libs; do
# FIXME: Pedantically, this is the right thing to do, so
# that some nasty dependency loop isn't accidentally
# broken:
#new_libs="$deplib $new_libs"
# Pragmatically, this seems to cause very few problems in
# practice:
case $deplib in
-L*) new_libs="$deplib $new_libs" ;;
-R*) ;;
*)
# And here is the reason: when a library appears more
# than once as an explicit dependence of a library, or
# is implicitly linked in more than once by the
# compiler, it is considered special, and multiple
# occurrences thereof are not removed. Compare this
# with having the same library being listed as a
# dependency of multiple other libraries: in this case,
# we know (pedantically, we assume) the library does not
# need to be listed more than once, so we keep only the
# last copy. This is not always right, but it is rare
# enough that we require users that really mean to play
# such unportable linking tricks to link the library
# using -Wl,-lname, so that libtool does not consider it
# for duplicate removal.
case " $specialdeplibs " in
*" $deplib "*) new_libs="$deplib $new_libs" ;;
*)
case " $new_libs " in
*" $deplib "*) ;;
*) new_libs="$deplib $new_libs" ;;
esac
;;
esac
;;
esac
done
tmp_libs=
for deplib in $new_libs; do
case $deplib in
-L*)
case " $tmp_libs " in
*" $deplib "*) ;;
*) func_append tmp_libs " $deplib" ;;
esac
;;
*) func_append tmp_libs " $deplib" ;;
esac
done
eval $var=\"$tmp_libs\"
done # for var
fi
# Last step: remove runtime libs from dependency_libs
# (they stay in deplibs)
tmp_libs=
for i in $dependency_libs ; do
case " $predeps $postdeps $compiler_lib_search_path " in
*" $i "*)
i=""
;;
esac
if test -n "$i" ; then
func_append tmp_libs " $i"
fi
done
dependency_libs=$tmp_libs
done # for pass
if test "$linkmode" = prog; then
dlfiles="$newdlfiles"
fi
if test "$linkmode" = prog || test "$linkmode" = lib; then
dlprefiles="$newdlprefiles"
fi
case $linkmode in
oldlib)
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
func_warning "\`-dlopen' is ignored for archives"
fi
case " $deplibs" in
*\ -l* | *\ -L*)
func_warning "\`-l' and \`-L' are ignored for archives" ;;
esac
test -n "$rpath" && \
func_warning "\`-rpath' is ignored for archives"
test -n "$xrpath" && \
func_warning "\`-R' is ignored for archives"
test -n "$vinfo" && \
func_warning "\`-version-info/-version-number' is ignored for archives"
test -n "$release" && \
func_warning "\`-release' is ignored for archives"
test -n "$export_symbols$export_symbols_regex" && \
func_warning "\`-export-symbols' is ignored for archives"
# Now set the variables for building old libraries.
build_libtool_libs=no
oldlibs="$output"
func_append objs "$old_deplibs"
;;
lib)
# Make sure we only generate libraries of the form `libNAME.la'.
case $outputname in
lib*)
func_stripname 'lib' '.la' "$outputname"
name=$func_stripname_result
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
;;
*)
test "$module" = no && \
func_fatal_help "libtool library \`$output' must begin with \`lib'"
if test "$need_lib_prefix" != no; then
# Add the "lib" prefix for modules if required
func_stripname '' '.la' "$outputname"
name=$func_stripname_result
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
else
func_stripname '' '.la' "$outputname"
libname=$func_stripname_result
fi
;;
esac
if test -n "$objs"; then
if test "$deplibs_check_method" != pass_all; then
func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
else
echo
$ECHO "*** Warning: Linking the shared library $output against the non-libtool"
$ECHO "*** objects $objs is not portable!"
func_append libobjs " $objs"
fi
fi
test "$dlself" != no && \
func_warning "\`-dlopen self' is ignored for libtool libraries"
set dummy $rpath
shift
test "$#" -gt 1 && \
func_warning "ignoring multiple \`-rpath's for a libtool library"
install_libdir="$1"
oldlibs=
if test -z "$rpath"; then
if test "$build_libtool_libs" = yes; then
# Building a libtool convenience library.
# Some compilers have problems with a `.al' extension so
# convenience libraries should have the same extension an
# archive normally would.
oldlibs="$output_objdir/$libname.$libext $oldlibs"
build_libtool_libs=convenience
build_old_libs=yes
fi
test -n "$vinfo" && \
func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
test -n "$release" && \
func_warning "\`-release' is ignored for convenience libraries"
else
# Parse the version information argument.
save_ifs="$IFS"; IFS=':'
set dummy $vinfo 0 0 0
shift
IFS="$save_ifs"
test -n "$7" && \
func_fatal_help "too many parameters to \`-version-info'"
# convert absolute version numbers to libtool ages
# this retains compatibility with .la files and attempts
# to make the code below a bit more comprehensible
case $vinfo_number in
yes)
number_major="$1"
number_minor="$2"
number_revision="$3"
#
# There are really only two kinds -- those that
# use the current revision as the major version
# and those that subtract age and use age as
# a minor version. But, then there is irix
# which has an extra 1 added just for fun
#
case $version_type in
# correct linux to gnu/linux during the next big refactor
darwin|linux|osf|windows|none)
func_arith $number_major + $number_minor
current=$func_arith_result
age="$number_minor"
revision="$number_revision"
;;
freebsd-aout|freebsd-elf|qnx|sunos)
current="$number_major"
revision="$number_minor"
age="0"
;;
irix|nonstopux)
func_arith $number_major + $number_minor
current=$func_arith_result
age="$number_minor"
revision="$number_minor"
lt_irix_increment=no
;;
*)
func_fatal_configuration "$modename: unknown library version type \`$version_type'"
;;
esac
;;
no)
current="$1"
revision="$2"
age="$3"
;;
esac
# Check that each of the things are valid numbers.
case $current in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "CURRENT \`$current' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
case $revision in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "REVISION \`$revision' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
case $age in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "AGE \`$age' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
if test "$age" -gt "$current"; then
func_error "AGE \`$age' is greater than the current interface number \`$current'"
func_fatal_error "\`$vinfo' is not valid version information"
fi
# Calculate the version variables.
major=
versuffix=
verstring=
case $version_type in
none) ;;
darwin)
# Like Linux, but with the current version available in
# verstring for coding it into the library header
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
func_arith $current + 1
minor_current=$func_arith_result
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
;;
freebsd-aout)
major=".$current"
versuffix=".$current.$revision";
;;
freebsd-elf)
major=".$current"
versuffix=".$current"
;;
irix | nonstopux)
if test "X$lt_irix_increment" = "Xno"; then
func_arith $current - $age
else
func_arith $current - $age + 1
fi
major=$func_arith_result
case $version_type in
nonstopux) verstring_prefix=nonstopux ;;
*) verstring_prefix=sgi ;;
esac
verstring="$verstring_prefix$major.$revision"
# Add in all the interfaces that we are compatible with.
loop=$revision
while test "$loop" -ne 0; do
func_arith $revision - $loop
iface=$func_arith_result
func_arith $loop - 1
loop=$func_arith_result
verstring="$verstring_prefix$major.$iface:$verstring"
done
# Before this point, $major must not contain `.'.
major=.$major
versuffix="$major.$revision"
;;
linux) # correct to gnu/linux during the next big refactor
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
;;
osf)
func_arith $current - $age
major=.$func_arith_result
versuffix=".$current.$age.$revision"
verstring="$current.$age.$revision"
# Add in all the interfaces that we are compatible with.
loop=$age
while test "$loop" -ne 0; do
func_arith $current - $loop
iface=$func_arith_result
func_arith $loop - 1
loop=$func_arith_result
verstring="$verstring:${iface}.0"
done
# Make executables depend on our current version.
func_append verstring ":${current}.0"
;;
qnx)
major=".$current"
versuffix=".$current"
;;
sunos)
major=".$current"
versuffix=".$current.$revision"
;;
windows)
# Use '-' rather than '.', since we only want one
# extension on DOS 8.3 filesystems.
func_arith $current - $age
major=$func_arith_result
versuffix="-$major"
;;
*)
func_fatal_configuration "unknown library version type \`$version_type'"
;;
esac
# Clear the version info if we defaulted, and they specified a release.
if test -z "$vinfo" && test -n "$release"; then
major=
case $version_type in
darwin)
# we can't check for "0.0" in archive_cmds due to quoting
# problems, so we reset it completely
verstring=
;;
*)
verstring="0.0"
;;
esac
if test "$need_version" = no; then
versuffix=
else
versuffix=".0.0"
fi
fi
# Remove version info from name if versioning should be avoided
if test "$avoid_version" = yes && test "$need_version" = no; then
major=
versuffix=
verstring=""
fi
# Check to see if the archive will have undefined symbols.
if test "$allow_undefined" = yes; then
if test "$allow_undefined_flag" = unsupported; then
func_warning "undefined symbols not allowed in $host shared libraries"
build_libtool_libs=no
build_old_libs=yes
fi
else
# Don't allow undefined symbols.
allow_undefined_flag="$no_undefined_flag"
fi
fi
func_generate_dlsyms "$libname" "$libname" "yes"
func_append libobjs " $symfileobj"
test "X$libobjs" = "X " && libobjs=
if test "$opt_mode" != relink; then
# Remove our outputs, but don't remove object files since they
# may have been created when compiling PIC objects.
removelist=
tempremovelist=`$ECHO "$output_objdir/*"`
for p in $tempremovelist; do
case $p in
*.$objext | *.gcno)
;;
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
if test "X$precious_files_regex" != "X"; then
if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
then
continue
fi
fi
func_append removelist " $p"
;;
*) ;;
esac
done
test -n "$removelist" && \
func_show_eval "${RM}r \$removelist"
fi
# Now set the variables for building old libraries.
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
func_append oldlibs " $output_objdir/$libname.$libext"
# Transform .lo files to .o files.
oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
fi
# Eliminate all temporary directories.
#for path in $notinst_path; do
# lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
# deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
# dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
#done
if test -n "$xrpath"; then
# If the user specified any rpath flags, then add them.
temp_xrpath=
for libdir in $xrpath; do
func_replace_sysroot "$libdir"
func_append temp_xrpath " -R$func_replace_sysroot_result"
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
done
if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
dependency_libs="$temp_xrpath $dependency_libs"
fi
fi
# Make sure dlfiles contains only unique files that won't be dlpreopened
old_dlfiles="$dlfiles"
dlfiles=
for lib in $old_dlfiles; do
case " $dlprefiles $dlfiles " in
*" $lib "*) ;;
*) func_append dlfiles " $lib" ;;
esac
done
# Make sure dlprefiles contains only unique files
old_dlprefiles="$dlprefiles"
dlprefiles=
for lib in $old_dlprefiles; do
case "$dlprefiles " in
*" $lib "*) ;;
*) func_append dlprefiles " $lib" ;;
esac
done
if test "$build_libtool_libs" = yes; then
if test -n "$rpath"; then
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
# these systems don't actually have a c library (as such)!
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C library is in the System framework
func_append deplibs " System.ltframework"
;;
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
;;
*)
# Add libc to deplibs on all other systems if necessary.
if test "$build_libtool_need_lc" = "yes"; then
func_append deplibs " -lc"
fi
;;
esac
fi
# Transform deplibs into only deplibs that can be linked in shared.
name_save=$name
libname_save=$libname
release_save=$release
versuffix_save=$versuffix
major_save=$major
# I'm not sure if I'm treating the release correctly. I think
# release should show up in the -l (ie -lgmp5) so we don't want to
# add it in twice. Is that correct?
release=""
versuffix=""
major=""
newdeplibs=
droppeddeps=no
case $deplibs_check_method in
pass_all)
# Don't check for shared/static. Everything works.
# This might be a little naive. We might want to check
# whether the library exists or not. But this is on
# osf3 & osf4 and I'm not really sure... Just
# implementing what was already the behavior.
newdeplibs=$deplibs
;;
test_compile)
# This code stresses the "libraries are programs" paradigm to its
# limits. Maybe even breaks it. We compile a program, linking it
# against the deplibs as a proxy for the library. Then we can check
# whether they linked in statically or dynamically with ldd.
$opt_dry_run || $RM conftest.c
cat > conftest.c <<EOF
int main() { return 0; }
EOF
$opt_dry_run || $RM conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
ldd_output=`ldd conftest`
for i in $deplibs; do
case $i in
-l*)
func_stripname -l '' "$i"
name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
func_append newdeplibs " $i"
i=""
;;
esac
fi
if test -n "$i" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
set dummy $deplib_matches; shift
deplib_match=$1
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
func_append newdeplibs " $i"
else
droppeddeps=yes
echo
$ECHO "*** Warning: dynamic linker does not accept needed library $i."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which I believe you do not have"
echo "*** because a test_compile did reveal that the linker did not use it for"
echo "*** its dynamic dependency list that programs get resolved with at runtime."
fi
fi
;;
*)
func_append newdeplibs " $i"
;;
esac
done
else
# Error occurred in the first compile. Let's try to salvage
# the situation: Compile a separate program for each library.
for i in $deplibs; do
case $i in
-l*)
func_stripname -l '' "$i"
name=$func_stripname_result
$opt_dry_run || $RM conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
ldd_output=`ldd conftest`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
func_append newdeplibs " $i"
i=""
;;
esac
fi
if test -n "$i" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
set dummy $deplib_matches; shift
deplib_match=$1
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
func_append newdeplibs " $i"
else
droppeddeps=yes
echo
$ECHO "*** Warning: dynamic linker does not accept needed library $i."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because a test_compile did reveal that the linker did not use this one"
echo "*** as a dynamic dependency that programs can get resolved with at runtime."
fi
fi
else
droppeddeps=yes
echo
$ECHO "*** Warning! Library $i is needed by this library but I was not able to"
echo "*** make it link in! You will probably need to install it or some"
echo "*** library that it depends on before this library will be fully"
echo "*** functional. Installing it before continuing would be even better."
fi
;;
*)
func_append newdeplibs " $i"
;;
esac
done
fi
;;
file_magic*)
set dummy $deplibs_check_method; shift
file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
for a_deplib in $deplibs; do
case $a_deplib in
-l*)
func_stripname -l '' "$a_deplib"
name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
func_append newdeplibs " $a_deplib"
a_deplib=""
;;
esac
fi
if test -n "$a_deplib" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
if test -n "$file_magic_glob"; then
libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
else
libnameglob=$libname
fi
test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
if test "$want_nocaseglob" = yes; then
shopt -s nocaseglob
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
$nocaseglob
else
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
fi
for potent_lib in $potential_libs; do
# Follow soft links.
if ls -lLd "$potent_lib" 2>/dev/null |
$GREP " -> " >/dev/null; then
continue
fi
# The statement above tries to avoid entering an
# endless loop below, in case of cyclic links.
# We might still enter an endless loop, since a link
# loop can be closed while we follow links,
# but so what?
potlib="$potent_lib"
while test -h "$potlib" 2>/dev/null; do
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
case $potliblink in
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
esac
done
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
$SED -e 10q |
$EGREP "$file_magic_regex" > /dev/null; then
func_append newdeplibs " $a_deplib"
a_deplib=""
break 2
fi
done
done
fi
if test -n "$a_deplib" ; then
droppeddeps=yes
echo
$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because I did check the linker path looking for a file starting"
if test -z "$potlib" ; then
$ECHO "*** with $libname but no candidates were found. (...for file magic test)"
else
$ECHO "*** with $libname and none of the candidates passed a file format test"
$ECHO "*** using a file magic. Last file checked: $potlib"
fi
fi
;;
*)
# Add a -L argument.
func_append newdeplibs " $a_deplib"
;;
esac
done # Gone through all deplibs.
;;
match_pattern*)
set dummy $deplibs_check_method; shift
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
for a_deplib in $deplibs; do
case $a_deplib in
-l*)
func_stripname -l '' "$a_deplib"
name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
func_append newdeplibs " $a_deplib"
a_deplib=""
;;
esac
fi
if test -n "$a_deplib" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
for potent_lib in $potential_libs; do
potlib="$potent_lib" # see symlink-check above in file_magic test
if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
$EGREP "$match_pattern_regex" > /dev/null; then
func_append newdeplibs " $a_deplib"
a_deplib=""
break 2
fi
done
done
fi
if test -n "$a_deplib" ; then
droppeddeps=yes
echo
$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because I did check the linker path looking for a file starting"
if test -z "$potlib" ; then
$ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
else
$ECHO "*** with $libname and none of the candidates passed a file format test"
$ECHO "*** using a regex pattern. Last file checked: $potlib"
fi
fi
;;
*)
# Add a -L argument.
func_append newdeplibs " $a_deplib"
;;
esac
done # Gone through all deplibs.
;;
none | unknown | *)
newdeplibs=""
tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
for i in $predeps $postdeps ; do
# can't use Xsed below, because $i might contain '/'
tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
done
fi
case $tmp_deplibs in
*[!\ \ ]*)
echo
if test "X$deplibs_check_method" = "Xnone"; then
echo "*** Warning: inter-library dependencies are not supported in this platform."
else
echo "*** Warning: inter-library dependencies are not known to be supported."
fi
echo "*** All declared inter-library dependencies are being dropped."
droppeddeps=yes
;;
esac
;;
esac
versuffix=$versuffix_save
major=$major_save
release=$release_save
libname=$libname_save
name=$name_save
case $host in
*-*-rhapsody* | *-*-darwin1.[012])
# On Rhapsody replace the C library with the System framework
newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
;;
esac
if test "$droppeddeps" = yes; then
if test "$module" = yes; then
echo
echo "*** Warning: libtool could not satisfy all declared inter-library"
$ECHO "*** dependencies of module $libname. Therefore, libtool will create"
echo "*** a static module, that should work as long as the dlopening"
echo "*** application is linked with the -dlopen flag."
if test -z "$global_symbol_pipe"; then
echo
echo "*** However, this would only work if libtool was able to extract symbol"
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
echo "*** not find such a program. So, this module is probably useless."
echo "*** \`nm' from GNU binutils and a full rebuild may help."
fi
if test "$build_old_libs" = no; then
oldlibs="$output_objdir/$libname.$libext"
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
else
echo "*** The inter-library dependencies that have been dropped here will be"
echo "*** automatically added whenever a program is linked with this library"
echo "*** or is declared to -dlopen it."
if test "$allow_undefined" = no; then
echo
echo "*** Since this library must not contain undefined symbols,"
echo "*** because either the platform does not support them or"
echo "*** it was explicitly requested with -no-undefined,"
echo "*** libtool will only create a static version of it."
if test "$build_old_libs" = no; then
oldlibs="$output_objdir/$libname.$libext"
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
fi
fi
fi
# Done checking deplibs!
deplibs=$newdeplibs
fi
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
case $host in
*-*-darwin*)
newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
;;
esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
for path in $notinst_path; do
case " $new_libs " in
*" -L$path/$objdir "*) ;;
*)
case " $deplibs " in
*" -L$path/$objdir "*)
func_append new_libs " -L$path/$objdir" ;;
esac
;;
esac
done
for deplib in $deplibs; do
case $deplib in
-L*)
case " $new_libs " in
*" $deplib "*) ;;
*) func_append new_libs " $deplib" ;;
esac
;;
*) func_append new_libs " $deplib" ;;
esac
done
deplibs="$new_libs"
# All the library-specific variables (install_libdir is set above).
library_names=
old_library=
dlname=
# Test again, we may have decided not to build it any more
if test "$build_libtool_libs" = yes; then
# Remove ${wl} instances when linking with ld.
# FIXME: should test the right _cmds variable.
case $archive_cmds in
*\$LD\ *) wl= ;;
esac
if test "$hardcode_into_libs" = yes; then
# Hardcode the library paths
hardcode_libdirs=
dep_rpath=
rpath="$finalize_rpath"
test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
func_replace_sysroot "$libdir"
libdir=$func_replace_sysroot_result
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
func_append dep_rpath " $flag"
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
*) func_append perm_rpath " $libdir" ;;
esac
fi
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
fi
if test -n "$runpath_var" && test -n "$perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
func_append rpath "$dir:"
done
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
fi
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
fi
shlibpath="$finalize_shlibpath"
test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
if test -n "$shlibpath"; then
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
fi
# Get the real and link names of the library.
eval shared_ext=\"$shrext_cmds\"
eval library_names=\"$library_names_spec\"
set dummy $library_names
shift
realname="$1"
shift
if test -n "$soname_spec"; then
eval soname=\"$soname_spec\"
else
soname="$realname"
fi
if test -z "$dlname"; then
dlname=$soname
fi
lib="$output_objdir/$realname"
linknames=
for link
do
func_append linknames " $link"
done
# Use standard objects if they are pic
test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
test "X$libobjs" = "X " && libobjs=
delfiles=
if test -n "$export_symbols" && test -n "$include_expsyms"; then
$opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
export_symbols="$output_objdir/$libname.uexp"
func_append delfiles " $export_symbols"
fi
orig_export_symbols=
case $host_os in
cygwin* | mingw* | cegcc*)
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
# exporting using user supplied symfile
if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
# and it's NOT already a .def file. Must figure out
# which of the given symbols are data symbols and tag
# them as such. So, trigger use of export_symbols_cmds.
# export_symbols gets reassigned inside the "prepare
# the list of exported symbols" if statement, so the
# include_expsyms logic still works.
orig_export_symbols="$export_symbols"
export_symbols=
always_export_symbols=yes
fi
fi
;;
esac
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
func_verbose "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
$opt_dry_run || $RM $export_symbols
cmds=$export_symbols_cmds
save_ifs="$IFS"; IFS='~'
for cmd1 in $cmds; do
IFS="$save_ifs"
# Take the normal branch if the nm_file_list_spec branch
# doesn't work or if tool conversion is not needed.
case $nm_file_list_spec~$to_tool_file_cmd in
*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
try_normal_branch=yes
eval cmd=\"$cmd1\"
func_len " $cmd"
len=$func_len_result
;;
*)
try_normal_branch=no
;;
esac
if test "$try_normal_branch" = yes \
&& { test "$len" -lt "$max_cmd_len" \
|| test "$max_cmd_len" -le -1; }
then
func_show_eval "$cmd" 'exit $?'
skipped_export=false
elif test -n "$nm_file_list_spec"; then
func_basename "$output"
output_la=$func_basename_result
save_libobjs=$libobjs
save_output=$output
output=${output_objdir}/${output_la}.nm
func_to_tool_file "$output"
libobjs=$nm_file_list_spec$func_to_tool_file_result
func_append delfiles " $output"
func_verbose "creating $NM input file list: $output"
for obj in $save_libobjs; do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result"
done > "$output"
eval cmd=\"$cmd1\"
func_show_eval "$cmd" 'exit $?'
output=$save_output
libobjs=$save_libobjs
skipped_export=false
else
# The command line is too long to execute in one step.
func_verbose "using reloadable object file for export list..."
skipped_export=:
# Break out early, otherwise skipped_export may be
# set to false by a later but shorter cmd.
break
fi
done
IFS="$save_ifs"
if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
fi
fi
fi
if test -n "$export_symbols" && test -n "$include_expsyms"; then
tmp_export_symbols="$export_symbols"
test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
fi
if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
# The given exports_symbols file has to be filtered, so filter it.
func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
# FIXME: $output_objdir/$libname.filter potentially contains lots of
# 's' commands which not all seds can handle. GNU sed should be fine
# though. Also, the filter scales superlinearly with the number of
# global variables. join(1) would be nice here, but unfortunately
# isn't a blessed tool.
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
export_symbols=$output_objdir/$libname.def
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
tmp_deplibs=
for test_deplib in $deplibs; do
case " $convenience " in
*" $test_deplib "*) ;;
*)
func_append tmp_deplibs " $test_deplib"
;;
esac
done
deplibs="$tmp_deplibs"
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec" &&
test "$compiler_needs_object" = yes &&
test -z "$libobjs"; then
# extract the archives, so we have objects to list.
# TODO: could optimize this to just extract one archive.
whole_archive_flag_spec=
fi
if test -n "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
test "X$libobjs" = "X " && libobjs=
else
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $convenience
func_append libobjs " $func_extract_archives_result"
test "X$libobjs" = "X " && libobjs=
fi
fi
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
func_append linker_flags " $flag"
fi
# Make a backup of the uninstalled library when relinking
if test "$opt_mode" = relink; then
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
fi
# Do each of the archive commands.
if test "$module" = yes && test -n "$module_cmds" ; then
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
eval test_cmds=\"$module_expsym_cmds\"
cmds=$module_expsym_cmds
else
eval test_cmds=\"$module_cmds\"
cmds=$module_cmds
fi
else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
eval test_cmds=\"$archive_expsym_cmds\"
cmds=$archive_expsym_cmds
else
eval test_cmds=\"$archive_cmds\"
cmds=$archive_cmds
fi
fi
if test "X$skipped_export" != "X:" &&
func_len " $test_cmds" &&
len=$func_len_result &&
test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
:
else
# The command line is too long to link in one step, link piecewise
# or, if using GNU ld and skipped_export is not :, use a linker
# script.
# Save the value of $output and $libobjs because we want to
# use them later. If we have whole_archive_flag_spec, we
# want to use save_libobjs as it was before
# whole_archive_flag_spec was expanded, because we can't
# assume the linker understands whole_archive_flag_spec.
# This may have to be revisited, in case too many
# convenience libraries get linked in and end up exceeding
# the spec.
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
fi
save_output=$output
func_basename "$output"
output_la=$func_basename_result
# Clear the reloadable object creation command queue and
# initialize k to one.
test_cmds=
concat_cmds=
objlist=
last_robj=
k=1
if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
output=${output_objdir}/${output_la}.lnkscript
func_verbose "creating GNU ld script: $output"
echo 'INPUT (' > $output
for obj in $save_libobjs
do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result" >> $output
done
echo ')' >> $output
func_append delfiles " $output"
func_to_tool_file "$output"
output=$func_to_tool_file_result
elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
output=${output_objdir}/${output_la}.lnk
func_verbose "creating linker input file list: $output"
: > $output
set x $save_libobjs
shift
firstobj=
if test "$compiler_needs_object" = yes; then
firstobj="$1 "
shift
fi
for obj
do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result" >> $output
done
func_append delfiles " $output"
func_to_tool_file "$output"
output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
else
if test -n "$save_libobjs"; then
func_verbose "creating reloadable object files..."
output=$output_objdir/$output_la-${k}.$objext
eval test_cmds=\"$reload_cmds\"
func_len " $test_cmds"
len0=$func_len_result
len=$len0
# Loop over the list of objects to be linked.
for obj in $save_libobjs
do
func_len " $obj"
func_arith $len + $func_len_result
len=$func_arith_result
if test "X$objlist" = X ||
test "$len" -lt "$max_cmd_len"; then
func_append objlist " $obj"
else
# The command $test_cmds is almost too long, add a
# command to the queue.
if test "$k" -eq 1 ; then
# The first file doesn't have a previous command to add.
reload_objs=$objlist
eval concat_cmds=\"$reload_cmds\"
else
# All subsequent reloadable object files will link in
# the last one created.
reload_objs="$objlist $last_robj"
eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
fi
last_robj=$output_objdir/$output_la-${k}.$objext
func_arith $k + 1
k=$func_arith_result
output=$output_objdir/$output_la-${k}.$objext
objlist=" $obj"
func_len " $last_robj"
func_arith $len0 + $func_len_result
len=$func_arith_result
fi
done
# Handle the remaining objects by creating one last
# reloadable object file. All subsequent reloadable object
# files will link in the last one created.
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
reload_objs="$objlist $last_robj"
eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
if test -n "$last_robj"; then
eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
fi
func_append delfiles " $output"
else
output=
fi
if ${skipped_export-false}; then
func_verbose "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
$opt_dry_run || $RM $export_symbols
libobjs=$output
# Append the command to create the export file.
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
if test -n "$last_robj"; then
eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
fi
fi
test -n "$save_libobjs" &&
func_verbose "creating a temporary reloadable object file: $output"
# Loop through the commands generated above and execute them.
save_ifs="$IFS"; IFS='~'
for cmd in $concat_cmds; do
IFS="$save_ifs"
$opt_silent || {
func_quote_for_expand "$cmd"
eval "func_echo $func_quote_for_expand_result"
}
$opt_dry_run || eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
if test "$opt_mode" = relink; then
( cd "$output_objdir" && \
$RM "${realname}T" && \
$MV "${realname}U" "$realname" )
fi
exit $lt_exit
}
done
IFS="$save_ifs"
if test -n "$export_symbols_regex" && ${skipped_export-false}; then
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
fi
fi
if ${skipped_export-false}; then
if test -n "$export_symbols" && test -n "$include_expsyms"; then
tmp_export_symbols="$export_symbols"
test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
fi
if test -n "$orig_export_symbols"; then
# The given exports_symbols file has to be filtered, so filter it.
func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
# FIXME: $output_objdir/$libname.filter potentially contains lots of
# 's' commands which not all seds can handle. GNU sed should be fine
# though. Also, the filter scales superlinearly with the number of
# global variables. join(1) would be nice here, but unfortunately
# isn't a blessed tool.
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
export_symbols=$output_objdir/$libname.def
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
fi
libobjs=$output
# Restore the value of output.
output=$save_output
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
test "X$libobjs" = "X " && libobjs=
fi
# Expand the library linking commands again to reset the
# value of $libobjs for piecewise linking.
# Do each of the archive commands.
if test "$module" = yes && test -n "$module_cmds" ; then
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
cmds=$module_expsym_cmds
else
cmds=$module_cmds
fi
else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
cmds=$archive_expsym_cmds
else
cmds=$archive_cmds
fi
fi
fi
if test -n "$delfiles"; then
# Append the command to remove temporary files to $cmds.
eval cmds=\"\$cmds~\$RM $delfiles\"
fi
# Add any objects from preloaded convenience libraries
if test -n "$dlprefiles"; then
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $dlprefiles
func_append libobjs " $func_extract_archives_result"
test "X$libobjs" = "X " && libobjs=
fi
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
eval cmd=\"$cmd\"
$opt_silent || {
func_quote_for_expand "$cmd"
eval "func_echo $func_quote_for_expand_result"
}
$opt_dry_run || eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
if test "$opt_mode" = relink; then
( cd "$output_objdir" && \
$RM "${realname}T" && \
$MV "${realname}U" "$realname" )
fi
exit $lt_exit
}
done
IFS="$save_ifs"
# Restore the uninstalled library and exit
if test "$opt_mode" = relink; then
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
if test -n "$convenience"; then
if test -z "$whole_archive_flag_spec"; then
func_show_eval '${RM}r "$gentop"'
fi
fi
exit $EXIT_SUCCESS
fi
# Create links to the real library.
for linkname in $linknames; do
if test "$realname" != "$linkname"; then
func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
fi
done
# If -module or -export-dynamic was specified, set the dlname.
if test "$module" = yes || test "$export_dynamic" = yes; then
# On all known operating systems, these are identical.
dlname="$soname"
fi
fi
;;
obj)
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
func_warning "\`-dlopen' is ignored for objects"
fi
case " $deplibs" in
*\ -l* | *\ -L*)
func_warning "\`-l' and \`-L' are ignored for objects" ;;
esac
test -n "$rpath" && \
func_warning "\`-rpath' is ignored for objects"
test -n "$xrpath" && \
func_warning "\`-R' is ignored for objects"
test -n "$vinfo" && \
func_warning "\`-version-info' is ignored for objects"
test -n "$release" && \
func_warning "\`-release' is ignored for objects"
case $output in
*.lo)
test -n "$objs$old_deplibs" && \
func_fatal_error "cannot build library object \`$output' from non-libtool objects"
libobj=$output
func_lo2o "$libobj"
obj=$func_lo2o_result
;;
*)
libobj=
obj="$output"
;;
esac
# Delete the old objects.
$opt_dry_run || $RM $obj $libobj
# Objects from convenience libraries. This assumes
# single-version convenience libraries. Whenever we create
# different ones for PIC/non-PIC, this we'll have to duplicate
# the extraction.
reload_conv_objs=
gentop=
# reload_cmds runs $LD directly, so let us get rid of
# -Wl from whole_archive_flag_spec and hope we can get by with
# turning comma into space..
wl=
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec"; then
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
else
gentop="$output_objdir/${obj}x"
func_append generated " $gentop"
func_extract_archives $gentop $convenience
reload_conv_objs="$reload_objs $func_extract_archives_result"
fi
fi
# If we're not building shared, we need to use non_pic_objs
test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
# Create the old-style object.
reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
output="$obj"
func_execute_cmds "$reload_cmds" 'exit $?'
# Exit if we aren't doing a library object file.
if test -z "$libobj"; then
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
fi
if test "$build_libtool_libs" != yes; then
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
# Create an invalid libtool object if no PIC, so that we don't
# accidentally link it into a program.
# $show "echo timestamp > $libobj"
# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
exit $EXIT_SUCCESS
fi
if test -n "$pic_flag" || test "$pic_mode" != default; then
# Only do commands if we really have different PIC objects.
reload_objs="$libobjs $reload_conv_objs"
output="$libobj"
func_execute_cmds "$reload_cmds" 'exit $?'
fi
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
;;
prog)
case $host in
*cygwin*) func_stripname '' '.exe' "$output"
output=$func_stripname_result.exe;;
esac
test -n "$vinfo" && \
func_warning "\`-version-info' is ignored for programs"
test -n "$release" && \
func_warning "\`-release' is ignored for programs"
test "$preload" = yes \
&& test "$dlopen_support" = unknown \
&& test "$dlopen_self" = unknown \
&& test "$dlopen_self_static" = unknown && \
func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
case $host in
*-*-rhapsody* | *-*-darwin1.[012])
# On Rhapsody replace the C library is the System framework
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
;;
esac
case $host in
*-*-darwin*)
# Don't allow lazy linking, it breaks C++ global constructors
# But is supposedly fixed on 10.4 or later (yay!).
if test "$tagname" = CXX ; then
case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10.[0123])
func_append compile_command " ${wl}-bind_at_load"
func_append finalize_command " ${wl}-bind_at_load"
;;
esac
fi
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
;;
esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
for path in $notinst_path; do
case " $new_libs " in
*" -L$path/$objdir "*) ;;
*)
case " $compile_deplibs " in
*" -L$path/$objdir "*)
func_append new_libs " -L$path/$objdir" ;;
esac
;;
esac
done
for deplib in $compile_deplibs; do
case $deplib in
-L*)
case " $new_libs " in
*" $deplib "*) ;;
*) func_append new_libs " $deplib" ;;
esac
;;
*) func_append new_libs " $deplib" ;;
esac
done
compile_deplibs="$new_libs"
func_append compile_command " $compile_deplibs"
func_append finalize_command " $finalize_deplibs"
if test -n "$rpath$xrpath"; then
# If the user specified any rpath flags, then add them.
for libdir in $rpath $xrpath; do
# This is the magic to use -rpath.
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
done
fi
# Now hardcode the library paths
rpath=
hardcode_libdirs=
for libdir in $compile_rpath $finalize_rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
func_append rpath " $flag"
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
*) func_append perm_rpath " $libdir" ;;
esac
fi
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
::) dllsearchpath=$libdir;;
*) func_append dllsearchpath ":$libdir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
::) dllsearchpath=$testbindir;;
*) func_append dllsearchpath ":$testbindir";;
esac
;;
esac
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
eval rpath=\" $hardcode_libdir_flag_spec\"
fi
compile_rpath="$rpath"
rpath=
hardcode_libdirs=
for libdir in $finalize_rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
func_append rpath " $flag"
fi
elif test -n "$runpath_var"; then
case "$finalize_perm_rpath " in
*" $libdir "*) ;;
*) func_append finalize_perm_rpath " $libdir" ;;
esac
fi
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
eval rpath=\" $hardcode_libdir_flag_spec\"
fi
finalize_rpath="$rpath"
if test -n "$libobjs" && test "$build_old_libs" = yes; then
# Transform all the library objects into standard objects.
compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
fi
func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
# template prelinking step
if test -n "$prelink_cmds"; then
func_execute_cmds "$prelink_cmds" 'exit $?'
fi
wrappers_required=yes
case $host in
*cegcc* | *mingw32ce*)
# Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
wrappers_required=no
;;
*cygwin* | *mingw* )
if test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
;;
*)
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
;;
esac
if test "$wrappers_required" = no; then
# Replace the output file specification.
compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
link_command="$compile_command$compile_rpath"
# We have no uninstalled library dependencies, so finalize right now.
exit_status=0
func_show_eval "$link_command" 'exit_status=$?'
if test -n "$postlink_cmds"; then
func_to_tool_file "$output"
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
func_execute_cmds "$postlink_cmds" 'exit $?'
fi
# Delete the generated files.
if test -f "$output_objdir/${outputname}S.${objext}"; then
func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
fi
exit $exit_status
fi
if test -n "$compile_shlibpath$finalize_shlibpath"; then
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
fi
if test -n "$finalize_shlibpath"; then
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
fi
compile_var=
finalize_var=
if test -n "$runpath_var"; then
if test -n "$perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
func_append rpath "$dir:"
done
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
fi
if test -n "$finalize_perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $finalize_perm_rpath; do
func_append rpath "$dir:"
done
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
fi
fi
if test "$no_install" = yes; then
# We don't need to create a wrapper script.
link_command="$compile_var$compile_command$compile_rpath"
# Replace the output file specification.
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
# Delete the old output file.
$opt_dry_run || $RM $output
# Link the executable and exit
func_show_eval "$link_command" 'exit $?'
if test -n "$postlink_cmds"; then
func_to_tool_file "$output"
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
func_execute_cmds "$postlink_cmds" 'exit $?'
fi
exit $EXIT_SUCCESS
fi
if test "$hardcode_action" = relink; then
# Fast installation is not supported
link_command="$compile_var$compile_command$compile_rpath"
relink_command="$finalize_var$finalize_command$finalize_rpath"
func_warning "this platform does not like uninstalled shared libraries"
func_warning "\`$output' will be relinked during installation"
else
if test "$fast_install" != no; then
link_command="$finalize_var$compile_command$finalize_rpath"
if test "$fast_install" = yes; then
relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
else
# fast_install is set to needless
relink_command=
fi
else
link_command="$compile_var$compile_command$compile_rpath"
relink_command="$finalize_var$finalize_command$finalize_rpath"
fi
fi
# Replace the output file specification.
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
# Delete the old output files.
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
func_show_eval "$link_command" 'exit $?'
if test -n "$postlink_cmds"; then
func_to_tool_file "$output_objdir/$outputname"
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
func_execute_cmds "$postlink_cmds" 'exit $?'
fi
# Now create the wrapper script.
func_verbose "creating $output"
# Quote the relink command for shipping.
if test -n "$relink_command"; then
# Preserve any variables that may affect compiler behavior
for var in $variables_saved_for_relink; do
if eval test -z \"\${$var+set}\"; then
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
func_quote_for_eval "$var_value"
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
relink_command="(cd `pwd`; $relink_command)"
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
fi
# Only actually do things if not in dry run mode.
$opt_dry_run || {
# win32 will think the script is a binary if it has
# a .exe suffix, so we strip it off here.
case $output in
*.exe) func_stripname '' '.exe' "$output"
output=$func_stripname_result ;;
esac
# test for cygwin because mv fails w/o .exe extensions
case $host in
*cygwin*)
exeext=.exe
func_stripname '' '.exe' "$outputname"
outputname=$func_stripname_result ;;
*) exeext= ;;
esac
case $host in
*cygwin* | *mingw* )
func_dirname_and_basename "$output" "" "."
output_name=$func_basename_result
output_path=$func_dirname_result
cwrappersource="$output_path/$objdir/lt-$output_name.c"
cwrapper="$output_path/$output_name.exe"
$RM $cwrappersource $cwrapper
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
func_emit_cwrapperexe_src > $cwrappersource
# The wrapper executable is built using the $host compiler,
# because it contains $host paths and files. If cross-
# compiling, it, like the target executable, must be
# executed on the $host or under an emulation environment.
$opt_dry_run || {
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
$STRIP $cwrapper
}
# Now, create the wrapper script for func_source use:
func_ltwrapper_scriptname $cwrapper
$RM $func_ltwrapper_scriptname_result
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
$opt_dry_run || {
# note: this script will not be executed, so do not chmod.
if test "x$build" = "x$host" ; then
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
else
func_emit_wrapper no > $func_ltwrapper_scriptname_result
fi
}
;;
* )
$RM $output
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
func_emit_wrapper no > $output
chmod +x $output
;;
esac
}
exit $EXIT_SUCCESS
;;
esac
# See if we need to build an old-fashioned archive.
for oldlib in $oldlibs; do
if test "$build_libtool_libs" = convenience; then
oldobjs="$libobjs_save $symfileobj"
addlibs="$convenience"
build_libtool_libs=no
else
if test "$build_libtool_libs" = module; then
oldobjs="$libobjs_save"
build_libtool_libs=no
else
oldobjs="$old_deplibs $non_pic_objects"
if test "$preload" = yes && test -f "$symfileobj"; then
func_append oldobjs " $symfileobj"
fi
fi
addlibs="$old_convenience"
fi
if test -n "$addlibs"; then
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $addlibs
func_append oldobjs " $func_extract_archives_result"
fi
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
cmds=$old_archive_from_new_cmds
else
# Add any objects from preloaded convenience libraries
if test -n "$dlprefiles"; then
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $dlprefiles
func_append oldobjs " $func_extract_archives_result"
fi
# POSIX demands no paths to be encoded in archives. We have
# to avoid creating archives with duplicate basenames if we
# might have to extract them afterwards, e.g., when creating a
# static archive out of a convenience library, or when linking
# the entirety of a libtool archive into another (currently
# not supported by libtool).
if (for obj in $oldobjs
do
func_basename "$obj"
$ECHO "$func_basename_result"
done | sort | sort -uc >/dev/null 2>&1); then
:
else
echo "copying selected object files to avoid basename conflicts..."
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_mkdir_p "$gentop"
save_oldobjs=$oldobjs
oldobjs=
counter=1
for obj in $save_oldobjs
do
func_basename "$obj"
objbase="$func_basename_result"
case " $oldobjs " in
" ") oldobjs=$obj ;;
*[\ /]"$objbase "*)
while :; do
# Make sure we don't pick an alternate name that also
# overlaps.
newobj=lt$counter-$objbase
func_arith $counter + 1
counter=$func_arith_result
case " $oldobjs " in
*[\ /]"$newobj "*) ;;
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
esac
done
func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
func_append oldobjs " $gentop/$newobj"
;;
*) func_append oldobjs " $obj" ;;
esac
done
fi
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
tool_oldlib=$func_to_tool_file_result
eval cmds=\"$old_archive_cmds\"
func_len " $cmds"
len=$func_len_result
if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
cmds=$old_archive_cmds
elif test -n "$archiver_list_spec"; then
func_verbose "using command file archive linking..."
for obj in $oldobjs
do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result"
done > $output_objdir/$libname.libcmd
func_to_tool_file "$output_objdir/$libname.libcmd"
oldobjs=" $archiver_list_spec$func_to_tool_file_result"
cmds=$old_archive_cmds
else
# the command line is too long to link in one step, link in parts
func_verbose "using piecewise archive linking..."
save_RANLIB=$RANLIB
RANLIB=:
objlist=
concat_cmds=
save_oldobjs=$oldobjs
oldobjs=
# Is there a better way of finding the last object in the list?
for obj in $save_oldobjs
do
last_oldobj=$obj
done
eval test_cmds=\"$old_archive_cmds\"
func_len " $test_cmds"
len0=$func_len_result
len=$len0
for obj in $save_oldobjs
do
func_len " $obj"
func_arith $len + $func_len_result
len=$func_arith_result
func_append objlist " $obj"
if test "$len" -lt "$max_cmd_len"; then
:
else
# the above command should be used before it gets too long
oldobjs=$objlist
if test "$obj" = "$last_oldobj" ; then
RANLIB=$save_RANLIB
fi
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
objlist=
len=$len0
fi
done
RANLIB=$save_RANLIB
oldobjs=$objlist
if test "X$oldobjs" = "X" ; then
eval cmds=\"\$concat_cmds\"
else
eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
fi
fi
fi
func_execute_cmds "$cmds" 'exit $?'
done
test -n "$generated" && \
func_show_eval "${RM}r$generated"
# Now create the libtool archive.
case $output in
*.la)
old_library=
test "$build_old_libs" = yes && old_library="$libname.$libext"
func_verbose "creating $output"
# Preserve any variables that may affect compiler behavior
for var in $variables_saved_for_relink; do
if eval test -z \"\${$var+set}\"; then
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
func_quote_for_eval "$var_value"
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
# Quote the link command for shipping.
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
if test "$hardcode_automatic" = yes ; then
relink_command=
fi
# Only create the output if not a dry run.
$opt_dry_run || {
for installed in no yes; do
if test "$installed" = yes; then
if test -z "$install_libdir"; then
break
fi
output="$output_objdir/$outputname"i
# Replace all uninstalled libtool libraries with the installed ones
newdependency_libs=
for deplib in $dependency_libs; do
case $deplib in
*.la)
func_basename "$deplib"
name="$func_basename_result"
func_resolve_sysroot "$deplib"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
test -z "$libdir" && \
func_fatal_error "\`$deplib' is not a valid libtool archive"
func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
;;
-L*)
func_stripname -L '' "$deplib"
func_replace_sysroot "$func_stripname_result"
func_append newdependency_libs " -L$func_replace_sysroot_result"
;;
-R*)
func_stripname -R '' "$deplib"
func_replace_sysroot "$func_stripname_result"
func_append newdependency_libs " -R$func_replace_sysroot_result"
;;
*) func_append newdependency_libs " $deplib" ;;
esac
done
dependency_libs="$newdependency_libs"
newdlfiles=
for lib in $dlfiles; do
case $lib in
*.la)
func_basename "$lib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
test -z "$libdir" && \
func_fatal_error "\`$lib' is not a valid libtool archive"
func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
;;
*) func_append newdlfiles " $lib" ;;
esac
done
dlfiles="$newdlfiles"
newdlprefiles=
for lib in $dlprefiles; do
case $lib in
*.la)
# Only pass preopened files to the pseudo-archive (for
# eventual linking with the app. that links it) if we
# didn't already link the preopened objects directly into
# the library:
func_basename "$lib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
test -z "$libdir" && \
func_fatal_error "\`$lib' is not a valid libtool archive"
func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
;;
esac
done
dlprefiles="$newdlprefiles"
else
newdlfiles=
for lib in $dlfiles; do
case $lib in
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
*) abs=`pwd`"/$lib" ;;
esac
func_append newdlfiles " $abs"
done
dlfiles="$newdlfiles"
newdlprefiles=
for lib in $dlprefiles; do
case $lib in
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
*) abs=`pwd`"/$lib" ;;
esac
func_append newdlprefiles " $abs"
done
dlprefiles="$newdlprefiles"
fi
$RM $output
# place dlname in correct position for cygwin
# In fact, it would be nice if we could use this code for all target
# systems that can't hard-code library paths into their executables
# and that have no shared library path variable independent of PATH,
# but it turns out we can't easily determine that from inspecting
# libtool variables, so we have to hard-code the OSs to which it
# applies here; at the moment, that means platforms that use the PE
# object format with DLL files. See the long comment at the top of
# tests/bindir.at for full details.
tdlname=$dlname
case $host,$output,$installed,$module,$dlname in
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
# If a -bindir argument was supplied, place the dll there.
if test "x$bindir" != x ;
then
func_relative_path "$install_libdir" "$bindir"
tdlname=$func_relative_path_result$dlname
else
# Otherwise fall back on heuristic.
tdlname=../bin/$dlname
fi
;;
esac
$ECHO > $output "\
# $outputname - a libtool library file
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='$tdlname'
# Names of this library.
library_names='$library_names'
# The name of the static archive.
old_library='$old_library'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags='$new_inherited_linker_flags'
# Libraries that this one depends upon.
dependency_libs='$dependency_libs'
# Names of additional weak libraries provided by this library
weak_library_names='$weak_libs'
# Version information for $libname.
current=$current
age=$age
revision=$revision
# Is this an already installed library?
installed=$installed
# Should we warn about portability when linking against -modules?
shouldnotlink=$module
# Files to dlopen/dlpreopen
dlopen='$dlfiles'
dlpreopen='$dlprefiles'
# Directory that this library needs to be installed in:
libdir='$install_libdir'"
if test "$installed" = no && test "$need_relink" = yes; then
$ECHO >> $output "\
relink_command=\"$relink_command\""
fi
done
}
# Do a symbolic link so that the libtool archive can be found in
# LD_LIBRARY_PATH before the program is installed.
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
;;
esac
exit $EXIT_SUCCESS
}
{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
func_mode_link ${1+"$@"}
# func_mode_uninstall arg...
func_mode_uninstall ()
{
$opt_debug
RM="$nonopt"
files=
rmforce=
exit_status=0
# This variable tells wrapper scripts just to set variables rather
# than running their programs.
libtool_install_magic="$magic"
for arg
do
case $arg in
-f) func_append RM " $arg"; rmforce=yes ;;
-*) func_append RM " $arg" ;;
*) func_append files " $arg" ;;
esac
done
test -z "$RM" && \
func_fatal_help "you must specify an RM program"
rmdirs=
for file in $files; do
func_dirname "$file" "" "."
dir="$func_dirname_result"
if test "X$dir" = X.; then
odir="$objdir"
else
odir="$dir/$objdir"
fi
func_basename "$file"
name="$func_basename_result"
test "$opt_mode" = uninstall && odir="$dir"
# Remember odir for removal later, being careful to avoid duplicates
if test "$opt_mode" = clean; then
case " $rmdirs " in
*" $odir "*) ;;
*) func_append rmdirs " $odir" ;;
esac
fi
# Don't error if the file doesn't exist and rm -f was used.
if { test -L "$file"; } >/dev/null 2>&1 ||
{ test -h "$file"; } >/dev/null 2>&1 ||
test -f "$file"; then
:
elif test -d "$file"; then
exit_status=1
continue
elif test "$rmforce" = yes; then
continue
fi
rmfiles="$file"
case $name in
*.la)
# Possibly a libtool archive, so verify it.
if func_lalib_p "$file"; then
func_source $dir/$name
# Delete the libtool libraries and symlinks.
for n in $library_names; do
func_append rmfiles " $odir/$n"
done
test -n "$old_library" && func_append rmfiles " $odir/$old_library"
case "$opt_mode" in
clean)
case " $library_names " in
*" $dlname "*) ;;
*) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
esac
test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
;;
uninstall)
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
fi
if test -n "$old_library"; then
# Do each command in the old_postuninstall commands.
func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
fi
# FIXME: should reinstall the best remaining shared library.
;;
esac
fi
;;
*.lo)
# Possibly a libtool object, so verify it.
if func_lalib_p "$file"; then
# Read the .lo file
func_source $dir/$name
# Add PIC object to the list of files to remove.
if test -n "$pic_object" &&
test "$pic_object" != none; then
func_append rmfiles " $dir/$pic_object"
fi
# Add non-PIC object to the list of files to remove.
if test -n "$non_pic_object" &&
test "$non_pic_object" != none; then
func_append rmfiles " $dir/$non_pic_object"
fi
fi
;;
*)
if test "$opt_mode" = clean ; then
noexename=$name
case $file in
*.exe)
func_stripname '' '.exe' "$file"
file=$func_stripname_result
func_stripname '' '.exe' "$name"
noexename=$func_stripname_result
# $file with .exe has already been added to rmfiles,
# add $file without .exe
func_append rmfiles " $file"
;;
esac
# Do a test to see if this is a libtool program.
if func_ltwrapper_p "$file"; then
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
relink_command=
func_source $func_ltwrapper_scriptname_result
func_append rmfiles " $func_ltwrapper_scriptname_result"
else
relink_command=
func_source $dir/$noexename
fi
# note $name still contains .exe if it was in $file originally
# as does the version of $file that was added into $rmfiles
func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
if test "$fast_install" = yes && test -n "$relink_command"; then
func_append rmfiles " $odir/lt-$name"
fi
if test "X$noexename" != "X$name" ; then
func_append rmfiles " $odir/lt-${noexename}.c"
fi
fi
fi
;;
esac
func_show_eval "$RM $rmfiles" 'exit_status=1'
done
# Try to remove the ${objdir}s in the directories where we deleted files
for dir in $rmdirs; do
if test -d "$dir"; then
func_show_eval "rmdir $dir >/dev/null 2>&1"
fi
done
exit $exit_status
}
{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
func_mode_uninstall ${1+"$@"}
test -z "$opt_mode" && {
help="$generic_help"
func_fatal_help "you must specify a MODE"
}
test -z "$exec_cmd" && \
func_fatal_help "invalid operation mode \`$opt_mode'"
if test -n "$exec_cmd"; then
eval exec "$exec_cmd"
exit $EXIT_FAILURE
fi
exit $exit_status
# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting
# choices, we go for a static library, that is the most portable,
# since we can't tell whether shared libraries were disabled because
# the user asked for that or because the platform doesn't support
# them. This is particularly important on AIX, because we don't
# support having both static and shared libraries enabled at the same
# time on that platform, so we default to a shared-only configuration.
# If a disable-shared tag is given, we'll fallback to a static-only
# configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
build_libtool_libs=no
build_old_libs=yes
# ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
# ### END LIBTOOL TAG CONFIG: disable-static
# Local Variables:
# mode:shell-script
# sh-indentation:2
# End:
# vi:sw=2
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/ltmain.sh | Shell | apache-2.0 | 283,670 |
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2012-01-06.13; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG=\${$#}
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG=\${$#}
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/missing | Shell | apache-2.0 | 10,346 |
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2009-04-28.21; # UTC
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
IFS=" "" $nl"
errstatus=0
dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit $?
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit $?
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp=$pathcomp/
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/Test/mkinstalldirs | Shell | apache-2.0 | 3,538 |
#!/bin/sh
#
# Hack for MacPorts
cp /usr/local/share/aclocal/sdl.m4 m4
# Prep
make distclean
aclocal --force -I /usr/local/share/aclocal
libtoolize --force --copy
autoreconf -fvi
rm -rf autom4te.cache
# Setup
aclocal -I /usr/local/share/aclocal
autoheader
automake --foreign
autoconf
#./configure $*
echo "Now you are ready to run ./configure"
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/autogen.sh | Shell | apache-2.0 | 347 |
#!/bin/sh
rm -rf /usr/src/RPM/BUILD/SDL_gfx-2.0.13
(cd ..; tar cvzf SDL_gfx-2.0.13.tar.gz SDL_gfx-2.0.13)
cp ../SDL_gfx-2.0.13.tar.gz /usr/src/RPM/SOURCES/SDL_gfx-2.0.13.tar.gz
rpm -ba SDL_gfx.spec
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/buildrpm.sh | Shell | apache-2.0 | 199 |
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2012-03-27.16; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# A tabulation character.
tab=' '
# A newline character.
nl='
'
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' "$nl" < "$tmpdepfile" |
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependent.h'.
# Do two passes, one to just change these to
# '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
# However on
# $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\':
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
# tcc 0.9.26 (FIXME still under development at the moment of writing)
# will emit a similar output, but also prepend the continuation lines
# with horizontal tabulation characters.
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form 'foo.o: dependent.h',
# or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
# Do two passes, one to just change these to
# '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
< "$tmpdepfile" > "$depfile"
sed '
s/[ '"$tab"'][ '"$tab"']*/ /g
s/^ *//
s/ *\\*$//
s/^[^:]*: *//
/^$/d
/:$/d
s/$/ :/
' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test "$stat" = 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' "$nl" < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/depcomp | Shell | apache-2.0 | 20,899 |
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-01-19.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for `test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for `test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/install-sh | Shell | apache-2.0 | 13,998 |
#! /bin/sh
# ltconfig - Create a system-specific libtool.
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# A lot of this script is taken from autoconf-2.10.
# Check that we are running under the correct shell.
SHELL=${CONFIG_SHELL-/bin/sh}
echo=echo
if test "X$1" = X--no-reexec; then
# Discard the --no-reexec flag, and continue.
shift
elif test "X$1" = X--fallback-echo; then
# Avoid inline document here, it may be left over
:
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
# Yippee, $echo works!
:
else
# Restart under the correct shell.
exec "$SHELL" "$0" --no-reexec ${1+"$@"}
fi
if test "X$1" = X--fallback-echo; then
# used as fallback echo
shift
cat <<EOF
$*
EOF
exit 0
fi
# Find the correct PATH separator. Usually this is `:', but
# DJGPP uses `;' like DOS.
if test "X${PATH_SEPARATOR+set}" != Xset; then
UNAME=${UNAME-`uname 2>/dev/null`}
case X$UNAME in
*-DOS) PATH_SEPARATOR=';' ;;
*) PATH_SEPARATOR=':' ;;
esac
fi
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
if test "X${echo_test_string+set}" != Xset; then
# find a string as large as possible, as long as the shell can cope with it
for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
# expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
if (echo_test_string="`eval $cmd`") 2>/dev/null &&
echo_test_string="`eval $cmd`" &&
(test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
break
fi
done
fi
if test "X`($echo '\t') 2>/dev/null`" != 'X\t' ||
test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then
# The Solaris, AIX, and Digital Unix default echo programs unquote
# backslashes. This makes it impossible to quote backslashes using
# echo "$something" | sed 's/\\/\\\\/g'
#
# So, first we look for a working echo in the user's PATH.
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
for dir in $PATH /usr/ucb; do
if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
echo="$dir/echo"
break
fi
done
IFS="$save_ifs"
if test "X$echo" = Xecho; then
# We didn't find a better echo, so look for alternatives.
if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
# This shell has a builtin print -r that does the trick.
echo='print -r'
elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
test "X$CONFIG_SHELL" != X/bin/ksh; then
# If we have ksh, try running ltconfig again with it.
ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
export ORIGINAL_CONFIG_SHELL
CONFIG_SHELL=/bin/ksh
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
else
# Try using printf.
echo='printf "%s\n"'
if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
# Cool, printf works
:
elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
export CONFIG_SHELL
SHELL="$CONFIG_SHELL"
export SHELL
echo="$CONFIG_SHELL $0 --fallback-echo"
elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
echo="$CONFIG_SHELL $0 --fallback-echo"
else
# maybe with a smaller string...
prev=:
for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
break
fi
prev="$cmd"
done
if test "$prev" != 'sed 50q "$0"'; then
echo_test_string=`eval $prev`
export echo_test_string
exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"}
else
# Oops. We lost completely, so just stick with echo.
echo=echo
fi
fi
fi
fi
fi
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed='sed -e s/^X//'
sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
# Sed substitution to delay expansion of an escaped shell variable in a
# double_quote_subst'ed string.
delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
# The name of this program.
progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
# Constants:
PROGRAM=ltconfig
PACKAGE=libtool
VERSION=1.3.5
TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
rm="rm -f"
help="Try \`$progname --help' for more information."
# Global variables:
default_ofile=libtool
can_build_shared=yes
enable_shared=yes
# All known linkers require a `.a' archive for static linking (except M$VC,
# which needs '.lib').
enable_static=yes
enable_fast_install=yes
enable_dlopen=unknown
enable_win32_dll=no
ltmain=
silent=
srcdir=
ac_config_guess=
ac_config_sub=
host=
nonopt=
ofile="$default_ofile"
verify_host=yes
with_gcc=no
with_gnu_ld=no
need_locks=yes
ac_ext=c
objext=o
libext=a
exeext=
cache_file=
old_AR="$AR"
old_CC="$CC"
old_CFLAGS="$CFLAGS"
old_CPPFLAGS="$CPPFLAGS"
old_LDFLAGS="$LDFLAGS"
old_LD="$LD"
old_LN_S="$LN_S"
old_LIBS="$LIBS"
old_NM="$NM"
old_RANLIB="$RANLIB"
old_DLLTOOL="$DLLTOOL"
old_OBJDUMP="$OBJDUMP"
old_AS="$AS"
# Parse the command line options.
args=
prev=
for option
do
case "$option" in
-*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
# If the previous option needs an argument, assign it.
if test -n "$prev"; then
eval "$prev=\$option"
prev=
continue
fi
case "$option" in
--help) cat <<EOM
Usage: $progname [OPTION]... [HOST [LTMAIN]]
Generate a system-specific libtool script.
--debug enable verbose shell tracing
--disable-shared do not build shared libraries
--disable-static do not build static libraries
--disable-fast-install do not optimize for fast installation
--enable-dlopen enable dlopen support
--enable-win32-dll enable building dlls on win32 hosts
--help display this help and exit
--no-verify do not verify that HOST is a valid host type
-o, --output=FILE specify the output file [default=$default_ofile]
--quiet same as \`--silent'
--silent do not print informational messages
--srcdir=DIR find \`config.guess' in DIR
--version output version information and exit
--with-gcc assume that the GNU C compiler will be used
--with-gnu-ld assume that the C compiler uses the GNU linker
--disable-lock disable file locking
--cache-file=FILE configure cache file
LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
that provides basic libtool functionality.
HOST is the canonical host system name [default=guessed].
EOM
exit 0
;;
--debug)
echo "$progname: enabling shell trace mode"
set -x
;;
--disable-shared) enable_shared=no ;;
--disable-static) enable_static=no ;;
--disable-fast-install) enable_fast_install=no ;;
--enable-dlopen) enable_dlopen=yes ;;
--enable-win32-dll) enable_win32_dll=yes ;;
--quiet | --silent) silent=yes ;;
--srcdir) prev=srcdir ;;
--srcdir=*) srcdir="$optarg" ;;
--no-verify) verify_host=no ;;
--output | -o) prev=ofile ;;
--output=*) ofile="$optarg" ;;
--version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
--with-gcc) with_gcc=yes ;;
--with-gnu-ld) with_gnu_ld=yes ;;
--disable-lock) need_locks=no ;;
--cache-file=*) cache_file="$optarg" ;;
-*)
echo "$progname: unrecognized option \`$option'" 1>&2
echo "$help" 1>&2
exit 1
;;
*)
if test -z "$ltmain"; then
ltmain="$option"
elif test -z "$host"; then
# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
# echo "$progname: warning \`$option' is not a valid host type" 1>&2
# fi
host="$option"
else
echo "$progname: too many arguments" 1>&2
echo "$help" 1>&2
exit 1
fi ;;
esac
done
if test -z "$ltmain"; then
echo "$progname: you must specify a LTMAIN file" 1>&2
echo "$help" 1>&2
exit 1
fi
if test ! -f "$ltmain"; then
echo "$progname: \`$ltmain' does not exist" 1>&2
echo "$help" 1>&2
exit 1
fi
# Quote any args containing shell metacharacters.
ltconfig_args=
for arg
do
case "$arg" in
*" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
ltconfig_args="$ltconfig_args '$arg'" ;;
*) ltconfig_args="$ltconfig_args $arg" ;;
esac
done
# A relevant subset of AC_INIT.
# File descriptor usage:
# 0 standard input
# 1 file creation
# 2 errors and warnings
# 3 some systems may open it to /dev/tty
# 4 used on the Kubota Titan
# 5 compiler messages saved in config.log
# 6 checking for... messages and results
if test "$silent" = yes; then
exec 6>/dev/null
else
exec 6>&1
fi
exec 5>>./config.log
# NLS nuisances.
# Only set LANG and LC_ALL to C if already set.
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi
if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi
if test -n "$cache_file" && test -r "$cache_file"; then
echo "loading cache $cache_file within ltconfig"
. $cache_file
fi
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi
if test -z "$srcdir"; then
# Assume the source directory is the same one as the path to LTMAIN.
srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
test "$srcdir" = "$ltmain" && srcdir=.
fi
trap "$rm conftest*; exit 1" 1 2 15
if test "$verify_host" = yes; then
# Check for config.guess and config.sub.
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/config.guess; then
ac_aux_dir=$ac_dir
break
fi
done
if test -z "$ac_aux_dir"; then
echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
echo "$help" 1>&2
exit 1
fi
ac_config_guess=$ac_aux_dir/config.guess
ac_config_sub=$ac_aux_dir/config.sub
# Make sure we can run config.sub.
if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then :
else
echo "$progname: cannot run $ac_config_sub" 1>&2
echo "$help" 1>&2
exit 1
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
host_alias=$host
case "$host_alias" in
"")
if host_alias=`$SHELL $ac_config_guess`; then :
else
echo "$progname: cannot guess host type; you must specify one" 1>&2
echo "$help" 1>&2
exit 1
fi ;;
esac
host=`$SHELL $ac_config_sub $host_alias`
echo "$ac_t$host" 1>&6
# Make sure the host verified.
test -z "$host" && exit 1
elif test -z "$host"; then
echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
echo "$help" 1>&2
exit 1
else
host_alias=$host
fi
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case "$host_os" in
linux-gnu*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
case "$host_os" in
aix3*)
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test "X${COLLECT_NAMES+set}" != Xset; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
;;
esac
# Determine commands to create old-style static archives.
old_archive_cmds='$AR cru $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib'
old_postuninstall_cmds=
# Set a sane default for `AR'.
test -z "$AR" && AR=ar
# Set a sane default for `OBJDUMP'.
test -z "$OBJDUMP" && OBJDUMP=objdump
# If RANLIB is not set, then run the test.
if test "${RANLIB+set}" != "set"; then
result=no
echo $ac_n "checking for ranlib... $ac_c" 1>&6
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then
RANLIB="ranlib"
result="ranlib"
break
fi
done
IFS="$save_ifs"
echo "$ac_t$result" 1>&6
fi
if test -n "$RANLIB"; then
old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
fi
# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin.
test -z "$DLLTOOL" && DLLTOOL=dlltool
test -z "$OBJDUMP" && OBJDUMP=objdump
test -z "$AS" && AS=as
# Check to see if we are using GCC.
if test "$with_gcc" != yes || test -z "$CC"; then
# If CC is not set, then try to find GCC or a usable CC.
if test -z "$CC"; then
echo $ac_n "checking for gcc... $ac_c" 1>&6
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then
CC="gcc"
break
fi
done
IFS="$save_ifs"
if test -n "$CC"; then
echo "$ac_t$CC" 1>&6
else
echo "$ac_t"no 1>&6
fi
fi
# Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
if test -z "$CC"; then
echo $ac_n "checking for cc... $ac_c" 1>&6
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
cc_rejected=no
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/cc || test -f $dir/cc$ac_exeext; then
if test "$dir/cc" = "/usr/ucb/cc"; then
cc_rejected=yes
continue
fi
CC="cc"
break
fi
done
IFS="$save_ifs"
if test $cc_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
set dummy $CC
shift
if test $# -gt 0; then
# We chose a different compiler from the bogus one.
# However, it has the same name, so the bogon will be chosen
# first if we set CC to just the name; use the full file name.
shift
set dummy "$dir/cc" "$@"
shift
CC="$@"
fi
fi
if test -n "$CC"; then
echo "$ac_t$CC" 1>&6
else
echo "$ac_t"no 1>&6
fi
if test -z "$CC"; then
echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
exit 1
fi
fi
# Now see if the compiler is really GCC.
with_gcc=no
echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
echo "$progname:581: checking whether we are using GNU C" >&5
$rm conftest.c
cat > conftest.c <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
with_gcc=yes
fi
$rm conftest.c
echo "$ac_t$with_gcc" 1>&6
fi
# Allow CC to be a program name with arguments.
set dummy $CC
compiler="$2"
echo $ac_n "checking for object suffix... $ac_c" 1>&6
$rm conftest*
echo 'int i = 1;' > conftest.c
echo "$progname:603: checking for object suffix" >& 5
if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
# Append any warnings to the config.log.
cat conftest.err 1>&5
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
*) objext=`echo $ac_file | sed -e s/conftest.//` ;;
esac
done
else
cat conftest.err 1>&5
echo "$progname: failed program was:" >&5
cat conftest.c >&5
fi
$rm conftest*
echo "$ac_t$objext" 1>&6
echo $ac_n "checking for executable suffix... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_exeext="no"
$rm conftest*
echo 'main () { return 0; }' > conftest.c
echo "$progname:629: checking for executable suffix" >& 5
if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then
# Append any warnings to the config.log.
cat conftest.err 1>&5
for ac_file in conftest.*; do
case $ac_file in
*.c | *.err | *.$objext ) ;;
*) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;;
esac
done
else
cat conftest.err 1>&5
echo "$progname: failed program was:" >&5
cat conftest.c >&5
fi
$rm conftest*
fi
if test "X$ac_cv_exeext" = Xno; then
exeext=""
else
exeext="$ac_cv_exeext"
fi
echo "$ac_t$ac_cv_exeext" 1>&6
echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
pic_flag=
special_shlib_compile_flags=
wl=
link_static_flag=
no_builtin_flag=
if test "$with_gcc" = yes; then
wl='-Wl,'
link_static_flag='-static'
case "$host_os" in
beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
aix*)
# Below there is a dirty hack to force normal static linking with -ldl
# The problem is because libdl dynamically linked with both libc and
# libC (AIX C++ library), which obviously doesn't included in libraries
# list by gcc. This cause undefined symbols with -static flags.
# This hack allows C programs to be linked with "-static -ldl", but
# we not sure about C++ programs.
link_static_flag="$link_static_flag ${wl}-lC"
;;
cygwin* | mingw* | os2*)
# We can build DLLs from non-PIC.
;;
amigaos*)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better,
# like `-m68040'.
pic_flag='-m68020 -resident32 -malways-restore-a4'
;;
sysv4*MP*)
if test -d /usr/nec; then
pic_flag=-Kconform_pic
fi
;;
*)
pic_flag='-fPIC'
;;
esac
else
# PORTME Check for PIC flags for the system compiler.
case "$host_os" in
aix3* | aix4*)
# All AIX code is PIC.
link_static_flag='-bnso -bI:/lib/syscalls.exp'
;;
hpux9* | hpux10* | hpux11*)
# Is there a better link_static_flag that works with the bundled CC?
wl='-Wl,'
link_static_flag="${wl}-a ${wl}archive"
pic_flag='+Z'
;;
irix5* | irix6*)
wl='-Wl,'
link_static_flag='-non_shared'
# PIC (with -KPIC) is the default.
;;
cygwin* | mingw* | os2*)
# We can build DLLs from non-PIC.
;;
osf3* | osf4* | osf5*)
# All OSF/1 code is PIC.
wl='-Wl,'
link_static_flag='-non_shared'
;;
sco3.2v5*)
pic_flag='-Kpic'
link_static_flag='-dn'
special_shlib_compile_flags='-belf'
;;
solaris*)
pic_flag='-KPIC'
link_static_flag='-Bstatic'
wl='-Wl,'
;;
sunos4*)
pic_flag='-PIC'
link_static_flag='-Bstatic'
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
pic_flag='-KPIC'
link_static_flag='-Bstatic'
wl='-Wl,'
;;
uts4*)
pic_flag='-pic'
link_static_flag='-Bstatic'
;;
sysv4*MP*)
if test -d /usr/nec ;then
pic_flag='-Kconform_pic'
link_static_flag='-Bstatic'
fi
;;
*)
can_build_shared=no
;;
esac
fi
if test -n "$pic_flag"; then
echo "$ac_t$pic_flag" 1>&6
# Check to make sure the pic_flag actually works.
echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
$rm conftest*
echo "int some_variable = 0;" > conftest.c
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $pic_flag -DPIC"
echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5
if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
# Append any warnings to the config.log.
cat conftest.err 1>&5
case "$host_os" in
hpux9* | hpux10* | hpux11*)
# On HP-UX, both CC and GCC only warn that PIC is supported... then they
# create non-PIC objects. So, if there were any warnings, we assume that
# PIC is not supported.
if test -s conftest.err; then
echo "$ac_t"no 1>&6
can_build_shared=no
pic_flag=
else
echo "$ac_t"yes 1>&6
pic_flag=" $pic_flag"
fi
;;
*)
echo "$ac_t"yes 1>&6
pic_flag=" $pic_flag"
;;
esac
else
# Append any errors to the config.log.
cat conftest.err 1>&5
can_build_shared=no
pic_flag=
echo "$ac_t"no 1>&6
fi
CFLAGS="$save_CFLAGS"
$rm conftest*
else
echo "$ac_t"none 1>&6
fi
# Check to see if options -o and -c are simultaneously supported by compiler
echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6
$rm -r conftest 2>/dev/null
mkdir conftest
cd conftest
$rm conftest*
echo "int some_variable = 0;" > conftest.c
mkdir out
# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
# that will create temporary files in the current directory regardless of
# the output directory. Thus, making CWD read-only will cause this test
# to fail, enabling locking or at least warning the user not to do parallel
# builds.
chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.o"
echo "$progname:829: checking if $compiler supports -c -o file.o" >&5
if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
echo "$ac_t"no 1>&6
compiler_c_o=no
else
echo "$ac_t"yes 1>&6
compiler_c_o=yes
fi
else
# Append any errors to the config.log.
cat out/conftest.err 1>&5
compiler_c_o=no
echo "$ac_t"no 1>&6
fi
CFLAGS="$save_CFLAGS"
chmod u+w .
$rm conftest* out/*
rmdir out
cd ..
rmdir conftest
$rm -r conftest 2>/dev/null
if test x"$compiler_c_o" = x"yes"; then
# Check to see if we can write to a .lo
echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
$rm conftest*
echo "int some_variable = 0;" > conftest.c
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -c -o conftest.lo"
echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5
if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s conftest.err; then
echo "$ac_t"no 1>&6
compiler_o_lo=no
else
echo "$ac_t"yes 1>&6
compiler_o_lo=yes
fi
else
# Append any errors to the config.log.
cat conftest.err 1>&5
compiler_o_lo=no
echo "$ac_t"no 1>&6
fi
CFLAGS="$save_CFLAGS"
$rm conftest*
else
compiler_o_lo=no
fi
# Check to see if we can do hard links to lock some files if needed
hard_links="nottested"
if test "$compiler_c_o" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
hard_links=yes
$rm conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
echo "$ac_t$hard_links" 1>&6
$rm conftest*
if test "$hard_links" = no; then
echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
need_locks=warn
fi
else
need_locks=no
fi
if test "$with_gcc" = yes; then
# Check to see if options -fno-rtti -fno-exceptions are supported by compiler
echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
$rm conftest*
echo "int some_variable = 0;" > conftest.c
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s conftest.err; then
echo "$ac_t"no 1>&6
compiler_rtti_exceptions=no
else
echo "$ac_t"yes 1>&6
compiler_rtti_exceptions=yes
fi
else
# Append any errors to the config.log.
cat conftest.err 1>&5
compiler_rtti_exceptions=no
echo "$ac_t"no 1>&6
fi
CFLAGS="$save_CFLAGS"
$rm conftest*
if test "$compiler_rtti_exceptions" = "yes"; then
no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
else
no_builtin_flag=' -fno-builtin'
fi
fi
# Check for any special shared library compilation flags.
if test -n "$special_shlib_compile_flags"; then
echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then :
else
echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
can_build_shared=no
fi
fi
echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
$rm conftest*
echo 'main(){return(0);}' > conftest.c
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $link_static_flag"
echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5
if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
echo "$ac_t$link_static_flag" 1>&6
else
echo "$ac_t"none 1>&6
link_static_flag=
fi
LDFLAGS="$save_LDFLAGS"
$rm conftest*
if test -z "$LN_S"; then
# Check to see if we can use ln -s, or we need hard links.
echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
$rm conftest.dat
if ln -s X conftest.dat 2>/dev/null; then
$rm conftest.dat
LN_S="ln -s"
else
LN_S=ln
fi
if test "$LN_S" = "ln -s"; then
echo "$ac_t"yes 1>&6
else
echo "$ac_t"no 1>&6
fi
fi
# Make sure LD is an absolute path.
if test -z "$LD"; then
ac_prog=ld
if test "$with_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
echo "$progname:991: checking for ld used by GCC" >&5
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
[\\/]* | [A-Za-z]:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we are not using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld... $ac_c" 1>&6
echo "$progname:1015: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
echo "$progname:1018: checking for non-GNU ld" >&5
fi
if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
fi
if test -n "$LD"; then
echo "$ac_t$LD" 1>&6
else
echo "$ac_t"no 1>&6
fi
if test -z "$LD"; then
echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
exit 1
fi
fi
# Check to see if it really is or is not GNU ld.
echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
with_gnu_ld=yes
else
with_gnu_ld=no
fi
echo "$ac_t$with_gnu_ld" 1>&6
# See if the linker supports building shared libraries.
echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
allow_undefined_flag=
no_undefined_flag=
need_lib_prefix=unknown
need_version=unknown
# when you set need_version to no, make sure it does not cause -set_version
# flags to be left without arguments
archive_cmds=
archive_expsym_cmds=
old_archive_from_new_cmds=
export_dynamic_flag_spec=
whole_archive_flag_spec=
thread_safe_flag_spec=
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
hardcode_shlibpath_var=unsupported
runpath_var=
always_export_symbols=no
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
include_expsyms=
# exclude_expsyms can be an egrep regular expression of symbols to exclude
# it will be wrapped by ` (' and `)$', so one must not match beginning or
# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
# as well as any symbol that contains `d'.
exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
# platforms (ab)use it in PIC code, but their linkers get confused if
# the symbol is explicitly referenced. Since portable code cannot
# rely on this symbol name, it's probably fine to never include it in
# preloaded symbol tables.
case "$host_os" in
cygwin* | mingw*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$with_gcc" != yes; then
with_gnu_ld=no
fi
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# If archive_cmds runs LD, not CC, wlarc should be empty
wlarc='${wl}'
# See if GNU ld supports shared libraries.
case "$host_os" in
aix3* | aix4*)
# On AIX, the GNU linker is very broken
ld_shlibs=no
cat <<EOF 1>&2
*** Warning: the GNU linker, at least up to release 2.9.1, is reported
*** to be unable to reliably create shared libraries on AIX.
*** Therefore, libtool is disabling shared libraries support. If you
*** really care for shared libraries, you may want to modify your PATH
*** so that a non-GNU linker is found, and then restart.
EOF
;;
amigaos*)
archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we can use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
#allow_undefined_flag=unsupported
# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
else
ld_shlibs=no
fi
;;
cygwin* | mingw*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
# allow_undefined_flag=unsupported
always_export_symbols=yes
# Extract the symbol export list from an `--export-all' def file,
# then regenerate the def file from the symbol export list, so that
# the compiled dll only exports the symbol export list.
# Be careful not to strip the DATA tag left by newer dlltools.
export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
$DLLTOOL --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~
sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols'
# If DATA tags from a recent dlltool are present, honour them!
archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
_lt_hint=1;
cat $export_symbols | while read symbol; do
set dummy \$symbol;
case \$# in
2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;;
*) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;;
esac;
_lt_hint=`expr 1 + \$_lt_hint`;
done~
test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
$CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
$CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
$CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
: strip_is_broken_with_dlls_on_win95B - strip $lib'
old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a'
;;
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
# can we support soname and/or expsyms with a.out? -oliva
fi
;;
solaris* | sysv5*)
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
cat <<EOF 1>&2
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.9.1 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
EOF
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
sunos4*)
archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts'
wlarc=
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = yes; then
runpath_var=LD_RUN_PATH
hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
export_dynamic_flag_spec='${wl}--export-dynamic'
case $host_os in
cygwin* | mingw*)
# dlltool doesn't understand --whole-archive et. al.
whole_archive_flag_spec=
;;
*)
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
else
whole_archive_flag_spec=
fi
;;
esac
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
case "$host_os" in
aix3*)
allow_undefined_flag=unsupported
always_export_symbols=yes
archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname'
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$with_gcc" = yes && test -z "$link_static_flag"; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4*)
hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib'
hardcode_libdir_separator=':'
if test "$with_gcc" = yes; then
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
hardcode_direct=yes
else
# We have old collect2
hardcode_direct=unsupported
# It fails to find uninstalled libraries when the uninstalled
# path is not listed in the libpath. Setting hardcode_minus_L
# to unsupported forces relinking
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
shared_flag='-shared'
else
shared_flag='${wl}-bM:SRE'
hardcode_direct=yes
fi
allow_undefined_flag=' ${wl}-berok'
archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}'
archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}'
case "$host_os" in aix4.[01]|aix4.[01].*)
# According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on
always_export_symbols=yes ;;
esac
;;
amigaos*)
archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
cygwin* | mingw*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
# allow_undefined_flag=unsupported
# Tell ltmain to make .lib files, not .a files.
libext=lib
# FIXME: Setting linknames here is a bad hack.
archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
# The linker will automatically build a .lib file if we build a DLL.
old_archive_from_new_cmds='true'
# FIXME: Should let the user specify the lib program.
old_archive_cmds='lib /OUT:$oldlib$oldobjs'
fix_srcfile_path='`cygpath -w $srcfile`'
;;
freebsd1*)
ld_shlibs=no
;;
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# does not break anything, and helps significantly (at the cost of a little
# extra space).
freebsd2.2*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
freebsd2*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd*)
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
hpux9* | hpux10* | hpux11*)
case "$host_os" in
hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
*) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;;
esac
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
hardcode_minus_L=yes # Not in the search PATH, but as the default
# location of the library.
export_dynamic_flag_spec='${wl}-E'
;;
irix5* | irix6*)
if test "$with_gcc" = yes; then
archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
else
archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
fi
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out
else
archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF
fi
hardcode_libdir_flag_spec='${wl}-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
openbsd*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
allow_undefined_flag=unsupported
archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
;;
osf3*)
if test "$with_gcc" = yes; then
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
else
allow_undefined_flag=' -expect_unresolved \*'
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
fi
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*) # As osf3* with the addition of the -msym flag
if test "$with_gcc" = yes; then
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
else
allow_undefined_flag=' -expect_unresolved \*'
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
fi
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
rhapsody*)
archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flags_spec='-L$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
sco3.2v5*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_shlibpath_var=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
;;
solaris*)
no_undefined_flag=' -z text'
# $CC -shared without GNU ld will not create a library from C++
# object files and a static libstdc++, better avoid it by now
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
case "$host_os" in
solaris2.[0-5] | solaris2.[0-5].*) ;;
*) # Supported since Solaris 2.6 (maybe 2.5.1?)
whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
esac
;;
sunos4*)
archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
sysv4)
if test "x$host_vendor" = xsequent; then
# Use $CC to link under sequent, because it throws in some extra .o
# files that make .init and .fini sections work.
archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts'
else
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
fi
runpath_var='LD_RUN_PATH'
hardcode_shlibpath_var=no
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
sysv4.3*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_shlibpath_var=no
export_dynamic_flag_spec='-Bexport'
;;
sysv5*)
no_undefined_flag=' -z text'
# $CC -shared without GNU ld will not create a library from C++
# object files and a static libstdc++, better avoid it by now
archive_cmds='$LD -G${allow_undefined_flag} -h $rpath/$soname -o $lib $libobjs $deplibs $linkopts'
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
hardcode_libdir_flag_spec=
hardcode_shlibpath_var=no
runpath_var='LD_RUN_PATH'
;;
uts4*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_shlibpath_var=no
;;
dgux*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_shlibpath_var=no
;;
sysv4*MP*)
if test -d /usr/nec; then
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
hardcode_shlibpath_var=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
ld_shlibs=yes
fi
;;
sysv4.2uw2*)
archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts'
hardcode_direct=yes
hardcode_minus_L=no
hardcode_shlibpath_var=no
hardcode_runpath_var=yes
runpath_var=LD_RUN_PATH
;;
unixware7*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
runpath_var='LD_RUN_PATH'
hardcode_shlibpath_var=no
;;
*)
ld_shlibs=no
;;
esac
fi
echo "$ac_t$ld_shlibs" 1>&6
test "$ld_shlibs" = no && can_build_shared=no
if test -z "$NM"; then
echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
case "$NM" in
[\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path.
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
NM="$ac_dir/nm -B"
break
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
NM="$ac_dir/nm -p"
break
else
NM=${NM="$ac_dir/nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
done
IFS="$ac_save_ifs"
test -z "$NM" && NM=nm
;;
esac
echo "$ac_t$NM" 1>&6
fi
# Check for command to grab the raw symbol name followed by C symbol from nm.
echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
# These are sane defaults that work on at least a few old systems.
# [They come from Ultrix. What could be older than Ultrix?!! ;)]
# Character class describing NM global symbol codes.
symcode='[BCDEGRST]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
# Transform the above into a raw symbol and a C symbol.
symxfrm='\1 \2\3 \3'
# Transform an extracted symbol line into a proper C declaration
global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
# Define system-specific variables.
case "$host_os" in
aix*)
symcode='[BCDT]'
;;
cygwin* | mingw*)
symcode='[ABCDGISTW]'
;;
hpux*) # Its linker distinguishes data from code symbols
global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
;;
irix*)
symcode='[BCDEGRST]'
;;
solaris*)
symcode='[BDT]'
;;
sysv4)
symcode='[DFNSTU]'
;;
esac
# If we're using GNU nm, then use its standard symbol codes.
if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
symcode='[ABCDGISTW]'
fi
# Try without a prefix undercore, then with it.
for ac_symprfx in "" "_"; do
# Write the raw and C identifiers.
global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'"
# Check to see that the pipe works correctly.
pipe_works=no
$rm conftest*
cat > conftest.c <<EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(){}
#ifdef __cplusplus
}
#endif
main(){nm_test_var='a';nm_test_func();return(0);}
EOF
echo "$progname:1653: checking if global_symbol_pipe works" >&5
if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
# Now try to grab the symbols.
nlist=conftest.nm
if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
else
rm -f "$nlist"T
fi
# Make sure that we snagged all the symbols we need.
if egrep ' nm_test_var$' "$nlist" >/dev/null; then
if egrep ' nm_test_func$' "$nlist" >/dev/null; then
cat <<EOF > conftest.c
#ifdef __cplusplus
extern "C" {
#endif
EOF
# Now generate the symbol file.
eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c'
cat <<EOF >> conftest.c
#if defined (__STDC__) && __STDC__
# define lt_ptr_t void *
#else
# define lt_ptr_t char *
# define const
#endif
/* The mapping between symbol names and symbols. */
const struct {
const char *name;
lt_ptr_t address;
}
lt_preloaded_symbols[] =
{
EOF
sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
cat <<\EOF >> conftest.c
{0, (lt_ptr_t) 0}
};
#ifdef __cplusplus
}
#endif
EOF
# Now try linking the two files.
mv conftest.$objext conftstm.$objext
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="conftstm.$objext"
CFLAGS="$CFLAGS$no_builtin_flag"
if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
pipe_works=yes
else
echo "$progname: failed program was:" >&5
cat conftest.c >&5
fi
LIBS="$save_LIBS"
else
echo "cannot find nm_test_func in $nlist" >&5
fi
else
echo "cannot find nm_test_var in $nlist" >&5
fi
else
echo "cannot run $global_symbol_pipe" >&5
fi
else
echo "$progname: failed program was:" >&5
cat conftest.c >&5
fi
$rm conftest* conftst*
# Do not use the global_symbol_pipe unless it works.
if test "$pipe_works" = yes; then
break
else
global_symbol_pipe=
fi
done
if test "$pipe_works" = yes; then
echo "${ac_t}ok" 1>&6
else
echo "${ac_t}failed" 1>&6
fi
if test -z "$global_symbol_pipe"; then
global_symbol_to_cdecl=
fi
# Check hardcoding attributes.
echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
hardcode_action=
if test -n "$hardcode_libdir_flag_spec" || \
test -n "$runpath_var"; then
# We can hardcode non-existant directories.
if test "$hardcode_direct" != no &&
# If the only mechanism to avoid hardcoding is shlibpath_var, we
# have to relink, otherwise we might link with an installed library
# when we should be linking with a yet-to-be-installed one
## test "$hardcode_shlibpath_var" != no &&
test "$hardcode_minus_L" != no; then
# Linking always hardcodes the temporary library directory.
hardcode_action=relink
else
# We can link without hardcoding, and we can hardcode nonexisting dirs.
hardcode_action=immediate
fi
else
# We cannot hardcode anything, or else we can only hardcode existing
# directories.
hardcode_action=unsupported
fi
echo "$ac_t$hardcode_action" 1>&6
reload_flag=
reload_cmds='$LD$reload_flag -o $output$reload_objs'
echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
# PORTME Some linkers may need a different reload flag.
reload_flag='-r'
echo "$ac_t$reload_flag" 1>&6
test -n "$reload_flag" && reload_flag=" $reload_flag"
# PORTME Fill in your ld.so characteristics
library_names_spec=
libname_spec='lib$name'
soname_spec=
postinstall_cmds=
postuninstall_cmds=
finish_cmds=
finish_eval=
shlibpath_var=
shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
file_magic_cmd=
file_magic_test_file=
deplibs_check_method='unknown'
# Need to set the preceding variable on all platforms that support
# interlibrary dependencies.
# 'none' -- dependencies not supported.
# `unknown' -- same as none, but documents that we really don't know.
# 'pass_all' -- all dependencies passed with no checks.
# 'test_compile' -- check by making test program.
# 'file_magic [regex]' -- check by looking for files in library path
# which responds to the $file_magic_cmd with a given egrep regex.
# If you have `file' or equivalent on your system and you're not sure
# whether `pass_all' will *always* work, you probably want this one.
echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
case "$host_os" in
aix3*)
version_type=linux
library_names_spec='${libname}${release}.so$versuffix $libname.a'
shlibpath_var=LIBPATH
# AIX has no versioning support, so we append a major version to the name.
soname_spec='${libname}${release}.so$major'
;;
aix4*)
version_type=linux
# AIX has no versioning support, so currently we can not hardcode correct
# soname into executable. Probably we can add versioning support to
# collect2, so additional links can be useful in future.
# We preserve .a as extension for shared libraries though AIX4.2
# and later linker supports .so
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a'
shlibpath_var=LIBPATH
deplibs_check_method=pass_all
;;
amigaos*)
library_names_spec='$libname.ixlibrary $libname.a'
# Create ${libname}_ixlibrary.a entries in /sys/libs.
finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
;;
beos*)
library_names_spec='${libname}.so'
dynamic_linker="$host_os ld.so"
shlibpath_var=LIBRARY_PATH
deplibs_check_method=pass_all
lt_cv_dlopen="load_add_on"
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
;;
bsdi4*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
file_magic_cmd=/usr/bin/file
file_magic_test_file=/shlib/libc.so
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
export_dynamic_flag_spec=-rdynamic
# the default ld.so.conf also contains /usr/contrib/lib and
# /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
# libtool to hard-code these into programs
;;
cygwin* | mingw*)
version_type=windows
need_version=no
need_lib_prefix=no
if test "$with_gcc" = yes; then
library_names_spec='`echo ${libname} | sed -e 's/^lib//g'`.dll $libname.a'
else
library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
fi
dynamic_linker='Win32 ld.exe'
deplibs_check_method='file_magic file format pe-i386(.*architecture: i386)?'
file_magic_cmd='${OBJDUMP} -f'
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
if test "$with_gcc" = yes; then
# See where the system libraries really are - /usr/lib won't cut it
libuser32=`$CC --print-file-name=libuser32.a`
win32libs=`expr $libuser32 : '\(.*\)/.*'`
sys_lib_search_path_spec="$sys_lib_search_path $win32libs"
fi
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
;;
freebsd1*)
dynamic_linker=no
;;
freebsd*)
objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
version_type=freebsd-$objformat
case "$version_type" in
freebsd-elf*)
deplibs_check_method='pass_all'
file_magic_cmd=/usr/bin/file
file_magic_test_file=`echo /usr/lib/libc.so*`
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
need_version=no
need_lib_prefix=no
;;
freebsd-*)
deplibs_check_method=unknown
library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
need_version=yes
;;
esac
shlibpath_var=LD_LIBRARY_PATH
case "$host_os" in
freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*)
shlibpath_overrides_runpath=yes
;;
*) # from 3.2 on
shlibpath_overrides_runpath=no
;;
esac
;;
gnu*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
;;
hpux9* | hpux10* | hpux11*)
# Give a soname corresponding to the major version so that dld.sl refuses to
# link against other versions.
dynamic_linker="$host_os dld.sl"
version_type=sunos
need_lib_prefix=no
need_version=no
shlibpath_var=SHLIB_PATH
shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
soname_spec='${libname}${release}.sl$major'
# HP-UX runs *really* slowly unless shared libraries are mode 555.
postinstall_cmds='chmod 555 $lib'
case "$host_os" in
hpux10.20*)
# TODO: Does this work for hpux-11 too?
deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
file_magic_cmd=/usr/bin/file
file_magic_test_file=/usr/lib/libc.sl
;;
esac
;;
irix5* | irix6*)
version_type=irix
need_lib_prefix=no
need_version=no
soname_spec='${libname}${release}.so.$major'
library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so'
case "$host_os" in
irix5*)
libsuff= shlibsuff=
# this will be overridden with pass_all, but let us keep it just in case
deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
;;
*)
case "$LD" in # libtool.m4 will add one of these switches to LD
*-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
*-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
*-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
*) libsuff= shlibsuff= libmagic=never-match;;
esac
;;
esac
shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
shlibpath_overrides_runpath=no
sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
file_magic_cmd=/usr/bin/file
file_magic_test_file=`echo /lib${libsuff}/libc.so*`
deplibs_check_method='pass_all'
;;
# No shared lib support for Linux oldld, aout, or coff.
linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
dynamic_linker=no
;;
# This must be Linux ELF.
linux-gnu*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
deplibs_check_method=pass_all
if test -f /lib/ld.so.1; then
dynamic_linker='GNU ld.so'
else
# Only the GNU ld.so supports shared libraries on MkLinux.
case "$host_cpu" in
powerpc*) dynamic_linker=no ;;
*) dynamic_linker='Linux ld.so' ;;
esac
fi
;;
netbsd*)
version_type=sunos
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
soname_spec='${libname}${release}.so$major'
dynamic_linker='NetBSD ld.elf_so'
fi
shlibpath_var=LD_LIBRARY_PATH
;;
openbsd*)
version_type=sunos
if test "$with_gnu_ld" = yes; then
need_lib_prefix=no
need_version=no
fi
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
;;
os2*)
libname_spec='$name'
need_lib_prefix=no
library_names_spec='$libname.dll $libname.a'
dynamic_linker='OS/2 ld.exe'
shlibpath_var=LIBPATH
;;
osf3* | osf4* | osf5*)
version_type=osf
need_version=no
soname_spec='${libname}${release}.so'
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
shlibpath_var=LD_LIBRARY_PATH
# this will be overridden with pass_all, but let us keep it just in case
deplibs_check_method='file_magic COFF format alpha shared library'
file_magic_cmd=/usr/bin/file
file_magic_test_file=/shlib/libc.so
deplibs_check_method='pass_all'
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
;;
rhapsody*)
version_type=sunos
library_names_spec='${libname}.so'
soname_spec='${libname}.so'
shlibpath_var=DYLD_LIBRARY_PATH
deplibs_check_method=pass_all
;;
sco3.2v5*)
version_type=osf
soname_spec='${libname}${release}.so$major'
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
shlibpath_var=LD_LIBRARY_PATH
;;
solaris*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
# ldd complains unless libraries are executable
postinstall_cmds='chmod +x $lib'
deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
file_magic_cmd=/usr/bin/file
file_magic_test_file=/lib/libc.so
;;
sunos4*)
version_type=sunos
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
if test "$with_gnu_ld" = yes; then
need_lib_prefix=no
fi
need_version=yes
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
version_type=linux
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
case "$host_vendor" in
sequent)
file_magic_cmd='/bin/file'
deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
;;
ncr)
deplibs_check_method='pass_all'
;;
motorola)
need_lib_prefix=no
need_version=no
shlibpath_overrides_runpath=no
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
file_magic_cmd=/usr/bin/file
file_magic_test_file=`echo /usr/lib/libc.so*`
;;
esac
;;
uts4*)
version_type=linux
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
;;
dgux*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
soname_spec='${libname}${release}.so$major'
shlibpath_var=LD_LIBRARY_PATH
;;
sysv4*MP*)
if test -d /usr/nec ;then
version_type=linux
library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
soname_spec='$libname.so.$major'
shlibpath_var=LD_LIBRARY_PATH
fi
;;
*)
dynamic_linker=no
;;
esac
echo "$ac_t$dynamic_linker" 1>&6
test "$dynamic_linker" = no && can_build_shared=no
# Report the final consequences.
echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in
# configure.in, otherwise build static only libraries.
case "$host_os" in
cygwin* | mingw* | os2*)
if test x$can_build_shared = xyes; then
test x$enable_win32_dll = xno && can_build_shared=no
echo "checking if package supports dlls... $can_build_shared" 1>&6
fi
;;
esac
if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then
case "$deplibs_check_method" in
"file_magic "*)
file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
egrep "$file_magic_regex" > /dev/null; then
:
else
cat <<EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
*** The result is that libtool may fail to recognize shared libraries
*** as such. This will affect the creation of libtool libraries that
*** depend on shared libraries, but programs linked with such libtool
*** libraries will work regardless of this problem. Nevertheless, you
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
EOF
fi ;;
esac
fi
echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case "$host_os" in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix4*)
test "$enable_shared" = yes && enable_static=no
;;
esac
echo "$ac_t$enable_shared" 1>&6
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
echo "checking whether to build static libraries... $enable_static" 1>&6
if test "$hardcode_action" = relink; then
# Fast installation is not supported
enable_fast_install=no
elif test "$shlibpath_overrides_runpath" = yes ||
test "$enable_shared" = no; then
# Fast installation is not necessary
enable_fast_install=needless
fi
echo $ac_n "checking for objdir... $ac_c" 1>&6
rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
if test -d .libs; then
objdir=.libs
else
# MS-DOS does not allow filenames that begin with a dot.
objdir=_libs
fi
rmdir .libs 2>/dev/null
echo "$ac_t$objdir" 1>&6
if test "x$enable_dlopen" != xyes; then
enable_dlopen=unknown
enable_dlopen_self=unknown
enable_dlopen_self_static=unknown
else
if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then
lt_cv_dlopen=no lt_cv_dlopen_libs=
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
echo "$progname:2248: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2256 "ltconfig"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen();
int main() {
dlopen()
; return 0; }
EOF
if { (eval echo $progname:2269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen""... $ac_c" 1>&6
echo "$progname:2288: checking for dlopen" >&5
if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2293 "ltconfig"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dlopen(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_dlopen) || defined (__stub___dlopen)
choke me
#else
dlopen();
#endif
; return 0; }
EOF
if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dlopen=yes"
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_dlopen=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
echo "$ac_t""yes" 1>&6
lt_cv_dlopen="dlopen"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
echo "$progname:2335: checking for dld_link in -ldld" >&5
ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2343 "ltconfig"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dld_link();
int main() {
dld_link()
; return 0; }
EOF
if { (eval echo $progname:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for shl_load""... $ac_c" 1>&6
echo "$progname:2375: checking for shl_load" >&5
if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2380 "ltconfig"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shl_load(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char shl_load();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_shl_load) || defined (__stub___shl_load)
choke me
#else
shl_load();
#endif
; return 0; }
EOF
if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_shl_load=yes"
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_shl_load=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
echo "$ac_t""yes" 1>&6
lt_cv_dlopen="shl_load"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
echo "$progname:2423: checking for shl_load in -ldld" >&5
ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2431 "ltconfig"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char shl_load();
int main() {
shl_load()
; return 0; }
EOF
if { (eval echo $progname:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
else
echo "$ac_t""no" 1>&6
fi
fi
fi
fi
fi
fi
if test "x$lt_cv_dlopen" != xno; then
enable_dlopen=yes
fi
case "$lt_cv_dlopen" in
dlopen)
for ac_hdr in dlfcn.h; do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "$progname:2488: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2493 "ltconfig"
#include <$ac_hdr>
int fnord = 0;
EOF
ac_try="$ac_compile >/dev/null 2>conftest.out"
{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
else
echo "$ac_t""no" 1>&6
fi
done
if test "x$ac_cv_header_dlfcn_h" = xyes; then
CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
fi
eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
LIBS="$lt_cv_dlopen_libs $LIBS"
echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
echo "$progname:2526: checking whether a program can dlopen itself" >&5
if test "${lt_cv_dlopen_self+set}" = set; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
lt_cv_dlopen_self=cross
else
cat > conftest.c <<EOF
#line 2534 "ltconfig"
#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include <stdio.h>
#ifdef RTLD_GLOBAL
# define LTDL_GLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LTDL_GLOBAL DL_GLOBAL
# else
# define LTDL_GLOBAL 0
# endif
#endif
/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
find out it does not work in some platform. */
#ifndef LTDL_LAZY_OR_NOW
# ifdef RTLD_LAZY
# define LTDL_LAZY_OR_NOW RTLD_LAZY
# else
# ifdef DL_LAZY
# define LTDL_LAZY_OR_NOW DL_LAZY
# else
# ifdef RTLD_NOW
# define LTDL_LAZY_OR_NOW RTLD_NOW
# else
# ifdef DL_NOW
# define LTDL_LAZY_OR_NOW DL_NOW
# else
# define LTDL_LAZY_OR_NOW 0
# endif
# endif
# endif
# endif
#endif
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
EOF
if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
lt_cv_dlopen_self=yes
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
lt_cv_dlopen_self=no
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$lt_cv_dlopen_self" 1>&6
if test "$lt_cv_dlopen_self" = yes; then
LDFLAGS="$LDFLAGS $link_static_flag"
echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5
if test "${lt_cv_dlopen_self_static+set}" = set; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
lt_cv_dlopen_self_static=cross
else
cat > conftest.c <<EOF
#line 2607 "ltconfig"
#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include <stdio.h>
#ifdef RTLD_GLOBAL
# define LTDL_GLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LTDL_GLOBAL DL_GLOBAL
# else
# define LTDL_GLOBAL 0
# endif
#endif
/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
find out it does not work in some platform. */
#ifndef LTDL_LAZY_OR_NOW
# ifdef RTLD_LAZY
# define LTDL_LAZY_OR_NOW RTLD_LAZY
# else
# ifdef DL_LAZY
# define LTDL_LAZY_OR_NOW DL_LAZY
# else
# ifdef RTLD_NOW
# define LTDL_LAZY_OR_NOW RTLD_NOW
# else
# ifdef DL_NOW
# define LTDL_LAZY_OR_NOW DL_NOW
# else
# define LTDL_LAZY_OR_NOW 0
# endif
# endif
# endif
# endif
#endif
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); }
EOF
if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
lt_cv_dlopen_self_static=yes
else
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
lt_cv_dlopen_self_static=no
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
fi
;;
esac
case "$lt_cv_dlopen_self" in
yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
*) enable_dlopen_self=unknown ;;
esac
case "$lt_cv_dlopen_self_static" in
yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
*) enable_dlopen_self_static=unknown ;;
esac
fi
# Copy echo and quote the copy, instead of the original, because it is
# used later.
ltecho="$echo"
if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then
ltecho="$CONFIG_SHELL \$0 --fallback-echo"
fi
LTSHELL="$SHELL"
LTCONFIG_VERSION="$VERSION"
# Only quote variables if we're using ltmain.sh.
case "$ltmain" in
*.sh)
# Now quote all the things that may contain metacharacters.
for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \
old_LD old_LDFLAGS old_LIBS \
old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \
AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \
reload_flag reload_cmds wl \
pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
thread_safe_flag_spec whole_archive_flag_spec libname_spec \
library_names_spec soname_spec \
RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \
finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
hardcode_libdir_flag_spec hardcode_libdir_separator \
sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
case "$var" in
reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
old_postinstall_cmds | old_postuninstall_cmds | \
export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
postinstall_cmds | postuninstall_cmds | \
finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
# Double-quote double-evaled strings.
eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
;;
*)
eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
;;
esac
done
case "$ltecho" in
*'\$0 --fallback-echo"')
ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
;;
esac
trap "$rm \"$ofile\"; exit 1" 1 2 15
echo "creating $ofile"
$rm "$ofile"
cat <<EOF > "$ofile"
#! $SHELL
# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
#
# Copyright (C) 1996-1999 Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
Xsed="sed -e s/^X//"
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
### BEGIN LIBTOOL CONFIG
EOF
cfgfile="$ofile"
;;
*)
# Double-quote the variables that need it (for aesthetics).
for var in old_CC old_CFLAGS old_CPPFLAGS \
old_LD old_LDFLAGS old_LIBS \
old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do
eval "$var=\\\"\$var\\\""
done
# Just create a config file.
cfgfile="$ofile.cfg"
trap "$rm \"$cfgfile\"; exit 1" 1 2 15
echo "creating $cfgfile"
$rm "$cfgfile"
cat <<EOF > "$cfgfile"
# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
EOF
;;
esac
cat <<EOF >> "$cfgfile"
# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
#
# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\
# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\
# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\
# $0$ltconfig_args
#
# Compiler and other test output produced by $progname, useful for
# debugging $progname, is in ./config.log if it exists.
# The version of $progname that generated this script.
LTCONFIG_VERSION=$LTCONFIG_VERSION
# Shell to use when invoking shell scripts.
SHELL=$LTSHELL
# Whether or not to build shared libraries.
build_libtool_libs=$enable_shared
# Whether or not to build static libraries.
build_old_libs=$enable_static
# Whether or not to optimize for fast installation.
fast_install=$enable_fast_install
# The host system.
host_alias=$host_alias
host=$host
# An echo program that does not interpret backslashes.
echo=$ltecho
# The archiver.
AR=$AR
# The default C compiler.
CC=$CC
# The linker used to build libraries.
LD=$LD
# Whether we need hard or soft links.
LN_S=$LN_S
# A BSD-compatible nm program.
NM=$NM
# Used on cygwin: DLL creation program.
DLLTOOL="$DLLTOOL"
# Used on cygwin: object dumper.
OBJDUMP="$OBJDUMP"
# Used on cygwin: assembler.
AS="$AS"
# The name of the directory that contains temporary libtool files.
objdir=$objdir
# How to create reloadable object files.
reload_flag=$reload_flag
reload_cmds=$reload_cmds
# How to pass a linker flag through the compiler.
wl=$wl
# Object file suffix (normally "o").
objext="$objext"
# Old archive suffix (normally "a").
libext="$libext"
# Executable file suffix (normally "").
exeext="$exeext"
# Additional compiler flags for building library objects.
pic_flag=$pic_flag
# Does compiler simultaneously support -c and -o options?
compiler_c_o=$compiler_c_o
# Can we write directly to a .lo ?
compiler_o_lo=$compiler_o_lo
# Must we lock files when doing compilation ?
need_locks=$need_locks
# Do we need the lib prefix for modules?
need_lib_prefix=$need_lib_prefix
# Do we need a version for libraries?
need_version=$need_version
# Whether dlopen is supported.
dlopen=$enable_dlopen
# Whether dlopen of programs is supported.
dlopen_self=$enable_dlopen_self
# Whether dlopen of statically linked programs is supported.
dlopen_self_static=$enable_dlopen_self_static
# Compiler flag to prevent dynamic linking.
link_static_flag=$link_static_flag
# Compiler flag to turn off builtin functions.
no_builtin_flag=$no_builtin_flag
# Compiler flag to allow reflexive dlopens.
export_dynamic_flag_spec=$export_dynamic_flag_spec
# Compiler flag to generate shared objects directly from archives.
whole_archive_flag_spec=$whole_archive_flag_spec
# Compiler flag to generate thread-safe objects.
thread_safe_flag_spec=$thread_safe_flag_spec
# Library versioning type.
version_type=$version_type
# Format of library name prefix.
libname_spec=$libname_spec
# List of archive names. First name is the real one, the rest are links.
# The last name is the one that the linker finds with -lNAME.
library_names_spec=$library_names_spec
# The coded name of the library, if different from the real name.
soname_spec=$soname_spec
# Commands used to build and install an old-style archive.
RANLIB=$RANLIB
old_archive_cmds=$old_archive_cmds
old_postinstall_cmds=$old_postinstall_cmds
old_postuninstall_cmds=$old_postuninstall_cmds
# Create an old-style archive from a shared archive.
old_archive_from_new_cmds=$old_archive_from_new_cmds
# Commands used to build and install a shared archive.
archive_cmds=$archive_cmds
archive_expsym_cmds=$archive_expsym_cmds
postinstall_cmds=$postinstall_cmds
postuninstall_cmds=$postuninstall_cmds
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$deplibs_check_method
# Command to use when deplibs_check_method == file_magic.
file_magic_cmd=$file_magic_cmd
# Flag that allows shared libraries with undefined symbols to be built.
allow_undefined_flag=$allow_undefined_flag
# Flag that forces no undefined symbols.
no_undefined_flag=$no_undefined_flag
# Commands used to finish a libtool library installation in a directory.
finish_cmds=$finish_cmds
# Same as above, but a single script fragment to be evaled but not shown.
finish_eval=$finish_eval
# Take the output of nm and produce a listing of raw symbols and C names.
global_symbol_pipe=$global_symbol_pipe
# Transform the output of nm in a proper C declaration
global_symbol_to_cdecl=$global_symbol_to_cdecl
# This is the shared library runtime path variable.
runpath_var=$runpath_var
# This is the shared library path variable.
shlibpath_var=$shlibpath_var
# Is shlibpath searched before the hard-coded library search path?
shlibpath_overrides_runpath=$shlibpath_overrides_runpath
# How to hardcode a shared library path into an executable.
hardcode_action=$hardcode_action
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator=$hardcode_libdir_separator
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct=$hardcode_direct
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L=$hardcode_minus_L
# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
# the resulting binary.
hardcode_shlibpath_var=$hardcode_shlibpath_var
# Compile-time system search path for libraries
sys_lib_search_path_spec=$sys_lib_search_path_spec
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec
# Fix the shell variable \$srcfile for the compiler.
fix_srcfile_path="$fix_srcfile_path"
# Set to yes if exported symbols are required.
always_export_symbols=$always_export_symbols
# The commands to list exported symbols.
export_symbols_cmds=$export_symbols_cmds
# Symbols that should not be listed in the preloaded symbols.
exclude_expsyms=$exclude_expsyms
# Symbols that must always be exported.
include_expsyms=$include_expsyms
EOF
case "$ltmain" in
*.sh)
echo '### END LIBTOOL CONFIG' >> "$ofile"
echo >> "$ofile"
case "$host_os" in
aix3*)
cat <<\EOF >> "$ofile"
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test "X${COLLECT_NAMES+set}" != Xset; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
EOF
;;
esac
# Append the ltmain.sh script.
sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
# We use sed instead of cat because bash on DJGPP gets confused if
# if finds mixed CR/LF and LF-only lines. Since sed operates in
# text mode, it properly converts lines to CR/LF. This bash problem
# is reportedly fixed, but why not run on old versions too?
chmod +x "$ofile"
;;
*)
# Compile the libtool program.
echo "FIXME: would compile $ltmain"
;;
esac
test -n "$cache_file" || exit 0
# AC_CACHE_SAVE
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs. It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already. You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
EOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
sed -n \
-e "s/'/'\\\\''/g" \
-e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
;;
esac >> confcache
if cmp -s $cache_file confcache; then
:
else
if test -w $cache_file; then
echo "updating cache $cache_file"
cat confcache > $cache_file
else
echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
exit 0
# Local Variables:
# mode:shell-script
# sh-indentation:2
# End:
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/ltconfig | Shell | apache-2.0 | 97,947 |
# libtool (GNU libtool) 2.4.2
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# GNU Libtool is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# As a special exception to the GNU General Public License,
# if you distribute this file as part of a program or library that
# is built using GNU Libtool, you may include this file under the
# same distribution terms that you use for the rest of that program.
#
# GNU Libtool is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Usage: $progname [OPTION]... [MODE-ARG]...
#
# Provide generalized library-building support services.
#
# --config show all configuration variables
# --debug enable verbose shell tracing
# -n, --dry-run display commands without modifying any files
# --features display basic configuration information and exit
# --mode=MODE use operation mode MODE
# --preserve-dup-deps don't remove duplicate dependency libraries
# --quiet, --silent don't print informational messages
# --no-quiet, --no-silent
# print informational messages (default)
# --no-warn don't display warning messages
# --tag=TAG use configuration variables from tag TAG
# -v, --verbose print more informational messages than default
# --no-verbose don't print the extra informational messages
# --version print version information
# -h, --help, --help-all print short, long, or detailed help message
#
# MODE must be one of the following:
#
# clean remove files from the build directory
# compile compile a source file into a libtool object
# execute automatically set library path, then run a program
# finish complete the installation of libtool libraries
# install install libraries or executables
# link create a library or an executable
# uninstall remove libraries from an installed directory
#
# MODE-ARGS vary depending on the MODE. When passed as first option,
# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
#
# When reporting a bug, please describe a test case to reproduce it and
# include the following information:
#
# host-triplet: $host
# shell: $SHELL
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.1
# automake: $automake_version
# autoconf: $autoconf_version
#
# Report bugs to <bug-libtool@gnu.org>.
# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
# General help using GNU software: <http://www.gnu.org/gethelp/>.
PROGRAM=libtool
PACKAGE=libtool
VERSION="2.4.2 Debian-2.4.2-1.1"
TIMESTAMP=""
package_revision=1.3337
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
# A function that is used when there is no print builtin or printf.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
$1
_LTECHO_EOF'
}
# NLS nuisances: We save the old values to restore during execute mode.
lt_user_locale=
lt_safe_locale=
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${$lt_var+set}\" = set; then
save_$lt_var=\$$lt_var
$lt_var=C
export $lt_var
lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
fi"
done
LC_ALL=C
LANGUAGE=C
export LANGUAGE LC_ALL
$lt_unset CDPATH
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
# is ksh but when the shell is invoked as "sh" and the current value of
# the _XPG environment variable is not equal to 1 (one), the special
# positional parameter $0, within a function call, is the name of the
# function.
progpath="$0"
: ${CP="cp -f"}
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
: ${MAKE="make"}
: ${MKDIR="mkdir"}
: ${MV="mv -f"}
: ${RM="rm -f"}
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
: ${Xsed="$SED -e 1s/^X//"}
# Global variables:
EXIT_SUCCESS=0
EXIT_FAILURE=1
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
exit_status=$EXIT_SUCCESS
# Make sure IFS has a sensible default
lt_nl='
'
IFS=" $lt_nl"
dirname="s,/[^/]*$,,"
basename="s,^.*/,,"
# func_dirname file append nondir_replacement
# Compute the dirname of FILE. If nonempty, add APPEND to the result,
# otherwise set result to NONDIR_REPLACEMENT.
func_dirname ()
{
func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
if test "X$func_dirname_result" = "X${1}"; then
func_dirname_result="${3}"
else
func_dirname_result="$func_dirname_result${2}"
fi
} # func_dirname may be replaced by extended shell implementation
# func_basename file
func_basename ()
{
func_basename_result=`$ECHO "${1}" | $SED "$basename"`
} # func_basename may be replaced by extended shell implementation
# func_dirname_and_basename file append nondir_replacement
# perform func_basename and func_dirname in a single function
# call:
# dirname: Compute the dirname of FILE. If nonempty,
# add APPEND to the result, otherwise set result
# to NONDIR_REPLACEMENT.
# value returned in "$func_dirname_result"
# basename: Compute filename of FILE.
# value retuned in "$func_basename_result"
# Implementation must be kept synchronized with func_dirname
# and func_basename. For efficiency, we do not delegate to
# those functions but instead duplicate the functionality here.
func_dirname_and_basename ()
{
# Extract subdirectory from the argument.
func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
if test "X$func_dirname_result" = "X${1}"; then
func_dirname_result="${3}"
else
func_dirname_result="$func_dirname_result${2}"
fi
func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
} # func_dirname_and_basename may be replaced by extended shell implementation
# func_stripname prefix suffix name
# strip PREFIX and SUFFIX off of NAME.
# PREFIX and SUFFIX must not contain globbing or regex special
# characters, hashes, percent signs, but SUFFIX may contain a leading
# dot (in which case that matches only a dot).
# func_strip_suffix prefix name
func_stripname ()
{
case ${2} in
.*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
esac
} # func_stripname may be replaced by extended shell implementation
# These SED scripts presuppose an absolute path with a trailing slash.
pathcar='s,^/\([^/]*\).*$,\1,'
pathcdr='s,^/[^/]*,,'
removedotparts=':dotsl
s@/\./@/@g
t dotsl
s,/\.$,/,'
collapseslashes='s@/\{1,\}@/@g'
finalslash='s,/*$,/,'
# func_normal_abspath PATH
# Remove doubled-up and trailing slashes, "." path components,
# and cancel out any ".." path components in PATH after making
# it an absolute path.
# value returned in "$func_normal_abspath_result"
func_normal_abspath ()
{
# Start from root dir and reassemble the path.
func_normal_abspath_result=
func_normal_abspath_tpath=$1
func_normal_abspath_altnamespace=
case $func_normal_abspath_tpath in
"")
# Empty path, that just means $cwd.
func_stripname '' '/' "`pwd`"
func_normal_abspath_result=$func_stripname_result
return
;;
# The next three entries are used to spot a run of precisely
# two leading slashes without using negated character classes;
# we take advantage of case's first-match behaviour.
///*)
# Unusual form of absolute path, do nothing.
;;
//*)
# Not necessarily an ordinary path; POSIX reserves leading '//'
# and for example Cygwin uses it to access remote file shares
# over CIFS/SMB, so we conserve a leading double slash if found.
func_normal_abspath_altnamespace=/
;;
/*)
# Absolute path, do nothing.
;;
*)
# Relative path, prepend $cwd.
func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
;;
esac
# Cancel out all the simple stuff to save iterations. We also want
# the path to end with a slash for ease of parsing, so make sure
# there is one (and only one) here.
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
while :; do
# Processed it all yet?
if test "$func_normal_abspath_tpath" = / ; then
# If we ascended to the root using ".." the result may be empty now.
if test -z "$func_normal_abspath_result" ; then
func_normal_abspath_result=/
fi
break
fi
func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$pathcar"`
func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-e "$pathcdr"`
# Figure out what to do with it
case $func_normal_abspath_tcomponent in
"")
# Trailing empty path component, ignore it.
;;
..)
# Parent dir; strip last assembled component from result.
func_dirname "$func_normal_abspath_result"
func_normal_abspath_result=$func_dirname_result
;;
*)
# Actual path component, append it.
func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
;;
esac
done
# Restore leading double-slash if one was found on entry.
func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
}
# func_relative_path SRCDIR DSTDIR
# generates a relative path from SRCDIR to DSTDIR, with a trailing
# slash if non-empty, suitable for immediately appending a filename
# without needing to append a separator.
# value returned in "$func_relative_path_result"
func_relative_path ()
{
func_relative_path_result=
func_normal_abspath "$1"
func_relative_path_tlibdir=$func_normal_abspath_result
func_normal_abspath "$2"
func_relative_path_tbindir=$func_normal_abspath_result
# Ascend the tree starting from libdir
while :; do
# check if we have found a prefix of bindir
case $func_relative_path_tbindir in
$func_relative_path_tlibdir)
# found an exact match
func_relative_path_tcancelled=
break
;;
$func_relative_path_tlibdir*)
# found a matching prefix
func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
func_relative_path_tcancelled=$func_stripname_result
if test -z "$func_relative_path_result"; then
func_relative_path_result=.
fi
break
;;
*)
func_dirname $func_relative_path_tlibdir
func_relative_path_tlibdir=${func_dirname_result}
if test "x$func_relative_path_tlibdir" = x ; then
# Have to descend all the way to the root!
func_relative_path_result=../$func_relative_path_result
func_relative_path_tcancelled=$func_relative_path_tbindir
break
fi
func_relative_path_result=../$func_relative_path_result
;;
esac
done
# Now calculate path; take care to avoid doubling-up slashes.
func_stripname '' '/' "$func_relative_path_result"
func_relative_path_result=$func_stripname_result
func_stripname '/' '/' "$func_relative_path_tcancelled"
if test "x$func_stripname_result" != x ; then
func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
fi
# Normalisation. If bindir is libdir, return empty string,
# else relative path ending with a slash; either way, target
# file name can be directly appended.
if test ! -z "$func_relative_path_result"; then
func_stripname './' '' "$func_relative_path_result/"
func_relative_path_result=$func_stripname_result
fi
}
# The name of this program:
func_dirname_and_basename "$progpath"
progname=$func_basename_result
# Make sure we have an absolute path for reexecution:
case $progpath in
[\\/]*|[A-Za-z]:\\*) ;;
*[\\/]*)
progdir=$func_dirname_result
progdir=`cd "$progdir" && pwd`
progpath="$progdir/$progname"
;;
*)
save_IFS="$IFS"
IFS=${PATH_SEPARATOR-:}
for progdir in $PATH; do
IFS="$save_IFS"
test -x "$progdir/$progname" && break
done
IFS="$save_IFS"
test -n "$progdir" || progdir=`pwd`
progpath="$progdir/$progname"
;;
esac
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed="${SED}"' -e 1s/^X//'
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\(["`\\]\)/\\\1/g'
# Sed substitution that turns a string into a regex matching for the
# string literally.
sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
# Sed substitution that converts a w32 file name or path
# which contains forward slashes, into one that contains
# (escaped) backslashes. A very naive implementation.
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
# Re-`\' parameter expansions in output of double_quote_subst that were
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
# in input to double_quote_subst, that '$' was protected from expansion.
# Since each input `\' is now two `\'s, look for any number of runs of
# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
bs='\\'
bs2='\\\\'
bs4='\\\\\\\\'
dollar='\$'
sed_double_backslash="\
s/$bs4/&\\
/g
s/^$bs2$dollar/$bs&/
s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
s/\n//g"
# Standard options:
opt_dry_run=false
opt_help=false
opt_quiet=false
opt_verbose=false
opt_warning=:
# func_echo arg...
# Echo program name prefixed message, along with the current mode
# name if it has been set yet.
func_echo ()
{
$ECHO "$progname: ${opt_mode+$opt_mode: }$*"
}
# func_verbose arg...
# Echo program name prefixed message in verbose mode only.
func_verbose ()
{
$opt_verbose && func_echo ${1+"$@"}
# A bug in bash halts the script if the last line of a function
# fails when set -e is in force, so we need another command to
# work around that:
:
}
# func_echo_all arg...
# Invoke $ECHO with all args, space-separated.
func_echo_all ()
{
$ECHO "$*"
}
# func_error arg...
# Echo program name prefixed message to standard error.
func_error ()
{
$ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
}
# func_warning arg...
# Echo program name prefixed warning message to standard error.
func_warning ()
{
$opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
# bash bug again:
:
}
# func_fatal_error arg...
# Echo program name prefixed message to standard error, and exit.
func_fatal_error ()
{
func_error ${1+"$@"}
exit $EXIT_FAILURE
}
# func_fatal_help arg...
# Echo program name prefixed message to standard error, followed by
# a help hint, and exit.
func_fatal_help ()
{
func_error ${1+"$@"}
func_fatal_error "$help"
}
help="Try \`$progname --help' for more information." ## default
# func_grep expression filename
# Check whether EXPRESSION matches any line of FILENAME, without output.
func_grep ()
{
$GREP "$1" "$2" >/dev/null 2>&1
}
# func_mkdir_p directory-path
# Make sure the entire path to DIRECTORY-PATH is available.
func_mkdir_p ()
{
my_directory_path="$1"
my_dir_list=
if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
# Protect directory names starting with `-'
case $my_directory_path in
-*) my_directory_path="./$my_directory_path" ;;
esac
# While some portion of DIR does not yet exist...
while test ! -d "$my_directory_path"; do
# ...make a list in topmost first order. Use a colon delimited
# list incase some portion of path contains whitespace.
my_dir_list="$my_directory_path:$my_dir_list"
# If the last portion added has no slash in it, the list is done
case $my_directory_path in */*) ;; *) break ;; esac
# ...otherwise throw away the child directory and loop
my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
done
my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
save_mkdir_p_IFS="$IFS"; IFS=':'
for my_dir in $my_dir_list; do
IFS="$save_mkdir_p_IFS"
# mkdir can fail with a `File exist' error if two processes
# try to create one of the directories concurrently. Don't
# stop in that case!
$MKDIR "$my_dir" 2>/dev/null || :
done
IFS="$save_mkdir_p_IFS"
# Bail out if we (or some other process) failed to create a directory.
test -d "$my_directory_path" || \
func_fatal_error "Failed to create \`$1'"
fi
}
# func_mktempdir [string]
# Make a temporary directory that won't clash with other running
# libtool processes, and avoids race conditions if possible. If
# given, STRING is the basename for that directory.
func_mktempdir ()
{
my_template="${TMPDIR-/tmp}/${1-$progname}"
if test "$opt_dry_run" = ":"; then
# Return a directory name, but don't create it in dry-run mode
my_tmpdir="${my_template}-$$"
else
# If mktemp works, use that first and foremost
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
# Failing that, at least try and use $RANDOM to avoid a race
my_tmpdir="${my_template}-${RANDOM-0}$$"
save_mktempdir_umask=`umask`
umask 0077
$MKDIR "$my_tmpdir"
umask $save_mktempdir_umask
fi
# If we're not in dry-run mode, bomb out on failure
test -d "$my_tmpdir" || \
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
fi
$ECHO "$my_tmpdir"
}
# func_quote_for_eval arg
# Aesthetically quote ARG to be evaled later.
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
# is double-quoted, suitable for a subsequent eval, whereas
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
# which are still active within double quotes backslashified.
func_quote_for_eval ()
{
case $1 in
*[\\\`\"\$]*)
func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
*)
func_quote_for_eval_unquoted_result="$1" ;;
esac
case $func_quote_for_eval_unquoted_result in
# Double-quote args containing shell metacharacters to delay
# word splitting, command substitution and and variable
# expansion for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
;;
*)
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
esac
}
# func_quote_for_expand arg
# Aesthetically quote ARG to be evaled later; same as above,
# but do not quote variable references.
func_quote_for_expand ()
{
case $1 in
*[\\\`\"]*)
my_arg=`$ECHO "$1" | $SED \
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
*)
my_arg="$1" ;;
esac
case $my_arg in
# Double-quote args containing shell metacharacters to delay
# word splitting and command substitution for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
my_arg="\"$my_arg\""
;;
esac
func_quote_for_expand_result="$my_arg"
}
# func_show_eval cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it.
func_show_eval ()
{
my_cmd="$1"
my_fail_exp="${2-:}"
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$my_cmd"
my_status=$?
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
fi
fi
}
# func_show_eval_locale cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it. Use the saved locale for evaluation.
func_show_eval_locale ()
{
my_cmd="$1"
my_fail_exp="${2-:}"
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$lt_user_locale
$my_cmd"
my_status=$?
eval "$lt_safe_locale"
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
fi
fi
}
# func_tr_sh
# Turn $1 into a string suitable for a shell variable name.
# Result is stored in $func_tr_sh_result. All characters
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
# if $1 begins with a digit, a '_' is prepended as well.
func_tr_sh ()
{
case $1 in
[0-9]* | *[!a-zA-Z0-9_]*)
func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
;;
* )
func_tr_sh_result=$1
;;
esac
}
# func_version
# Echo version message to standard output and exit.
func_version ()
{
$opt_debug
$SED -n '/(C)/!b go
:more
/\./!{
N
s/\n# / /
b more
}
:go
/^# '$PROGRAM' (GNU /,/# warranty; / {
s/^# //
s/^# *$//
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
p
}' < "$progpath"
exit $?
}
# func_usage
# Echo short help message to standard output and exit.
func_usage ()
{
$opt_debug
$SED -n '/^# Usage:/,/^# *.*--help/ {
s/^# //
s/^# *$//
s/\$progname/'$progname'/
p
}' < "$progpath"
echo
$ECHO "run \`$progname --help | more' for full usage"
exit $?
}
# func_help [NOEXIT]
# Echo long help message to standard output and exit,
# unless 'noexit' is passed as argument.
func_help ()
{
$opt_debug
$SED -n '/^# Usage:/,/# Report bugs to/ {
:print
s/^# //
s/^# *$//
s*\$progname*'$progname'*
s*\$host*'"$host"'*
s*\$SHELL*'"$SHELL"'*
s*\$LTCC*'"$LTCC"'*
s*\$LTCFLAGS*'"$LTCFLAGS"'*
s*\$LD*'"$LD"'*
s/\$with_gnu_ld/'"$with_gnu_ld"'/
s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
p
d
}
/^# .* home page:/b print
/^# General help using/b print
' < "$progpath"
ret=$?
if test -z "$1"; then
exit $ret
fi
}
# func_missing_arg argname
# Echo program name prefixed message to standard error and set global
# exit_cmd.
func_missing_arg ()
{
$opt_debug
func_error "missing argument for $1."
exit_cmd=exit
}
# func_split_short_opt shortopt
# Set func_split_short_opt_name and func_split_short_opt_arg shell
# variables after splitting SHORTOPT after the 2nd character.
func_split_short_opt ()
{
my_sed_short_opt='1s/^\(..\).*$/\1/;q'
my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
} # func_split_short_opt may be replaced by extended shell implementation
# func_split_long_opt longopt
# Set func_split_long_opt_name and func_split_long_opt_arg shell
# variables after splitting LONGOPT at the `=' sign.
func_split_long_opt ()
{
my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
my_sed_long_arg='1s/^--[^=]*=//'
func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
} # func_split_long_opt may be replaced by extended shell implementation
exit_cmd=:
magic="%%%MAGIC variable%%%"
magic_exe="%%%MAGIC EXE variable%%%"
# Global variables.
nonopt=
preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
extracted_archives=
extracted_serial=0
# If this variable is set in any of the actions, the command in it
# will be execed at the end. This prevents here-documents from being
# left over by shells.
exec_cmd=
# func_append var value
# Append VALUE to the end of shell variable VAR.
func_append ()
{
eval "${1}=\$${1}\${2}"
} # func_append may be replaced by extended shell implementation
# func_append_quoted var value
# Quote VALUE and append to the end of shell variable VAR, separated
# by a space.
func_append_quoted ()
{
func_quote_for_eval "${2}"
eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
} # func_append_quoted may be replaced by extended shell implementation
# func_arith arithmetic-term...
func_arith ()
{
func_arith_result=`expr "${@}"`
} # func_arith may be replaced by extended shell implementation
# func_len string
# STRING may not start with a hyphen.
func_len ()
{
func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
} # func_len may be replaced by extended shell implementation
# func_lo2o object
func_lo2o ()
{
func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
} # func_lo2o may be replaced by extended shell implementation
# func_xform libobj-or-source
func_xform ()
{
func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
} # func_xform may be replaced by extended shell implementation
# func_fatal_configuration arg...
# Echo program name prefixed message to standard error, followed by
# a configuration failure hint, and exit.
func_fatal_configuration ()
{
func_error ${1+"$@"}
func_error "See the $PACKAGE documentation for more information."
func_fatal_error "Fatal configuration error."
}
# func_config
# Display the configuration for all the tags in this script.
func_config ()
{
re_begincf='^# ### BEGIN LIBTOOL'
re_endcf='^# ### END LIBTOOL'
# Default configuration.
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
# Now print the configurations for the tags.
for tagname in $taglist; do
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
done
exit $?
}
# func_features
# Display the features supported by this script.
func_features ()
{
echo "host: $host"
if test "$build_libtool_libs" = yes; then
echo "enable shared libraries"
else
echo "disable shared libraries"
fi
if test "$build_old_libs" = yes; then
echo "enable static libraries"
else
echo "disable static libraries"
fi
exit $?
}
# func_enable_tag tagname
# Verify that TAGNAME is valid, and either flag an error and exit, or
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
# variable here.
func_enable_tag ()
{
# Global variable:
tagname="$1"
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
sed_extractcf="/$re_begincf/,/$re_endcf/p"
# Validate tagname.
case $tagname in
*[!-_A-Za-z0-9,/]*)
func_fatal_error "invalid tag name: $tagname"
;;
esac
# Don't test for the "default" C tag, as we know it's
# there but not specially marked.
case $tagname in
CC) ;;
*)
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
taglist="$taglist $tagname"
# Evaluate the configuration. Be careful to quote the path
# and the sed script, to avoid splitting on whitespace, but
# also don't use non-portable quotes within backquotes within
# quotes we have to do it in 2 steps:
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
eval "$extractedcf"
else
func_error "ignoring unknown tag $tagname"
fi
;;
esac
}
# func_check_version_match
# Ensure that we are using m4 macros, and libtool script from the same
# release of libtool.
func_check_version_match ()
{
if test "$package_revision" != "$macro_revision"; then
if test "$VERSION" != "$macro_version"; then
if test -z "$macro_version"; then
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from an older release.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
fi
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
$progname: of $PACKAGE $VERSION and run autoconf again.
_LT_EOF
fi
exit $EXIT_MISMATCH
fi
}
# Shorthand for --mode=foo, only valid as the first argument
case $1 in
clean|clea|cle|cl)
shift; set dummy --mode clean ${1+"$@"}; shift
;;
compile|compil|compi|comp|com|co|c)
shift; set dummy --mode compile ${1+"$@"}; shift
;;
execute|execut|execu|exec|exe|ex|e)
shift; set dummy --mode execute ${1+"$@"}; shift
;;
finish|finis|fini|fin|fi|f)
shift; set dummy --mode finish ${1+"$@"}; shift
;;
install|instal|insta|inst|ins|in|i)
shift; set dummy --mode install ${1+"$@"}; shift
;;
link|lin|li|l)
shift; set dummy --mode link ${1+"$@"}; shift
;;
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
shift; set dummy --mode uninstall ${1+"$@"}; shift
;;
esac
# Option defaults:
opt_debug=:
opt_dry_run=false
opt_config=false
opt_preserve_dup_deps=false
opt_features=false
opt_finish=false
opt_help=false
opt_help_all=false
opt_silent=:
opt_warning=:
opt_verbose=:
opt_silent=false
opt_verbose=false
# Parse options once, thoroughly. This comes as soon as possible in the
# script to make things like `--version' happen as quickly as we can.
{
# this just eases exit handling
while test $# -gt 0; do
opt="$1"
shift
case $opt in
--debug|-x) opt_debug='set -x'
func_echo "enabling shell trace mode"
$opt_debug
;;
--dry-run|--dryrun|-n)
opt_dry_run=:
;;
--config)
opt_config=:
func_config
;;
--dlopen|-dlopen)
optarg="$1"
opt_dlopen="${opt_dlopen+$opt_dlopen
}$optarg"
shift
;;
--preserve-dup-deps)
opt_preserve_dup_deps=:
;;
--features)
opt_features=:
func_features
;;
--finish)
opt_finish=:
set dummy --mode finish ${1+"$@"}; shift
;;
--help)
opt_help=:
;;
--help-all)
opt_help_all=:
opt_help=': help-all'
;;
--mode)
test $# = 0 && func_missing_arg $opt && break
optarg="$1"
opt_mode="$optarg"
case $optarg in
# Valid mode arguments:
clean|compile|execute|finish|install|link|relink|uninstall) ;;
# Catch anything else as an error
*) func_error "invalid argument for $opt"
exit_cmd=exit
break
;;
esac
shift
;;
--no-silent|--no-quiet)
opt_silent=false
func_append preserve_args " $opt"
;;
--no-warning|--no-warn)
opt_warning=false
func_append preserve_args " $opt"
;;
--no-verbose)
opt_verbose=false
func_append preserve_args " $opt"
;;
--silent|--quiet)
opt_silent=:
func_append preserve_args " $opt"
opt_verbose=false
;;
--verbose|-v)
opt_verbose=:
func_append preserve_args " $opt"
opt_silent=false
;;
--tag)
test $# = 0 && func_missing_arg $opt && break
optarg="$1"
opt_tag="$optarg"
func_append preserve_args " $opt $optarg"
func_enable_tag "$optarg"
shift
;;
-\?|-h) func_usage ;;
--help) func_help ;;
--version) func_version ;;
# Separate optargs to long options:
--*=*)
func_split_long_opt "$opt"
set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
shift
;;
# Separate non-argument short options:
-\?*|-h*|-n*|-v*)
func_split_short_opt "$opt"
set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
shift
;;
--) break ;;
-*) func_fatal_help "unrecognized option \`$opt'" ;;
*) set dummy "$opt" ${1+"$@"}; shift; break ;;
esac
done
# Validate options:
# save first non-option argument
if test "$#" -gt 0; then
nonopt="$opt"
shift
fi
# preserve --debug
test "$opt_debug" = : || func_append preserve_args " --debug"
case $host in
*cygwin* | *mingw* | *pw32* | *cegcc*)
# don't eliminate duplications in $postdeps and $predeps
opt_duplicate_compiler_generated_deps=:
;;
*)
opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
;;
esac
$opt_help || {
# Sanity checks first:
func_check_version_match
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
func_fatal_configuration "not configured to build any kind of library"
fi
# Darwin sucks
eval std_shrext=\"$shrext_cmds\"
# Only execute mode is allowed to have -dlopen flags.
if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
func_error "unrecognized option \`-dlopen'"
$ECHO "$help" 1>&2
exit $EXIT_FAILURE
fi
# Change the help message to a mode-specific one.
generic_help="$help"
help="Try \`$progname --help --mode=$opt_mode' for more information."
}
# Bail if the options were screwed
$exit_cmd $EXIT_FAILURE
}
## ----------- ##
## Main. ##
## ----------- ##
# func_lalib_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_lalib_p ()
{
test -f "$1" &&
$SED -e 4q "$1" 2>/dev/null \
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
}
# func_lalib_unsafe_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function implements the same check as func_lalib_p without
# resorting to external programs. To this end, it redirects stdin and
# closes it afterwards, without saving the original file descriptor.
# As a safety measure, use it only where a negative result would be
# fatal anyway. Works if `file' does not exist.
func_lalib_unsafe_p ()
{
lalib_p=no
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
for lalib_p_l in 1 2 3 4
do
read lalib_p_line
case "$lalib_p_line" in
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
esac
done
exec 0<&5 5<&-
fi
test "$lalib_p" = yes
}
# func_ltwrapper_script_p file
# True iff FILE is a libtool wrapper script
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_script_p ()
{
func_lalib_p "$1"
}
# func_ltwrapper_executable_p file
# True iff FILE is a libtool wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_executable_p ()
{
func_ltwrapper_exec_suffix=
case $1 in
*.exe) ;;
*) func_ltwrapper_exec_suffix=.exe ;;
esac
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
}
# func_ltwrapper_scriptname file
# Assumes file is an ltwrapper_executable
# uses $file to determine the appropriate filename for a
# temporary ltwrapper_script.
func_ltwrapper_scriptname ()
{
func_dirname_and_basename "$1" "" "."
func_stripname '' '.exe' "$func_basename_result"
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
}
# func_ltwrapper_p file
# True iff FILE is a libtool wrapper script or wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_p ()
{
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
}
# func_execute_cmds commands fail_cmd
# Execute tilde-delimited COMMANDS.
# If FAIL_CMD is given, eval that upon failure.
# FAIL_CMD may read-access the current command in variable CMD!
func_execute_cmds ()
{
$opt_debug
save_ifs=$IFS; IFS='~'
for cmd in $1; do
IFS=$save_ifs
eval cmd=\"$cmd\"
func_show_eval "$cmd" "${2-:}"
done
IFS=$save_ifs
}
# func_source file
# Source FILE, adding directory component if necessary.
# Note that it is not necessary on cygwin/mingw to append a dot to
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
# behavior happens only for exec(3), not for open(2)! Also, sourcing
# `FILE.' does not work on cygwin managed mounts.
func_source ()
{
$opt_debug
case $1 in
*/* | *\\*) . "$1" ;;
*) . "./$1" ;;
esac
}
# func_resolve_sysroot PATH
# Replace a leading = in PATH with a sysroot. Store the result into
# func_resolve_sysroot_result
func_resolve_sysroot ()
{
func_resolve_sysroot_result=$1
case $func_resolve_sysroot_result in
=*)
func_stripname '=' '' "$func_resolve_sysroot_result"
func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
;;
esac
}
# func_replace_sysroot PATH
# If PATH begins with the sysroot, replace it with = and
# store the result into func_replace_sysroot_result.
func_replace_sysroot ()
{
case "$lt_sysroot:$1" in
?*:"$lt_sysroot"*)
func_stripname "$lt_sysroot" '' "$1"
func_replace_sysroot_result="=$func_stripname_result"
;;
*)
# Including no sysroot.
func_replace_sysroot_result=$1
;;
esac
}
# func_infer_tag arg
# Infer tagged configuration to use if any are available and
# if one wasn't chosen via the "--tag" command line option.
# Only attempt this if the compiler in the base compile
# command doesn't match the default compiler.
# arg is usually of the form 'gcc ...'
func_infer_tag ()
{
$opt_debug
if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted=
for arg in $CC; do
func_append_quoted CC_quoted "$arg"
done
CC_expanded=`func_echo_all $CC`
CC_quoted_expanded=`func_echo_all $CC_quoted`
case $@ in
# Blanks in the command may have been stripped by the calling shell,
# but not from the CC environment variable when configure was run.
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
# Blanks at the start of $base_compile will cause this to fail
# if we don't check for them as well.
*)
for z in $available_tags; do
if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
# Evaluate the configuration.
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
CC_quoted=
for arg in $CC; do
# Double-quote args containing other shell metacharacters.
func_append_quoted CC_quoted "$arg"
done
CC_expanded=`func_echo_all $CC`
CC_quoted_expanded=`func_echo_all $CC_quoted`
case "$@ " in
" $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
" $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
# The compiler in the base compile command matches
# the one in the tagged configuration.
# Assume this is the tagged configuration we want.
tagname=$z
break
;;
esac
fi
done
# If $tagname still isn't set, then no tagged configuration
# was found and let the user know that the "--tag" command
# line option must be used.
if test -z "$tagname"; then
func_echo "unable to infer tagged configuration"
func_fatal_error "specify a tag with \`--tag'"
# else
# func_verbose "using $tagname tagged configuration"
fi
;;
esac
fi
}
# func_write_libtool_object output_name pic_name nonpic_name
# Create a libtool object file (analogous to a ".la" file),
# but don't create it if we're doing a dry run.
func_write_libtool_object ()
{
write_libobj=${1}
if test "$build_libtool_libs" = yes; then
write_lobj=\'${2}\'
else
write_lobj=none
fi
if test "$build_old_libs" = yes; then
write_oldobj=\'${3}\'
else
write_oldobj=none
fi
$opt_dry_run || {
cat >${write_libobj}T <<EOF
# $write_libobj - a libtool object file
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object=$write_lobj
# Name of the non-PIC object
non_pic_object=$write_oldobj
EOF
$MV "${write_libobj}T" "${write_libobj}"
}
}
##################################################
# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
##################################################
# func_convert_core_file_wine_to_w32 ARG
# Helper function used by file name conversion functions when $build is *nix,
# and $host is mingw, cygwin, or some other w32 environment. Relies on a
# correctly configured wine environment available, with the winepath program
# in $build's $PATH.
#
# ARG is the $build file name to be converted to w32 format.
# Result is available in $func_convert_core_file_wine_to_w32_result, and will
# be empty on error (or when ARG is empty)
func_convert_core_file_wine_to_w32 ()
{
$opt_debug
func_convert_core_file_wine_to_w32_result="$1"
if test -n "$1"; then
# Unfortunately, winepath does not exit with a non-zero error code, so we
# are forced to check the contents of stdout. On the other hand, if the
# command is not found, the shell will set an exit code of 127 and print
# *an error message* to stdout. So we must check for both error code of
# zero AND non-empty stdout, which explains the odd construction:
func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
$SED -e "$lt_sed_naive_backslashify"`
else
func_convert_core_file_wine_to_w32_result=
fi
fi
}
# end: func_convert_core_file_wine_to_w32
# func_convert_core_path_wine_to_w32 ARG
# Helper function used by path conversion functions when $build is *nix, and
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
# configured wine environment available, with the winepath program in $build's
# $PATH. Assumes ARG has no leading or trailing path separator characters.
#
# ARG is path to be converted from $build format to win32.
# Result is available in $func_convert_core_path_wine_to_w32_result.
# Unconvertible file (directory) names in ARG are skipped; if no directory names
# are convertible, then the result may be empty.
func_convert_core_path_wine_to_w32 ()
{
$opt_debug
# unfortunately, winepath doesn't convert paths, only file names
func_convert_core_path_wine_to_w32_result=""
if test -n "$1"; then
oldIFS=$IFS
IFS=:
for func_convert_core_path_wine_to_w32_f in $1; do
IFS=$oldIFS
func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
if test -n "$func_convert_core_file_wine_to_w32_result" ; then
if test -z "$func_convert_core_path_wine_to_w32_result"; then
func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
else
func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
fi
fi
done
IFS=$oldIFS
fi
}
# end: func_convert_core_path_wine_to_w32
# func_cygpath ARGS...
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
# (2), returns the Cygwin file name or path in func_cygpath_result (input
# file name or path is assumed to be in w32 format, as previously converted
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
# or path in func_cygpath_result (input file name or path is assumed to be in
# Cygwin format). Returns an empty string on error.
#
# ARGS are passed to cygpath, with the last one being the file name or path to
# be converted.
#
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
# environment variable; do not put it in $PATH.
func_cygpath ()
{
$opt_debug
if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
if test "$?" -ne 0; then
# on failure, ensure result is empty
func_cygpath_result=
fi
else
func_cygpath_result=
func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
fi
}
#end: func_cygpath
# func_convert_core_msys_to_w32 ARG
# Convert file name or path ARG from MSYS format to w32 format. Return
# result in func_convert_core_msys_to_w32_result.
func_convert_core_msys_to_w32 ()
{
$opt_debug
# awkward: cmd appends spaces to result
func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
$SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
}
#end: func_convert_core_msys_to_w32
# func_convert_file_check ARG1 ARG2
# Verify that ARG1 (a file name in $build format) was converted to $host
# format in ARG2. Otherwise, emit an error message, but continue (resetting
# func_to_host_file_result to ARG1).
func_convert_file_check ()
{
$opt_debug
if test -z "$2" && test -n "$1" ; then
func_error "Could not determine host file name corresponding to"
func_error " \`$1'"
func_error "Continuing, but uninstalled executables may not work."
# Fallback:
func_to_host_file_result="$1"
fi
}
# end func_convert_file_check
# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
# Verify that FROM_PATH (a path in $build format) was converted to $host
# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
# func_to_host_file_result to a simplistic fallback value (see below).
func_convert_path_check ()
{
$opt_debug
if test -z "$4" && test -n "$3"; then
func_error "Could not determine the host path corresponding to"
func_error " \`$3'"
func_error "Continuing, but uninstalled executables may not work."
# Fallback. This is a deliberately simplistic "conversion" and
# should not be "improved". See libtool.info.
if test "x$1" != "x$2"; then
lt_replace_pathsep_chars="s|$1|$2|g"
func_to_host_path_result=`echo "$3" |
$SED -e "$lt_replace_pathsep_chars"`
else
func_to_host_path_result="$3"
fi
fi
}
# end func_convert_path_check
# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
# and appending REPL if ORIG matches BACKPAT.
func_convert_path_front_back_pathsep ()
{
$opt_debug
case $4 in
$1 ) func_to_host_path_result="$3$func_to_host_path_result"
;;
esac
case $4 in
$2 ) func_append func_to_host_path_result "$3"
;;
esac
}
# end func_convert_path_front_back_pathsep
##################################################
# $build to $host FILE NAME CONVERSION FUNCTIONS #
##################################################
# invoked via `$to_host_file_cmd ARG'
#
# In each case, ARG is the path to be converted from $build to $host format.
# Result will be available in $func_to_host_file_result.
# func_to_host_file ARG
# Converts the file name ARG from $build format to $host format. Return result
# in func_to_host_file_result.
func_to_host_file ()
{
$opt_debug
$to_host_file_cmd "$1"
}
# end func_to_host_file
# func_to_tool_file ARG LAZY
# converts the file name ARG from $build format to toolchain format. Return
# result in func_to_tool_file_result. If the conversion in use is listed
# in (the comma separated) LAZY, no conversion takes place.
func_to_tool_file ()
{
$opt_debug
case ,$2, in
*,"$to_tool_file_cmd",*)
func_to_tool_file_result=$1
;;
*)
$to_tool_file_cmd "$1"
func_to_tool_file_result=$func_to_host_file_result
;;
esac
}
# end func_to_tool_file
# func_convert_file_noop ARG
# Copy ARG to func_to_host_file_result.
func_convert_file_noop ()
{
func_to_host_file_result="$1"
}
# end func_convert_file_noop
# func_convert_file_msys_to_w32 ARG
# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
# conversion to w32 is not available inside the cwrapper. Returns result in
# func_to_host_file_result.
func_convert_file_msys_to_w32 ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
func_convert_core_msys_to_w32 "$1"
func_to_host_file_result="$func_convert_core_msys_to_w32_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_msys_to_w32
# func_convert_file_cygwin_to_w32 ARG
# Convert file name ARG from Cygwin to w32 format. Returns result in
# func_to_host_file_result.
func_convert_file_cygwin_to_w32 ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
# because $build is cygwin, we call "the" cygpath in $PATH; no need to use
# LT_CYGPATH in this case.
func_to_host_file_result=`cygpath -m "$1"`
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_cygwin_to_w32
# func_convert_file_nix_to_w32 ARG
# Convert file name ARG from *nix to w32 format. Requires a wine environment
# and a working winepath. Returns result in func_to_host_file_result.
func_convert_file_nix_to_w32 ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
func_convert_core_file_wine_to_w32 "$1"
func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_nix_to_w32
# func_convert_file_msys_to_cygwin ARG
# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
# Returns result in func_to_host_file_result.
func_convert_file_msys_to_cygwin ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
func_convert_core_msys_to_w32 "$1"
func_cygpath -u "$func_convert_core_msys_to_w32_result"
func_to_host_file_result="$func_cygpath_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_msys_to_cygwin
# func_convert_file_nix_to_cygwin ARG
# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
# in func_to_host_file_result.
func_convert_file_nix_to_cygwin ()
{
$opt_debug
func_to_host_file_result="$1"
if test -n "$1"; then
# convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
func_convert_core_file_wine_to_w32 "$1"
func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
func_to_host_file_result="$func_cygpath_result"
fi
func_convert_file_check "$1" "$func_to_host_file_result"
}
# end func_convert_file_nix_to_cygwin
#############################################
# $build to $host PATH CONVERSION FUNCTIONS #
#############################################
# invoked via `$to_host_path_cmd ARG'
#
# In each case, ARG is the path to be converted from $build to $host format.
# The result will be available in $func_to_host_path_result.
#
# Path separators are also converted from $build format to $host format. If
# ARG begins or ends with a path separator character, it is preserved (but
# converted to $host format) on output.
#
# All path conversion functions are named using the following convention:
# file name conversion function : func_convert_file_X_to_Y ()
# path conversion function : func_convert_path_X_to_Y ()
# where, for any given $build/$host combination the 'X_to_Y' value is the
# same. If conversion functions are added for new $build/$host combinations,
# the two new functions must follow this pattern, or func_init_to_host_path_cmd
# will break.
# func_init_to_host_path_cmd
# Ensures that function "pointer" variable $to_host_path_cmd is set to the
# appropriate value, based on the value of $to_host_file_cmd.
to_host_path_cmd=
func_init_to_host_path_cmd ()
{
$opt_debug
if test -z "$to_host_path_cmd"; then
func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
to_host_path_cmd="func_convert_path_${func_stripname_result}"
fi
}
# func_to_host_path ARG
# Converts the path ARG from $build format to $host format. Return result
# in func_to_host_path_result.
func_to_host_path ()
{
$opt_debug
func_init_to_host_path_cmd
$to_host_path_cmd "$1"
}
# end func_to_host_path
# func_convert_path_noop ARG
# Copy ARG to func_to_host_path_result.
func_convert_path_noop ()
{
func_to_host_path_result="$1"
}
# end func_convert_path_noop
# func_convert_path_msys_to_w32 ARG
# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
# conversion to w32 is not available inside the cwrapper. Returns result in
# func_to_host_path_result.
func_convert_path_msys_to_w32 ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# Remove leading and trailing path separator characters from ARG. MSYS
# behavior is inconsistent here; cygpath turns them into '.;' and ';.';
# and winepath ignores them completely.
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
func_to_host_path_result="$func_convert_core_msys_to_w32_result"
func_convert_path_check : ";" \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
fi
}
# end func_convert_path_msys_to_w32
# func_convert_path_cygwin_to_w32 ARG
# Convert path ARG from Cygwin to w32 format. Returns result in
# func_to_host_file_result.
func_convert_path_cygwin_to_w32 ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# See func_convert_path_msys_to_w32:
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
func_convert_path_check : ";" \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
fi
}
# end func_convert_path_cygwin_to_w32
# func_convert_path_nix_to_w32 ARG
# Convert path ARG from *nix to w32 format. Requires a wine environment and
# a working winepath. Returns result in func_to_host_file_result.
func_convert_path_nix_to_w32 ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# See func_convert_path_msys_to_w32:
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
func_convert_path_check : ";" \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
fi
}
# end func_convert_path_nix_to_w32
# func_convert_path_msys_to_cygwin ARG
# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
# Returns result in func_to_host_file_result.
func_convert_path_msys_to_cygwin ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# See func_convert_path_msys_to_w32:
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
func_to_host_path_result="$func_cygpath_result"
func_convert_path_check : : \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
fi
}
# end func_convert_path_msys_to_cygwin
# func_convert_path_nix_to_cygwin ARG
# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
# func_to_host_file_result.
func_convert_path_nix_to_cygwin ()
{
$opt_debug
func_to_host_path_result="$1"
if test -n "$1"; then
# Remove leading and trailing path separator characters from
# ARG. msys behavior is inconsistent here, cygpath turns them
# into '.;' and ';.', and winepath ignores them completely.
func_stripname : : "$1"
func_to_host_path_tmp1=$func_stripname_result
func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
func_to_host_path_result="$func_cygpath_result"
func_convert_path_check : : \
"$func_to_host_path_tmp1" "$func_to_host_path_result"
func_convert_path_front_back_pathsep ":*" "*:" : "$1"
fi
}
# end func_convert_path_nix_to_cygwin
# func_mode_compile arg...
func_mode_compile ()
{
$opt_debug
# Get the compilation command and the source file.
base_compile=
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
suppress_opt=yes
suppress_output=
arg_mode=normal
libobj=
later=
pie_flag=
for arg
do
case $arg_mode in
arg )
# do not "continue". Instead, add this to base_compile
lastarg="$arg"
arg_mode=normal
;;
target )
libobj="$arg"
arg_mode=normal
continue
;;
normal )
# Accept any command-line options.
case $arg in
-o)
test -n "$libobj" && \
func_fatal_error "you cannot specify \`-o' more than once"
arg_mode=target
continue
;;
-pie | -fpie | -fPIE)
func_append pie_flag " $arg"
continue
;;
-shared | -static | -prefer-pic | -prefer-non-pic)
func_append later " $arg"
continue
;;
-no-suppress)
suppress_opt=no
continue
;;
-Xcompiler)
arg_mode=arg # the next one goes into the "base_compile" arg list
continue # The current "srcfile" will either be retained or
;; # replaced later. I would guess that would be a bug.
-Wc,*)
func_stripname '-Wc,' '' "$arg"
args=$func_stripname_result
lastarg=
save_ifs="$IFS"; IFS=','
for arg in $args; do
IFS="$save_ifs"
func_append_quoted lastarg "$arg"
done
IFS="$save_ifs"
func_stripname ' ' '' "$lastarg"
lastarg=$func_stripname_result
# Add the arguments to base_compile.
func_append base_compile " $lastarg"
continue
;;
*)
# Accept the current argument as the source file.
# The previous "srcfile" becomes the current argument.
#
lastarg="$srcfile"
srcfile="$arg"
;;
esac # case $arg
;;
esac # case $arg_mode
# Aesthetically quote the previous argument.
func_append_quoted base_compile "$lastarg"
done # for arg
case $arg_mode in
arg)
func_fatal_error "you must specify an argument for -Xcompile"
;;
target)
func_fatal_error "you must specify a target with \`-o'"
;;
*)
# Get the name of the library object.
test -z "$libobj" && {
func_basename "$srcfile"
libobj="$func_basename_result"
}
;;
esac
# Recognize several different file suffixes.
# If the user specifies -o file.o, it is replaced with file.lo
case $libobj in
*.[cCFSifmso] | \
*.ada | *.adb | *.ads | *.asm | \
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
*.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
func_xform "$libobj"
libobj=$func_xform_result
;;
esac
case $libobj in
*.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
*)
func_fatal_error "cannot determine name of library object from \`$libobj'"
;;
esac
func_infer_tag $base_compile
for arg in $later; do
case $arg in
-shared)
test "$build_libtool_libs" != yes && \
func_fatal_configuration "can not build a shared library"
build_old_libs=no
continue
;;
-static)
build_libtool_libs=no
build_old_libs=yes
continue
;;
-prefer-pic)
pic_mode=yes
continue
;;
-prefer-non-pic)
pic_mode=no
continue
;;
esac
done
func_quote_for_eval "$libobj"
test "X$libobj" != "X$func_quote_for_eval_result" \
&& $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
&& func_warning "libobj name \`$libobj' may not contain shell special characters."
func_dirname_and_basename "$obj" "/" ""
objname="$func_basename_result"
xdir="$func_dirname_result"
lobj=${xdir}$objdir/$objname
test -z "$base_compile" && \
func_fatal_help "you must specify a compilation command"
# Delete any leftover library objects.
if test "$build_old_libs" = yes; then
removelist="$obj $lobj $libobj ${libobj}T"
else
removelist="$lobj $libobj ${libobj}T"
fi
# On Cygwin there's no "real" PIC flag so we must build both object types
case $host_os in
cygwin* | mingw* | pw32* | os2* | cegcc*)
pic_mode=default
;;
esac
if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
# non-PIC code in shared libraries is not supported
pic_mode=default
fi
# Calculate the filename of the output object if compiler does
# not support -o with -c
if test "$compiler_c_o" = no; then
output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
lockfile="$output_obj.lock"
else
output_obj=
need_locks=no
lockfile=
fi
# Lock this critical section if it is needed
# We use this script file to make the link, it avoids creating a new file
if test "$need_locks" = yes; then
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
func_echo "Waiting for $lockfile to be removed"
sleep 2
done
elif test "$need_locks" = warn; then
if test -f "$lockfile"; then
$ECHO "\
*** ERROR, $lockfile exists and contains:
`cat $lockfile 2>/dev/null`
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
func_append removelist " $output_obj"
$ECHO "$srcfile" > "$lockfile"
fi
$opt_dry_run || $RM $removelist
func_append removelist " $lockfile"
trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
srcfile=$func_to_tool_file_result
func_quote_for_eval "$srcfile"
qsrcfile=$func_quote_for_eval_result
# Only build a PIC object if we are building libtool libraries.
if test "$build_libtool_libs" = yes; then
# Without this assignment, base_compile gets emptied.
fbsd_hideous_sh_bug=$base_compile
if test "$pic_mode" != no; then
command="$base_compile $qsrcfile $pic_flag"
else
# Don't build PIC code
command="$base_compile $qsrcfile"
fi
func_mkdir_p "$xdir$objdir"
if test -z "$output_obj"; then
# Place PIC objects in $objdir
func_append command " -o $lobj"
fi
func_show_eval_locale "$command" \
'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
$ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
but it should contain:
$srcfile
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
# Just move the object if needed, then go on to compile the next one
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
func_show_eval '$MV "$output_obj" "$lobj"' \
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
# Allow error messages only from the first compilation.
if test "$suppress_opt" = yes; then
suppress_output=' >/dev/null 2>&1'
fi
fi
# Only build a position-dependent object if we build old libraries.
if test "$build_old_libs" = yes; then
if test "$pic_mode" != yes; then
# Don't build PIC code
command="$base_compile $qsrcfile$pie_flag"
else
command="$base_compile $qsrcfile $pic_flag"
fi
if test "$compiler_c_o" = yes; then
func_append command " -o $obj"
fi
# Suppress compiler output if we already did a PIC compilation.
func_append command "$suppress_output"
func_show_eval_locale "$command" \
'$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
$ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
but it should contain:
$srcfile
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
# Just move the object if needed
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
func_show_eval '$MV "$output_obj" "$obj"' \
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
fi
$opt_dry_run || {
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
# Unlock the critical section if it was locked
if test "$need_locks" != no; then
removelist=$lockfile
$RM "$lockfile"
fi
}
exit $EXIT_SUCCESS
}
$opt_help || {
test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
}
func_mode_help ()
{
# We need to display help for each of the modes.
case $opt_mode in
"")
# Generic help is extracted from the usage comments
# at the start of this file.
func_help
;;
clean)
$ECHO \
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
Remove files from the build directory.
RM is the name of the program to use to delete files associated with each FILE
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
to RM.
If FILE is a libtool library, object or program, all the files associated
with it are deleted. Otherwise, only FILE itself is deleted using RM."
;;
compile)
$ECHO \
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
Compile a source file into a libtool library object.
This mode accepts the following additional options:
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
-no-suppress do not suppress compiler output for multiple passes
-prefer-pic try to build PIC objects only
-prefer-non-pic try to build non-PIC objects only
-shared do not build a \`.o' file suitable for static linking
-static only build a \`.o' file suitable for static linking
-Wc,FLAG pass FLAG directly to the compiler
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
from the given SOURCEFILE.
The output file name is determined by removing the directory component from
SOURCEFILE, then substituting the C source code suffix \`.c' with the
library object suffix, \`.lo'."
;;
execute)
$ECHO \
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
Automatically set library path, then run a program.
This mode accepts the following additional options:
-dlopen FILE add the directory containing FILE to the library path
This mode sets the library path environment variable according to \`-dlopen'
flags.
If any of the ARGS are libtool executable wrappers, then they are translated
into their corresponding uninstalled binary, and any of their required library
directories are added to the library path.
Then, COMMAND is executed, with ARGS as arguments."
;;
finish)
$ECHO \
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
Complete the installation of libtool libraries.
Each LIBDIR is a directory that contains libtool libraries.
The commands that this mode executes may require superuser privileges. Use
the \`--dry-run' option if you just want to see what would be executed."
;;
install)
$ECHO \
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
Install executables or libraries.
INSTALL-COMMAND is the installation command. The first component should be
either the \`install' or \`cp' program.
The following components of INSTALL-COMMAND are treated specially:
-inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
The rest of the components are interpreted as arguments to that command (only
BSD-compatible install options are recognized)."
;;
link)
$ECHO \
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
Link object files or libraries together to form another library, or to
create an executable program.
LINK-COMMAND is a command using the C compiler that you would use to create
a program from several object files.
The following components of LINK-COMMAND are treated specially:
-all-static do not do any dynamic linking at all
-avoid-version do not add a version suffix if possible
-bindir BINDIR specify path to binaries directory (for systems where
libraries must be found in the PATH setting at runtime)
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-export-symbols SYMFILE
try to export only the symbols listed in SYMFILE
-export-symbols-regex REGEX
try to export only the symbols matching REGEX
-LLIBDIR search LIBDIR for required installed libraries
-lNAME OUTPUT-FILE requires the installed library libNAME
-module build a library that can dlopened
-no-fast-install disable the fast-install mode
-no-install link a not-installable executable
-no-undefined declare that a library does not refer to external symbols
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
-objectlist FILE Use a list of object files found in FILE to specify objects
-precious-files-regex REGEX
don't remove output files matching REGEX
-release RELEASE specify package release information
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
-shared only do dynamic linking of libtool libraries
-shrext SUFFIX override the standard shared library file extension
-static do not do any dynamic linking of uninstalled libtool libraries
-static-libtool-libs
do not do any dynamic linking of libtool libraries
-version-info CURRENT[:REVISION[:AGE]]
specify library version info [each variable defaults to 0]
-weak LIBNAME declare that the target provides the LIBNAME interface
-Wc,FLAG
-Xcompiler FLAG pass linker-specific FLAG directly to the compiler
-Wl,FLAG
-Xlinker FLAG pass linker-specific FLAG directly to the linker
-XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
All other options (arguments beginning with \`-') are ignored.
Every other argument is treated as a filename. Files ending in \`.la' are
treated as uninstalled libtool libraries, other files are standard or library
object files.
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
only library objects (\`.lo' files) may be specified, and \`-rpath' is
required, except when creating a convenience library.
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
using \`ar' and \`ranlib', or on Windows using \`lib'.
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
is created, otherwise an executable program is created."
;;
uninstall)
$ECHO \
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
Remove libraries from an installation directory.
RM is the name of the program to use to delete files associated with each FILE
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
to RM.
If FILE is a libtool library, all the files associated with it are deleted.
Otherwise, only FILE itself is deleted using RM."
;;
*)
func_fatal_help "invalid operation mode \`$opt_mode'"
;;
esac
echo
$ECHO "Try \`$progname --help' for more information about other modes."
}
# Now that we've collected a possible --mode arg, show help if necessary
if $opt_help; then
if test "$opt_help" = :; then
func_mode_help
else
{
func_help noexit
for opt_mode in compile link execute install finish uninstall clean; do
func_mode_help
done
} | sed -n '1p; 2,$s/^Usage:/ or: /p'
{
func_help noexit
for opt_mode in compile link execute install finish uninstall clean; do
echo
func_mode_help
done
} |
sed '1d
/^When reporting/,/^Report/{
H
d
}
$x
/information about other modes/d
/more detailed .*MODE/d
s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
fi
exit $?
fi
# func_mode_execute arg...
func_mode_execute ()
{
$opt_debug
# The first argument is the command name.
cmd="$nonopt"
test -z "$cmd" && \
func_fatal_help "you must specify a COMMAND"
# Handle -dlopen flags immediately.
for file in $opt_dlopen; do
test -f "$file" \
|| func_fatal_help "\`$file' is not a file"
dir=
case $file in
*.la)
func_resolve_sysroot "$file"
file=$func_resolve_sysroot_result
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$file" \
|| func_fatal_help "\`$lib' is not a valid libtool archive"
# Read the libtool library.
dlname=
library_names=
func_source "$file"
# Skip this library if it cannot be dlopened.
if test -z "$dlname"; then
# Warn if it was a shared library.
test -n "$library_names" && \
func_warning "\`$file' was not linked with \`-export-dynamic'"
continue
fi
func_dirname "$file" "" "."
dir="$func_dirname_result"
if test -f "$dir/$objdir/$dlname"; then
func_append dir "/$objdir"
else
if test ! -f "$dir/$dlname"; then
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
fi
fi
;;
*.lo)
# Just add the directory containing the .lo file.
func_dirname "$file" "" "."
dir="$func_dirname_result"
;;
*)
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
continue
;;
esac
# Get the absolute pathname.
absdir=`cd "$dir" && pwd`
test -n "$absdir" && dir="$absdir"
# Now add the directory to shlibpath_var.
if eval "test -z \"\$$shlibpath_var\""; then
eval "$shlibpath_var=\"\$dir\""
else
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
fi
done
# This variable tells wrapper scripts just to set shlibpath_var
# rather than running their programs.
libtool_execute_magic="$magic"
# Check if any of the arguments is a wrapper script.
args=
for file
do
case $file in
-* | *.la | *.lo ) ;;
*)
# Do a test to see if this is really a libtool program.
if func_ltwrapper_script_p "$file"; then
func_source "$file"
# Transform arg to wrapped name.
file="$progdir/$program"
elif func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
func_source "$func_ltwrapper_scriptname_result"
# Transform arg to wrapped name.
file="$progdir/$program"
fi
;;
esac
# Quote arguments (to preserve shell metacharacters).
func_append_quoted args "$file"
done
if test "X$opt_dry_run" = Xfalse; then
if test -n "$shlibpath_var"; then
# Export the shlibpath_var.
eval "export $shlibpath_var"
fi
# Restore saved environment variables
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${save_$lt_var+set}\" = set; then
$lt_var=\$save_$lt_var; export $lt_var
else
$lt_unset $lt_var
fi"
done
# Now prepare to actually exec the command.
exec_cmd="\$cmd$args"
else
# Display what would be done.
if test -n "$shlibpath_var"; then
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
echo "export $shlibpath_var"
fi
$ECHO "$cmd$args"
exit $EXIT_SUCCESS
fi
}
test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
# func_mode_finish arg...
func_mode_finish ()
{
$opt_debug
libs=
libdirs=
admincmds=
for opt in "$nonopt" ${1+"$@"}
do
if test -d "$opt"; then
func_append libdirs " $opt"
elif test -f "$opt"; then
if func_lalib_unsafe_p "$opt"; then
func_append libs " $opt"
else
func_warning "\`$opt' is not a valid libtool archive"
fi
else
func_fatal_error "invalid argument \`$opt'"
fi
done
if test -n "$libs"; then
if test -n "$lt_sysroot"; then
sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
else
sysroot_cmd=
fi
# Remove sysroot references
if $opt_dry_run; then
for lib in $libs; do
echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
done
else
tmpdir=`func_mktempdir`
for lib in $libs; do
sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
> $tmpdir/tmp-la
mv -f $tmpdir/tmp-la $lib
done
${RM}r "$tmpdir"
fi
fi
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
for libdir in $libdirs; do
if test -n "$finish_cmds"; then
# Do each command in the finish commands.
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
'"$cmd"'"'
fi
if test -n "$finish_eval"; then
# Do the single finish_eval.
eval cmds=\"$finish_eval\"
$opt_dry_run || eval "$cmds" || func_append admincmds "
$cmds"
fi
done
fi
# Exit here if they wanted silent mode.
$opt_silent && exit $EXIT_SUCCESS
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
echo "----------------------------------------------------------------------"
echo "Libraries have been installed in:"
for libdir in $libdirs; do
$ECHO " $libdir"
done
echo
echo "If you ever happen to want to link against installed libraries"
echo "in a given directory, LIBDIR, you must either use libtool, and"
echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
echo "flag during linking and do at least one of the following:"
if test -n "$shlibpath_var"; then
echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
echo " during execution"
fi
if test -n "$runpath_var"; then
echo " - add LIBDIR to the \`$runpath_var' environment variable"
echo " during linking"
fi
if test -n "$hardcode_libdir_flag_spec"; then
libdir=LIBDIR
eval flag=\"$hardcode_libdir_flag_spec\"
$ECHO " - use the \`$flag' linker flag"
fi
if test -n "$admincmds"; then
$ECHO " - have your system administrator run these commands:$admincmds"
fi
if test -f /etc/ld.so.conf; then
echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
fi
echo
echo "See any operating system documentation about shared libraries for"
case $host in
solaris2.[6789]|solaris2.1[0-9])
echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
echo "pages."
;;
*)
echo "more information, such as the ld(1) and ld.so(8) manual pages."
;;
esac
echo "----------------------------------------------------------------------"
fi
exit $EXIT_SUCCESS
}
test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
# func_mode_install arg...
func_mode_install ()
{
$opt_debug
# There may be an optional sh(1) argument at the beginning of
# install_prog (especially on Windows NT).
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command.
case $nonopt in *shtool*) :;; *) false;; esac; then
# Aesthetically quote it.
func_quote_for_eval "$nonopt"
install_prog="$func_quote_for_eval_result "
arg=$1
shift
else
install_prog=
arg=$nonopt
fi
# The real first argument should be the name of the installation program.
# Aesthetically quote it.
func_quote_for_eval "$arg"
func_append install_prog "$func_quote_for_eval_result"
install_shared_prog=$install_prog
case " $install_prog " in
*[\\\ /]cp\ *) install_cp=: ;;
*) install_cp=false ;;
esac
# We need to accept at least all the BSD install flags.
dest=
files=
opts=
prev=
install_type=
isdir=no
stripme=
no_mode=:
for arg
do
arg2=
if test -n "$dest"; then
func_append files " $dest"
dest=$arg
continue
fi
case $arg in
-d) isdir=yes ;;
-f)
if $install_cp; then :; else
prev=$arg
fi
;;
-g | -m | -o)
prev=$arg
;;
-s)
stripme=" -s"
continue
;;
-*)
;;
*)
# If the previous option needed an argument, then skip it.
if test -n "$prev"; then
if test "x$prev" = x-m && test -n "$install_override_mode"; then
arg2=$install_override_mode
no_mode=false
fi
prev=
else
dest=$arg
continue
fi
;;
esac
# Aesthetically quote the argument.
func_quote_for_eval "$arg"
func_append install_prog " $func_quote_for_eval_result"
if test -n "$arg2"; then
func_quote_for_eval "$arg2"
fi
func_append install_shared_prog " $func_quote_for_eval_result"
done
test -z "$install_prog" && \
func_fatal_help "you must specify an install program"
test -n "$prev" && \
func_fatal_help "the \`$prev' option requires an argument"
if test -n "$install_override_mode" && $no_mode; then
if $install_cp; then :; else
func_quote_for_eval "$install_override_mode"
func_append install_shared_prog " -m $func_quote_for_eval_result"
fi
fi
if test -z "$files"; then
if test -z "$dest"; then
func_fatal_help "no file or destination specified"
else
func_fatal_help "you must specify a destination"
fi
fi
# Strip any trailing slash from the destination.
func_stripname '' '/' "$dest"
dest=$func_stripname_result
# Check to see that the destination is a directory.
test -d "$dest" && isdir=yes
if test "$isdir" = yes; then
destdir="$dest"
destname=
else
func_dirname_and_basename "$dest" "" "."
destdir="$func_dirname_result"
destname="$func_basename_result"
# Not a directory, so check to see that there is only one file specified.
set dummy $files; shift
test "$#" -gt 1 && \
func_fatal_help "\`$dest' is not a directory"
fi
case $destdir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
for file in $files; do
case $file in
*.lo) ;;
*)
func_fatal_help "\`$destdir' must be an absolute directory name"
;;
esac
done
;;
esac
# This variable tells wrapper scripts just to set variables rather
# than running their programs.
libtool_install_magic="$magic"
staticlibs=
future_libdirs=
current_libdirs=
for file in $files; do
# Do each installation.
case $file in
*.$libext)
# Do the static libraries later.
func_append staticlibs " $file"
;;
*.la)
func_resolve_sysroot "$file"
file=$func_resolve_sysroot_result
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$file" \
|| func_fatal_help "\`$file' is not a valid libtool archive"
library_names=
old_library=
relink_command=
func_source "$file"
# Add the libdir to current_libdirs if it is the destination.
if test "X$destdir" = "X$libdir"; then
case "$current_libdirs " in
*" $libdir "*) ;;
*) func_append current_libdirs " $libdir" ;;
esac
else
# Note the libdir as a future libdir.
case "$future_libdirs " in
*" $libdir "*) ;;
*) func_append future_libdirs " $libdir" ;;
esac
fi
func_dirname "$file" "/" ""
dir="$func_dirname_result"
func_append dir "$objdir"
if test -n "$relink_command"; then
# Determine the prefix the user has applied to our future dir.
inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
# Don't allow the user to place us outside of our expected
# location b/c this prevents finding dependent libraries that
# are installed to the same prefix.
# At present, this check doesn't affect windows .dll's that
# are installed into $libdir/../bin (currently, that works fine)
# but it's something to keep an eye on.
test "$inst_prefix_dir" = "$destdir" && \
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
if test -n "$inst_prefix_dir"; then
# Stick the inst_prefix_dir data into the link command.
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
else
relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
fi
func_warning "relinking \`$file'"
func_show_eval "$relink_command" \
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
fi
# See the names of the shared library.
set dummy $library_names; shift
if test -n "$1"; then
realname="$1"
shift
srcname="$realname"
test -n "$relink_command" && srcname="$realname"T
# Install the shared library and build the symlinks.
func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
'exit $?'
tstripme="$stripme"
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
case $realname in
*.dll.a)
tstripme=""
;;
esac
;;
esac
if test -n "$tstripme" && test -n "$striplib"; then
func_show_eval "$striplib $destdir/$realname" 'exit $?'
fi
if test "$#" -gt 0; then
# Delete the old symlinks, and create new ones.
# Try `ln -sf' first, because the `ln' binary might depend on
# the symlink we replace! Solaris /bin/ln does not understand -f,
# so we also need to try rm && ln -s.
for linkname
do
test "$linkname" != "$realname" \
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
done
fi
# Do each command in the postinstall commands.
lib="$destdir/$realname"
func_execute_cmds "$postinstall_cmds" 'exit $?'
fi
# Install the pseudo-library for information purposes.
func_basename "$file"
name="$func_basename_result"
instname="$dir/$name"i
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
# Maybe install the static library, too.
test -n "$old_library" && func_append staticlibs " $dir/$old_library"
;;
*.lo)
# Install (i.e. copy) a libtool object.
# Figure out destination file name, if it wasn't already specified.
if test -n "$destname"; then
destfile="$destdir/$destname"
else
func_basename "$file"
destfile="$func_basename_result"
destfile="$destdir/$destfile"
fi
# Deduce the name of the destination old-style object file.
case $destfile in
*.lo)
func_lo2o "$destfile"
staticdest=$func_lo2o_result
;;
*.$objext)
staticdest="$destfile"
destfile=
;;
*)
func_fatal_help "cannot copy a libtool object to \`$destfile'"
;;
esac
# Install the libtool object if requested.
test -n "$destfile" && \
func_show_eval "$install_prog $file $destfile" 'exit $?'
# Install the old object if enabled.
if test "$build_old_libs" = yes; then
# Deduce the name of the old-style object file.
func_lo2o "$file"
staticobj=$func_lo2o_result
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
fi
exit $EXIT_SUCCESS
;;
*)
# Figure out destination file name, if it wasn't already specified.
if test -n "$destname"; then
destfile="$destdir/$destname"
else
func_basename "$file"
destfile="$func_basename_result"
destfile="$destdir/$destfile"
fi
# If the file is missing, and there is a .exe on the end, strip it
# because it is most likely a libtool script we actually want to
# install
stripped_ext=""
case $file in
*.exe)
if test ! -f "$file"; then
func_stripname '' '.exe' "$file"
file=$func_stripname_result
stripped_ext=".exe"
fi
;;
esac
# Do a test to see if this is really a libtool program.
case $host in
*cygwin* | *mingw*)
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
wrapper=$func_ltwrapper_scriptname_result
else
func_stripname '' '.exe' "$file"
wrapper=$func_stripname_result
fi
;;
*)
wrapper=$file
;;
esac
if func_ltwrapper_script_p "$wrapper"; then
notinst_deplibs=
relink_command=
func_source "$wrapper"
# Check the variables that should have been set.
test -z "$generated_by_libtool_version" && \
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
finalize=yes
for lib in $notinst_deplibs; do
# Check to see that each library is installed.
libdir=
if test -f "$lib"; then
func_source "$lib"
fi
libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
if test -n "$libdir" && test ! -f "$libfile"; then
func_warning "\`$lib' has not been installed in \`$libdir'"
finalize=no
fi
done
relink_command=
func_source "$wrapper"
outputname=
if test "$fast_install" = no && test -n "$relink_command"; then
$opt_dry_run || {
if test "$finalize" = yes; then
tmpdir=`func_mktempdir`
func_basename "$file$stripped_ext"
file="$func_basename_result"
outputname="$tmpdir/$file"
# Replace the output file specification.
relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
$opt_silent || {
func_quote_for_expand "$relink_command"
eval "func_echo $func_quote_for_expand_result"
}
if eval "$relink_command"; then :
else
func_error "error: relink \`$file' with the above command before installing it"
$opt_dry_run || ${RM}r "$tmpdir"
continue
fi
file="$outputname"
else
func_warning "cannot relink \`$file'"
fi
}
else
# Install the binary that we compiled earlier.
file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
fi
fi
# remove .exe since cygwin /usr/bin/install will append another
# one anyway
case $install_prog,$host in
*/usr/bin/install*,*cygwin*)
case $file:$destfile in
*.exe:*.exe)
# this is ok
;;
*.exe:*)
destfile=$destfile.exe
;;
*:*.exe)
func_stripname '' '.exe' "$destfile"
destfile=$func_stripname_result
;;
esac
;;
esac
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
$opt_dry_run || if test -n "$outputname"; then
${RM}r "$tmpdir"
fi
;;
esac
done
for file in $staticlibs; do
func_basename "$file"
name="$func_basename_result"
# Set up the ranlib parameters.
oldlib="$destdir/$name"
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
tool_oldlib=$func_to_tool_file_result
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
if test -n "$stripme" && test -n "$old_striplib"; then
func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
fi
# Do each command in the postinstall commands.
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
done
test -n "$future_libdirs" && \
func_warning "remember to run \`$progname --finish$future_libdirs'"
if test -n "$current_libdirs"; then
# Maybe just do a dry run.
$opt_dry_run && current_libdirs=" -n$current_libdirs"
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
else
exit $EXIT_SUCCESS
fi
}
test "$opt_mode" = install && func_mode_install ${1+"$@"}
# func_generate_dlsyms outputname originator pic_p
# Extract symbols from dlprefiles and create ${outputname}S.o with
# a dlpreopen symbol table.
func_generate_dlsyms ()
{
$opt_debug
my_outputname="$1"
my_originator="$2"
my_pic_p="${3-no}"
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
my_dlsyms=
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
if test -n "$NM" && test -n "$global_symbol_pipe"; then
my_dlsyms="${my_outputname}S.c"
else
func_error "not configured to extract global symbols from dlpreopened files"
fi
fi
if test -n "$my_dlsyms"; then
case $my_dlsyms in
"") ;;
*.c)
# Discover the nlist of each of the dlfiles.
nlist="$output_objdir/${my_outputname}.nm"
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
# Parse the name list into a source file.
func_verbose "creating $output_objdir/$my_dlsyms"
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
#ifdef __cplusplus
extern \"C\" {
#endif
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
#endif
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
/* DATA imports from DLLs on WIN32 con't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs. */
# define LT_DLSYM_CONST
#elif defined(__osf__)
/* This system does not cope well with relocations in const data. */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif
/* External symbol declarations for the compiler. */\
"
if test "$dlself" = yes; then
func_verbose "generating symbol list for \`$output'"
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
# Add our own program objects to the symbol list.
progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
for progfile in $progfiles; do
func_to_tool_file "$progfile" func_convert_file_msys_to_w32
func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
$opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
done
if test -n "$exclude_expsyms"; then
$opt_dry_run || {
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
}
fi
if test -n "$export_symbols_regex"; then
$opt_dry_run || {
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
}
fi
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
export_symbols="$output_objdir/$outputname.exp"
$opt_dry_run || {
$RM $export_symbols
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
case $host in
*cygwin* | *mingw* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
;;
esac
}
else
$opt_dry_run || {
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
case $host in
*cygwin* | *mingw* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
;;
esac
}
fi
fi
for dlprefile in $dlprefiles; do
func_verbose "extracting global C symbols from \`$dlprefile'"
func_basename "$dlprefile"
name="$func_basename_result"
case $host in
*cygwin* | *mingw* | *cegcc* )
# if an import library, we need to obtain dlname
if func_win32_import_lib_p "$dlprefile"; then
func_tr_sh "$dlprefile"
eval "curr_lafile=\$libfile_$func_tr_sh_result"
dlprefile_dlbasename=""
if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
# Use subshell, to avoid clobbering current variable values
dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
if test -n "$dlprefile_dlname" ; then
func_basename "$dlprefile_dlname"
dlprefile_dlbasename="$func_basename_result"
else
# no lafile. user explicitly requested -dlpreopen <import library>.
$sharedlib_from_linklib_cmd "$dlprefile"
dlprefile_dlbasename=$sharedlib_from_linklib_result
fi
fi
$opt_dry_run || {
if test -n "$dlprefile_dlbasename" ; then
eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
else
func_warning "Could not compute DLL name from $name"
eval '$ECHO ": $name " >> "$nlist"'
fi
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
$SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
}
else # not an import lib
$opt_dry_run || {
eval '$ECHO ": $name " >> "$nlist"'
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
}
fi
;;
*)
$opt_dry_run || {
eval '$ECHO ": $name " >> "$nlist"'
func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
}
;;
esac
done
$opt_dry_run || {
# Make sure we have at least an empty file.
test -f "$nlist" || : > "$nlist"
if test -n "$exclude_expsyms"; then
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
$MV "$nlist"T "$nlist"
fi
# Try sorting and uniquifying the output.
if $GREP -v "^: " < "$nlist" |
if sort -k 3 </dev/null >/dev/null 2>&1; then
sort -k 3
else
sort +2
fi |
uniq > "$nlist"S; then
:
else
$GREP -v "^: " < "$nlist" > "$nlist"S
fi
if test -f "$nlist"S; then
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
else
echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
fi
echo >> "$output_objdir/$my_dlsyms" "\
/* The mapping between symbol names and symbols. */
typedef struct {
const char *name;
void *address;
} lt_dlsymlist;
extern LT_DLSYM_CONST lt_dlsymlist
lt_${my_prefix}_LTX_preloaded_symbols[];
LT_DLSYM_CONST lt_dlsymlist
lt_${my_prefix}_LTX_preloaded_symbols[] =
{\
{ \"$my_originator\", (void *) 0 },"
case $need_lib_prefix in
no)
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
;;
*)
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
;;
esac
echo >> "$output_objdir/$my_dlsyms" "\
{0, (void *) 0}
};
/* This works around a problem in FreeBSD linker */
#ifdef FREEBSD_WORKAROUND
static const void *lt_preloaded_setup() {
return lt_${my_prefix}_LTX_preloaded_symbols;
}
#endif
#ifdef __cplusplus
}
#endif\
"
} # !$opt_dry_run
pic_flag_for_symtable=
case "$compile_command " in
*" -static "*) ;;
*)
case $host in
# compiling the symbol table file with pic_flag works around
# a FreeBSD bug that causes programs to crash when -lm is
# linked before any other PIC object. But we must not use
# pic_flag when linking with -static. The problem exists in
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
*-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
*-*-hpux*)
pic_flag_for_symtable=" $pic_flag" ;;
*)
if test "X$my_pic_p" != Xno; then
pic_flag_for_symtable=" $pic_flag"
fi
;;
esac
;;
esac
symtab_cflags=
for arg in $LTCFLAGS; do
case $arg in
-pie | -fpie | -fPIE) ;;
*) func_append symtab_cflags " $arg" ;;
esac
done
# Now compile the dynamic symbol file.
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
# Clean up the generated files.
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
# Transform the symbol file into the correct name.
symfileobj="$output_objdir/${my_outputname}S.$objext"
case $host in
*cygwin* | *mingw* | *cegcc* )
if test -f "$output_objdir/$my_outputname.def"; then
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
else
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
fi
;;
*)
compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
;;
esac
;;
*)
func_fatal_error "unknown suffix for \`$my_dlsyms'"
;;
esac
else
# We keep going just in case the user didn't refer to
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
# really was required.
# Nullify the symbol file.
compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
fi
}
# func_win32_libid arg
# return the library type of file 'arg'
#
# Need a lot of goo to handle *both* DLLs and import libs
# Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called.
# Despite the name, also deal with 64 bit binaries.
func_win32_libid ()
{
$opt_debug
win32_libid_type="unknown"
win32_fileres=`file -L $1 2>/dev/null`
case $win32_fileres in
*ar\ archive\ import\ library*) # definitely import
win32_libid_type="x86 archive import"
;;
*ar\ archive*) # could be an import, or static
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
$EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
func_to_tool_file "$1" func_convert_file_msys_to_w32
win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
$SED -n -e '
1,100{
/ I /{
s,.*,import,
p
q
}
}'`
case $win32_nmres in
import*) win32_libid_type="x86 archive import";;
*) win32_libid_type="x86 archive static";;
esac
fi
;;
*DLL*)
win32_libid_type="x86 DLL"
;;
*executable*) # but shell scripts are "executable" too...
case $win32_fileres in
*MS\ Windows\ PE\ Intel*)
win32_libid_type="x86 DLL"
;;
esac
;;
esac
$ECHO "$win32_libid_type"
}
# func_cygming_dll_for_implib ARG
#
# Platform-specific function to extract the
# name of the DLL associated with the specified
# import library ARG.
# Invoked by eval'ing the libtool variable
# $sharedlib_from_linklib_cmd
# Result is available in the variable
# $sharedlib_from_linklib_result
func_cygming_dll_for_implib ()
{
$opt_debug
sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
}
# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
#
# The is the core of a fallback implementation of a
# platform-specific function to extract the name of the
# DLL associated with the specified import library LIBNAME.
#
# SECTION_NAME is either .idata$6 or .idata$7, depending
# on the platform and compiler that created the implib.
#
# Echos the name of the DLL associated with the
# specified import library.
func_cygming_dll_for_implib_fallback_core ()
{
$opt_debug
match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
$OBJDUMP -s --section "$1" "$2" 2>/dev/null |
$SED '/^Contents of section '"$match_literal"':/{
# Place marker at beginning of archive member dllname section
s/.*/====MARK====/
p
d
}
# These lines can sometimes be longer than 43 characters, but
# are always uninteresting
/:[ ]*file format pe[i]\{,1\}-/d
/^In archive [^:]*:/d
# Ensure marker is printed
/^====MARK====/p
# Remove all lines with less than 43 characters
/^.\{43\}/!d
# From remaining lines, remove first 43 characters
s/^.\{43\}//' |
$SED -n '
# Join marker and all lines until next marker into a single line
/^====MARK====/ b para
H
$ b para
b
:para
x
s/\n//g
# Remove the marker
s/^====MARK====//
# Remove trailing dots and whitespace
s/[\. \t]*$//
# Print
/./p' |
# we now have a list, one entry per line, of the stringified
# contents of the appropriate section of all members of the
# archive which possess that section. Heuristic: eliminate
# all those which have a first or second character that is
# a '.' (that is, objdump's representation of an unprintable
# character.) This should work for all archives with less than
# 0x302f exports -- but will fail for DLLs whose name actually
# begins with a literal '.' or a single character followed by
# a '.'.
#
# Of those that remain, print the first one.
$SED -e '/^\./d;/^.\./d;q'
}
# func_cygming_gnu_implib_p ARG
# This predicate returns with zero status (TRUE) if
# ARG is a GNU/binutils-style import library. Returns
# with nonzero status (FALSE) otherwise.
func_cygming_gnu_implib_p ()
{
$opt_debug
func_to_tool_file "$1" func_convert_file_msys_to_w32
func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
test -n "$func_cygming_gnu_implib_tmp"
}
# func_cygming_ms_implib_p ARG
# This predicate returns with zero status (TRUE) if
# ARG is an MS-style import library. Returns
# with nonzero status (FALSE) otherwise.
func_cygming_ms_implib_p ()
{
$opt_debug
func_to_tool_file "$1" func_convert_file_msys_to_w32
func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
test -n "$func_cygming_ms_implib_tmp"
}
# func_cygming_dll_for_implib_fallback ARG
# Platform-specific function to extract the
# name of the DLL associated with the specified
# import library ARG.
#
# This fallback implementation is for use when $DLLTOOL
# does not support the --identify-strict option.
# Invoked by eval'ing the libtool variable
# $sharedlib_from_linklib_cmd
# Result is available in the variable
# $sharedlib_from_linklib_result
func_cygming_dll_for_implib_fallback ()
{
$opt_debug
if func_cygming_gnu_implib_p "$1" ; then
# binutils import library
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
elif func_cygming_ms_implib_p "$1" ; then
# ms-generated import library
sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
else
# unknown
sharedlib_from_linklib_result=""
fi
}
# func_extract_an_archive dir oldlib
func_extract_an_archive ()
{
$opt_debug
f_ex_an_ar_dir="$1"; shift
f_ex_an_ar_oldlib="$1"
if test "$lock_old_archive_extraction" = yes; then
lockfile=$f_ex_an_ar_oldlib.lock
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
func_echo "Waiting for $lockfile to be removed"
sleep 2
done
fi
func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
'stat=$?; rm -f "$lockfile"; exit $stat'
if test "$lock_old_archive_extraction" = yes; then
$opt_dry_run || rm -f "$lockfile"
fi
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
:
else
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
fi
}
# func_extract_archives gentop oldlib ...
func_extract_archives ()
{
$opt_debug
my_gentop="$1"; shift
my_oldlibs=${1+"$@"}
my_oldobjs=""
my_xlib=""
my_xabs=""
my_xdir=""
for my_xlib in $my_oldlibs; do
# Extract the objects.
case $my_xlib in
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
*) my_xabs=`pwd`"/$my_xlib" ;;
esac
func_basename "$my_xlib"
my_xlib="$func_basename_result"
my_xlib_u=$my_xlib
while :; do
case " $extracted_archives " in
*" $my_xlib_u "*)
func_arith $extracted_serial + 1
extracted_serial=$func_arith_result
my_xlib_u=lt$extracted_serial-$my_xlib ;;
*) break ;;
esac
done
extracted_archives="$extracted_archives $my_xlib_u"
my_xdir="$my_gentop/$my_xlib_u"
func_mkdir_p "$my_xdir"
case $host in
*-darwin*)
func_verbose "Extracting $my_xabs"
# Do not bother doing anything if just a dry run
$opt_dry_run || {
darwin_orig_dir=`pwd`
cd $my_xdir || exit $?
darwin_archive=$my_xabs
darwin_curdir=`pwd`
darwin_base_archive=`basename "$darwin_archive"`
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
if test -n "$darwin_arches"; then
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
darwin_arch=
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
for darwin_arch in $darwin_arches ; do
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
cd "$darwin_curdir"
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
done # $darwin_arches
## Okay now we've a bunch of thin objects, gotta fatten them up :)
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
darwin_file=
darwin_files=
for darwin_file in $darwin_filelist; do
darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
$LIPO -create -output "$darwin_file" $darwin_files
done # $darwin_filelist
$RM -rf unfat-$$
cd "$darwin_orig_dir"
else
cd $darwin_orig_dir
func_extract_an_archive "$my_xdir" "$my_xabs"
fi # $darwin_arches
} # !$opt_dry_run
;;
*)
func_extract_an_archive "$my_xdir" "$my_xabs"
;;
esac
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
done
func_extract_archives_result="$my_oldobjs"
}
# func_emit_wrapper [arg=no]
#
# Emit a libtool wrapper script on stdout.
# Don't directly open a file because we may want to
# incorporate the script contents within a cygwin/mingw
# wrapper executable. Must ONLY be called from within
# func_mode_link because it depends on a number of variables
# set therein.
#
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
# variable will take. If 'yes', then the emitted script
# will assume that the directory in which it is stored is
# the $objdir directory. This is a cygwin/mingw-specific
# behavior.
func_emit_wrapper ()
{
func_emit_wrapper_arg1=${1-no}
$ECHO "\
#! $SHELL
# $output - temporary wrapper script for $objdir/$outputname
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# The $output program cannot be directly executed until all the libtool
# libraries that it depends on are installed.
#
# This wrapper script should never be moved out of the build directory.
# If it is, it will not operate correctly.
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
sed_quote_subst='$sed_quote_subst'
# Be Bourne compatible
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
relink_command=\"$relink_command\"
# This environment variable determines our operation mode.
if test \"\$libtool_install_magic\" = \"$magic\"; then
# install mode needs the following variables:
generated_by_libtool_version='$macro_version'
notinst_deplibs='$notinst_deplibs'
else
# When we are sourced in execute mode, \$file and \$ECHO are already set.
if test \"\$libtool_execute_magic\" != \"$magic\"; then
file=\"\$0\""
qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
$ECHO "\
# A function that is used when there is no print builtin or printf.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
\$1
_LTECHO_EOF'
}
ECHO=\"$qECHO\"
fi
# Very basic option parsing. These options are (a) specific to
# the libtool wrapper, (b) are identical between the wrapper
# /script/ and the wrapper /executable/ which is used only on
# windows platforms, and (c) all begin with the string "--lt-"
# (application programs are unlikely to have options which match
# this pattern).
#
# There are only two supported options: --lt-debug and
# --lt-dump-script. There is, deliberately, no --lt-help.
#
# The first argument to this parsing function should be the
# script's $0 value, followed by "$@".
lt_option_debug=
func_parse_lt_options ()
{
lt_script_arg0=\$0
shift
for lt_opt
do
case \"\$lt_opt\" in
--lt-debug) lt_option_debug=1 ;;
--lt-dump-script)
lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
cat \"\$lt_dump_D/\$lt_dump_F\"
exit 0
;;
--lt-*)
\$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
exit 1
;;
esac
done
# Print the debug banner immediately:
if test -n \"\$lt_option_debug\"; then
echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
fi
}
# Used when --lt-debug. Prints its arguments to stdout
# (redirection is the responsibility of the caller)
func_lt_dump_args ()
{
lt_dump_args_N=1;
for lt_arg
do
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
done
}
# Core function for launching the target application
func_exec_program_core ()
{
"
case $host in
# Backslashes separate directories on plain windows
*-*-mingw | *-*-os2* | *-cegcc*)
$ECHO "\
if test -n \"\$lt_option_debug\"; then
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
func_lt_dump_args \${1+\"\$@\"} 1>&2
fi
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
"
;;
*)
$ECHO "\
if test -n \"\$lt_option_debug\"; then
\$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
func_lt_dump_args \${1+\"\$@\"} 1>&2
fi
exec \"\$progdir/\$program\" \${1+\"\$@\"}
"
;;
esac
$ECHO "\
\$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
exit 1
}
# A function to encapsulate launching the target application
# Strips options in the --lt-* namespace from \$@ and
# launches target application with the remaining arguments.
func_exec_program ()
{
case \" \$* \" in
*\\ --lt-*)
for lt_wr_arg
do
case \$lt_wr_arg in
--lt-*) ;;
*) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
esac
shift
done ;;
esac
func_exec_program_core \${1+\"\$@\"}
}
# Parse options
func_parse_lt_options \"\$0\" \${1+\"\$@\"}
# Find the directory that this script lives in.
thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
# Follow symbolic links until we get to the real thisdir.
file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
while test -n \"\$file\"; do
destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
# If there was a directory component, then change thisdir.
if test \"x\$destdir\" != \"x\$file\"; then
case \"\$destdir\" in
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
*) thisdir=\"\$thisdir/\$destdir\" ;;
esac
fi
file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
done
# Usually 'no', except on cygwin/mingw when embedded into
# the cwrapper.
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
# special case for '.'
if test \"\$thisdir\" = \".\"; then
thisdir=\`pwd\`
fi
# remove .libs from thisdir
case \"\$thisdir\" in
*[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
$objdir ) thisdir=. ;;
esac
fi
# Try to get the absolute directory name.
absdir=\`cd \"\$thisdir\" && pwd\`
test -n \"\$absdir\" && thisdir=\"\$absdir\"
"
if test "$fast_install" = yes; then
$ECHO "\
program=lt-'$outputname'$exeext
progdir=\"\$thisdir/$objdir\"
if test ! -f \"\$progdir/\$program\" ||
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
file=\"\$\$-\$program\"
if test ! -d \"\$progdir\"; then
$MKDIR \"\$progdir\"
else
$RM \"\$progdir/\$file\"
fi"
$ECHO "\
# relink executable if necessary
if test -n \"\$relink_command\"; then
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
else
$ECHO \"\$relink_command_output\" >&2
$RM \"\$progdir/\$file\"
exit 1
fi
fi
$MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
{ $RM \"\$progdir/\$program\";
$MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
$RM \"\$progdir/\$file\"
fi"
else
$ECHO "\
program='$outputname'
progdir=\"\$thisdir/$objdir\"
"
fi
$ECHO "\
if test -f \"\$progdir/\$program\"; then"
# fixup the dll searchpath if we need to.
#
# Fix the DLL searchpath if we need to. Do this before prepending
# to shlibpath, because on Windows, both are PATH and uninstalled
# libraries must come first.
if test -n "$dllsearchpath"; then
$ECHO "\
# Add the dll search path components to the executable PATH
PATH=$dllsearchpath:\$PATH
"
fi
# Export our shlibpath_var if we have one.
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
$ECHO "\
# Add our own library path to $shlibpath_var
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
# Some systems cannot cope with colon-terminated $shlibpath_var
# The second colon is a workaround for a bug in BeOS R4 sed
$shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
export $shlibpath_var
"
fi
$ECHO "\
if test \"\$libtool_execute_magic\" != \"$magic\"; then
# Run the actual program with our arguments.
func_exec_program \${1+\"\$@\"}
fi
else
# The program doesn't exist.
\$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
\$ECHO \"This script is just a wrapper for \$program.\" 1>&2
\$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
exit 1
fi
fi\
"
}
# func_emit_cwrapperexe_src
# emit the source code for a wrapper executable on stdout
# Must ONLY be called from within func_mode_link because
# it depends on a number of variable set therein.
func_emit_cwrapperexe_src ()
{
cat <<EOF
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
The $output program cannot be directly executed until all the libtool
libraries that it depends on are installed.
This wrapper executable should never be moved out of the build directory.
If it is, it will not operate correctly.
*/
EOF
cat <<"EOF"
#ifdef _MSC_VER
# define _CRT_SECURE_NO_DEPRECATE 1
#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef _MSC_VER
# include <direct.h>
# include <process.h>
# include <io.h>
#else
# include <unistd.h>
# include <stdint.h>
# ifdef __CYGWIN__
# include <io.h>
# endif
#endif
#include <malloc.h>
#include <stdarg.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
/* declarations of non-ANSI functions */
#if defined(__MINGW32__)
# ifdef __STRICT_ANSI__
int _putenv (const char *);
# endif
#elif defined(__CYGWIN__)
# ifdef __STRICT_ANSI__
char *realpath (const char *, char *);
int putenv (char *);
int setenv (const char *, const char *, int);
# endif
/* #elif defined (other platforms) ... */
#endif
/* portability defines, excluding path handling macros */
#if defined(_MSC_VER)
# define setmode _setmode
# define stat _stat
# define chmod _chmod
# define getcwd _getcwd
# define putenv _putenv
# define S_IXUSR _S_IEXEC
# ifndef _INTPTR_T_DEFINED
# define _INTPTR_T_DEFINED
# define intptr_t int
# endif
#elif defined(__MINGW32__)
# define setmode _setmode
# define stat _stat
# define chmod _chmod
# define getcwd _getcwd
# define putenv _putenv
#elif defined(__CYGWIN__)
# define HAVE_SETENV
# define FOPEN_WB "wb"
/* #elif defined (other platforms) ... */
#endif
#if defined(PATH_MAX)
# define LT_PATHMAX PATH_MAX
#elif defined(MAXPATHLEN)
# define LT_PATHMAX MAXPATHLEN
#else
# define LT_PATHMAX 1024
#endif
#ifndef S_IXOTH
# define S_IXOTH 0
#endif
#ifndef S_IXGRP
# define S_IXGRP 0
#endif
/* path handling portability macros */
#ifndef DIR_SEPARATOR
# define DIR_SEPARATOR '/'
# define PATH_SEPARATOR ':'
#endif
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
defined (__OS2__)
# define HAVE_DOS_BASED_FILE_SYSTEM
# define FOPEN_WB "wb"
# ifndef DIR_SEPARATOR_2
# define DIR_SEPARATOR_2 '\\'
# endif
# ifndef PATH_SEPARATOR_2
# define PATH_SEPARATOR_2 ';'
# endif
#endif
#ifndef DIR_SEPARATOR_2
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
#else /* DIR_SEPARATOR_2 */
# define IS_DIR_SEPARATOR(ch) \
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
#endif /* DIR_SEPARATOR_2 */
#ifndef PATH_SEPARATOR_2
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
#else /* PATH_SEPARATOR_2 */
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
#endif /* PATH_SEPARATOR_2 */
#ifndef FOPEN_WB
# define FOPEN_WB "w"
#endif
#ifndef _O_BINARY
# define _O_BINARY 0
#endif
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
#define XFREE(stale) do { \
if (stale) { free ((void *) stale); stale = 0; } \
} while (0)
#if defined(LT_DEBUGWRAPPER)
static int lt_debug = 1;
#else
static int lt_debug = 0;
#endif
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
void *xmalloc (size_t num);
char *xstrdup (const char *string);
const char *base_name (const char *name);
char *find_executable (const char *wrapper);
char *chase_symlinks (const char *pathspec);
int make_executable (const char *path);
int check_executable (const char *path);
char *strendzap (char *str, const char *pat);
void lt_debugprintf (const char *file, int line, const char *fmt, ...);
void lt_fatal (const char *file, int line, const char *message, ...);
static const char *nonnull (const char *s);
static const char *nonempty (const char *s);
void lt_setenv (const char *name, const char *value);
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
void lt_update_exe_path (const char *name, const char *value);
void lt_update_lib_path (const char *name, const char *value);
char **prepare_spawn (char **argv);
void lt_dump_script (FILE *f);
EOF
cat <<EOF
volatile const char * MAGIC_EXE = "$magic_exe";
const char * LIB_PATH_VARNAME = "$shlibpath_var";
EOF
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
func_to_host_path "$temp_rpath"
cat <<EOF
const char * LIB_PATH_VALUE = "$func_to_host_path_result";
EOF
else
cat <<"EOF"
const char * LIB_PATH_VALUE = "";
EOF
fi
if test -n "$dllsearchpath"; then
func_to_host_path "$dllsearchpath:"
cat <<EOF
const char * EXE_PATH_VARNAME = "PATH";
const char * EXE_PATH_VALUE = "$func_to_host_path_result";
EOF
else
cat <<"EOF"
const char * EXE_PATH_VARNAME = "";
const char * EXE_PATH_VALUE = "";
EOF
fi
if test "$fast_install" = yes; then
cat <<EOF
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
EOF
else
cat <<EOF
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
EOF
fi
cat <<"EOF"
#define LTWRAPPER_OPTION_PREFIX "--lt-"
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
int
main (int argc, char *argv[])
{
char **newargz;
int newargc;
char *tmp_pathspec;
char *actual_cwrapper_path;
char *actual_cwrapper_name;
char *target_name;
char *lt_argv_zero;
intptr_t rval = 127;
int i;
program_name = (char *) xstrdup (base_name (argv[0]));
newargz = XMALLOC (char *, argc + 1);
/* very simple arg parsing; don't want to rely on getopt
* also, copy all non cwrapper options to newargz, except
* argz[0], which is handled differently
*/
newargc=0;
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], dumpscript_opt) == 0)
{
EOF
case "$host" in
*mingw* | *cygwin* )
# make stdout use "unix" line endings
echo " setmode(1,_O_BINARY);"
;;
esac
cat <<"EOF"
lt_dump_script (stdout);
return 0;
}
if (strcmp (argv[i], debug_opt) == 0)
{
lt_debug = 1;
continue;
}
if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
{
/* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
namespace, but it is not one of the ones we know about and
have already dealt with, above (inluding dump-script), then
report an error. Otherwise, targets might begin to believe
they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
namespace. The first time any user complains about this, we'll
need to make LTWRAPPER_OPTION_PREFIX a configure-time option
or a configure.ac-settable value.
*/
lt_fatal (__FILE__, __LINE__,
"unrecognized %s option: '%s'",
ltwrapper_option_prefix, argv[i]);
}
/* otherwise ... */
newargz[++newargc] = xstrdup (argv[i]);
}
newargz[++newargc] = NULL;
EOF
cat <<EOF
/* The GNU banner must be the first non-error debug message */
lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
EOF
cat <<"EOF"
lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
tmp_pathspec = find_executable (argv[0]);
if (tmp_pathspec == NULL)
lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
lt_debugprintf (__FILE__, __LINE__,
"(main) found exe (before symlink chase) at: %s\n",
tmp_pathspec);
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
lt_debugprintf (__FILE__, __LINE__,
"(main) found exe (after symlink chase) at: %s\n",
actual_cwrapper_path);
XFREE (tmp_pathspec);
actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
strendzap (actual_cwrapper_path, actual_cwrapper_name);
/* wrapper name transforms */
strendzap (actual_cwrapper_name, ".exe");
tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
XFREE (actual_cwrapper_name);
actual_cwrapper_name = tmp_pathspec;
tmp_pathspec = 0;
/* target_name transforms -- use actual target program name; might have lt- prefix */
target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
strendzap (target_name, ".exe");
tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
XFREE (target_name);
target_name = tmp_pathspec;
tmp_pathspec = 0;
lt_debugprintf (__FILE__, __LINE__,
"(main) libtool target name: %s\n",
target_name);
EOF
cat <<EOF
newargz[0] =
XMALLOC (char, (strlen (actual_cwrapper_path) +
strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
strcpy (newargz[0], actual_cwrapper_path);
strcat (newargz[0], "$objdir");
strcat (newargz[0], "/");
EOF
cat <<"EOF"
/* stop here, and copy so we don't have to do this twice */
tmp_pathspec = xstrdup (newargz[0]);
/* do NOT want the lt- prefix here, so use actual_cwrapper_name */
strcat (newargz[0], actual_cwrapper_name);
/* DO want the lt- prefix here if it exists, so use target_name */
lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
XFREE (tmp_pathspec);
tmp_pathspec = NULL;
EOF
case $host_os in
mingw*)
cat <<"EOF"
{
char* p;
while ((p = strchr (newargz[0], '\\')) != NULL)
{
*p = '/';
}
while ((p = strchr (lt_argv_zero, '\\')) != NULL)
{
*p = '/';
}
}
EOF
;;
esac
cat <<"EOF"
XFREE (target_name);
XFREE (actual_cwrapper_path);
XFREE (actual_cwrapper_name);
lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
lt_setenv ("DUALCASE", "1"); /* for MSK sh */
/* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
because on Windows, both *_VARNAMEs are PATH but uninstalled
libraries must come first. */
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
nonnull (lt_argv_zero));
for (i = 0; i < newargc; i++)
{
lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
i, nonnull (newargz[i]));
}
EOF
case $host_os in
mingw*)
cat <<"EOF"
/* execv doesn't actually work on mingw as expected on unix */
newargz = prepare_spawn (newargz);
rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
if (rval == -1)
{
/* failed to start process */
lt_debugprintf (__FILE__, __LINE__,
"(main) failed to launch target \"%s\": %s\n",
lt_argv_zero, nonnull (strerror (errno)));
return 127;
}
return rval;
EOF
;;
*)
cat <<"EOF"
execv (lt_argv_zero, newargz);
return rval; /* =127, but avoids unused variable warning */
EOF
;;
esac
cat <<"EOF"
}
void *
xmalloc (size_t num)
{
void *p = (void *) malloc (num);
if (!p)
lt_fatal (__FILE__, __LINE__, "memory exhausted");
return p;
}
char *
xstrdup (const char *string)
{
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
string) : NULL;
}
const char *
base_name (const char *name)
{
const char *base;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
/* Skip over the disk name in MSDOS pathnames. */
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
name += 2;
#endif
for (base = name; *name; name++)
if (IS_DIR_SEPARATOR (*name))
base = name + 1;
return base;
}
int
check_executable (const char *path)
{
struct stat st;
lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
nonempty (path));
if ((!path) || (!*path))
return 0;
if ((stat (path, &st) >= 0)
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
return 1;
else
return 0;
}
int
make_executable (const char *path)
{
int rval = 0;
struct stat st;
lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
nonempty (path));
if ((!path) || (!*path))
return 0;
if (stat (path, &st) >= 0)
{
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
}
return rval;
}
/* Searches for the full path of the wrapper. Returns
newly allocated full path name if found, NULL otherwise
Does not chase symlinks, even on platforms that support them.
*/
char *
find_executable (const char *wrapper)
{
int has_slash = 0;
const char *p;
const char *p_next;
/* static buffer for getcwd */
char tmp[LT_PATHMAX + 1];
int tmp_len;
char *concat_name;
lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
nonempty (wrapper));
if ((wrapper == NULL) || (*wrapper == '\0'))
return NULL;
/* Absolute path? */
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
{
concat_name = xstrdup (wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
else
{
#endif
if (IS_DIR_SEPARATOR (wrapper[0]))
{
concat_name = xstrdup (wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
}
#endif
for (p = wrapper; *p; p++)
if (*p == '/')
{
has_slash = 1;
break;
}
if (!has_slash)
{
/* no slashes; search PATH */
const char *path = getenv ("PATH");
if (path != NULL)
{
for (p = path; *p; p = p_next)
{
const char *q;
size_t p_len;
for (q = p; *q; q++)
if (IS_PATH_SEPARATOR (*q))
break;
p_len = q - p;
p_next = (*q == '\0' ? q : q + 1);
if (p_len == 0)
{
/* empty path: current directory */
if (getcwd (tmp, LT_PATHMAX) == NULL)
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
nonnull (strerror (errno)));
tmp_len = strlen (tmp);
concat_name =
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, tmp, tmp_len);
concat_name[tmp_len] = '/';
strcpy (concat_name + tmp_len + 1, wrapper);
}
else
{
concat_name =
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, p, p_len);
concat_name[p_len] = '/';
strcpy (concat_name + p_len + 1, wrapper);
}
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
}
/* not found in PATH; assume curdir */
}
/* Relative path | not found in path: prepend cwd */
if (getcwd (tmp, LT_PATHMAX) == NULL)
lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
nonnull (strerror (errno)));
tmp_len = strlen (tmp);
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, tmp, tmp_len);
concat_name[tmp_len] = '/';
strcpy (concat_name + tmp_len + 1, wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
return NULL;
}
char *
chase_symlinks (const char *pathspec)
{
#ifndef S_ISLNK
return xstrdup (pathspec);
#else
char buf[LT_PATHMAX];
struct stat s;
char *tmp_pathspec = xstrdup (pathspec);
char *p;
int has_symlinks = 0;
while (strlen (tmp_pathspec) && !has_symlinks)
{
lt_debugprintf (__FILE__, __LINE__,
"checking path component for symlinks: %s\n",
tmp_pathspec);
if (lstat (tmp_pathspec, &s) == 0)
{
if (S_ISLNK (s.st_mode) != 0)
{
has_symlinks = 1;
break;
}
/* search backwards for last DIR_SEPARATOR */
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
p--;
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
{
/* no more DIR_SEPARATORS left */
break;
}
*p = '\0';
}
else
{
lt_fatal (__FILE__, __LINE__,
"error accessing file \"%s\": %s",
tmp_pathspec, nonnull (strerror (errno)));
}
}
XFREE (tmp_pathspec);
if (!has_symlinks)
{
return xstrdup (pathspec);
}
tmp_pathspec = realpath (pathspec, buf);
if (tmp_pathspec == 0)
{
lt_fatal (__FILE__, __LINE__,
"could not follow symlinks for %s", pathspec);
}
return xstrdup (tmp_pathspec);
#endif
}
char *
strendzap (char *str, const char *pat)
{
size_t len, patlen;
assert (str != NULL);
assert (pat != NULL);
len = strlen (str);
patlen = strlen (pat);
if (patlen <= len)
{
str += len - patlen;
if (strcmp (str, pat) == 0)
*str = '\0';
}
return str;
}
void
lt_debugprintf (const char *file, int line, const char *fmt, ...)
{
va_list args;
if (lt_debug)
{
(void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
va_start (args, fmt);
(void) vfprintf (stderr, fmt, args);
va_end (args);
}
}
static void
lt_error_core (int exit_status, const char *file,
int line, const char *mode,
const char *message, va_list ap)
{
fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
vfprintf (stderr, message, ap);
fprintf (stderr, ".\n");
if (exit_status >= 0)
exit (exit_status);
}
void
lt_fatal (const char *file, int line, const char *message, ...)
{
va_list ap;
va_start (ap, message);
lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
va_end (ap);
}
static const char *
nonnull (const char *s)
{
return s ? s : "(null)";
}
static const char *
nonempty (const char *s)
{
return (s && !*s) ? "(empty)" : nonnull (s);
}
void
lt_setenv (const char *name, const char *value)
{
lt_debugprintf (__FILE__, __LINE__,
"(lt_setenv) setting '%s' to '%s'\n",
nonnull (name), nonnull (value));
{
#ifdef HAVE_SETENV
/* always make a copy, for consistency with !HAVE_SETENV */
char *str = xstrdup (value);
setenv (name, str, 1);
#else
int len = strlen (name) + 1 + strlen (value) + 1;
char *str = XMALLOC (char, len);
sprintf (str, "%s=%s", name, value);
if (putenv (str) != EXIT_SUCCESS)
{
XFREE (str);
}
#endif
}
}
char *
lt_extend_str (const char *orig_value, const char *add, int to_end)
{
char *new_value;
if (orig_value && *orig_value)
{
int orig_value_len = strlen (orig_value);
int add_len = strlen (add);
new_value = XMALLOC (char, add_len + orig_value_len + 1);
if (to_end)
{
strcpy (new_value, orig_value);
strcpy (new_value + orig_value_len, add);
}
else
{
strcpy (new_value, add);
strcpy (new_value + add_len, orig_value);
}
}
else
{
new_value = xstrdup (add);
}
return new_value;
}
void
lt_update_exe_path (const char *name, const char *value)
{
lt_debugprintf (__FILE__, __LINE__,
"(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
nonnull (name), nonnull (value));
if (name && *name && value && *value)
{
char *new_value = lt_extend_str (getenv (name), value, 0);
/* some systems can't cope with a ':'-terminated path #' */
int len = strlen (new_value);
while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
{
new_value[len-1] = '\0';
}
lt_setenv (name, new_value);
XFREE (new_value);
}
}
void
lt_update_lib_path (const char *name, const char *value)
{
lt_debugprintf (__FILE__, __LINE__,
"(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
nonnull (name), nonnull (value));
if (name && *name && value && *value)
{
char *new_value = lt_extend_str (getenv (name), value, 0);
lt_setenv (name, new_value);
XFREE (new_value);
}
}
EOF
case $host_os in
mingw*)
cat <<"EOF"
/* Prepares an argument vector before calling spawn().
Note that spawn() does not by itself call the command interpreter
(getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&v);
v.dwPlatformId == VER_PLATFORM_WIN32_NT;
}) ? "cmd.exe" : "command.com").
Instead it simply concatenates the arguments, separated by ' ', and calls
CreateProcess(). We must quote the arguments since Win32 CreateProcess()
interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
special way:
- Space and tab are interpreted as delimiters. They are not treated as
delimiters if they are surrounded by double quotes: "...".
- Unescaped double quotes are removed from the input. Their only effect is
that within double quotes, space and tab are treated like normal
characters.
- Backslashes not followed by double quotes are not special.
- But 2*n+1 backslashes followed by a double quote become
n backslashes followed by a double quote (n >= 0):
\" -> "
\\\" -> \"
\\\\\" -> \\"
*/
#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
char **
prepare_spawn (char **argv)
{
size_t argc;
char **new_argv;
size_t i;
/* Count number of arguments. */
for (argc = 0; argv[argc] != NULL; argc++)
;
/* Allocate new argument vector. */
new_argv = XMALLOC (char *, argc + 1);
/* Put quoted arguments into the new argument vector. */
for (i = 0; i < argc; i++)
{
const char *string = argv[i];
if (string[0] == '\0')
new_argv[i] = xstrdup ("\"\"");
else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
{
int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
size_t length;
unsigned int backslashes;
const char *s;
char *quoted_string;
char *p;
length = 0;
backslashes = 0;
if (quote_around)
length++;
for (s = string; *s != '\0'; s++)
{
char c = *s;
if (c == '"')
length += backslashes + 1;
length++;
if (c == '\\')
backslashes++;
else
backslashes = 0;
}
if (quote_around)
length += backslashes + 1;
quoted_string = XMALLOC (char, length + 1);
p = quoted_string;
backslashes = 0;
if (quote_around)
*p++ = '"';
for (s = string; *s != '\0'; s++)
{
char c = *s;
if (c == '"')
{
unsigned int j;
for (j = backslashes + 1; j > 0; j--)
*p++ = '\\';
}
*p++ = c;
if (c == '\\')
backslashes++;
else
backslashes = 0;
}
if (quote_around)
{
unsigned int j;
for (j = backslashes; j > 0; j--)
*p++ = '\\';
*p++ = '"';
}
*p = '\0';
new_argv[i] = quoted_string;
}
else
new_argv[i] = (char *) string;
}
new_argv[argc] = NULL;
return new_argv;
}
EOF
;;
esac
cat <<"EOF"
void lt_dump_script (FILE* f)
{
EOF
func_emit_wrapper yes |
$SED -n -e '
s/^\(.\{79\}\)\(..*\)/\1\
\2/
h
s/\([\\"]\)/\\\1/g
s/$/\\n/
s/\([^\n]*\).*/ fputs ("\1", f);/p
g
D'
cat <<"EOF"
}
EOF
}
# end: func_emit_cwrapperexe_src
# func_win32_import_lib_p ARG
# True if ARG is an import lib, as indicated by $file_magic_cmd
func_win32_import_lib_p ()
{
$opt_debug
case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
*import*) : ;;
*) false ;;
esac
}
# func_mode_link arg...
func_mode_link ()
{
$opt_debug
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
# It is impossible to link a dll without this setting, and
# we shouldn't force the makefile maintainer to figure out
# which system we are compiling for in order to pass an extra
# flag for every libtool invocation.
# allow_undefined=no
# FIXME: Unfortunately, there are problems with the above when trying
# to make a dll which has undefined symbols, in which case not
# even a static library is built. For now, we need to specify
# -no-undefined on the libtool link line when we can be certain
# that all symbols are satisfied, otherwise we get a static library.
allow_undefined=yes
;;
*)
allow_undefined=yes
;;
esac
libtool_args=$nonopt
base_compile="$nonopt $@"
compile_command=$nonopt
finalize_command=$nonopt
compile_rpath=
finalize_rpath=
compile_shlibpath=
finalize_shlibpath=
convenience=
old_convenience=
deplibs=
old_deplibs=
compiler_flags=
linker_flags=
dllsearchpath=
lib_search_path=`pwd`
inst_prefix_dir=
new_inherited_linker_flags=
avoid_version=no
bindir=
dlfiles=
dlprefiles=
dlself=no
export_dynamic=no
export_symbols=
export_symbols_regex=
generated=
libobjs=
ltlibs=
module=no
no_install=no
objs=
non_pic_objects=
precious_files_regex=
prefer_static_libs=no
preload=no
prev=
prevarg=
release=
rpath=
xrpath=
perm_rpath=
temp_rpath=
thread_safe=no
vinfo=
vinfo_number=no
weak_libs=
single_module="${wl}-single_module"
func_infer_tag $base_compile
# We need to know -static, to get the right output filenames.
for arg
do
case $arg in
-shared)
test "$build_libtool_libs" != yes && \
func_fatal_configuration "can not build a shared library"
build_old_libs=no
break
;;
-all-static | -static | -static-libtool-libs)
case $arg in
-all-static)
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
func_warning "complete static linking is impossible in this configuration"
fi
if test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=yes
;;
-static)
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=built
;;
-static-libtool-libs)
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=yes
;;
esac
build_libtool_libs=no
build_old_libs=yes
break
;;
esac
done
# See if our shared archives depend on static archives.
test -n "$old_archive_from_new_cmds" && build_old_libs=yes
# Go through the arguments, transforming them on the way.
while test "$#" -gt 0; do
arg="$1"
shift
func_quote_for_eval "$arg"
qarg=$func_quote_for_eval_unquoted_result
func_append libtool_args " $func_quote_for_eval_result"
# If the previous option needs an argument, assign it.
if test -n "$prev"; then
case $prev in
output)
func_append compile_command " @OUTPUT@"
func_append finalize_command " @OUTPUT@"
;;
esac
case $prev in
bindir)
bindir="$arg"
prev=
continue
;;
dlfiles|dlprefiles)
if test "$preload" = no; then
# Add the symbol object into the linking commands.
func_append compile_command " @SYMFILE@"
func_append finalize_command " @SYMFILE@"
preload=yes
fi
case $arg in
*.la | *.lo) ;; # We handle these cases below.
force)
if test "$dlself" = no; then
dlself=needless
export_dynamic=yes
fi
prev=
continue
;;
self)
if test "$prev" = dlprefiles; then
dlself=yes
elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
dlself=yes
else
dlself=needless
export_dynamic=yes
fi
prev=
continue
;;
*)
if test "$prev" = dlfiles; then
func_append dlfiles " $arg"
else
func_append dlprefiles " $arg"
fi
prev=
continue
;;
esac
;;
expsyms)
export_symbols="$arg"
test -f "$arg" \
|| func_fatal_error "symbol file \`$arg' does not exist"
prev=
continue
;;
expsyms_regex)
export_symbols_regex="$arg"
prev=
continue
;;
framework)
case $host in
*-*-darwin*)
case "$deplibs " in
*" $qarg.ltframework "*) ;;
*) func_append deplibs " $qarg.ltframework" # this is fixed later
;;
esac
;;
esac
prev=
continue
;;
inst_prefix)
inst_prefix_dir="$arg"
prev=
continue
;;
objectlist)
if test -f "$arg"; then
save_arg=$arg
moreargs=
for fil in `cat "$save_arg"`
do
# func_append moreargs " $fil"
arg=$fil
# A libtool-controlled object.
# Check to see that this really is a libtool object.
if func_lalib_unsafe_p "$arg"; then
pic_object=
non_pic_object=
# Read the .lo file
func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
test "$pic_object" = none &&
test "$non_pic_object" = none; then
func_fatal_error "cannot find name of object for \`$arg'"
fi
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
pic_object="$xdir$pic_object"
if test "$prev" = dlfiles; then
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
func_append dlfiles " $pic_object"
prev=
continue
else
# If libtool objects are unsupported, then we need to preload.
prev=dlprefiles
fi
fi
# CHECK ME: I think I busted this. -Ossama
if test "$prev" = dlprefiles; then
# Preload the old-style object.
func_append dlprefiles " $pic_object"
prev=
fi
# A PIC object.
func_append libobjs " $pic_object"
arg="$pic_object"
fi
# Non-PIC object.
if test "$non_pic_object" != none; then
# Prepend the subdirectory the object is found in.
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
else
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
func_append non_pic_objects " $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
if $opt_dry_run; then
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
func_lo2o "$arg"
pic_object=$xdir$objdir/$func_lo2o_result
non_pic_object=$xdir$func_lo2o_result
func_append libobjs " $pic_object"
func_append non_pic_objects " $non_pic_object"
else
func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
done
else
func_fatal_error "link input file \`$arg' does not exist"
fi
arg=$save_arg
prev=
continue
;;
precious_regex)
precious_files_regex="$arg"
prev=
continue
;;
release)
release="-$arg"
prev=
continue
;;
rpath | xrpath)
# We need an absolute path.
case $arg in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
func_fatal_error "only absolute run-paths are allowed"
;;
esac
if test "$prev" = rpath; then
case "$rpath " in
*" $arg "*) ;;
*) func_append rpath " $arg" ;;
esac
else
case "$xrpath " in
*" $arg "*) ;;
*) func_append xrpath " $arg" ;;
esac
fi
prev=
continue
;;
shrext)
shrext_cmds="$arg"
prev=
continue
;;
weak)
func_append weak_libs " $arg"
prev=
continue
;;
xcclinker)
func_append linker_flags " $qarg"
func_append compiler_flags " $qarg"
prev=
func_append compile_command " $qarg"
func_append finalize_command " $qarg"
continue
;;
xcompiler)
func_append compiler_flags " $qarg"
prev=
func_append compile_command " $qarg"
func_append finalize_command " $qarg"
continue
;;
xlinker)
func_append linker_flags " $qarg"
func_append compiler_flags " $wl$qarg"
prev=
func_append compile_command " $wl$qarg"
func_append finalize_command " $wl$qarg"
continue
;;
*)
eval "$prev=\"\$arg\""
prev=
continue
;;
esac
fi # test -n "$prev"
prevarg="$arg"
case $arg in
-all-static)
if test -n "$link_static_flag"; then
# See comment for -static flag below, for more details.
func_append compile_command " $link_static_flag"
func_append finalize_command " $link_static_flag"
fi
continue
;;
-allow-undefined)
# FIXME: remove this flag sometime in the future.
func_fatal_error "\`-allow-undefined' must not be used because it is the default"
;;
-avoid-version)
avoid_version=yes
continue
;;
-bindir)
prev=bindir
continue
;;
-dlopen)
prev=dlfiles
continue
;;
-dlpreopen)
prev=dlprefiles
continue
;;
-export-dynamic)
export_dynamic=yes
continue
;;
-export-symbols | -export-symbols-regex)
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
func_fatal_error "more than one -exported-symbols argument is not allowed"
fi
if test "X$arg" = "X-export-symbols"; then
prev=expsyms
else
prev=expsyms_regex
fi
continue
;;
-framework)
prev=framework
continue
;;
-inst-prefix-dir)
prev=inst_prefix
continue
;;
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
# so, if we see these flags be careful not to treat them like -L
-L[A-Z][A-Z]*:*)
case $with_gcc/$host in
no/*-*-irix* | /*-*-irix*)
func_append compile_command " $arg"
func_append finalize_command " $arg"
;;
esac
continue
;;
-L*)
func_stripname "-L" '' "$arg"
if test -z "$func_stripname_result"; then
if test "$#" -gt 0; then
func_fatal_error "require no space between \`-L' and \`$1'"
else
func_fatal_error "need path for \`-L' option"
fi
fi
func_resolve_sysroot "$func_stripname_result"
dir=$func_resolve_sysroot_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
absdir=`cd "$dir" && pwd`
test -z "$absdir" && \
func_fatal_error "cannot determine absolute directory name of \`$dir'"
dir="$absdir"
;;
esac
case "$deplibs " in
*" -L$dir "* | *" $arg "*)
# Will only happen for absolute or sysroot arguments
;;
*)
# Preserve sysroot, but never include relative directories
case $dir in
[\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
*) func_append deplibs " -L$dir" ;;
esac
func_append lib_search_path " $dir"
;;
esac
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
::) dllsearchpath=$dir;;
*) func_append dllsearchpath ":$dir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
::) dllsearchpath=$testbindir;;
*) func_append dllsearchpath ":$testbindir";;
esac
;;
esac
continue
;;
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
# These systems don't actually have a C or math library (as such)
continue
;;
*-*-os2*)
# These systems don't actually have a C library (as such)
test "X$arg" = "X-lc" && continue
;;
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C and math libraries are in the System framework
func_append deplibs " System.ltframework"
continue
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
test "X$arg" = "X-lc" && continue
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
test "X$arg" = "X-lc" && continue
;;
esac
elif test "X$arg" = "X-lc_r"; then
case $host in
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc_r directly, use -pthread flag.
continue
;;
esac
fi
func_append deplibs " $arg"
continue
;;
-module)
module=yes
continue
;;
# Tru64 UNIX uses -model [arg] to determine the layout of C++
# classes, name mangling, and exception handling.
# Darwin uses the -arch flag to determine output architecture.
-model|-arch|-isysroot|--sysroot)
func_append compiler_flags " $arg"
func_append compile_command " $arg"
func_append finalize_command " $arg"
prev=xcompiler
continue
;;
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
func_append compiler_flags " $arg"
func_append compile_command " $arg"
func_append finalize_command " $arg"
case "$new_inherited_linker_flags " in
*" $arg "*) ;;
* ) func_append new_inherited_linker_flags " $arg" ;;
esac
continue
;;
-multi_module)
single_module="${wl}-multi_module"
continue
;;
-no-fast-install)
fast_install=no
continue
;;
-no-install)
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
# The PATH hackery in wrapper scripts is required on Windows
# and Darwin in order for the loader to find any dlls it needs.
func_warning "\`-no-install' is ignored for $host"
func_warning "assuming \`-no-fast-install' instead"
fast_install=no
;;
*) no_install=yes ;;
esac
continue
;;
-no-undefined)
allow_undefined=no
continue
;;
-objectlist)
prev=objectlist
continue
;;
-o) prev=output ;;
-precious-files-regex)
prev=precious_regex
continue
;;
-release)
prev=release
continue
;;
-rpath)
prev=rpath
continue
;;
-R)
prev=xrpath
continue
;;
-R*)
func_stripname '-R' '' "$arg"
dir=$func_stripname_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
=*)
func_stripname '=' '' "$dir"
dir=$lt_sysroot$func_stripname_result
;;
*)
func_fatal_error "only absolute run-paths are allowed"
;;
esac
case "$xrpath " in
*" $dir "*) ;;
*) func_append xrpath " $dir" ;;
esac
continue
;;
-shared)
# The effects of -shared are defined in a previous loop.
continue
;;
-shrext)
prev=shrext
continue
;;
-static | -static-libtool-libs)
# The effects of -static are defined in a previous loop.
# We used to do the same as -all-static on platforms that
# didn't have a PIC flag, but the assumption that the effects
# would be equivalent was wrong. It would break on at least
# Digital Unix and AIX.
continue
;;
-thread-safe)
thread_safe=yes
continue
;;
-version-info)
prev=vinfo
continue
;;
-version-number)
prev=vinfo
vinfo_number=yes
continue
;;
-weak)
prev=weak
continue
;;
-Wc,*)
func_stripname '-Wc,' '' "$arg"
args=$func_stripname_result
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
func_quote_for_eval "$flag"
func_append arg " $func_quote_for_eval_result"
func_append compiler_flags " $func_quote_for_eval_result"
done
IFS="$save_ifs"
func_stripname ' ' '' "$arg"
arg=$func_stripname_result
;;
-Wl,*)
func_stripname '-Wl,' '' "$arg"
args=$func_stripname_result
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
func_quote_for_eval "$flag"
func_append arg " $wl$func_quote_for_eval_result"
func_append compiler_flags " $wl$func_quote_for_eval_result"
func_append linker_flags " $func_quote_for_eval_result"
done
IFS="$save_ifs"
func_stripname ' ' '' "$arg"
arg=$func_stripname_result
;;
-Xcompiler)
prev=xcompiler
continue
;;
-Xlinker)
prev=xlinker
continue
;;
-XCClinker)
prev=xcclinker
continue
;;
# -msg_* for osf cc
-msg_*)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
# Flags to be passed through unchanged, with rationale:
# -64, -mips[0-9] enable 64-bit mode for the SGI compiler
# -r[0-9][0-9]* specify processor for the SGI compiler
# -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
# +DA*, +DD* enable 64-bit mode for the HP compiler
# -q* compiler args for the IBM compiler
# -m*, -t[45]*, -txscale* architecture-specific flags for GCC
# -F/path path to uninstalled frameworks, gcc on darwin
# -p, -pg, --coverage, -fprofile-* profiling flags for GCC
# @file GCC response files
# -tp=* Portland pgcc target processor selection
# --sysroot=* for sysroot support
# -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-O*|-flto*|-fwhopr*|-fuse-linker-plugin)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
func_append compile_command " $arg"
func_append finalize_command " $arg"
func_append compiler_flags " $arg"
continue
;;
# Some other compiler flag.
-* | +*)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
*.$objext)
# A standard object.
func_append objs " $arg"
;;
*.lo)
# A libtool-controlled object.
# Check to see that this really is a libtool object.
if func_lalib_unsafe_p "$arg"; then
pic_object=
non_pic_object=
# Read the .lo file
func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
test "$pic_object" = none &&
test "$non_pic_object" = none; then
func_fatal_error "cannot find name of object for \`$arg'"
fi
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
pic_object="$xdir$pic_object"
if test "$prev" = dlfiles; then
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
func_append dlfiles " $pic_object"
prev=
continue
else
# If libtool objects are unsupported, then we need to preload.
prev=dlprefiles
fi
fi
# CHECK ME: I think I busted this. -Ossama
if test "$prev" = dlprefiles; then
# Preload the old-style object.
func_append dlprefiles " $pic_object"
prev=
fi
# A PIC object.
func_append libobjs " $pic_object"
arg="$pic_object"
fi
# Non-PIC object.
if test "$non_pic_object" != none; then
# Prepend the subdirectory the object is found in.
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
else
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
func_append non_pic_objects " $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
if $opt_dry_run; then
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
func_lo2o "$arg"
pic_object=$xdir$objdir/$func_lo2o_result
non_pic_object=$xdir$func_lo2o_result
func_append libobjs " $pic_object"
func_append non_pic_objects " $non_pic_object"
else
func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
;;
*.$libext)
# An archive.
func_append deplibs " $arg"
func_append old_deplibs " $arg"
continue
;;
*.la)
# A libtool-controlled library.
func_resolve_sysroot "$arg"
if test "$prev" = dlfiles; then
# This library was specified with -dlopen.
func_append dlfiles " $func_resolve_sysroot_result"
prev=
elif test "$prev" = dlprefiles; then
# The library was specified with -dlpreopen.
func_append dlprefiles " $func_resolve_sysroot_result"
prev=
else
func_append deplibs " $func_resolve_sysroot_result"
fi
continue
;;
# Some other compiler argument.
*)
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
esac # arg
# Now actually substitute the argument into the commands.
if test -n "$arg"; then
func_append compile_command " $arg"
func_append finalize_command " $arg"
fi
done # argument parsing loop
test -n "$prev" && \
func_fatal_help "the \`$prevarg' option requires an argument"
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
eval arg=\"$export_dynamic_flag_spec\"
func_append compile_command " $arg"
func_append finalize_command " $arg"
fi
oldlibs=
# calculate the name of the file, without its directory
func_basename "$output"
outputname="$func_basename_result"
libobjs_save="$libobjs"
if test -n "$shlibpath_var"; then
# get the directories listed in $shlibpath_var
eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
else
shlib_search_path=
fi
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
func_dirname "$output" "/" ""
output_objdir="$func_dirname_result$objdir"
func_to_tool_file "$output_objdir/"
tool_output_objdir=$func_to_tool_file_result
# Create the object directory.
func_mkdir_p "$output_objdir"
# Determine the type of output
case $output in
"")
func_fatal_help "you must specify an output file"
;;
*.$libext) linkmode=oldlib ;;
*.lo | *.$objext) linkmode=obj ;;
*.la) linkmode=lib ;;
*) linkmode=prog ;; # Anything else should be a program.
esac
specialdeplibs=
libs=
# Find all interdependent deplibs by searching for libraries
# that are linked more than once (e.g. -la -lb -la)
for deplib in $deplibs; do
if $opt_preserve_dup_deps ; then
case "$libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append libs " $deplib"
done
if test "$linkmode" = lib; then
libs="$predeps $libs $compiler_lib_search_path $postdeps"
# Compute libraries that are listed more than once in $predeps
# $postdeps and mark them as special (i.e., whose duplicates are
# not to be eliminated).
pre_post_deps=
if $opt_duplicate_compiler_generated_deps; then
for pre_post_dep in $predeps $postdeps; do
case "$pre_post_deps " in
*" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
esac
func_append pre_post_deps " $pre_post_dep"
done
fi
pre_post_deps=
fi
deplibs=
newdependency_libs=
newlib_search_path=
need_relink=no # whether we're linking any uninstalled libtool libraries
notinst_deplibs= # not-installed libtool libraries
notinst_path= # paths that contain not-installed libtool libraries
case $linkmode in
lib)
passes="conv dlpreopen link"
for file in $dlfiles $dlprefiles; do
case $file in
*.la) ;;
*)
func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
;;
esac
done
;;
prog)
compile_deplibs=
finalize_deplibs=
alldeplibs=no
newdlfiles=
newdlprefiles=
passes="conv scan dlopen dlpreopen link"
;;
*) passes="conv"
;;
esac
for pass in $passes; do
# The preopen pass in lib mode reverses $deplibs; put it back here
# so that -L comes before libs that need it for instance...
if test "$linkmode,$pass" = "lib,link"; then
## FIXME: Find the place where the list is rebuilt in the wrong
## order, and fix it there properly
tmp_deplibs=
for deplib in $deplibs; do
tmp_deplibs="$deplib $tmp_deplibs"
done
deplibs="$tmp_deplibs"
fi
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan"; then
libs="$deplibs"
deplibs=
fi
if test "$linkmode" = prog; then
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
link)
libs="$deplibs %DEPLIBS%"
test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
;;
esac
fi
if test "$linkmode,$pass" = "lib,dlpreopen"; then
# Collect and forward deplibs of preopened libtool libs
for lib in $dlprefiles; do
# Ignore non-libtool-libs
dependency_libs=
func_resolve_sysroot "$lib"
case $lib in
*.la) func_source "$func_resolve_sysroot_result" ;;
esac
# Collect preopened libtool deplibs, except any this library
# has declared as weak libs
for deplib in $dependency_libs; do
func_basename "$deplib"
deplib_base=$func_basename_result
case " $weak_libs " in
*" $deplib_base "*) ;;
*) func_append deplibs " $deplib" ;;
esac
done
done
libs="$dlprefiles"
fi
if test "$pass" = dlopen; then
# Collect dlpreopened libraries
save_deplibs="$deplibs"
deplibs=
fi
for deplib in $libs; do
lib=
found=no
case $deplib in
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
func_append compiler_flags " $deplib"
if test "$linkmode" = lib ; then
case "$new_inherited_linker_flags " in
*" $deplib "*) ;;
* ) func_append new_inherited_linker_flags " $deplib" ;;
esac
fi
fi
continue
;;
-l*)
if test "$linkmode" != lib && test "$linkmode" != prog; then
func_warning "\`-l' is ignored for archives/objects"
continue
fi
func_stripname '-l' '' "$deplib"
name=$func_stripname_result
if test "$linkmode" = lib; then
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
else
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
fi
for searchdir in $searchdirs; do
for search_ext in .la $std_shrext .so .a; do
# Search the libtool library
lib="$searchdir/lib${name}${search_ext}"
if test -f "$lib"; then
if test "$search_ext" = ".la"; then
found=yes
else
found=no
fi
break 2
fi
done
done
if test "$found" != yes; then
# deplib doesn't seem to be a libtool library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
fi
continue
else # deplib is a libtool library
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
# We need to do some special things here, and not later.
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $deplib "*)
if func_lalib_p "$lib"; then
library_names=
old_library=
func_source "$lib"
for l in $old_library $library_names; do
ll="$l"
done
if test "X$ll" = "X$old_library" ; then # only static version available
found=no
func_dirname "$lib" "" "."
ladir="$func_dirname_result"
lib=$ladir/$old_library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
fi
continue
fi
fi
;;
*) ;;
esac
fi
fi
;; # -l
*.ltframework)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
if test "$linkmode" = lib ; then
case "$new_inherited_linker_flags " in
*" $deplib "*) ;;
* ) func_append new_inherited_linker_flags " $deplib" ;;
esac
fi
fi
continue
;;
-L*)
case $linkmode in
lib)
deplibs="$deplib $deplibs"
test "$pass" = conv && continue
newdependency_libs="$deplib $newdependency_libs"
func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
func_append newlib_search_path " $func_resolve_sysroot_result"
;;
prog)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
if test "$pass" = scan; then
deplibs="$deplib $deplibs"
else
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
func_append newlib_search_path " $func_resolve_sysroot_result"
;;
*)
func_warning "\`-L' is ignored for archives/objects"
;;
esac # linkmode
continue
;; # -L
-R*)
if test "$pass" = link; then
func_stripname '-R' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
dir=$func_resolve_sysroot_result
# Make sure the xrpath contains only unique directories.
case "$xrpath " in
*" $dir "*) ;;
*) func_append xrpath " $dir" ;;
esac
fi
deplibs="$deplib $deplibs"
continue
;;
*.la)
func_resolve_sysroot "$deplib"
lib=$func_resolve_sysroot_result
;;
*.$libext)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
case $linkmode in
lib)
# Linking convenience modules into shared libraries is allowed,
# but linking other static libraries is non-portable.
case " $dlpreconveniencelibs " in
*" $deplib "*) ;;
*)
valid_a_lib=no
case $deplibs_check_method in
match_pattern*)
set dummy $deplibs_check_method; shift
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
| $EGREP "$match_pattern_regex" > /dev/null; then
valid_a_lib=yes
fi
;;
pass_all)
valid_a_lib=yes
;;
esac
if test "$valid_a_lib" != yes; then
echo
$ECHO "*** Warning: Trying to link with static lib archive $deplib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because the file extensions .$libext of this argument makes me believe"
echo "*** that it is just a static archive that I should not use here."
else
echo
$ECHO "*** Warning: Linking the shared library $output against the"
$ECHO "*** static library $deplib is not portable!"
deplibs="$deplib $deplibs"
fi
;;
esac
continue
;;
prog)
if test "$pass" != link; then
deplibs="$deplib $deplibs"
else
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
continue
;;
esac # linkmode
;; # *.$libext
*.lo | *.$objext)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
elif test "$linkmode" = prog; then
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
# If there is no dlopen support or we're linking statically,
# we need to preload.
func_append newdlprefiles " $deplib"
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
func_append newdlfiles " $deplib"
fi
fi
continue
;;
%DEPLIBS%)
alldeplibs=yes
continue
;;
esac # case $deplib
if test "$found" = yes || test -f "$lib"; then :
else
func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
fi
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$lib" \
|| func_fatal_error "\`$lib' is not a valid libtool archive"
func_dirname "$lib" "" "."
ladir="$func_dirname_result"
dlname=
dlopen=
dlpreopen=
libdir=
library_names=
old_library=
inherited_linker_flags=
# If the library was installed with an old release of libtool,
# it will not redefine variables installed, or shouldnotlink
installed=yes
shouldnotlink=no
avoidtemprpath=
# Read the .la file
func_source "$lib"
# Convert "-framework foo" to "foo.ltframework"
if test -n "$inherited_linker_flags"; then
tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
case " $new_inherited_linker_flags " in
*" $tmp_inherited_linker_flag "*) ;;
*) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
esac
done
fi
dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan" ||
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
test -n "$dlopen" && func_append dlfiles " $dlopen"
test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
fi
if test "$pass" = conv; then
# Only check for convenience libraries
deplibs="$lib $deplibs"
if test -z "$libdir"; then
if test -z "$old_library"; then
func_fatal_error "cannot find name of link library for \`$lib'"
fi
# It is a libtool convenience library, so add in its objects.
func_append convenience " $ladir/$objdir/$old_library"
func_append old_convenience " $ladir/$objdir/$old_library"
tmp_libs=
for deplib in $dependency_libs; do
deplibs="$deplib $deplibs"
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append tmp_libs " $deplib"
done
elif test "$linkmode" != prog && test "$linkmode" != lib; then
func_fatal_error "\`$lib' is not a convenience library"
fi
continue
fi # $pass = conv
# Get the name of the library we link against.
linklib=
if test -n "$old_library" &&
{ test "$prefer_static_libs" = yes ||
test "$prefer_static_libs,$installed" = "built,no"; }; then
linklib=$old_library
else
for l in $old_library $library_names; do
linklib="$l"
done
fi
if test -z "$linklib"; then
func_fatal_error "cannot find name of link library for \`$lib'"
fi
# This library was specified with -dlopen.
if test "$pass" = dlopen; then
if test -z "$libdir"; then
func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
fi
if test -z "$dlname" ||
test "$dlopen_support" != yes ||
test "$build_libtool_libs" = no; then
# If there is no dlname, no dlopen support or we're linking
# statically, we need to preload. We also need to preload any
# dependent libraries so libltdl's deplib preloader doesn't
# bomb out in the load deplibs phase.
func_append dlprefiles " $lib $dependency_libs"
else
func_append newdlfiles " $lib"
fi
continue
fi # $pass = dlopen
# We need an absolute path.
case $ladir in
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
*)
abs_ladir=`cd "$ladir" && pwd`
if test -z "$abs_ladir"; then
func_warning "cannot determine absolute directory name of \`$ladir'"
func_warning "passing it literally to the linker, although it might fail"
abs_ladir="$ladir"
fi
;;
esac
func_basename "$lib"
laname="$func_basename_result"
# Find the relevant object directory and library name.
if test "X$installed" = Xyes; then
if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
func_warning "library \`$lib' was moved."
dir="$ladir"
absdir="$abs_ladir"
libdir="$abs_ladir"
else
dir="$lt_sysroot$libdir"
absdir="$lt_sysroot$libdir"
fi
test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
else
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
dir="$ladir"
absdir="$abs_ladir"
# Remove this search path later
func_append notinst_path " $abs_ladir"
else
dir="$ladir/$objdir"
absdir="$abs_ladir/$objdir"
# Remove this search path later
func_append notinst_path " $abs_ladir"
fi
fi # $installed = yes
func_stripname 'lib' '.la' "$laname"
name=$func_stripname_result
# This library was specified with -dlpreopen.
if test "$pass" = dlpreopen; then
if test -z "$libdir" && test "$linkmode" = prog; then
func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
fi
case "$host" in
# special handling for platforms with PE-DLLs.
*cygwin* | *mingw* | *cegcc* )
# Linker will automatically link against shared library if both
# static and shared are present. Therefore, ensure we extract
# symbols from the import library if a shared library is present
# (otherwise, the dlopen module name will be incorrect). We do
# this by putting the import library name into $newdlprefiles.
# We recover the dlopen module name by 'saving' the la file
# name in a special purpose variable, and (later) extracting the
# dlname from the la file.
if test -n "$dlname"; then
func_tr_sh "$dir/$linklib"
eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
func_append newdlprefiles " $dir/$linklib"
else
func_append newdlprefiles " $dir/$old_library"
# Keep a list of preopened convenience libraries to check
# that they are being used correctly in the link pass.
test -z "$libdir" && \
func_append dlpreconveniencelibs " $dir/$old_library"
fi
;;
* )
# Prefer using a static library (so that no silly _DYNAMIC symbols
# are required to link).
if test -n "$old_library"; then
func_append newdlprefiles " $dir/$old_library"
# Keep a list of preopened convenience libraries to check
# that they are being used correctly in the link pass.
test -z "$libdir" && \
func_append dlpreconveniencelibs " $dir/$old_library"
# Otherwise, use the dlname, so that lt_dlopen finds it.
elif test -n "$dlname"; then
func_append newdlprefiles " $dir/$dlname"
else
func_append newdlprefiles " $dir/$linklib"
fi
;;
esac
fi # $pass = dlpreopen
if test -z "$libdir"; then
# Link the convenience library
if test "$linkmode" = lib; then
deplibs="$dir/$old_library $deplibs"
elif test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$dir/$old_library $compile_deplibs"
finalize_deplibs="$dir/$old_library $finalize_deplibs"
else
deplibs="$lib $deplibs" # used for prog,scan pass
fi
continue
fi
if test "$linkmode" = prog && test "$pass" != link; then
func_append newlib_search_path " $ladir"
deplibs="$lib $deplibs"
linkalldeplibs=no
if test "$link_all_deplibs" != no || test -z "$library_names" ||
test "$build_libtool_libs" = no; then
linkalldeplibs=yes
fi
tmp_libs=
for deplib in $dependency_libs; do
case $deplib in
-L*) func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result"
func_append newlib_search_path " $func_resolve_sysroot_result"
;;
esac
# Need to link against all dependency_libs?
if test "$linkalldeplibs" = yes; then
deplibs="$deplib $deplibs"
else
# Need to hardcode shared library paths
# or/and link against static libraries
newdependency_libs="$deplib $newdependency_libs"
fi
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append tmp_libs " $deplib"
done # for deplib
continue
fi # $linkmode = prog...
if test "$linkmode,$pass" = "prog,link"; then
if test -n "$library_names" &&
{ { test "$prefer_static_libs" = no ||
test "$prefer_static_libs,$installed" = "built,yes"; } ||
test -z "$old_library"; }; then
# We need to hardcode the library path
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
# Make sure the rpath contains only unique directories.
case "$temp_rpath:" in
*"$absdir:"*) ;;
*) func_append temp_rpath "$absdir:" ;;
esac
fi
# Hardcode the library path.
# Skip directories that are in the system default run-time
# search path.
case " $sys_lib_dlsearch_path " in
*" $absdir "*) ;;
*)
case "$compile_rpath " in
*" $absdir "*) ;;
*) func_append compile_rpath " $absdir" ;;
esac
;;
esac
case " $sys_lib_dlsearch_path " in
*" $libdir "*) ;;
*)
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
;;
esac
fi # $linkmode,$pass = prog,link...
if test "$alldeplibs" = yes &&
{ test "$deplibs_check_method" = pass_all ||
{ test "$build_libtool_libs" = yes &&
test -n "$library_names"; }; }; then
# We only need to search for static libraries
continue
fi
fi
link_static=no # Whether the deplib will be linked statically
use_static_libs=$prefer_static_libs
if test "$use_static_libs" = built && test "$installed" = yes; then
use_static_libs=no
fi
if test -n "$library_names" &&
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
case $host in
*cygwin* | *mingw* | *cegcc*)
# No point in relinking DLLs because paths are not encoded
func_append notinst_deplibs " $lib"
need_relink=no
;;
*)
if test "$installed" = no; then
func_append notinst_deplibs " $lib"
need_relink=yes
fi
;;
esac
# This is a shared library
# Warn about portability, can't link against -module's on some
# systems (darwin). Don't bleat about dlopened modules though!
dlopenmodule=""
for dlpremoduletest in $dlprefiles; do
if test "X$dlpremoduletest" = "X$lib"; then
dlopenmodule="$dlpremoduletest"
break
fi
done
if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
echo
if test "$linkmode" = prog; then
$ECHO "*** Warning: Linking the executable $output against the loadable module"
else
$ECHO "*** Warning: Linking the shared library $output against the loadable module"
fi
$ECHO "*** $linklib is not portable!"
fi
if test "$linkmode" = lib &&
test "$hardcode_into_libs" = yes; then
# Hardcode the library path.
# Skip directories that are in the system default run-time
# search path.
case " $sys_lib_dlsearch_path " in
*" $absdir "*) ;;
*)
case "$compile_rpath " in
*" $absdir "*) ;;
*) func_append compile_rpath " $absdir" ;;
esac
;;
esac
case " $sys_lib_dlsearch_path " in
*" $libdir "*) ;;
*)
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
;;
esac
fi
if test -n "$old_archive_from_expsyms_cmds"; then
# figure out the soname
set dummy $library_names
shift
realname="$1"
shift
libname=`eval "\\$ECHO \"$libname_spec\""`
# use dlname if we got it. it's perfectly good, no?
if test -n "$dlname"; then
soname="$dlname"
elif test -n "$soname_spec"; then
# bleh windows
case $host in
*cygwin* | mingw* | *cegcc*)
func_arith $current - $age
major=$func_arith_result
versuffix="-$major"
;;
esac
eval soname=\"$soname_spec\"
else
soname="$realname"
fi
# Make a new name for the extract_expsyms_cmds to use
soroot="$soname"
func_basename "$soroot"
soname="$func_basename_result"
func_stripname 'lib' '.dll' "$soname"
newlib=libimp-$func_stripname_result.a
# If the library has no export list, then create one now
if test -f "$output_objdir/$soname-def"; then :
else
func_verbose "extracting exported symbol list from \`$soname'"
func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
fi
# Create $newlib
if test -f "$output_objdir/$newlib"; then :; else
func_verbose "generating import library for \`$soname'"
func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
fi
# make sure the library variables are pointing to the new library
dir=$output_objdir
linklib=$newlib
fi # test -n "$old_archive_from_expsyms_cmds"
if test "$linkmode" = prog || test "$opt_mode" != relink; then
add_shlibpath=
add_dir=
add=
lib_linked=yes
case $hardcode_action in
immediate | unsupported)
if test "$hardcode_direct" = no; then
add="$dir/$linklib"
case $host in
*-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
*-*-sysv4*uw2*) add_dir="-L$dir" ;;
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
*-*-unixware7*) add_dir="-L$dir" ;;
*-*-darwin* )
# if the lib is a (non-dlopened) module then we can not
# link against it, someone is ignoring the earlier warnings
if /usr/bin/file -L $add 2> /dev/null |
$GREP ": [^:]* bundle" >/dev/null ; then
if test "X$dlopenmodule" != "X$lib"; then
$ECHO "*** Warning: lib $linklib is a module, not a shared library"
if test -z "$old_library" ; then
echo
echo "*** And there doesn't seem to be a static archive available"
echo "*** The link will probably fail, sorry"
else
add="$dir/$old_library"
fi
elif test -n "$old_library"; then
add="$dir/$old_library"
fi
fi
esac
elif test "$hardcode_minus_L" = no; then
case $host in
*-*-sunos*) add_shlibpath="$dir" ;;
esac
add_dir="-L$dir"
add="-l$name"
elif test "$hardcode_shlibpath_var" = no; then
add_shlibpath="$dir"
add="-l$name"
else
lib_linked=no
fi
;;
relink)
if test "$hardcode_direct" = yes &&
test "$hardcode_direct_absolute" = no; then
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$absdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
func_append add_dir " -L$inst_prefix_dir$libdir"
;;
esac
fi
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
add_shlibpath="$dir"
add="-l$name"
else
lib_linked=no
fi
;;
*) lib_linked=no ;;
esac
if test "$lib_linked" != yes; then
func_fatal_configuration "unsupported hardcode properties"
fi
if test -n "$add_shlibpath"; then
case :$compile_shlibpath: in
*":$add_shlibpath:"*) ;;
*) func_append compile_shlibpath "$add_shlibpath:" ;;
esac
fi
if test "$linkmode" = prog; then
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
test -n "$add" && compile_deplibs="$add $compile_deplibs"
else
test -n "$add_dir" && deplibs="$add_dir $deplibs"
test -n "$add" && deplibs="$add $deplibs"
if test "$hardcode_direct" != yes &&
test "$hardcode_minus_L" != yes &&
test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
*) func_append finalize_shlibpath "$libdir:" ;;
esac
fi
fi
fi
if test "$linkmode" = prog || test "$opt_mode" = relink; then
add_shlibpath=
add_dir=
add=
# Finalize command for both is simple: just hardcode it.
if test "$hardcode_direct" = yes &&
test "$hardcode_direct_absolute" = no; then
add="$libdir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$libdir"
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
*) func_append finalize_shlibpath "$libdir:" ;;
esac
add="-l$name"
elif test "$hardcode_automatic" = yes; then
if test -n "$inst_prefix_dir" &&
test -f "$inst_prefix_dir$libdir/$linklib" ; then
add="$inst_prefix_dir$libdir/$linklib"
else
add="$libdir/$linklib"
fi
else
# We cannot seem to hardcode it, guess we'll fake it.
add_dir="-L$libdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
func_append add_dir " -L$inst_prefix_dir$libdir"
;;
esac
fi
add="-l$name"
fi
if test "$linkmode" = prog; then
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
else
test -n "$add_dir" && deplibs="$add_dir $deplibs"
test -n "$add" && deplibs="$add $deplibs"
fi
fi
elif test "$linkmode" = prog; then
# Here we assume that one of hardcode_direct or hardcode_minus_L
# is not unsupported. This is valid on all known static and
# shared platforms.
if test "$hardcode_direct" != unsupported; then
test -n "$old_library" && linklib="$old_library"
compile_deplibs="$dir/$linklib $compile_deplibs"
finalize_deplibs="$dir/$linklib $finalize_deplibs"
else
compile_deplibs="-l$name -L$dir $compile_deplibs"
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
fi
elif test "$build_libtool_libs" = yes; then
# Not a shared library
if test "$deplibs_check_method" != pass_all; then
# We're trying link a shared library against a static one
# but the system doesn't support it.
# Just print a warning and add the library to dependency_libs so
# that the program can be linked against the static library.
echo
$ECHO "*** Warning: This system can not link to static lib archive $lib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have."
if test "$module" = yes; then
echo "*** But as you try to build a module library, libtool will still create "
echo "*** a static module, that should work as long as the dlopening application"
echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
if test -z "$global_symbol_pipe"; then
echo
echo "*** However, this would only work if libtool was able to extract symbol"
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
echo "*** not find such a program. So, this module is probably useless."
echo "*** \`nm' from GNU binutils and a full rebuild may help."
fi
if test "$build_old_libs" = no; then
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
fi
else
deplibs="$dir/$old_library $deplibs"
link_static=yes
fi
fi # link shared/static library?
if test "$linkmode" = lib; then
if test -n "$dependency_libs" &&
{ test "$hardcode_into_libs" != yes ||
test "$build_old_libs" = yes ||
test "$link_static" = yes; }; then
# Extract -R from dependency_libs
temp_deplibs=
for libdir in $dependency_libs; do
case $libdir in
-R*) func_stripname '-R' '' "$libdir"
temp_xrpath=$func_stripname_result
case " $xrpath " in
*" $temp_xrpath "*) ;;
*) func_append xrpath " $temp_xrpath";;
esac;;
*) func_append temp_deplibs " $libdir";;
esac
done
dependency_libs="$temp_deplibs"
fi
func_append newlib_search_path " $absdir"
# Link against this library
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
# ... and its dependency_libs
tmp_libs=
for deplib in $dependency_libs; do
newdependency_libs="$deplib $newdependency_libs"
case $deplib in
-L*) func_stripname '-L' '' "$deplib"
func_resolve_sysroot "$func_stripname_result";;
*) func_resolve_sysroot "$deplib" ;;
esac
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $func_resolve_sysroot_result "*)
func_append specialdeplibs " $func_resolve_sysroot_result" ;;
esac
fi
func_append tmp_libs " $func_resolve_sysroot_result"
done
if test "$link_all_deplibs" != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
path=
case $deplib in
-L*) path="$deplib" ;;
*.la)
func_resolve_sysroot "$deplib"
deplib=$func_resolve_sysroot_result
func_dirname "$deplib" "" "."
dir=$func_dirname_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
*)
absdir=`cd "$dir" && pwd`
if test -z "$absdir"; then
func_warning "cannot determine absolute directory name of \`$dir'"
absdir="$dir"
fi
;;
esac
if $GREP "^installed=no" $deplib > /dev/null; then
case $host in
*-*-darwin*)
depdepl=
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
if test -n "$deplibrary_names" ; then
for tmp in $deplibrary_names ; do
depdepl=$tmp
done
if test -f "$absdir/$objdir/$depdepl" ; then
depdepl="$absdir/$objdir/$depdepl"
darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
if test -z "$darwin_install_name"; then
darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
fi
func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
path=
fi
fi
;;
*)
path="-L$absdir/$objdir"
;;
esac
else
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
test -z "$libdir" && \
func_fatal_error "\`$deplib' is not a valid libtool archive"
test "$absdir" != "$libdir" && \
func_warning "\`$deplib' seems to be moved"
path="-L$absdir"
fi
;;
esac
case " $deplibs " in
*" $path "*) ;;
*) deplibs="$path $deplibs" ;;
esac
done
fi # link_all_deplibs != no
fi # linkmode = lib
done # for deplib in $libs
if test "$pass" = link; then
if test "$linkmode" = "prog"; then
compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
else
compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
fi
fi
dependency_libs="$newdependency_libs"
if test "$pass" = dlpreopen; then
# Link the dlpreopened libraries before other libraries
for deplib in $save_deplibs; do
deplibs="$deplib $deplibs"
done
fi
if test "$pass" != dlopen; then
if test "$pass" != conv; then
# Make sure lib_search_path contains only unique directories.
lib_search_path=
for dir in $newlib_search_path; do
case "$lib_search_path " in
*" $dir "*) ;;
*) func_append lib_search_path " $dir" ;;
esac
done
newlib_search_path=
fi
if test "$linkmode,$pass" != "prog,link"; then
vars="deplibs"
else
vars="compile_deplibs finalize_deplibs"
fi
for var in $vars dependency_libs; do
# Add libraries to $var in reverse order
eval tmp_libs=\"\$$var\"
new_libs=
for deplib in $tmp_libs; do
# FIXME: Pedantically, this is the right thing to do, so
# that some nasty dependency loop isn't accidentally
# broken:
#new_libs="$deplib $new_libs"
# Pragmatically, this seems to cause very few problems in
# practice:
case $deplib in
-L*) new_libs="$deplib $new_libs" ;;
-R*) ;;
*)
# And here is the reason: when a library appears more
# than once as an explicit dependence of a library, or
# is implicitly linked in more than once by the
# compiler, it is considered special, and multiple
# occurrences thereof are not removed. Compare this
# with having the same library being listed as a
# dependency of multiple other libraries: in this case,
# we know (pedantically, we assume) the library does not
# need to be listed more than once, so we keep only the
# last copy. This is not always right, but it is rare
# enough that we require users that really mean to play
# such unportable linking tricks to link the library
# using -Wl,-lname, so that libtool does not consider it
# for duplicate removal.
case " $specialdeplibs " in
*" $deplib "*) new_libs="$deplib $new_libs" ;;
*)
case " $new_libs " in
*" $deplib "*) ;;
*) new_libs="$deplib $new_libs" ;;
esac
;;
esac
;;
esac
done
tmp_libs=
for deplib in $new_libs; do
case $deplib in
-L*)
case " $tmp_libs " in
*" $deplib "*) ;;
*) func_append tmp_libs " $deplib" ;;
esac
;;
*) func_append tmp_libs " $deplib" ;;
esac
done
eval $var=\"$tmp_libs\"
done # for var
fi
# Last step: remove runtime libs from dependency_libs
# (they stay in deplibs)
tmp_libs=
for i in $dependency_libs ; do
case " $predeps $postdeps $compiler_lib_search_path " in
*" $i "*)
i=""
;;
esac
if test -n "$i" ; then
func_append tmp_libs " $i"
fi
done
dependency_libs=$tmp_libs
done # for pass
if test "$linkmode" = prog; then
dlfiles="$newdlfiles"
fi
if test "$linkmode" = prog || test "$linkmode" = lib; then
dlprefiles="$newdlprefiles"
fi
case $linkmode in
oldlib)
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
func_warning "\`-dlopen' is ignored for archives"
fi
case " $deplibs" in
*\ -l* | *\ -L*)
func_warning "\`-l' and \`-L' are ignored for archives" ;;
esac
test -n "$rpath" && \
func_warning "\`-rpath' is ignored for archives"
test -n "$xrpath" && \
func_warning "\`-R' is ignored for archives"
test -n "$vinfo" && \
func_warning "\`-version-info/-version-number' is ignored for archives"
test -n "$release" && \
func_warning "\`-release' is ignored for archives"
test -n "$export_symbols$export_symbols_regex" && \
func_warning "\`-export-symbols' is ignored for archives"
# Now set the variables for building old libraries.
build_libtool_libs=no
oldlibs="$output"
func_append objs "$old_deplibs"
;;
lib)
# Make sure we only generate libraries of the form `libNAME.la'.
case $outputname in
lib*)
func_stripname 'lib' '.la' "$outputname"
name=$func_stripname_result
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
;;
*)
test "$module" = no && \
func_fatal_help "libtool library \`$output' must begin with \`lib'"
if test "$need_lib_prefix" != no; then
# Add the "lib" prefix for modules if required
func_stripname '' '.la' "$outputname"
name=$func_stripname_result
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
else
func_stripname '' '.la' "$outputname"
libname=$func_stripname_result
fi
;;
esac
if test -n "$objs"; then
if test "$deplibs_check_method" != pass_all; then
func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
else
echo
$ECHO "*** Warning: Linking the shared library $output against the non-libtool"
$ECHO "*** objects $objs is not portable!"
func_append libobjs " $objs"
fi
fi
test "$dlself" != no && \
func_warning "\`-dlopen self' is ignored for libtool libraries"
set dummy $rpath
shift
test "$#" -gt 1 && \
func_warning "ignoring multiple \`-rpath's for a libtool library"
install_libdir="$1"
oldlibs=
if test -z "$rpath"; then
if test "$build_libtool_libs" = yes; then
# Building a libtool convenience library.
# Some compilers have problems with a `.al' extension so
# convenience libraries should have the same extension an
# archive normally would.
oldlibs="$output_objdir/$libname.$libext $oldlibs"
build_libtool_libs=convenience
build_old_libs=yes
fi
test -n "$vinfo" && \
func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
test -n "$release" && \
func_warning "\`-release' is ignored for convenience libraries"
else
# Parse the version information argument.
save_ifs="$IFS"; IFS=':'
set dummy $vinfo 0 0 0
shift
IFS="$save_ifs"
test -n "$7" && \
func_fatal_help "too many parameters to \`-version-info'"
# convert absolute version numbers to libtool ages
# this retains compatibility with .la files and attempts
# to make the code below a bit more comprehensible
case $vinfo_number in
yes)
number_major="$1"
number_minor="$2"
number_revision="$3"
#
# There are really only two kinds -- those that
# use the current revision as the major version
# and those that subtract age and use age as
# a minor version. But, then there is irix
# which has an extra 1 added just for fun
#
case $version_type in
# correct linux to gnu/linux during the next big refactor
darwin|linux|osf|windows|none)
func_arith $number_major + $number_minor
current=$func_arith_result
age="$number_minor"
revision="$number_revision"
;;
freebsd-aout|freebsd-elf|qnx|sunos)
current="$number_major"
revision="$number_minor"
age="0"
;;
irix|nonstopux)
func_arith $number_major + $number_minor
current=$func_arith_result
age="$number_minor"
revision="$number_minor"
lt_irix_increment=no
;;
*)
func_fatal_configuration "$modename: unknown library version type \`$version_type'"
;;
esac
;;
no)
current="$1"
revision="$2"
age="$3"
;;
esac
# Check that each of the things are valid numbers.
case $current in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "CURRENT \`$current' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
case $revision in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "REVISION \`$revision' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
case $age in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "AGE \`$age' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
if test "$age" -gt "$current"; then
func_error "AGE \`$age' is greater than the current interface number \`$current'"
func_fatal_error "\`$vinfo' is not valid version information"
fi
# Calculate the version variables.
major=
versuffix=
verstring=
case $version_type in
none) ;;
darwin)
# Like Linux, but with the current version available in
# verstring for coding it into the library header
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
func_arith $current + 1
minor_current=$func_arith_result
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
;;
freebsd-aout)
major=".$current"
versuffix=".$current.$revision";
;;
freebsd-elf)
major=".$current"
versuffix=".$current"
;;
irix | nonstopux)
if test "X$lt_irix_increment" = "Xno"; then
func_arith $current - $age
else
func_arith $current - $age + 1
fi
major=$func_arith_result
case $version_type in
nonstopux) verstring_prefix=nonstopux ;;
*) verstring_prefix=sgi ;;
esac
verstring="$verstring_prefix$major.$revision"
# Add in all the interfaces that we are compatible with.
loop=$revision
while test "$loop" -ne 0; do
func_arith $revision - $loop
iface=$func_arith_result
func_arith $loop - 1
loop=$func_arith_result
verstring="$verstring_prefix$major.$iface:$verstring"
done
# Before this point, $major must not contain `.'.
major=.$major
versuffix="$major.$revision"
;;
linux) # correct to gnu/linux during the next big refactor
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
;;
osf)
func_arith $current - $age
major=.$func_arith_result
versuffix=".$current.$age.$revision"
verstring="$current.$age.$revision"
# Add in all the interfaces that we are compatible with.
loop=$age
while test "$loop" -ne 0; do
func_arith $current - $loop
iface=$func_arith_result
func_arith $loop - 1
loop=$func_arith_result
verstring="$verstring:${iface}.0"
done
# Make executables depend on our current version.
func_append verstring ":${current}.0"
;;
qnx)
major=".$current"
versuffix=".$current"
;;
sunos)
major=".$current"
versuffix=".$current.$revision"
;;
windows)
# Use '-' rather than '.', since we only want one
# extension on DOS 8.3 filesystems.
func_arith $current - $age
major=$func_arith_result
versuffix="-$major"
;;
*)
func_fatal_configuration "unknown library version type \`$version_type'"
;;
esac
# Clear the version info if we defaulted, and they specified a release.
if test -z "$vinfo" && test -n "$release"; then
major=
case $version_type in
darwin)
# we can't check for "0.0" in archive_cmds due to quoting
# problems, so we reset it completely
verstring=
;;
*)
verstring="0.0"
;;
esac
if test "$need_version" = no; then
versuffix=
else
versuffix=".0.0"
fi
fi
# Remove version info from name if versioning should be avoided
if test "$avoid_version" = yes && test "$need_version" = no; then
major=
versuffix=
verstring=""
fi
# Check to see if the archive will have undefined symbols.
if test "$allow_undefined" = yes; then
if test "$allow_undefined_flag" = unsupported; then
func_warning "undefined symbols not allowed in $host shared libraries"
build_libtool_libs=no
build_old_libs=yes
fi
else
# Don't allow undefined symbols.
allow_undefined_flag="$no_undefined_flag"
fi
fi
func_generate_dlsyms "$libname" "$libname" "yes"
func_append libobjs " $symfileobj"
test "X$libobjs" = "X " && libobjs=
if test "$opt_mode" != relink; then
# Remove our outputs, but don't remove object files since they
# may have been created when compiling PIC objects.
removelist=
tempremovelist=`$ECHO "$output_objdir/*"`
for p in $tempremovelist; do
case $p in
*.$objext | *.gcno)
;;
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
if test "X$precious_files_regex" != "X"; then
if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
then
continue
fi
fi
func_append removelist " $p"
;;
*) ;;
esac
done
test -n "$removelist" && \
func_show_eval "${RM}r \$removelist"
fi
# Now set the variables for building old libraries.
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
func_append oldlibs " $output_objdir/$libname.$libext"
# Transform .lo files to .o files.
oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
fi
# Eliminate all temporary directories.
#for path in $notinst_path; do
# lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
# deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
# dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
#done
if test -n "$xrpath"; then
# If the user specified any rpath flags, then add them.
temp_xrpath=
for libdir in $xrpath; do
func_replace_sysroot "$libdir"
func_append temp_xrpath " -R$func_replace_sysroot_result"
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
done
if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
dependency_libs="$temp_xrpath $dependency_libs"
fi
fi
# Make sure dlfiles contains only unique files that won't be dlpreopened
old_dlfiles="$dlfiles"
dlfiles=
for lib in $old_dlfiles; do
case " $dlprefiles $dlfiles " in
*" $lib "*) ;;
*) func_append dlfiles " $lib" ;;
esac
done
# Make sure dlprefiles contains only unique files
old_dlprefiles="$dlprefiles"
dlprefiles=
for lib in $old_dlprefiles; do
case "$dlprefiles " in
*" $lib "*) ;;
*) func_append dlprefiles " $lib" ;;
esac
done
if test "$build_libtool_libs" = yes; then
if test -n "$rpath"; then
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
# these systems don't actually have a c library (as such)!
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C library is in the System framework
func_append deplibs " System.ltframework"
;;
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
;;
*)
# Add libc to deplibs on all other systems if necessary.
if test "$build_libtool_need_lc" = "yes"; then
func_append deplibs " -lc"
fi
;;
esac
fi
# Transform deplibs into only deplibs that can be linked in shared.
name_save=$name
libname_save=$libname
release_save=$release
versuffix_save=$versuffix
major_save=$major
# I'm not sure if I'm treating the release correctly. I think
# release should show up in the -l (ie -lgmp5) so we don't want to
# add it in twice. Is that correct?
release=""
versuffix=""
major=""
newdeplibs=
droppeddeps=no
case $deplibs_check_method in
pass_all)
# Don't check for shared/static. Everything works.
# This might be a little naive. We might want to check
# whether the library exists or not. But this is on
# osf3 & osf4 and I'm not really sure... Just
# implementing what was already the behavior.
newdeplibs=$deplibs
;;
test_compile)
# This code stresses the "libraries are programs" paradigm to its
# limits. Maybe even breaks it. We compile a program, linking it
# against the deplibs as a proxy for the library. Then we can check
# whether they linked in statically or dynamically with ldd.
$opt_dry_run || $RM conftest.c
cat > conftest.c <<EOF
int main() { return 0; }
EOF
$opt_dry_run || $RM conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
ldd_output=`ldd conftest`
for i in $deplibs; do
case $i in
-l*)
func_stripname -l '' "$i"
name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
func_append newdeplibs " $i"
i=""
;;
esac
fi
if test -n "$i" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
set dummy $deplib_matches; shift
deplib_match=$1
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
func_append newdeplibs " $i"
else
droppeddeps=yes
echo
$ECHO "*** Warning: dynamic linker does not accept needed library $i."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which I believe you do not have"
echo "*** because a test_compile did reveal that the linker did not use it for"
echo "*** its dynamic dependency list that programs get resolved with at runtime."
fi
fi
;;
*)
func_append newdeplibs " $i"
;;
esac
done
else
# Error occurred in the first compile. Let's try to salvage
# the situation: Compile a separate program for each library.
for i in $deplibs; do
case $i in
-l*)
func_stripname -l '' "$i"
name=$func_stripname_result
$opt_dry_run || $RM conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
ldd_output=`ldd conftest`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
func_append newdeplibs " $i"
i=""
;;
esac
fi
if test -n "$i" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
set dummy $deplib_matches; shift
deplib_match=$1
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
func_append newdeplibs " $i"
else
droppeddeps=yes
echo
$ECHO "*** Warning: dynamic linker does not accept needed library $i."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because a test_compile did reveal that the linker did not use this one"
echo "*** as a dynamic dependency that programs can get resolved with at runtime."
fi
fi
else
droppeddeps=yes
echo
$ECHO "*** Warning! Library $i is needed by this library but I was not able to"
echo "*** make it link in! You will probably need to install it or some"
echo "*** library that it depends on before this library will be fully"
echo "*** functional. Installing it before continuing would be even better."
fi
;;
*)
func_append newdeplibs " $i"
;;
esac
done
fi
;;
file_magic*)
set dummy $deplibs_check_method; shift
file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
for a_deplib in $deplibs; do
case $a_deplib in
-l*)
func_stripname -l '' "$a_deplib"
name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
func_append newdeplibs " $a_deplib"
a_deplib=""
;;
esac
fi
if test -n "$a_deplib" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
if test -n "$file_magic_glob"; then
libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
else
libnameglob=$libname
fi
test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
if test "$want_nocaseglob" = yes; then
shopt -s nocaseglob
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
$nocaseglob
else
potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
fi
for potent_lib in $potential_libs; do
# Follow soft links.
if ls -lLd "$potent_lib" 2>/dev/null |
$GREP " -> " >/dev/null; then
continue
fi
# The statement above tries to avoid entering an
# endless loop below, in case of cyclic links.
# We might still enter an endless loop, since a link
# loop can be closed while we follow links,
# but so what?
potlib="$potent_lib"
while test -h "$potlib" 2>/dev/null; do
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
case $potliblink in
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
esac
done
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
$SED -e 10q |
$EGREP "$file_magic_regex" > /dev/null; then
func_append newdeplibs " $a_deplib"
a_deplib=""
break 2
fi
done
done
fi
if test -n "$a_deplib" ; then
droppeddeps=yes
echo
$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because I did check the linker path looking for a file starting"
if test -z "$potlib" ; then
$ECHO "*** with $libname but no candidates were found. (...for file magic test)"
else
$ECHO "*** with $libname and none of the candidates passed a file format test"
$ECHO "*** using a file magic. Last file checked: $potlib"
fi
fi
;;
*)
# Add a -L argument.
func_append newdeplibs " $a_deplib"
;;
esac
done # Gone through all deplibs.
;;
match_pattern*)
set dummy $deplibs_check_method; shift
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
for a_deplib in $deplibs; do
case $a_deplib in
-l*)
func_stripname -l '' "$a_deplib"
name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
func_append newdeplibs " $a_deplib"
a_deplib=""
;;
esac
fi
if test -n "$a_deplib" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
for potent_lib in $potential_libs; do
potlib="$potent_lib" # see symlink-check above in file_magic test
if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
$EGREP "$match_pattern_regex" > /dev/null; then
func_append newdeplibs " $a_deplib"
a_deplib=""
break 2
fi
done
done
fi
if test -n "$a_deplib" ; then
droppeddeps=yes
echo
$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
echo "*** I have the capability to make that library automatically link in when"
echo "*** you link to this library. But I can only do this if you have a"
echo "*** shared version of the library, which you do not appear to have"
echo "*** because I did check the linker path looking for a file starting"
if test -z "$potlib" ; then
$ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
else
$ECHO "*** with $libname and none of the candidates passed a file format test"
$ECHO "*** using a regex pattern. Last file checked: $potlib"
fi
fi
;;
*)
# Add a -L argument.
func_append newdeplibs " $a_deplib"
;;
esac
done # Gone through all deplibs.
;;
none | unknown | *)
newdeplibs=""
tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
for i in $predeps $postdeps ; do
# can't use Xsed below, because $i might contain '/'
tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
done
fi
case $tmp_deplibs in
*[!\ \ ]*)
echo
if test "X$deplibs_check_method" = "Xnone"; then
echo "*** Warning: inter-library dependencies are not supported in this platform."
else
echo "*** Warning: inter-library dependencies are not known to be supported."
fi
echo "*** All declared inter-library dependencies are being dropped."
droppeddeps=yes
;;
esac
;;
esac
versuffix=$versuffix_save
major=$major_save
release=$release_save
libname=$libname_save
name=$name_save
case $host in
*-*-rhapsody* | *-*-darwin1.[012])
# On Rhapsody replace the C library with the System framework
newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
;;
esac
if test "$droppeddeps" = yes; then
if test "$module" = yes; then
echo
echo "*** Warning: libtool could not satisfy all declared inter-library"
$ECHO "*** dependencies of module $libname. Therefore, libtool will create"
echo "*** a static module, that should work as long as the dlopening"
echo "*** application is linked with the -dlopen flag."
if test -z "$global_symbol_pipe"; then
echo
echo "*** However, this would only work if libtool was able to extract symbol"
echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
echo "*** not find such a program. So, this module is probably useless."
echo "*** \`nm' from GNU binutils and a full rebuild may help."
fi
if test "$build_old_libs" = no; then
oldlibs="$output_objdir/$libname.$libext"
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
else
echo "*** The inter-library dependencies that have been dropped here will be"
echo "*** automatically added whenever a program is linked with this library"
echo "*** or is declared to -dlopen it."
if test "$allow_undefined" = no; then
echo
echo "*** Since this library must not contain undefined symbols,"
echo "*** because either the platform does not support them or"
echo "*** it was explicitly requested with -no-undefined,"
echo "*** libtool will only create a static version of it."
if test "$build_old_libs" = no; then
oldlibs="$output_objdir/$libname.$libext"
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
fi
fi
fi
# Done checking deplibs!
deplibs=$newdeplibs
fi
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
case $host in
*-*-darwin*)
newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
;;
esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
for path in $notinst_path; do
case " $new_libs " in
*" -L$path/$objdir "*) ;;
*)
case " $deplibs " in
*" -L$path/$objdir "*)
func_append new_libs " -L$path/$objdir" ;;
esac
;;
esac
done
for deplib in $deplibs; do
case $deplib in
-L*)
case " $new_libs " in
*" $deplib "*) ;;
*) func_append new_libs " $deplib" ;;
esac
;;
*) func_append new_libs " $deplib" ;;
esac
done
deplibs="$new_libs"
# All the library-specific variables (install_libdir is set above).
library_names=
old_library=
dlname=
# Test again, we may have decided not to build it any more
if test "$build_libtool_libs" = yes; then
# Remove ${wl} instances when linking with ld.
# FIXME: should test the right _cmds variable.
case $archive_cmds in
*\$LD\ *) wl= ;;
esac
if test "$hardcode_into_libs" = yes; then
# Hardcode the library paths
hardcode_libdirs=
dep_rpath=
rpath="$finalize_rpath"
test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
func_replace_sysroot "$libdir"
libdir=$func_replace_sysroot_result
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
func_append dep_rpath " $flag"
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
*) func_append perm_rpath " $libdir" ;;
esac
fi
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
fi
if test -n "$runpath_var" && test -n "$perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
func_append rpath "$dir:"
done
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
fi
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
fi
shlibpath="$finalize_shlibpath"
test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
if test -n "$shlibpath"; then
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
fi
# Get the real and link names of the library.
eval shared_ext=\"$shrext_cmds\"
eval library_names=\"$library_names_spec\"
set dummy $library_names
shift
realname="$1"
shift
if test -n "$soname_spec"; then
eval soname=\"$soname_spec\"
else
soname="$realname"
fi
if test -z "$dlname"; then
dlname=$soname
fi
lib="$output_objdir/$realname"
linknames=
for link
do
func_append linknames " $link"
done
# Use standard objects if they are pic
test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
test "X$libobjs" = "X " && libobjs=
delfiles=
if test -n "$export_symbols" && test -n "$include_expsyms"; then
$opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
export_symbols="$output_objdir/$libname.uexp"
func_append delfiles " $export_symbols"
fi
orig_export_symbols=
case $host_os in
cygwin* | mingw* | cegcc*)
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
# exporting using user supplied symfile
if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
# and it's NOT already a .def file. Must figure out
# which of the given symbols are data symbols and tag
# them as such. So, trigger use of export_symbols_cmds.
# export_symbols gets reassigned inside the "prepare
# the list of exported symbols" if statement, so the
# include_expsyms logic still works.
orig_export_symbols="$export_symbols"
export_symbols=
always_export_symbols=yes
fi
fi
;;
esac
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
func_verbose "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
$opt_dry_run || $RM $export_symbols
cmds=$export_symbols_cmds
save_ifs="$IFS"; IFS='~'
for cmd1 in $cmds; do
IFS="$save_ifs"
# Take the normal branch if the nm_file_list_spec branch
# doesn't work or if tool conversion is not needed.
case $nm_file_list_spec~$to_tool_file_cmd in
*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
try_normal_branch=yes
eval cmd=\"$cmd1\"
func_len " $cmd"
len=$func_len_result
;;
*)
try_normal_branch=no
;;
esac
if test "$try_normal_branch" = yes \
&& { test "$len" -lt "$max_cmd_len" \
|| test "$max_cmd_len" -le -1; }
then
func_show_eval "$cmd" 'exit $?'
skipped_export=false
elif test -n "$nm_file_list_spec"; then
func_basename "$output"
output_la=$func_basename_result
save_libobjs=$libobjs
save_output=$output
output=${output_objdir}/${output_la}.nm
func_to_tool_file "$output"
libobjs=$nm_file_list_spec$func_to_tool_file_result
func_append delfiles " $output"
func_verbose "creating $NM input file list: $output"
for obj in $save_libobjs; do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result"
done > "$output"
eval cmd=\"$cmd1\"
func_show_eval "$cmd" 'exit $?'
output=$save_output
libobjs=$save_libobjs
skipped_export=false
else
# The command line is too long to execute in one step.
func_verbose "using reloadable object file for export list..."
skipped_export=:
# Break out early, otherwise skipped_export may be
# set to false by a later but shorter cmd.
break
fi
done
IFS="$save_ifs"
if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
fi
fi
fi
if test -n "$export_symbols" && test -n "$include_expsyms"; then
tmp_export_symbols="$export_symbols"
test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
fi
if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
# The given exports_symbols file has to be filtered, so filter it.
func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
# FIXME: $output_objdir/$libname.filter potentially contains lots of
# 's' commands which not all seds can handle. GNU sed should be fine
# though. Also, the filter scales superlinearly with the number of
# global variables. join(1) would be nice here, but unfortunately
# isn't a blessed tool.
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
export_symbols=$output_objdir/$libname.def
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
tmp_deplibs=
for test_deplib in $deplibs; do
case " $convenience " in
*" $test_deplib "*) ;;
*)
func_append tmp_deplibs " $test_deplib"
;;
esac
done
deplibs="$tmp_deplibs"
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec" &&
test "$compiler_needs_object" = yes &&
test -z "$libobjs"; then
# extract the archives, so we have objects to list.
# TODO: could optimize this to just extract one archive.
whole_archive_flag_spec=
fi
if test -n "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
test "X$libobjs" = "X " && libobjs=
else
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $convenience
func_append libobjs " $func_extract_archives_result"
test "X$libobjs" = "X " && libobjs=
fi
fi
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
func_append linker_flags " $flag"
fi
# Make a backup of the uninstalled library when relinking
if test "$opt_mode" = relink; then
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
fi
# Do each of the archive commands.
if test "$module" = yes && test -n "$module_cmds" ; then
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
eval test_cmds=\"$module_expsym_cmds\"
cmds=$module_expsym_cmds
else
eval test_cmds=\"$module_cmds\"
cmds=$module_cmds
fi
else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
eval test_cmds=\"$archive_expsym_cmds\"
cmds=$archive_expsym_cmds
else
eval test_cmds=\"$archive_cmds\"
cmds=$archive_cmds
fi
fi
if test "X$skipped_export" != "X:" &&
func_len " $test_cmds" &&
len=$func_len_result &&
test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
:
else
# The command line is too long to link in one step, link piecewise
# or, if using GNU ld and skipped_export is not :, use a linker
# script.
# Save the value of $output and $libobjs because we want to
# use them later. If we have whole_archive_flag_spec, we
# want to use save_libobjs as it was before
# whole_archive_flag_spec was expanded, because we can't
# assume the linker understands whole_archive_flag_spec.
# This may have to be revisited, in case too many
# convenience libraries get linked in and end up exceeding
# the spec.
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
fi
save_output=$output
func_basename "$output"
output_la=$func_basename_result
# Clear the reloadable object creation command queue and
# initialize k to one.
test_cmds=
concat_cmds=
objlist=
last_robj=
k=1
if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
output=${output_objdir}/${output_la}.lnkscript
func_verbose "creating GNU ld script: $output"
echo 'INPUT (' > $output
for obj in $save_libobjs
do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result" >> $output
done
echo ')' >> $output
func_append delfiles " $output"
func_to_tool_file "$output"
output=$func_to_tool_file_result
elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
output=${output_objdir}/${output_la}.lnk
func_verbose "creating linker input file list: $output"
: > $output
set x $save_libobjs
shift
firstobj=
if test "$compiler_needs_object" = yes; then
firstobj="$1 "
shift
fi
for obj
do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result" >> $output
done
func_append delfiles " $output"
func_to_tool_file "$output"
output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
else
if test -n "$save_libobjs"; then
func_verbose "creating reloadable object files..."
output=$output_objdir/$output_la-${k}.$objext
eval test_cmds=\"$reload_cmds\"
func_len " $test_cmds"
len0=$func_len_result
len=$len0
# Loop over the list of objects to be linked.
for obj in $save_libobjs
do
func_len " $obj"
func_arith $len + $func_len_result
len=$func_arith_result
if test "X$objlist" = X ||
test "$len" -lt "$max_cmd_len"; then
func_append objlist " $obj"
else
# The command $test_cmds is almost too long, add a
# command to the queue.
if test "$k" -eq 1 ; then
# The first file doesn't have a previous command to add.
reload_objs=$objlist
eval concat_cmds=\"$reload_cmds\"
else
# All subsequent reloadable object files will link in
# the last one created.
reload_objs="$objlist $last_robj"
eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
fi
last_robj=$output_objdir/$output_la-${k}.$objext
func_arith $k + 1
k=$func_arith_result
output=$output_objdir/$output_la-${k}.$objext
objlist=" $obj"
func_len " $last_robj"
func_arith $len0 + $func_len_result
len=$func_arith_result
fi
done
# Handle the remaining objects by creating one last
# reloadable object file. All subsequent reloadable object
# files will link in the last one created.
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
reload_objs="$objlist $last_robj"
eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
if test -n "$last_robj"; then
eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
fi
func_append delfiles " $output"
else
output=
fi
if ${skipped_export-false}; then
func_verbose "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
$opt_dry_run || $RM $export_symbols
libobjs=$output
# Append the command to create the export file.
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
if test -n "$last_robj"; then
eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
fi
fi
test -n "$save_libobjs" &&
func_verbose "creating a temporary reloadable object file: $output"
# Loop through the commands generated above and execute them.
save_ifs="$IFS"; IFS='~'
for cmd in $concat_cmds; do
IFS="$save_ifs"
$opt_silent || {
func_quote_for_expand "$cmd"
eval "func_echo $func_quote_for_expand_result"
}
$opt_dry_run || eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
if test "$opt_mode" = relink; then
( cd "$output_objdir" && \
$RM "${realname}T" && \
$MV "${realname}U" "$realname" )
fi
exit $lt_exit
}
done
IFS="$save_ifs"
if test -n "$export_symbols_regex" && ${skipped_export-false}; then
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
fi
fi
if ${skipped_export-false}; then
if test -n "$export_symbols" && test -n "$include_expsyms"; then
tmp_export_symbols="$export_symbols"
test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
$opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
fi
if test -n "$orig_export_symbols"; then
# The given exports_symbols file has to be filtered, so filter it.
func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
# FIXME: $output_objdir/$libname.filter potentially contains lots of
# 's' commands which not all seds can handle. GNU sed should be fine
# though. Also, the filter scales superlinearly with the number of
# global variables. join(1) would be nice here, but unfortunately
# isn't a blessed tool.
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
func_append delfiles " $export_symbols $output_objdir/$libname.filter"
export_symbols=$output_objdir/$libname.def
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
fi
libobjs=$output
# Restore the value of output.
output=$save_output
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
test "X$libobjs" = "X " && libobjs=
fi
# Expand the library linking commands again to reset the
# value of $libobjs for piecewise linking.
# Do each of the archive commands.
if test "$module" = yes && test -n "$module_cmds" ; then
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
cmds=$module_expsym_cmds
else
cmds=$module_cmds
fi
else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
cmds=$archive_expsym_cmds
else
cmds=$archive_cmds
fi
fi
fi
if test -n "$delfiles"; then
# Append the command to remove temporary files to $cmds.
eval cmds=\"\$cmds~\$RM $delfiles\"
fi
# Add any objects from preloaded convenience libraries
if test -n "$dlprefiles"; then
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $dlprefiles
func_append libobjs " $func_extract_archives_result"
test "X$libobjs" = "X " && libobjs=
fi
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
eval cmd=\"$cmd\"
$opt_silent || {
func_quote_for_expand "$cmd"
eval "func_echo $func_quote_for_expand_result"
}
$opt_dry_run || eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
if test "$opt_mode" = relink; then
( cd "$output_objdir" && \
$RM "${realname}T" && \
$MV "${realname}U" "$realname" )
fi
exit $lt_exit
}
done
IFS="$save_ifs"
# Restore the uninstalled library and exit
if test "$opt_mode" = relink; then
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
if test -n "$convenience"; then
if test -z "$whole_archive_flag_spec"; then
func_show_eval '${RM}r "$gentop"'
fi
fi
exit $EXIT_SUCCESS
fi
# Create links to the real library.
for linkname in $linknames; do
if test "$realname" != "$linkname"; then
func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
fi
done
# If -module or -export-dynamic was specified, set the dlname.
if test "$module" = yes || test "$export_dynamic" = yes; then
# On all known operating systems, these are identical.
dlname="$soname"
fi
fi
;;
obj)
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
func_warning "\`-dlopen' is ignored for objects"
fi
case " $deplibs" in
*\ -l* | *\ -L*)
func_warning "\`-l' and \`-L' are ignored for objects" ;;
esac
test -n "$rpath" && \
func_warning "\`-rpath' is ignored for objects"
test -n "$xrpath" && \
func_warning "\`-R' is ignored for objects"
test -n "$vinfo" && \
func_warning "\`-version-info' is ignored for objects"
test -n "$release" && \
func_warning "\`-release' is ignored for objects"
case $output in
*.lo)
test -n "$objs$old_deplibs" && \
func_fatal_error "cannot build library object \`$output' from non-libtool objects"
libobj=$output
func_lo2o "$libobj"
obj=$func_lo2o_result
;;
*)
libobj=
obj="$output"
;;
esac
# Delete the old objects.
$opt_dry_run || $RM $obj $libobj
# Objects from convenience libraries. This assumes
# single-version convenience libraries. Whenever we create
# different ones for PIC/non-PIC, this we'll have to duplicate
# the extraction.
reload_conv_objs=
gentop=
# reload_cmds runs $LD directly, so let us get rid of
# -Wl from whole_archive_flag_spec and hope we can get by with
# turning comma into space..
wl=
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec"; then
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
else
gentop="$output_objdir/${obj}x"
func_append generated " $gentop"
func_extract_archives $gentop $convenience
reload_conv_objs="$reload_objs $func_extract_archives_result"
fi
fi
# If we're not building shared, we need to use non_pic_objs
test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
# Create the old-style object.
reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
output="$obj"
func_execute_cmds "$reload_cmds" 'exit $?'
# Exit if we aren't doing a library object file.
if test -z "$libobj"; then
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
fi
if test "$build_libtool_libs" != yes; then
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
# Create an invalid libtool object if no PIC, so that we don't
# accidentally link it into a program.
# $show "echo timestamp > $libobj"
# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
exit $EXIT_SUCCESS
fi
if test -n "$pic_flag" || test "$pic_mode" != default; then
# Only do commands if we really have different PIC objects.
reload_objs="$libobjs $reload_conv_objs"
output="$libobj"
func_execute_cmds "$reload_cmds" 'exit $?'
fi
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
;;
prog)
case $host in
*cygwin*) func_stripname '' '.exe' "$output"
output=$func_stripname_result.exe;;
esac
test -n "$vinfo" && \
func_warning "\`-version-info' is ignored for programs"
test -n "$release" && \
func_warning "\`-release' is ignored for programs"
test "$preload" = yes \
&& test "$dlopen_support" = unknown \
&& test "$dlopen_self" = unknown \
&& test "$dlopen_self_static" = unknown && \
func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
case $host in
*-*-rhapsody* | *-*-darwin1.[012])
# On Rhapsody replace the C library is the System framework
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
;;
esac
case $host in
*-*-darwin*)
# Don't allow lazy linking, it breaks C++ global constructors
# But is supposedly fixed on 10.4 or later (yay!).
if test "$tagname" = CXX ; then
case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10.[0123])
func_append compile_command " ${wl}-bind_at_load"
func_append finalize_command " ${wl}-bind_at_load"
;;
esac
fi
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
;;
esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
for path in $notinst_path; do
case " $new_libs " in
*" -L$path/$objdir "*) ;;
*)
case " $compile_deplibs " in
*" -L$path/$objdir "*)
func_append new_libs " -L$path/$objdir" ;;
esac
;;
esac
done
for deplib in $compile_deplibs; do
case $deplib in
-L*)
case " $new_libs " in
*" $deplib "*) ;;
*) func_append new_libs " $deplib" ;;
esac
;;
*) func_append new_libs " $deplib" ;;
esac
done
compile_deplibs="$new_libs"
func_append compile_command " $compile_deplibs"
func_append finalize_command " $finalize_deplibs"
if test -n "$rpath$xrpath"; then
# If the user specified any rpath flags, then add them.
for libdir in $rpath $xrpath; do
# This is the magic to use -rpath.
case "$finalize_rpath " in
*" $libdir "*) ;;
*) func_append finalize_rpath " $libdir" ;;
esac
done
fi
# Now hardcode the library paths
rpath=
hardcode_libdirs=
for libdir in $compile_rpath $finalize_rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
func_append rpath " $flag"
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
*) func_append perm_rpath " $libdir" ;;
esac
fi
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
::) dllsearchpath=$libdir;;
*) func_append dllsearchpath ":$libdir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
::) dllsearchpath=$testbindir;;
*) func_append dllsearchpath ":$testbindir";;
esac
;;
esac
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
eval rpath=\" $hardcode_libdir_flag_spec\"
fi
compile_rpath="$rpath"
rpath=
hardcode_libdirs=
for libdir in $finalize_rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
func_append rpath " $flag"
fi
elif test -n "$runpath_var"; then
case "$finalize_perm_rpath " in
*" $libdir "*) ;;
*) func_append finalize_perm_rpath " $libdir" ;;
esac
fi
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
eval rpath=\" $hardcode_libdir_flag_spec\"
fi
finalize_rpath="$rpath"
if test -n "$libobjs" && test "$build_old_libs" = yes; then
# Transform all the library objects into standard objects.
compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
fi
func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
# template prelinking step
if test -n "$prelink_cmds"; then
func_execute_cmds "$prelink_cmds" 'exit $?'
fi
wrappers_required=yes
case $host in
*cegcc* | *mingw32ce*)
# Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
wrappers_required=no
;;
*cygwin* | *mingw* )
if test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
;;
*)
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
;;
esac
if test "$wrappers_required" = no; then
# Replace the output file specification.
compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
link_command="$compile_command$compile_rpath"
# We have no uninstalled library dependencies, so finalize right now.
exit_status=0
func_show_eval "$link_command" 'exit_status=$?'
if test -n "$postlink_cmds"; then
func_to_tool_file "$output"
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
func_execute_cmds "$postlink_cmds" 'exit $?'
fi
# Delete the generated files.
if test -f "$output_objdir/${outputname}S.${objext}"; then
func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
fi
exit $exit_status
fi
if test -n "$compile_shlibpath$finalize_shlibpath"; then
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
fi
if test -n "$finalize_shlibpath"; then
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
fi
compile_var=
finalize_var=
if test -n "$runpath_var"; then
if test -n "$perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
func_append rpath "$dir:"
done
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
fi
if test -n "$finalize_perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $finalize_perm_rpath; do
func_append rpath "$dir:"
done
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
fi
fi
if test "$no_install" = yes; then
# We don't need to create a wrapper script.
link_command="$compile_var$compile_command$compile_rpath"
# Replace the output file specification.
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
# Delete the old output file.
$opt_dry_run || $RM $output
# Link the executable and exit
func_show_eval "$link_command" 'exit $?'
if test -n "$postlink_cmds"; then
func_to_tool_file "$output"
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
func_execute_cmds "$postlink_cmds" 'exit $?'
fi
exit $EXIT_SUCCESS
fi
if test "$hardcode_action" = relink; then
# Fast installation is not supported
link_command="$compile_var$compile_command$compile_rpath"
relink_command="$finalize_var$finalize_command$finalize_rpath"
func_warning "this platform does not like uninstalled shared libraries"
func_warning "\`$output' will be relinked during installation"
else
if test "$fast_install" != no; then
link_command="$finalize_var$compile_command$finalize_rpath"
if test "$fast_install" = yes; then
relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
else
# fast_install is set to needless
relink_command=
fi
else
link_command="$compile_var$compile_command$compile_rpath"
relink_command="$finalize_var$finalize_command$finalize_rpath"
fi
fi
# Replace the output file specification.
link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
# Delete the old output files.
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
func_show_eval "$link_command" 'exit $?'
if test -n "$postlink_cmds"; then
func_to_tool_file "$output_objdir/$outputname"
postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
func_execute_cmds "$postlink_cmds" 'exit $?'
fi
# Now create the wrapper script.
func_verbose "creating $output"
# Quote the relink command for shipping.
if test -n "$relink_command"; then
# Preserve any variables that may affect compiler behavior
for var in $variables_saved_for_relink; do
if eval test -z \"\${$var+set}\"; then
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
func_quote_for_eval "$var_value"
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
relink_command="(cd `pwd`; $relink_command)"
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
fi
# Only actually do things if not in dry run mode.
$opt_dry_run || {
# win32 will think the script is a binary if it has
# a .exe suffix, so we strip it off here.
case $output in
*.exe) func_stripname '' '.exe' "$output"
output=$func_stripname_result ;;
esac
# test for cygwin because mv fails w/o .exe extensions
case $host in
*cygwin*)
exeext=.exe
func_stripname '' '.exe' "$outputname"
outputname=$func_stripname_result ;;
*) exeext= ;;
esac
case $host in
*cygwin* | *mingw* )
func_dirname_and_basename "$output" "" "."
output_name=$func_basename_result
output_path=$func_dirname_result
cwrappersource="$output_path/$objdir/lt-$output_name.c"
cwrapper="$output_path/$output_name.exe"
$RM $cwrappersource $cwrapper
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
func_emit_cwrapperexe_src > $cwrappersource
# The wrapper executable is built using the $host compiler,
# because it contains $host paths and files. If cross-
# compiling, it, like the target executable, must be
# executed on the $host or under an emulation environment.
$opt_dry_run || {
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
$STRIP $cwrapper
}
# Now, create the wrapper script for func_source use:
func_ltwrapper_scriptname $cwrapper
$RM $func_ltwrapper_scriptname_result
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
$opt_dry_run || {
# note: this script will not be executed, so do not chmod.
if test "x$build" = "x$host" ; then
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
else
func_emit_wrapper no > $func_ltwrapper_scriptname_result
fi
}
;;
* )
$RM $output
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
func_emit_wrapper no > $output
chmod +x $output
;;
esac
}
exit $EXIT_SUCCESS
;;
esac
# See if we need to build an old-fashioned archive.
for oldlib in $oldlibs; do
if test "$build_libtool_libs" = convenience; then
oldobjs="$libobjs_save $symfileobj"
addlibs="$convenience"
build_libtool_libs=no
else
if test "$build_libtool_libs" = module; then
oldobjs="$libobjs_save"
build_libtool_libs=no
else
oldobjs="$old_deplibs $non_pic_objects"
if test "$preload" = yes && test -f "$symfileobj"; then
func_append oldobjs " $symfileobj"
fi
fi
addlibs="$old_convenience"
fi
if test -n "$addlibs"; then
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $addlibs
func_append oldobjs " $func_extract_archives_result"
fi
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
cmds=$old_archive_from_new_cmds
else
# Add any objects from preloaded convenience libraries
if test -n "$dlprefiles"; then
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_extract_archives $gentop $dlprefiles
func_append oldobjs " $func_extract_archives_result"
fi
# POSIX demands no paths to be encoded in archives. We have
# to avoid creating archives with duplicate basenames if we
# might have to extract them afterwards, e.g., when creating a
# static archive out of a convenience library, or when linking
# the entirety of a libtool archive into another (currently
# not supported by libtool).
if (for obj in $oldobjs
do
func_basename "$obj"
$ECHO "$func_basename_result"
done | sort | sort -uc >/dev/null 2>&1); then
:
else
echo "copying selected object files to avoid basename conflicts..."
gentop="$output_objdir/${outputname}x"
func_append generated " $gentop"
func_mkdir_p "$gentop"
save_oldobjs=$oldobjs
oldobjs=
counter=1
for obj in $save_oldobjs
do
func_basename "$obj"
objbase="$func_basename_result"
case " $oldobjs " in
" ") oldobjs=$obj ;;
*[\ /]"$objbase "*)
while :; do
# Make sure we don't pick an alternate name that also
# overlaps.
newobj=lt$counter-$objbase
func_arith $counter + 1
counter=$func_arith_result
case " $oldobjs " in
*[\ /]"$newobj "*) ;;
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
esac
done
func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
func_append oldobjs " $gentop/$newobj"
;;
*) func_append oldobjs " $obj" ;;
esac
done
fi
func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
tool_oldlib=$func_to_tool_file_result
eval cmds=\"$old_archive_cmds\"
func_len " $cmds"
len=$func_len_result
if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
cmds=$old_archive_cmds
elif test -n "$archiver_list_spec"; then
func_verbose "using command file archive linking..."
for obj in $oldobjs
do
func_to_tool_file "$obj"
$ECHO "$func_to_tool_file_result"
done > $output_objdir/$libname.libcmd
func_to_tool_file "$output_objdir/$libname.libcmd"
oldobjs=" $archiver_list_spec$func_to_tool_file_result"
cmds=$old_archive_cmds
else
# the command line is too long to link in one step, link in parts
func_verbose "using piecewise archive linking..."
save_RANLIB=$RANLIB
RANLIB=:
objlist=
concat_cmds=
save_oldobjs=$oldobjs
oldobjs=
# Is there a better way of finding the last object in the list?
for obj in $save_oldobjs
do
last_oldobj=$obj
done
eval test_cmds=\"$old_archive_cmds\"
func_len " $test_cmds"
len0=$func_len_result
len=$len0
for obj in $save_oldobjs
do
func_len " $obj"
func_arith $len + $func_len_result
len=$func_arith_result
func_append objlist " $obj"
if test "$len" -lt "$max_cmd_len"; then
:
else
# the above command should be used before it gets too long
oldobjs=$objlist
if test "$obj" = "$last_oldobj" ; then
RANLIB=$save_RANLIB
fi
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
objlist=
len=$len0
fi
done
RANLIB=$save_RANLIB
oldobjs=$objlist
if test "X$oldobjs" = "X" ; then
eval cmds=\"\$concat_cmds\"
else
eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
fi
fi
fi
func_execute_cmds "$cmds" 'exit $?'
done
test -n "$generated" && \
func_show_eval "${RM}r$generated"
# Now create the libtool archive.
case $output in
*.la)
old_library=
test "$build_old_libs" = yes && old_library="$libname.$libext"
func_verbose "creating $output"
# Preserve any variables that may affect compiler behavior
for var in $variables_saved_for_relink; do
if eval test -z \"\${$var+set}\"; then
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
func_quote_for_eval "$var_value"
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
# Quote the link command for shipping.
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
if test "$hardcode_automatic" = yes ; then
relink_command=
fi
# Only create the output if not a dry run.
$opt_dry_run || {
for installed in no yes; do
if test "$installed" = yes; then
if test -z "$install_libdir"; then
break
fi
output="$output_objdir/$outputname"i
# Replace all uninstalled libtool libraries with the installed ones
newdependency_libs=
for deplib in $dependency_libs; do
case $deplib in
*.la)
func_basename "$deplib"
name="$func_basename_result"
func_resolve_sysroot "$deplib"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
test -z "$libdir" && \
func_fatal_error "\`$deplib' is not a valid libtool archive"
func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
;;
-L*)
func_stripname -L '' "$deplib"
func_replace_sysroot "$func_stripname_result"
func_append newdependency_libs " -L$func_replace_sysroot_result"
;;
-R*)
func_stripname -R '' "$deplib"
func_replace_sysroot "$func_stripname_result"
func_append newdependency_libs " -R$func_replace_sysroot_result"
;;
*) func_append newdependency_libs " $deplib" ;;
esac
done
dependency_libs="$newdependency_libs"
newdlfiles=
for lib in $dlfiles; do
case $lib in
*.la)
func_basename "$lib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
test -z "$libdir" && \
func_fatal_error "\`$lib' is not a valid libtool archive"
func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
;;
*) func_append newdlfiles " $lib" ;;
esac
done
dlfiles="$newdlfiles"
newdlprefiles=
for lib in $dlprefiles; do
case $lib in
*.la)
# Only pass preopened files to the pseudo-archive (for
# eventual linking with the app. that links it) if we
# didn't already link the preopened objects directly into
# the library:
func_basename "$lib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
test -z "$libdir" && \
func_fatal_error "\`$lib' is not a valid libtool archive"
func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
;;
esac
done
dlprefiles="$newdlprefiles"
else
newdlfiles=
for lib in $dlfiles; do
case $lib in
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
*) abs=`pwd`"/$lib" ;;
esac
func_append newdlfiles " $abs"
done
dlfiles="$newdlfiles"
newdlprefiles=
for lib in $dlprefiles; do
case $lib in
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
*) abs=`pwd`"/$lib" ;;
esac
func_append newdlprefiles " $abs"
done
dlprefiles="$newdlprefiles"
fi
$RM $output
# place dlname in correct position for cygwin
# In fact, it would be nice if we could use this code for all target
# systems that can't hard-code library paths into their executables
# and that have no shared library path variable independent of PATH,
# but it turns out we can't easily determine that from inspecting
# libtool variables, so we have to hard-code the OSs to which it
# applies here; at the moment, that means platforms that use the PE
# object format with DLL files. See the long comment at the top of
# tests/bindir.at for full details.
tdlname=$dlname
case $host,$output,$installed,$module,$dlname in
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
# If a -bindir argument was supplied, place the dll there.
if test "x$bindir" != x ;
then
func_relative_path "$install_libdir" "$bindir"
tdlname=$func_relative_path_result$dlname
else
# Otherwise fall back on heuristic.
tdlname=../bin/$dlname
fi
;;
esac
$ECHO > $output "\
# $outputname - a libtool library file
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='$tdlname'
# Names of this library.
library_names='$library_names'
# The name of the static archive.
old_library='$old_library'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags='$new_inherited_linker_flags'
# Libraries that this one depends upon.
dependency_libs='$dependency_libs'
# Names of additional weak libraries provided by this library
weak_library_names='$weak_libs'
# Version information for $libname.
current=$current
age=$age
revision=$revision
# Is this an already installed library?
installed=$installed
# Should we warn about portability when linking against -modules?
shouldnotlink=$module
# Files to dlopen/dlpreopen
dlopen='$dlfiles'
dlpreopen='$dlprefiles'
# Directory that this library needs to be installed in:
libdir='$install_libdir'"
if test "$installed" = no && test "$need_relink" = yes; then
$ECHO >> $output "\
relink_command=\"$relink_command\""
fi
done
}
# Do a symbolic link so that the libtool archive can be found in
# LD_LIBRARY_PATH before the program is installed.
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
;;
esac
exit $EXIT_SUCCESS
}
{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
func_mode_link ${1+"$@"}
# func_mode_uninstall arg...
func_mode_uninstall ()
{
$opt_debug
RM="$nonopt"
files=
rmforce=
exit_status=0
# This variable tells wrapper scripts just to set variables rather
# than running their programs.
libtool_install_magic="$magic"
for arg
do
case $arg in
-f) func_append RM " $arg"; rmforce=yes ;;
-*) func_append RM " $arg" ;;
*) func_append files " $arg" ;;
esac
done
test -z "$RM" && \
func_fatal_help "you must specify an RM program"
rmdirs=
for file in $files; do
func_dirname "$file" "" "."
dir="$func_dirname_result"
if test "X$dir" = X.; then
odir="$objdir"
else
odir="$dir/$objdir"
fi
func_basename "$file"
name="$func_basename_result"
test "$opt_mode" = uninstall && odir="$dir"
# Remember odir for removal later, being careful to avoid duplicates
if test "$opt_mode" = clean; then
case " $rmdirs " in
*" $odir "*) ;;
*) func_append rmdirs " $odir" ;;
esac
fi
# Don't error if the file doesn't exist and rm -f was used.
if { test -L "$file"; } >/dev/null 2>&1 ||
{ test -h "$file"; } >/dev/null 2>&1 ||
test -f "$file"; then
:
elif test -d "$file"; then
exit_status=1
continue
elif test "$rmforce" = yes; then
continue
fi
rmfiles="$file"
case $name in
*.la)
# Possibly a libtool archive, so verify it.
if func_lalib_p "$file"; then
func_source $dir/$name
# Delete the libtool libraries and symlinks.
for n in $library_names; do
func_append rmfiles " $odir/$n"
done
test -n "$old_library" && func_append rmfiles " $odir/$old_library"
case "$opt_mode" in
clean)
case " $library_names " in
*" $dlname "*) ;;
*) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
esac
test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
;;
uninstall)
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
fi
if test -n "$old_library"; then
# Do each command in the old_postuninstall commands.
func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
fi
# FIXME: should reinstall the best remaining shared library.
;;
esac
fi
;;
*.lo)
# Possibly a libtool object, so verify it.
if func_lalib_p "$file"; then
# Read the .lo file
func_source $dir/$name
# Add PIC object to the list of files to remove.
if test -n "$pic_object" &&
test "$pic_object" != none; then
func_append rmfiles " $dir/$pic_object"
fi
# Add non-PIC object to the list of files to remove.
if test -n "$non_pic_object" &&
test "$non_pic_object" != none; then
func_append rmfiles " $dir/$non_pic_object"
fi
fi
;;
*)
if test "$opt_mode" = clean ; then
noexename=$name
case $file in
*.exe)
func_stripname '' '.exe' "$file"
file=$func_stripname_result
func_stripname '' '.exe' "$name"
noexename=$func_stripname_result
# $file with .exe has already been added to rmfiles,
# add $file without .exe
func_append rmfiles " $file"
;;
esac
# Do a test to see if this is a libtool program.
if func_ltwrapper_p "$file"; then
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
relink_command=
func_source $func_ltwrapper_scriptname_result
func_append rmfiles " $func_ltwrapper_scriptname_result"
else
relink_command=
func_source $dir/$noexename
fi
# note $name still contains .exe if it was in $file originally
# as does the version of $file that was added into $rmfiles
func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
if test "$fast_install" = yes && test -n "$relink_command"; then
func_append rmfiles " $odir/lt-$name"
fi
if test "X$noexename" != "X$name" ; then
func_append rmfiles " $odir/lt-${noexename}.c"
fi
fi
fi
;;
esac
func_show_eval "$RM $rmfiles" 'exit_status=1'
done
# Try to remove the ${objdir}s in the directories where we deleted files
for dir in $rmdirs; do
if test -d "$dir"; then
func_show_eval "rmdir $dir >/dev/null 2>&1"
fi
done
exit $exit_status
}
{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
func_mode_uninstall ${1+"$@"}
test -z "$opt_mode" && {
help="$generic_help"
func_fatal_help "you must specify a MODE"
}
test -z "$exec_cmd" && \
func_fatal_help "invalid operation mode \`$opt_mode'"
if test -n "$exec_cmd"; then
eval exec "$exec_cmd"
exit $EXIT_FAILURE
fi
exit $exit_status
# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting
# choices, we go for a static library, that is the most portable,
# since we can't tell whether shared libraries were disabled because
# the user asked for that or because the platform doesn't support
# them. This is particularly important on AIX, because we don't
# support having both static and shared libraries enabled at the same
# time on that platform, so we default to a shared-only configuration.
# If a disable-shared tag is given, we'll fallback to a static-only
# configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
build_libtool_libs=no
build_old_libs=yes
# ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
# ### END LIBTOOL TAG CONFIG: disable-static
# Local Variables:
# mode:shell-script
# sh-indentation:2
# End:
# vi:sw=2
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/ltmain.sh | Shell | apache-2.0 | 283,670 |
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2012-01-06.13; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG=\${$#}
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG=\${$#}
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/missing | Shell | apache-2.0 | 10,346 |
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2009-04-28.21; # UTC
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
IFS=" "" $nl"
errstatus=0
dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit $?
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit $?
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp=$pathcomp/
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/mkinstalldirs | Shell | apache-2.0 | 3,538 |
#!/bin/sh
#
# Remove the '-g' debug flag from Makefiles to build release versions
# of the libraries in one go.
#
# Run after './configure' and before 'make'.
#
echo "Removing debug flags from Makefile."
echo
TARGET="Makefile"
if [ "$1" != "" ]; then
TARGET="$1"
fi
for i in `find . -name "$TARGET" -print`; do
echo "Patching $i ..."
cat $i | sed 's/-g -O2/-O -Wl,-s/' | sed 's/-shared/-shared -Wl,-s/' >$i.new
cp -f $i.new $i
done
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/nodebug.sh | Shell | apache-2.0 | 441 |
#
# Splint based static code analysis
# http://www.splint.org/
#
splint -I/usr/local/include/SDL -exportlocal SDL_framerate.c
# splint -I/usr/local/include/SDL -weak +matchanyintegral SDL_gfxBlitFunc.c
splint -I/usr/local/include/SDL -exportlocal +matchanyintegral -shiftimplementation -boolops +boolint -predboolint -shadow -casebreak -dependenttrans -nullstate -compdestroy -compmempass SDL_gfxBlitFunc.c
# splint -I/usr/local/include/SDL -weak +matchanyintegral SDL_rotozoom.c
splint -I/usr/local/include/SDL -exportlocal +matchanyintegral -shiftimplementation -boolops +boolint -retvalint -predboolint -branchstate -nullret -paramuse -compdef -nullpass -usedef -mustfreefresh -incondefs SDL_rotozoom.c
# splint -I/usr/local/include/SDL -weak +matchanyintegral SDL_gfxPrimitives.c
splint -I/usr/local/include/SDL -exportlocal +matchanyintegral -shiftimplementation -boolops -type -retvalint -shiftnegative -predboolint -nullassign -branchstate -globstate -usereleased -nullstate -nullpass -compdef -usedef -evalorder -compdestroy SDL_gfxPrimitives.c
# splint -I/usr/local/include/SDL -weak +matchanyintegral SDL_imageFilter.c
splint -I/usr/local/include/SDL -exportlocal +matchanyintegral -shiftimplementation -boolops +boolint -paramuse -retvalint +charint -mayaliasunique SDL_imageFilter.c
| YifuLiu/AliOS-Things | components/SDL2/src/gfx/splint.sh | Shell | apache-2.0 | 1,300 |
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../SDL_internal.h"
#include "SDL_syshaptic.h"
#include "SDL_haptic_c.h"
#include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
#include "SDL_assert.h"
/* Global for SDL_windowshaptic.c */
#if (defined(SDL_HAPTIC_DINPUT) && SDL_HAPTIC_DINPUT) || (defined(SDL_HAPTIC_XINPUT) && SDL_HAPTIC_XINPUT)
SDL_Haptic *SDL_haptics = NULL;
#else
static SDL_Haptic *SDL_haptics = NULL;
#endif
/*
* Initializes the Haptic devices.
*/
int
SDL_HapticInit(void)
{
int status;
status = SDL_SYS_HapticInit();
if (status >= 0) {
status = 0;
}
return status;
}
/*
* Checks to see if the haptic device is valid
*/
static int
ValidHaptic(SDL_Haptic * haptic)
{
int valid;
SDL_Haptic *hapticlist;
valid = 0;
if (haptic != NULL) {
hapticlist = SDL_haptics;
while ( hapticlist )
{
if (hapticlist == haptic) {
valid = 1;
break;
}
hapticlist = hapticlist->next;
}
}
/* Create the error here. */
if (valid == 0) {
SDL_SetError("Haptic: Invalid haptic device identifier");
}
return valid;
}
/*
* Returns the number of available devices.
*/
int
SDL_NumHaptics(void)
{
return SDL_SYS_NumHaptics();
}
/*
* Gets the name of a Haptic device by index.
*/
const char *
SDL_HapticName(int device_index)
{
if ((device_index < 0) || (device_index >= SDL_NumHaptics())) {
SDL_SetError("Haptic: There are %d haptic devices available",
SDL_NumHaptics());
return NULL;
}
return SDL_SYS_HapticName(device_index);
}
/*
* Opens a Haptic device.
*/
SDL_Haptic *
SDL_HapticOpen(int device_index)
{
SDL_Haptic *haptic;
SDL_Haptic *hapticlist;
if ((device_index < 0) || (device_index >= SDL_NumHaptics())) {
SDL_SetError("Haptic: There are %d haptic devices available",
SDL_NumHaptics());
return NULL;
}
hapticlist = SDL_haptics;
/* If the haptic is already open, return it
* TODO: Should we create haptic instance IDs like the Joystick API?
*/
while ( hapticlist )
{
if (device_index == hapticlist->index) {
haptic = hapticlist;
++haptic->ref_count;
return haptic;
}
hapticlist = hapticlist->next;
}
/* Create the haptic device */
haptic = (SDL_Haptic *) SDL_malloc((sizeof *haptic));
if (haptic == NULL) {
SDL_OutOfMemory();
return NULL;
}
/* Initialize the haptic device */
SDL_memset(haptic, 0, (sizeof *haptic));
haptic->rumble_id = -1;
haptic->index = device_index;
if (SDL_SYS_HapticOpen(haptic) < 0) {
SDL_free(haptic);
return NULL;
}
/* Add haptic to list */
++haptic->ref_count;
/* Link the haptic in the list */
haptic->next = SDL_haptics;
SDL_haptics = haptic;
/* Disable autocenter and set gain to max. */
if (haptic->supported & SDL_HAPTIC_GAIN)
SDL_HapticSetGain(haptic, 100);
if (haptic->supported & SDL_HAPTIC_AUTOCENTER)
SDL_HapticSetAutocenter(haptic, 0);
return haptic;
}
/*
* Returns 1 if the device has been opened.
*/
int
SDL_HapticOpened(int device_index)
{
int opened;
SDL_Haptic *hapticlist;
/* Make sure it's valid. */
if ((device_index < 0) || (device_index >= SDL_NumHaptics())) {
SDL_SetError("Haptic: There are %d haptic devices available",
SDL_NumHaptics());
return 0;
}
opened = 0;
hapticlist = SDL_haptics;
/* TODO Should this use an instance ID? */
while ( hapticlist )
{
if (hapticlist->index == (Uint8) device_index) {
opened = 1;
break;
}
hapticlist = hapticlist->next;
}
return opened;
}
/*
* Returns the index to a haptic device.
*/
int
SDL_HapticIndex(SDL_Haptic * haptic)
{
if (!ValidHaptic(haptic)) {
return -1;
}
return haptic->index;
}
/*
* Returns SDL_TRUE if mouse is haptic, SDL_FALSE if it isn't.
*/
int
SDL_MouseIsHaptic(void)
{
if (SDL_SYS_HapticMouse() < 0)
return SDL_FALSE;
return SDL_TRUE;
}
/*
* Returns the haptic device if mouse is haptic or NULL elsewise.
*/
SDL_Haptic *
SDL_HapticOpenFromMouse(void)
{
int device_index;
device_index = SDL_SYS_HapticMouse();
if (device_index < 0) {
SDL_SetError("Haptic: Mouse isn't a haptic device.");
return NULL;
}
return SDL_HapticOpen(device_index);
}
/*
* Returns SDL_TRUE if joystick has haptic features.
*/
int
SDL_JoystickIsHaptic(SDL_Joystick * joystick)
{
int ret;
/* Must be a valid joystick */
if (!SDL_PrivateJoystickValid(joystick)) {
return -1;
}
ret = SDL_SYS_JoystickIsHaptic(joystick);
if (ret > 0)
return SDL_TRUE;
else if (ret == 0)
return SDL_FALSE;
else
return -1;
}
/*
* Opens a haptic device from a joystick.
*/
SDL_Haptic *
SDL_HapticOpenFromJoystick(SDL_Joystick * joystick)
{
SDL_Haptic *haptic;
SDL_Haptic *hapticlist;
/* Make sure there is room. */
if (SDL_NumHaptics() <= 0) {
SDL_SetError("Haptic: There are %d haptic devices available",
SDL_NumHaptics());
return NULL;
}
/* Must be a valid joystick */
if (!SDL_PrivateJoystickValid(joystick)) {
SDL_SetError("Haptic: Joystick isn't valid.");
return NULL;
}
/* Joystick must be haptic */
if (SDL_SYS_JoystickIsHaptic(joystick) <= 0) {
SDL_SetError("Haptic: Joystick isn't a haptic device.");
return NULL;
}
hapticlist = SDL_haptics;
/* Check to see if joystick's haptic is already open */
while ( hapticlist )
{
if (SDL_SYS_JoystickSameHaptic(hapticlist, joystick)) {
haptic = hapticlist;
++haptic->ref_count;
return haptic;
}
hapticlist = hapticlist->next;
}
/* Create the haptic device */
haptic = (SDL_Haptic *) SDL_malloc((sizeof *haptic));
if (haptic == NULL) {
SDL_OutOfMemory();
return NULL;
}
/* Initialize the haptic device */
SDL_memset(haptic, 0, sizeof(SDL_Haptic));
haptic->rumble_id = -1;
if (SDL_SYS_HapticOpenFromJoystick(haptic, joystick) < 0) {
SDL_SetError("Haptic: SDL_SYS_HapticOpenFromJoystick failed.");
SDL_free(haptic);
return NULL;
}
/* Add haptic to list */
++haptic->ref_count;
/* Link the haptic in the list */
haptic->next = SDL_haptics;
SDL_haptics = haptic;
return haptic;
}
/*
* Closes a SDL_Haptic device.
*/
void
SDL_HapticClose(SDL_Haptic * haptic)
{
int i;
SDL_Haptic *hapticlist;
SDL_Haptic *hapticlistprev;
/* Must be valid */
if (!ValidHaptic(haptic)) {
return;
}
/* Check if it's still in use */
if (--haptic->ref_count > 0) {
return;
}
/* Close it, properly removing effects if needed */
for (i = 0; i < haptic->neffects; i++) {
if (haptic->effects[i].hweffect != NULL) {
SDL_HapticDestroyEffect(haptic, i);
}
}
SDL_SYS_HapticClose(haptic);
/* Remove from the list */
hapticlist = SDL_haptics;
hapticlistprev = NULL;
while ( hapticlist )
{
if (haptic == hapticlist)
{
if ( hapticlistprev )
{
/* unlink this entry */
hapticlistprev->next = hapticlist->next;
}
else
{
SDL_haptics = haptic->next;
}
break;
}
hapticlistprev = hapticlist;
hapticlist = hapticlist->next;
}
/* Free */
SDL_free(haptic);
}
/*
* Cleans up after the subsystem.
*/
void
SDL_HapticQuit(void)
{
while (SDL_haptics) {
SDL_HapticClose(SDL_haptics);
}
SDL_SYS_HapticQuit();
}
/*
* Returns the number of effects a haptic device has.
*/
int
SDL_HapticNumEffects(SDL_Haptic * haptic)
{
if (!ValidHaptic(haptic)) {
return -1;
}
return haptic->neffects;
}
/*
* Returns the number of effects a haptic device can play.
*/
int
SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic)
{
if (!ValidHaptic(haptic)) {
return -1;
}
return haptic->nplaying;
}
/*
* Returns supported effects by the device.
*/
unsigned int
SDL_HapticQuery(SDL_Haptic * haptic)
{
if (!ValidHaptic(haptic)) {
return 0; /* same as if no effects were supported */
}
return haptic->supported;
}
/*
* Returns the number of axis on the device.
*/
int
SDL_HapticNumAxes(SDL_Haptic * haptic)
{
if (!ValidHaptic(haptic)) {
return -1;
}
return haptic->naxes;
}
/*
* Checks to see if the device can support the effect.
*/
int
SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect)
{
if (!ValidHaptic(haptic)) {
return -1;
}
if ((haptic->supported & effect->type) != 0)
return SDL_TRUE;
return SDL_FALSE;
}
/*
* Creates a new haptic effect.
*/
int
SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect)
{
int i;
/* Check for device validity. */
if (!ValidHaptic(haptic)) {
return -1;
}
/* Check to see if effect is supported */
if (SDL_HapticEffectSupported(haptic, effect) == SDL_FALSE) {
return SDL_SetError("Haptic: Effect not supported by haptic device.");
}
/* See if there's a free slot */
for (i = 0; i < haptic->neffects; i++) {
if (haptic->effects[i].hweffect == NULL) {
/* Now let the backend create the real effect */
if (SDL_SYS_HapticNewEffect(haptic, &haptic->effects[i], effect)
!= 0) {
return -1; /* Backend failed to create effect */
}
SDL_memcpy(&haptic->effects[i].effect, effect,
sizeof(SDL_HapticEffect));
return i;
}
}
return SDL_SetError("Haptic: Device has no free space left.");
}
/*
* Checks to see if an effect is valid.
*/
static int
ValidEffect(SDL_Haptic * haptic, int effect)
{
if ((effect < 0) || (effect >= haptic->neffects)) {
SDL_SetError("Haptic: Invalid effect identifier.");
return 0;
}
return 1;
}
/*
* Updates an effect.
*/
int
SDL_HapticUpdateEffect(SDL_Haptic * haptic, int effect,
SDL_HapticEffect * data)
{
if (!ValidHaptic(haptic) || !ValidEffect(haptic, effect)) {
return -1;
}
/* Can't change type dynamically. */
if (data->type != haptic->effects[effect].effect.type) {
return SDL_SetError("Haptic: Updating effect type is illegal.");
}
/* Updates the effect */
if (SDL_SYS_HapticUpdateEffect(haptic, &haptic->effects[effect], data) <
0) {
return -1;
}
SDL_memcpy(&haptic->effects[effect].effect, data,
sizeof(SDL_HapticEffect));
return 0;
}
/*
* Runs the haptic effect on the device.
*/
int
SDL_HapticRunEffect(SDL_Haptic * haptic, int effect, Uint32 iterations)
{
if (!ValidHaptic(haptic) || !ValidEffect(haptic, effect)) {
return -1;
}
/* Run the effect */
if (SDL_SYS_HapticRunEffect(haptic, &haptic->effects[effect], iterations)
< 0) {
return -1;
}
return 0;
}
/*
* Stops the haptic effect on the device.
*/
int
SDL_HapticStopEffect(SDL_Haptic * haptic, int effect)
{
if (!ValidHaptic(haptic) || !ValidEffect(haptic, effect)) {
return -1;
}
/* Stop the effect */
if (SDL_SYS_HapticStopEffect(haptic, &haptic->effects[effect]) < 0) {
return -1;
}
return 0;
}
/*
* Gets rid of a haptic effect.
*/
void
SDL_HapticDestroyEffect(SDL_Haptic * haptic, int effect)
{
if (!ValidHaptic(haptic) || !ValidEffect(haptic, effect)) {
return;
}
/* Not allocated */
if (haptic->effects[effect].hweffect == NULL) {
return;
}
SDL_SYS_HapticDestroyEffect(haptic, &haptic->effects[effect]);
}
/*
* Gets the status of a haptic effect.
*/
int
SDL_HapticGetEffectStatus(SDL_Haptic * haptic, int effect)
{
if (!ValidHaptic(haptic) || !ValidEffect(haptic, effect)) {
return -1;
}
if ((haptic->supported & SDL_HAPTIC_STATUS) == 0) {
return SDL_SetError("Haptic: Device does not support status queries.");
}
return SDL_SYS_HapticGetEffectStatus(haptic, &haptic->effects[effect]);
}
/*
* Sets the global gain of the device.
*/
int
SDL_HapticSetGain(SDL_Haptic * haptic, int gain)
{
const char *env;
int real_gain, max_gain;
if (!ValidHaptic(haptic)) {
return -1;
}
if ((haptic->supported & SDL_HAPTIC_GAIN) == 0) {
return SDL_SetError("Haptic: Device does not support setting gain.");
}
if ((gain < 0) || (gain > 100)) {
return SDL_SetError("Haptic: Gain must be between 0 and 100.");
}
/* We use the envvar to get the maximum gain. */
env = SDL_getenv("SDL_HAPTIC_GAIN_MAX");
if (env != NULL) {
max_gain = SDL_atoi(env);
/* Check for sanity. */
if (max_gain < 0)
max_gain = 0;
else if (max_gain > 100)
max_gain = 100;
/* We'll scale it linearly with SDL_HAPTIC_GAIN_MAX */
real_gain = (gain * max_gain) / 100;
} else {
real_gain = gain;
}
if (SDL_SYS_HapticSetGain(haptic, real_gain) < 0) {
return -1;
}
return 0;
}
/*
* Makes the device autocenter, 0 disables.
*/
int
SDL_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
{
if (!ValidHaptic(haptic)) {
return -1;
}
if ((haptic->supported & SDL_HAPTIC_AUTOCENTER) == 0) {
return SDL_SetError("Haptic: Device does not support setting autocenter.");
}
if ((autocenter < 0) || (autocenter > 100)) {
return SDL_SetError("Haptic: Autocenter must be between 0 and 100.");
}
if (SDL_SYS_HapticSetAutocenter(haptic, autocenter) < 0) {
return -1;
}
return 0;
}
/*
* Pauses the haptic device.
*/
int
SDL_HapticPause(SDL_Haptic * haptic)
{
if (!ValidHaptic(haptic)) {
return -1;
}
if ((haptic->supported & SDL_HAPTIC_PAUSE) == 0) {
return SDL_SetError("Haptic: Device does not support setting pausing.");
}
return SDL_SYS_HapticPause(haptic);
}
/*
* Unpauses the haptic device.
*/
int
SDL_HapticUnpause(SDL_Haptic * haptic)
{
if (!ValidHaptic(haptic)) {
return -1;
}
if ((haptic->supported & SDL_HAPTIC_PAUSE) == 0) {
return 0; /* Not going to be paused, so we pretend it's unpaused. */
}
return SDL_SYS_HapticUnpause(haptic);
}
/*
* Stops all the currently playing effects.
*/
int
SDL_HapticStopAll(SDL_Haptic * haptic)
{
if (!ValidHaptic(haptic)) {
return -1;
}
return SDL_SYS_HapticStopAll(haptic);
}
/*
* Checks to see if rumble is supported.
*/
int
SDL_HapticRumbleSupported(SDL_Haptic * haptic)
{
if (!ValidHaptic(haptic)) {
return -1;
}
/* Most things can use SINE, but XInput only has LEFTRIGHT. */
return ((haptic->supported & (SDL_HAPTIC_SINE|SDL_HAPTIC_LEFTRIGHT)) != 0);
}
/*
* Initializes the haptic device for simple rumble playback.
*/
int
SDL_HapticRumbleInit(SDL_Haptic * haptic)
{
SDL_HapticEffect *efx = &haptic->rumble_effect;
if (!ValidHaptic(haptic)) {
return -1;
}
/* Already allocated. */
if (haptic->rumble_id >= 0) {
return 0;
}
SDL_zerop(efx);
if (haptic->supported & SDL_HAPTIC_SINE) {
efx->type = SDL_HAPTIC_SINE;
efx->periodic.direction.type = SDL_HAPTIC_CARTESIAN;
efx->periodic.period = 1000;
efx->periodic.magnitude = 0x4000;
efx->periodic.length = 5000;
efx->periodic.attack_length = 0;
efx->periodic.fade_length = 0;
} else if (haptic->supported & SDL_HAPTIC_LEFTRIGHT) { /* XInput? */
efx->type = SDL_HAPTIC_LEFTRIGHT;
efx->leftright.length = 5000;
efx->leftright.large_magnitude = 0x4000;
efx->leftright.small_magnitude = 0x4000;
} else {
return SDL_SetError("Device doesn't support rumble");
}
haptic->rumble_id = SDL_HapticNewEffect(haptic, &haptic->rumble_effect);
if (haptic->rumble_id >= 0) {
return 0;
}
return -1;
}
/*
* Runs simple rumble on a haptic device
*/
int
SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length)
{
SDL_HapticEffect *efx;
Sint16 magnitude;
if (!ValidHaptic(haptic)) {
return -1;
}
if (haptic->rumble_id < 0) {
return SDL_SetError("Haptic: Rumble effect not initialized on haptic device");
}
/* Clamp strength. */
if (strength > 1.0f) {
strength = 1.0f;
} else if (strength < 0.0f) {
strength = 0.0f;
}
magnitude = (Sint16)(32767.0f*strength);
efx = &haptic->rumble_effect;
if (efx->type == SDL_HAPTIC_SINE) {
efx->periodic.magnitude = magnitude;
efx->periodic.length = length;
} else if (efx->type == SDL_HAPTIC_LEFTRIGHT) {
efx->leftright.small_magnitude = efx->leftright.large_magnitude = magnitude;
efx->leftright.length = length;
} else {
SDL_assert(0 && "This should have been caught elsewhere");
}
if (SDL_HapticUpdateEffect(haptic, haptic->rumble_id, &haptic->rumble_effect) < 0) {
return -1;
}
return SDL_HapticRunEffect(haptic, haptic->rumble_id, 1);
}
/*
* Stops the simple rumble on a haptic device.
*/
int
SDL_HapticRumbleStop(SDL_Haptic * haptic)
{
if (!ValidHaptic(haptic)) {
return -1;
}
if (haptic->rumble_id < 0) {
return SDL_SetError("Haptic: Rumble effect not initialized on haptic device");
}
return SDL_HapticStopEffect(haptic, haptic->rumble_id);
}
/* vi: set ts=4 sw=4 expandtab: */
| YifuLiu/AliOS-Things | components/SDL2/src/haptic/SDL_haptic.c | C | apache-2.0 | 18,982 |
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_haptic_c_h_
#define SDL_haptic_c_h_
extern int SDL_HapticInit(void);
extern void SDL_HapticQuit(void);
#endif /* SDL_haptic_c_h_ */
/* vi: set ts=4 sw=4 expandtab: */
| YifuLiu/AliOS-Things | components/SDL2/src/haptic/SDL_haptic_c.h | C | apache-2.0 | 1,122 |
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../SDL_internal.h"
#ifndef SDL_syshaptic_h_
#define SDL_syshaptic_h_
#include "SDL_haptic.h"
struct haptic_effect
{
SDL_HapticEffect effect; /* The current event */
struct haptic_hweffect *hweffect; /* The hardware behind the event */
};
/*
* The real SDL_Haptic struct.
*/
struct _SDL_Haptic
{
Uint8 index; /* Stores index it is attached to */
struct haptic_effect *effects; /* Allocated effects */
int neffects; /* Maximum amount of effects */
int nplaying; /* Maximum amount of effects to play at the same time */
unsigned int supported; /* Supported effects */
int naxes; /* Number of axes on the device. */
struct haptic_hwdata *hwdata; /* Driver dependent */
int ref_count; /* Count for multiple opens */
int rumble_id; /* ID of rumble effect for simple rumble API. */
SDL_HapticEffect rumble_effect; /* Rumble effect. */
struct _SDL_Haptic *next; /* pointer to next haptic we have allocated */
};
/*
* Scans the system for haptic devices.
*
* Returns number of devices on success, -1 on error.
*/
extern int SDL_SYS_HapticInit(void);
/* Function to return the number of haptic devices plugged in right now */
extern int SDL_SYS_NumHaptics(void);
/*
* Gets the device dependent name of the haptic device
*/
extern const char *SDL_SYS_HapticName(int index);
/*
* Opens the haptic device for usage. The haptic device should have
* the index value set previously.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticOpen(SDL_Haptic * haptic);
/*
* Returns the index of the haptic core pointer or -1 if none is found.
*/
int SDL_SYS_HapticMouse(void);
/*
* Checks to see if the joystick has haptic capabilities.
*
* Returns >0 if haptic capabilities are detected, 0 if haptic
* capabilities aren't detected and -1 on error.
*/
extern int SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick);
/*
* Opens the haptic device for usage using the same device as
* the joystick.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic,
SDL_Joystick * joystick);
/*
* Checks to see if haptic device and joystick device are the same.
*
* Returns 1 if they are the same, 0 if they aren't.
*/
extern int SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic,
SDL_Joystick * joystick);
/*
* Closes a haptic device after usage.
*/
extern void SDL_SYS_HapticClose(SDL_Haptic * haptic);
/*
* Performs a cleanup on the haptic subsystem.
*/
extern void SDL_SYS_HapticQuit(void);
/*
* Creates a new haptic effect on the haptic device using base
* as a template for the effect.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticNewEffect(SDL_Haptic * haptic,
struct haptic_effect *effect,
SDL_HapticEffect * base);
/*
* Updates the haptic effect on the haptic device using data
* as a template.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
struct haptic_effect *effect,
SDL_HapticEffect * data);
/*
* Runs the effect on the haptic device.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticRunEffect(SDL_Haptic * haptic,
struct haptic_effect *effect,
Uint32 iterations);
/*
* Stops the effect on the haptic device.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticStopEffect(SDL_Haptic * haptic,
struct haptic_effect *effect);
/*
* Cleanups up the effect on the haptic device.
*/
extern void SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic,
struct haptic_effect *effect);
/*
* Queries the device for the status of effect.
*
* Returns 0 if device is stopped, >0 if device is playing and
* -1 on error.
*/
extern int SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
struct haptic_effect *effect);
/*
* Sets the global gain of the haptic device.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain);
/*
* Sets the autocenter feature of the haptic device.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter);
/*
* Pauses the haptic device.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticPause(SDL_Haptic * haptic);
/*
* Unpauses the haptic device.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticUnpause(SDL_Haptic * haptic);
/*
* Stops all the currently playing haptic effects on the device.
*
* Returns 0 on success, -1 on error.
*/
extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic);
#endif /* SDL_syshaptic_h_ */
/* vi: set ts=4 sw=4 expandtab: */
| YifuLiu/AliOS-Things | components/SDL2/src/haptic/SDL_syshaptic.h | C | apache-2.0 | 6,084 |
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifdef SDL_HAPTIC_ANDROID
#include "SDL_assert.h"
#include "SDL_timer.h"
#include "SDL_syshaptic_c.h"
#include "../SDL_syshaptic.h"
#include "SDL_haptic.h"
#include "../../core/android/SDL_android.h"
#include "SDL_joystick.h"
#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
#include "../../joystick/android/SDL_sysjoystick_c.h" /* For joystick hwdata */
typedef struct SDL_hapticlist_item
{
int device_id;
char *name;
SDL_Haptic *haptic;
struct SDL_hapticlist_item *next;
} SDL_hapticlist_item;
static SDL_hapticlist_item *SDL_hapticlist = NULL;
static SDL_hapticlist_item *SDL_hapticlist_tail = NULL;
static int numhaptics = 0;
int
SDL_SYS_HapticInit(void)
{
/* Support for device connect/disconnect is API >= 16 only,
* so we poll every three seconds
* Ref: http://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener.html
*/
static Uint32 timeout = 0;
if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) {
timeout = SDL_GetTicks() + 3000;
Android_JNI_PollHapticDevices();
}
return (numhaptics);
}
int
SDL_SYS_NumHaptics(void)
{
return (numhaptics);
}
static SDL_hapticlist_item *
HapticByOrder(int index)
{
SDL_hapticlist_item *item = SDL_hapticlist;
if ((index < 0) || (index >= numhaptics)) {
return NULL;
}
while (index > 0) {
SDL_assert(item != NULL);
--index;
item = item->next;
}
return item;
}
static SDL_hapticlist_item *
HapticByDevId (int device_id)
{
SDL_hapticlist_item *item;
for (item = SDL_hapticlist; item != NULL; item = item->next) {
if (device_id == item->device_id) {
/*SDL_Log("=+=+=+=+=+= HapticByDevId id [%d]", device_id);*/
return item;
}
}
return NULL;
}
const char *
SDL_SYS_HapticName(int index)
{
SDL_hapticlist_item *item = HapticByOrder(index);
if (item == NULL ) {
SDL_SetError("No such device");
return NULL;
}
return item->name;
}
static SDL_hapticlist_item *
OpenHaptic(SDL_Haptic *haptic, SDL_hapticlist_item *item)
{
if (item == NULL ) {
SDL_SetError("No such device");
return NULL;
}
if (item->haptic != NULL) {
SDL_SetError("Haptic already opened");
return NULL;
}
haptic->hwdata = (struct haptic_hwdata *)item;
item->haptic = haptic;
haptic->supported = SDL_HAPTIC_LEFTRIGHT;
haptic->neffects = 1;
haptic->nplaying = haptic->neffects;
haptic->effects = (struct haptic_effect *)SDL_malloc (sizeof (struct haptic_effect) * haptic->neffects);
if (haptic->effects == NULL) {
SDL_OutOfMemory();
return NULL;
}
SDL_memset(haptic->effects, 0, sizeof (struct haptic_effect) * haptic->neffects);
return item;
}
static SDL_hapticlist_item *
OpenHapticByOrder(SDL_Haptic *haptic, int index)
{
return OpenHaptic (haptic, HapticByOrder(index));
}
static SDL_hapticlist_item *
OpenHapticByDevId(SDL_Haptic *haptic, int device_id)
{
return OpenHaptic (haptic, HapticByDevId(device_id));
}
int
SDL_SYS_HapticOpen(SDL_Haptic *haptic)
{
return (OpenHapticByOrder(haptic, haptic->index) == NULL ? -1 : 0);
}
int
SDL_SYS_HapticMouse(void)
{
return 0;
}
int
SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick)
{
SDL_hapticlist_item *item;
item = HapticByDevId(((joystick_hwdata *)joystick->hwdata)->device_id);
return (item != NULL) ? 1 : 0;
}
int
SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
{
return (OpenHapticByDevId(haptic, ((joystick_hwdata *)joystick->hwdata)->device_id) == NULL ? -1 : 0);
}
int
SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
return (((SDL_hapticlist_item *)haptic->hwdata)->device_id == ((joystick_hwdata *)joystick->hwdata)->device_id ? 1 : 0);
}
void
SDL_SYS_HapticClose(SDL_Haptic * haptic)
{
((SDL_hapticlist_item *)haptic->hwdata)->haptic = NULL;
haptic->hwdata = NULL;
return;
}
void
SDL_SYS_HapticQuit(void)
{
/* We don't have any way to scan for joysticks (and their vibrators) at init, so don't wipe the list
* of joysticks here in case this is a reinit.
*/
#if 0
SDL_hapticlist_item *item = NULL;
SDL_hapticlist_item *next = NULL;
for (item = SDL_hapticlist; item; item = next) {
next = item->next;
SDL_free(item);
}
SDL_hapticlist = SDL_hapticlist_tail = NULL;
numhaptics = 0;
return;
#endif
}
int
SDL_SYS_HapticNewEffect(SDL_Haptic * haptic,
struct haptic_effect *effect, SDL_HapticEffect * base)
{
return 0;
}
int
SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
struct haptic_effect *effect,
SDL_HapticEffect * data)
{
return 0;
}
int
SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
Uint32 iterations)
{
float large = effect->effect.leftright.large_magnitude / 32767.0f;
float small = effect->effect.leftright.small_magnitude / 32767.0f;
float total = (large * 0.6f) + (small * 0.4f);
Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, total, effect->effect.leftright.length);
return 0;
}
int
SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
{
Android_JNI_HapticStop (((SDL_hapticlist_item *)haptic->hwdata)->device_id);
return 0;
}
void
SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
{
return;
}
int
SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
struct haptic_effect *effect)
{
return 0;
}
int
SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
{
return 0;
}
int
SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
{
return 0;
}
int
SDL_SYS_HapticPause(SDL_Haptic * haptic)
{
return 0;
}
int
SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
{
return 0;
}
int
SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
{
return 0;
}
int
Android_AddHaptic(int device_id, const char *name)
{
SDL_hapticlist_item *item;
item = (SDL_hapticlist_item *) SDL_calloc(1, sizeof (SDL_hapticlist_item));
if (item == NULL) {
return -1;
}
item->device_id = device_id;
item->name = SDL_strdup (name);
if (item->name == NULL) {
SDL_free (item);
return -1;
}
if (SDL_hapticlist_tail == NULL) {
SDL_hapticlist = SDL_hapticlist_tail = item;
} else {
SDL_hapticlist_tail->next = item;
SDL_hapticlist_tail = item;
}
++numhaptics;
return numhaptics;
}
int
Android_RemoveHaptic(int device_id)
{
SDL_hapticlist_item *item;
SDL_hapticlist_item *prev = NULL;
for (item = SDL_hapticlist; item != NULL; item = item->next) {
/* found it, remove it. */
if (device_id == item->device_id) {
const int retval = item->haptic ? item->haptic->index : -1;
if (prev != NULL) {
prev->next = item->next;
} else {
SDL_assert(SDL_hapticlist == item);
SDL_hapticlist = item->next;
}
if (item == SDL_hapticlist_tail) {
SDL_hapticlist_tail = prev;
}
/* Need to decrement the haptic count */
--numhaptics;
/* !!! TODO: Send a haptic remove event? */
SDL_free(item->name);
SDL_free(item);
return retval;
}
prev = item;
}
return -1;
}
#endif /* SDL_HAPTIC_ANDROID */
/* vi: set ts=4 sw=4 expandtab: */
| YifuLiu/AliOS-Things | components/SDL2/src/haptic/android/SDL_syshaptic.c | C | apache-2.0 | 8,653 |
#include "SDL_config.h"
#ifdef SDL_HAPTIC_ANDROID
extern int Android_AddHaptic(int device_id, const char *name);
extern int Android_RemoveHaptic(int device_id);
#endif /* SDL_HAPTIC_ANDROID */
/* vi: set ts=4 sw=4 expandtab: */
| YifuLiu/AliOS-Things | components/SDL2/src/haptic/android/SDL_syshaptic_c.h | C | apache-2.0 | 234 |
/*
Simple DirectMedia Layer
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifdef SDL_HAPTIC_IOKIT
#include "SDL_assert.h"
#include "SDL_stdinc.h"
#include "SDL_haptic.h"
#include "../SDL_syshaptic.h"
#include "SDL_joystick.h"
#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
#include "../../joystick/darwin/SDL_sysjoystick_c.h" /* For joystick hwdata */
#include "SDL_syshaptic_c.h"
#include <IOKit/IOKitLib.h>
#include <IOKit/hid/IOHIDKeys.h>
#include <IOKit/hid/IOHIDUsageTables.h>
#include <ForceFeedback/ForceFeedback.h>
#include <ForceFeedback/ForceFeedbackConstants.h>
#ifndef IO_OBJECT_NULL
#define IO_OBJECT_NULL ((io_service_t)0)
#endif
/*
* List of available haptic devices.
*/
typedef struct SDL_hapticlist_item
{
char name[256]; /* Name of the device. */
io_service_t dev; /* Node we use to create the device. */
SDL_Haptic *haptic; /* Haptic currently associated with it. */
/* Usage pages for determining if it's a mouse or not. */
long usage;
long usagePage;
struct SDL_hapticlist_item *next;
} SDL_hapticlist_item;
/*
* Haptic system hardware data.
*/
struct haptic_hwdata
{
FFDeviceObjectReference device; /* Hardware device. */
UInt8 axes[3];
};
/*
* Haptic system effect data.
*/
struct haptic_hweffect
{
FFEffectObjectReference ref; /* Reference. */
struct FFEFFECT effect; /* Hardware effect. */
};
/*
* Prototypes.
*/
static void SDL_SYS_HapticFreeFFEFFECT(FFEFFECT * effect, int type);
static int HIDGetDeviceProduct(io_service_t dev, char *name);
static SDL_hapticlist_item *SDL_hapticlist = NULL;
static SDL_hapticlist_item *SDL_hapticlist_tail = NULL;
static int numhaptics = -1;
/*
* Like strerror but for force feedback errors.
*/
static const char *
FFStrError(unsigned int err)
{
switch (err) {
case FFERR_DEVICEFULL:
return "device full";
/* This should be valid, but for some reason isn't defined... */
/* case FFERR_DEVICENOTREG:
return "device not registered"; */
case FFERR_DEVICEPAUSED:
return "device paused";
case FFERR_DEVICERELEASED:
return "device released";
case FFERR_EFFECTPLAYING:
return "effect playing";
case FFERR_EFFECTTYPEMISMATCH:
return "effect type mismatch";
case FFERR_EFFECTTYPENOTSUPPORTED:
return "effect type not supported";
case FFERR_GENERIC:
return "undetermined error";
case FFERR_HASEFFECTS:
return "device has effects";
case FFERR_INCOMPLETEEFFECT:
return "incomplete effect";
case FFERR_INTERNAL:
return "internal fault";
case FFERR_INVALIDDOWNLOADID:
return "invalid download id";
case FFERR_INVALIDPARAM:
return "invalid parameter";
case FFERR_MOREDATA:
return "more data";
case FFERR_NOINTERFACE:
return "interface not supported";
case FFERR_NOTDOWNLOADED:
return "effect is not downloaded";
case FFERR_NOTINITIALIZED:
return "object has not been initialized";
case FFERR_OUTOFMEMORY:
return "out of memory";
case FFERR_UNPLUGGED:
return "device is unplugged";
case FFERR_UNSUPPORTED:
return "function call unsupported";
case FFERR_UNSUPPORTEDAXIS:
return "axis unsupported";
default:
return "unknown error";
}
}
/*
* Initializes the haptic subsystem.
*/
int
SDL_SYS_HapticInit(void)
{
IOReturn result;
io_iterator_t iter;
CFDictionaryRef match;
io_service_t device;
if (numhaptics != -1) {
return SDL_SetError("Haptic subsystem already initialized!");
}
numhaptics = 0;
/* Get HID devices. */
match = IOServiceMatching(kIOHIDDeviceKey);
if (match == NULL) {
return SDL_SetError("Haptic: Failed to get IOServiceMatching.");
}
/* Now search I/O Registry for matching devices. */
result = IOServiceGetMatchingServices(kIOMasterPortDefault, match, &iter);
if (result != kIOReturnSuccess) {
return SDL_SetError("Haptic: Couldn't create a HID object iterator.");
}
/* IOServiceGetMatchingServices consumes dictionary. */
if (!IOIteratorIsValid(iter)) { /* No iterator. */
return 0;
}
while ((device = IOIteratorNext(iter)) != IO_OBJECT_NULL) {
MacHaptic_MaybeAddDevice(device);
/* always release as the AddDevice will retain IF it's a forcefeedback device */
IOObjectRelease(device);
}
IOObjectRelease(iter);
return numhaptics;
}
int
SDL_SYS_NumHaptics(void)
{
return numhaptics;
}
static SDL_hapticlist_item *
HapticByDevIndex(int device_index)
{
SDL_hapticlist_item *item = SDL_hapticlist;
if ((device_index < 0) || (device_index >= numhaptics)) {
return NULL;
}
while (device_index > 0) {
SDL_assert(item != NULL);
--device_index;
item = item->next;
}
return item;
}
int
MacHaptic_MaybeAddDevice( io_object_t device )
{
IOReturn result;
CFMutableDictionaryRef hidProperties;
CFTypeRef refCF;
SDL_hapticlist_item *item;
if (numhaptics == -1) {
return -1; /* not initialized. We'll pick these up on enumeration if we init later. */
}
/* Check for force feedback. */
if (FFIsForceFeedback(device) != FF_OK) {
return -1;
}
/* Make sure we don't already have it */
for (item = SDL_hapticlist; item ; item = item->next)
{
if (IOObjectIsEqualTo((io_object_t) item->dev, device)) {
/* Already added */
return -1;
}
}
item = (SDL_hapticlist_item *)SDL_calloc(1, sizeof(SDL_hapticlist_item));
if (item == NULL) {
return SDL_SetError("Could not allocate haptic storage");
}
/* retain it as we are going to keep it around a while */
IOObjectRetain(device);
/* Set basic device data. */
HIDGetDeviceProduct(device, item->name);
item->dev = device;
/* Set usage pages. */
hidProperties = 0;
refCF = 0;
result = IORegistryEntryCreateCFProperties(device,
&hidProperties,
kCFAllocatorDefault,
kNilOptions);
if ((result == KERN_SUCCESS) && hidProperties) {
refCF = CFDictionaryGetValue(hidProperties,
CFSTR(kIOHIDPrimaryUsagePageKey));
if (refCF) {
if (!CFNumberGetValue(refCF, kCFNumberLongType, &item->usagePage)) {
SDL_SetError("Haptic: Receiving device's usage page.");
}
refCF = CFDictionaryGetValue(hidProperties,
CFSTR(kIOHIDPrimaryUsageKey));
if (refCF) {
if (!CFNumberGetValue(refCF, kCFNumberLongType, &item->usage)) {
SDL_SetError("Haptic: Receiving device's usage.");
}
}
}
CFRelease(hidProperties);
}
if (SDL_hapticlist_tail == NULL) {
SDL_hapticlist = SDL_hapticlist_tail = item;
} else {
SDL_hapticlist_tail->next = item;
SDL_hapticlist_tail = item;
}
/* Device has been added. */
++numhaptics;
return numhaptics;
}
int
MacHaptic_MaybeRemoveDevice( io_object_t device )
{
SDL_hapticlist_item *item;
SDL_hapticlist_item *prev = NULL;
if (numhaptics == -1) {
return -1; /* not initialized. ignore this. */
}
for (item = SDL_hapticlist; item != NULL; item = item->next) {
/* found it, remove it. */
if (IOObjectIsEqualTo((io_object_t) item->dev, device)) {
const int retval = item->haptic ? item->haptic->index : -1;
if (prev != NULL) {
prev->next = item->next;
} else {
SDL_assert(SDL_hapticlist == item);
SDL_hapticlist = item->next;
}
if (item == SDL_hapticlist_tail) {
SDL_hapticlist_tail = prev;
}
/* Need to decrement the haptic count */
--numhaptics;
/* !!! TODO: Send a haptic remove event? */
IOObjectRelease(item->dev);
SDL_free(item);
return retval;
}
prev = item;
}
return -1;
}
/*
* Return the name of a haptic device, does not need to be opened.
*/
const char *
SDL_SYS_HapticName(int index)
{
SDL_hapticlist_item *item;
item = HapticByDevIndex(index);
return item->name;
}
/*
* Gets the device's product name.
*/
static int
HIDGetDeviceProduct(io_service_t dev, char *name)
{
CFMutableDictionaryRef hidProperties, usbProperties;
io_registry_entry_t parent1, parent2;
kern_return_t ret;
hidProperties = usbProperties = 0;
ret = IORegistryEntryCreateCFProperties(dev, &hidProperties,
kCFAllocatorDefault, kNilOptions);
if ((ret != KERN_SUCCESS) || !hidProperties) {
return SDL_SetError("Haptic: Unable to create CFProperties.");
}
/* Mac OS X currently is not mirroring all USB properties to HID page so need to look at USB device page also
* get dictionary for USB properties: step up two levels and get CF dictionary for USB properties
*/
if ((KERN_SUCCESS ==
IORegistryEntryGetParentEntry(dev, kIOServicePlane, &parent1))
&& (KERN_SUCCESS ==
IORegistryEntryGetParentEntry(parent1, kIOServicePlane, &parent2))
&& (KERN_SUCCESS ==
IORegistryEntryCreateCFProperties(parent2, &usbProperties,
kCFAllocatorDefault,
kNilOptions))) {
if (usbProperties) {
CFTypeRef refCF = 0;
/* get device info
* try hid dictionary first, if fail then go to USB dictionary
*/
/* Get product name */
refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDProductKey));
if (!refCF) {
refCF = CFDictionaryGetValue(usbProperties,
CFSTR("USB Product Name"));
}
if (refCF) {
if (!CFStringGetCString(refCF, name, 256,
CFStringGetSystemEncoding())) {
return SDL_SetError("Haptic: CFStringGetCString error retrieving pDevice->product.");
}
}
CFRelease(usbProperties);
} else {
return SDL_SetError("Haptic: IORegistryEntryCreateCFProperties failed to create usbProperties.");
}
/* Release stuff. */
if (kIOReturnSuccess != IOObjectRelease(parent2)) {
SDL_SetError("Haptic: IOObjectRelease error with parent2.");
}
if (kIOReturnSuccess != IOObjectRelease(parent1)) {
SDL_SetError("Haptic: IOObjectRelease error with parent1.");
}
} else {
return SDL_SetError("Haptic: Error getting registry entries.");
}
return 0;
}
#define FF_TEST(ff, s) \
if (features.supportedEffects & (ff)) supported |= (s)
/*
* Gets supported features.
*/
static unsigned int
GetSupportedFeatures(SDL_Haptic * haptic)
{
HRESULT ret;
FFDeviceObjectReference device;
FFCAPABILITIES features;
unsigned int supported;
Uint32 val;
device = haptic->hwdata->device;
ret = FFDeviceGetForceFeedbackCapabilities(device, &features);
if (ret != FF_OK) {
return SDL_SetError("Haptic: Unable to get device's supported features.");
}
supported = 0;
/* Get maximum effects. */
haptic->neffects = features.storageCapacity;
haptic->nplaying = features.playbackCapacity;
/* Test for effects. */
FF_TEST(FFCAP_ET_CONSTANTFORCE, SDL_HAPTIC_CONSTANT);
FF_TEST(FFCAP_ET_RAMPFORCE, SDL_HAPTIC_RAMP);
/* !!! FIXME: put this back when we have more bits in 2.1 */
/* FF_TEST(FFCAP_ET_SQUARE, SDL_HAPTIC_SQUARE); */
FF_TEST(FFCAP_ET_SINE, SDL_HAPTIC_SINE);
FF_TEST(FFCAP_ET_TRIANGLE, SDL_HAPTIC_TRIANGLE);
FF_TEST(FFCAP_ET_SAWTOOTHUP, SDL_HAPTIC_SAWTOOTHUP);
FF_TEST(FFCAP_ET_SAWTOOTHDOWN, SDL_HAPTIC_SAWTOOTHDOWN);
FF_TEST(FFCAP_ET_SPRING, SDL_HAPTIC_SPRING);
FF_TEST(FFCAP_ET_DAMPER, SDL_HAPTIC_DAMPER);
FF_TEST(FFCAP_ET_INERTIA, SDL_HAPTIC_INERTIA);
FF_TEST(FFCAP_ET_FRICTION, SDL_HAPTIC_FRICTION);
FF_TEST(FFCAP_ET_CUSTOMFORCE, SDL_HAPTIC_CUSTOM);
/* Check if supports gain. */
ret = FFDeviceGetForceFeedbackProperty(device, FFPROP_FFGAIN,
&val, sizeof(val));
if (ret == FF_OK) {
supported |= SDL_HAPTIC_GAIN;
} else if (ret != FFERR_UNSUPPORTED) {
return SDL_SetError("Haptic: Unable to get if device supports gain: %s.",
FFStrError(ret));
}
/* Checks if supports autocenter. */
ret = FFDeviceGetForceFeedbackProperty(device, FFPROP_AUTOCENTER,
&val, sizeof(val));
if (ret == FF_OK) {
supported |= SDL_HAPTIC_AUTOCENTER;
} else if (ret != FFERR_UNSUPPORTED) {
return SDL_SetError
("Haptic: Unable to get if device supports autocenter: %s.",
FFStrError(ret));
}
/* Check for axes, we have an artificial limit on axes */
haptic->naxes = ((features.numFfAxes) > 3) ? 3 : features.numFfAxes;
/* Actually store the axes we want to use */
SDL_memcpy(haptic->hwdata->axes, features.ffAxes,
haptic->naxes * sizeof(Uint8));
/* Always supported features. */
supported |= SDL_HAPTIC_STATUS | SDL_HAPTIC_PAUSE;
haptic->supported = supported;
return 0;
}
/*
* Opens the haptic device from the file descriptor.
*/
static int
SDL_SYS_HapticOpenFromService(SDL_Haptic * haptic, io_service_t service)
{
HRESULT ret;
int ret2;
/* Allocate the hwdata */
haptic->hwdata = (struct haptic_hwdata *)
SDL_malloc(sizeof(*haptic->hwdata));
if (haptic->hwdata == NULL) {
SDL_OutOfMemory();
goto creat_err;
}
SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata));
/* Open the device */
ret = FFCreateDevice(service, &haptic->hwdata->device);
if (ret != FF_OK) {
SDL_SetError("Haptic: Unable to create device from service: %s.",
FFStrError(ret));
goto creat_err;
}
/* Get supported features. */
ret2 = GetSupportedFeatures(haptic);
if (ret2 < 0) {
goto open_err;
}
/* Reset and then enable actuators. */
ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
FFSFFC_RESET);
if (ret != FF_OK) {
SDL_SetError("Haptic: Unable to reset device: %s.", FFStrError(ret));
goto open_err;
}
ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
FFSFFC_SETACTUATORSON);
if (ret != FF_OK) {
SDL_SetError("Haptic: Unable to enable actuators: %s.",
FFStrError(ret));
goto open_err;
}
/* Allocate effects memory. */
haptic->effects = (struct haptic_effect *)
SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
if (haptic->effects == NULL) {
SDL_OutOfMemory();
goto open_err;
}
/* Clear the memory */
SDL_memset(haptic->effects, 0,
sizeof(struct haptic_effect) * haptic->neffects);
return 0;
/* Error handling */
open_err:
FFReleaseDevice(haptic->hwdata->device);
creat_err:
if (haptic->hwdata != NULL) {
SDL_free(haptic->hwdata);
haptic->hwdata = NULL;
}
return -1;
}
/*
* Opens a haptic device for usage.
*/
int
SDL_SYS_HapticOpen(SDL_Haptic * haptic)
{
SDL_hapticlist_item *item;
item = HapticByDevIndex(haptic->index);
return SDL_SYS_HapticOpenFromService(haptic, item->dev);
}
/*
* Opens a haptic device from first mouse it finds for usage.
*/
int
SDL_SYS_HapticMouse(void)
{
int device_index = 0;
SDL_hapticlist_item *item;
for (item = SDL_hapticlist; item; item = item->next) {
if ((item->usagePage == kHIDPage_GenericDesktop) &&
(item->usage == kHIDUsage_GD_Mouse)) {
return device_index;
}
++device_index;
}
return -1;
}
/*
* Checks to see if a joystick has haptic features.
*/
int
SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
{
#ifdef SDL_JOYSTICK_IOKIT
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
return SDL_FALSE;
}
if (joystick->hwdata->ffservice != 0) {
return SDL_TRUE;
}
#endif
return SDL_FALSE;
}
/*
* Checks to see if the haptic device and joystick are in reality the same.
*/
int
SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
#ifdef SDL_JOYSTICK_IOKIT
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
return 0;
}
if (IOObjectIsEqualTo((io_object_t) ((size_t)haptic->hwdata->device),
joystick->hwdata->ffservice)) {
return 1;
}
#endif
return 0;
}
/*
* Opens a SDL_Haptic from a SDL_Joystick.
*/
int
SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
#ifdef SDL_JOYSTICK_IOKIT
int device_index = 0;
SDL_hapticlist_item *item;
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
return -1;
}
for (item = SDL_hapticlist; item; item = item->next) {
if (IOObjectIsEqualTo((io_object_t) item->dev,
joystick->hwdata->ffservice)) {
haptic->index = device_index;
break;
}
++device_index;
}
return SDL_SYS_HapticOpenFromService(haptic, joystick->hwdata->ffservice);
#else
return -1;
#endif
}
/*
* Closes the haptic device.
*/
void
SDL_SYS_HapticClose(SDL_Haptic * haptic)
{
if (haptic->hwdata) {
/* Free Effects. */
SDL_free(haptic->effects);
haptic->effects = NULL;
haptic->neffects = 0;
/* Clean up */
FFReleaseDevice(haptic->hwdata->device);
/* Free */
SDL_free(haptic->hwdata);
haptic->hwdata = NULL;
}
}
/*
* Clean up after system specific haptic stuff
*/
void
SDL_SYS_HapticQuit(void)
{
SDL_hapticlist_item *item;
SDL_hapticlist_item *next = NULL;
for (item = SDL_hapticlist; item; item = next) {
next = item->next;
/* Opened and not closed haptics are leaked, this is on purpose.
* Close your haptic devices after usage. */
/* Free the io_service_t */
IOObjectRelease(item->dev);
SDL_free(item);
}
numhaptics = -1;
SDL_hapticlist = NULL;
SDL_hapticlist_tail = NULL;
}
/*
* Converts an SDL trigger button to an FFEFFECT trigger button.
*/
static DWORD
FFGetTriggerButton(Uint16 button)
{
DWORD dwTriggerButton;
dwTriggerButton = FFEB_NOTRIGGER;
if (button != 0) {
dwTriggerButton = FFJOFS_BUTTON(button - 1);
}
return dwTriggerButton;
}
/*
* Sets the direction.
*/
static int
SDL_SYS_SetDirection(FFEFFECT * effect, SDL_HapticDirection * dir, int naxes)
{
LONG *rglDir;
/* Handle no axes a part. */
if (naxes == 0) {
effect->dwFlags |= FFEFF_SPHERICAL; /* Set as default. */
effect->rglDirection = NULL;
return 0;
}
/* Has axes. */
rglDir = SDL_malloc(sizeof(LONG) * naxes);
if (rglDir == NULL) {
return SDL_OutOfMemory();
}
SDL_memset(rglDir, 0, sizeof(LONG) * naxes);
effect->rglDirection = rglDir;
switch (dir->type) {
case SDL_HAPTIC_POLAR:
effect->dwFlags |= FFEFF_POLAR;
rglDir[0] = dir->dir[0];
return 0;
case SDL_HAPTIC_CARTESIAN:
effect->dwFlags |= FFEFF_CARTESIAN;
rglDir[0] = dir->dir[0];
if (naxes > 1) {
rglDir[1] = dir->dir[1];
}
if (naxes > 2) {
rglDir[2] = dir->dir[2];
}
return 0;
case SDL_HAPTIC_SPHERICAL:
effect->dwFlags |= FFEFF_SPHERICAL;
rglDir[0] = dir->dir[0];
if (naxes > 1) {
rglDir[1] = dir->dir[1];
}
if (naxes > 2) {
rglDir[2] = dir->dir[2];
}
return 0;
case SDL_HAPTIC_STEERING_AXIS:
effect->dwFlags |= FFEFF_CARTESIAN;
rglDir[0] = 0;
return 0;
default:
return SDL_SetError("Haptic: Unknown direction type.");
}
}
/* Clamps and converts. */
#define CCONVERT(x) (((x) > 0x7FFF) ? 10000 : ((x)*10000) / 0x7FFF)
/* Just converts. */
#define CONVERT(x) (((x)*10000) / 0x7FFF)
/*
* Creates the FFEFFECT from a SDL_HapticEffect.
*/
static int
SDL_SYS_ToFFEFFECT(SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src)
{
int i;
FFCONSTANTFORCE *constant = NULL;
FFPERIODIC *periodic = NULL;
FFCONDITION *condition = NULL; /* Actually an array of conditions - one per axis. */
FFRAMPFORCE *ramp = NULL;
FFCUSTOMFORCE *custom = NULL;
FFENVELOPE *envelope = NULL;
SDL_HapticConstant *hap_constant = NULL;
SDL_HapticPeriodic *hap_periodic = NULL;
SDL_HapticCondition *hap_condition = NULL;
SDL_HapticRamp *hap_ramp = NULL;
SDL_HapticCustom *hap_custom = NULL;
DWORD *axes = NULL;
/* Set global stuff. */
SDL_memset(dest, 0, sizeof(FFEFFECT));
dest->dwSize = sizeof(FFEFFECT); /* Set the structure size. */
dest->dwSamplePeriod = 0; /* Not used by us. */
dest->dwGain = 10000; /* Gain is set globally, not locally. */
dest->dwFlags = FFEFF_OBJECTOFFSETS; /* Seems obligatory. */
/* Envelope. */
envelope = SDL_malloc(sizeof(FFENVELOPE));
if (envelope == NULL) {
return SDL_OutOfMemory();
}
SDL_memset(envelope, 0, sizeof(FFENVELOPE));
dest->lpEnvelope = envelope;
envelope->dwSize = sizeof(FFENVELOPE); /* Always should be this. */
/* Axes. */
if (src->constant.direction.type == SDL_HAPTIC_STEERING_AXIS) {
dest->cAxes = 1;
} else {
dest->cAxes = haptic->naxes;
}
if (dest->cAxes > 0) {
axes = SDL_malloc(sizeof(DWORD) * dest->cAxes);
if (axes == NULL) {
return SDL_OutOfMemory();
}
axes[0] = haptic->hwdata->axes[0]; /* Always at least one axis. */
if (dest->cAxes > 1) {
axes[1] = haptic->hwdata->axes[1];
}
if (dest->cAxes > 2) {
axes[2] = haptic->hwdata->axes[2];
}
dest->rgdwAxes = axes;
}
/* The big type handling switch, even bigger then Linux's version. */
switch (src->type) {
case SDL_HAPTIC_CONSTANT:
hap_constant = &src->constant;
constant = SDL_malloc(sizeof(FFCONSTANTFORCE));
if (constant == NULL) {
return SDL_OutOfMemory();
}
SDL_memset(constant, 0, sizeof(FFCONSTANTFORCE));
/* Specifics */
constant->lMagnitude = CONVERT(hap_constant->level);
dest->cbTypeSpecificParams = sizeof(FFCONSTANTFORCE);
dest->lpvTypeSpecificParams = constant;
/* Generics */
dest->dwDuration = hap_constant->length * 1000; /* In microseconds. */
dest->dwTriggerButton = FFGetTriggerButton(hap_constant->button);
dest->dwTriggerRepeatInterval = hap_constant->interval;
dest->dwStartDelay = hap_constant->delay * 1000; /* In microseconds. */
/* Direction. */
if (SDL_SYS_SetDirection(dest, &hap_constant->direction, dest->cAxes)
< 0) {
return -1;
}
/* Envelope */
if ((hap_constant->attack_length == 0)
&& (hap_constant->fade_length == 0)) {
SDL_free(envelope);
dest->lpEnvelope = NULL;
} else {
envelope->dwAttackLevel = CCONVERT(hap_constant->attack_level);
envelope->dwAttackTime = hap_constant->attack_length * 1000;
envelope->dwFadeLevel = CCONVERT(hap_constant->fade_level);
envelope->dwFadeTime = hap_constant->fade_length * 1000;
}
break;
case SDL_HAPTIC_SINE:
/* !!! FIXME: put this back when we have more bits in 2.1 */
/* case SDL_HAPTIC_SQUARE: */
case SDL_HAPTIC_TRIANGLE:
case SDL_HAPTIC_SAWTOOTHUP:
case SDL_HAPTIC_SAWTOOTHDOWN:
hap_periodic = &src->periodic;
periodic = SDL_malloc(sizeof(FFPERIODIC));
if (periodic == NULL) {
return SDL_OutOfMemory();
}
SDL_memset(periodic, 0, sizeof(FFPERIODIC));
/* Specifics */
periodic->dwMagnitude = CONVERT(SDL_abs(hap_periodic->magnitude));
periodic->lOffset = CONVERT(hap_periodic->offset);
periodic->dwPhase =
(hap_periodic->phase + (hap_periodic->magnitude < 0 ? 18000 : 0)) % 36000;
periodic->dwPeriod = hap_periodic->period * 1000;
dest->cbTypeSpecificParams = sizeof(FFPERIODIC);
dest->lpvTypeSpecificParams = periodic;
/* Generics */
dest->dwDuration = hap_periodic->length * 1000; /* In microseconds. */
dest->dwTriggerButton = FFGetTriggerButton(hap_periodic->button);
dest->dwTriggerRepeatInterval = hap_periodic->interval;
dest->dwStartDelay = hap_periodic->delay * 1000; /* In microseconds. */
/* Direction. */
if (SDL_SYS_SetDirection(dest, &hap_periodic->direction, dest->cAxes)
< 0) {
return -1;
}
/* Envelope */
if ((hap_periodic->attack_length == 0)
&& (hap_periodic->fade_length == 0)) {
SDL_free(envelope);
dest->lpEnvelope = NULL;
} else {
envelope->dwAttackLevel = CCONVERT(hap_periodic->attack_level);
envelope->dwAttackTime = hap_periodic->attack_length * 1000;
envelope->dwFadeLevel = CCONVERT(hap_periodic->fade_level);
envelope->dwFadeTime = hap_periodic->fade_length * 1000;
}
break;
case SDL_HAPTIC_SPRING:
case SDL_HAPTIC_DAMPER:
case SDL_HAPTIC_INERTIA:
case SDL_HAPTIC_FRICTION:
hap_condition = &src->condition;
if (dest->cAxes > 0) {
condition = SDL_malloc(sizeof(FFCONDITION) * dest->cAxes);
if (condition == NULL) {
return SDL_OutOfMemory();
}
SDL_memset(condition, 0, sizeof(FFCONDITION));
/* Specifics */
for (i = 0; i < dest->cAxes; i++) {
condition[i].lOffset = CONVERT(hap_condition->center[i]);
condition[i].lPositiveCoefficient =
CONVERT(hap_condition->right_coeff[i]);
condition[i].lNegativeCoefficient =
CONVERT(hap_condition->left_coeff[i]);
condition[i].dwPositiveSaturation =
CCONVERT(hap_condition->right_sat[i] / 2);
condition[i].dwNegativeSaturation =
CCONVERT(hap_condition->left_sat[i] / 2);
condition[i].lDeadBand = CCONVERT(hap_condition->deadband[i] / 2);
}
}
dest->cbTypeSpecificParams = sizeof(FFCONDITION) * dest->cAxes;
dest->lpvTypeSpecificParams = condition;
/* Generics */
dest->dwDuration = hap_condition->length * 1000; /* In microseconds. */
dest->dwTriggerButton = FFGetTriggerButton(hap_condition->button);
dest->dwTriggerRepeatInterval = hap_condition->interval;
dest->dwStartDelay = hap_condition->delay * 1000; /* In microseconds. */
/* Direction. */
if (SDL_SYS_SetDirection(dest, &hap_condition->direction, dest->cAxes)
< 0) {
return -1;
}
/* Envelope - Not actually supported by most CONDITION implementations. */
SDL_free(dest->lpEnvelope);
dest->lpEnvelope = NULL;
break;
case SDL_HAPTIC_RAMP:
hap_ramp = &src->ramp;
ramp = SDL_malloc(sizeof(FFRAMPFORCE));
if (ramp == NULL) {
return SDL_OutOfMemory();
}
SDL_memset(ramp, 0, sizeof(FFRAMPFORCE));
/* Specifics */
ramp->lStart = CONVERT(hap_ramp->start);
ramp->lEnd = CONVERT(hap_ramp->end);
dest->cbTypeSpecificParams = sizeof(FFRAMPFORCE);
dest->lpvTypeSpecificParams = ramp;
/* Generics */
dest->dwDuration = hap_ramp->length * 1000; /* In microseconds. */
dest->dwTriggerButton = FFGetTriggerButton(hap_ramp->button);
dest->dwTriggerRepeatInterval = hap_ramp->interval;
dest->dwStartDelay = hap_ramp->delay * 1000; /* In microseconds. */
/* Direction. */
if (SDL_SYS_SetDirection(dest, &hap_ramp->direction, dest->cAxes) < 0) {
return -1;
}
/* Envelope */
if ((hap_ramp->attack_length == 0) && (hap_ramp->fade_length == 0)) {
SDL_free(envelope);
dest->lpEnvelope = NULL;
} else {
envelope->dwAttackLevel = CCONVERT(hap_ramp->attack_level);
envelope->dwAttackTime = hap_ramp->attack_length * 1000;
envelope->dwFadeLevel = CCONVERT(hap_ramp->fade_level);
envelope->dwFadeTime = hap_ramp->fade_length * 1000;
}
break;
case SDL_HAPTIC_CUSTOM:
hap_custom = &src->custom;
custom = SDL_malloc(sizeof(FFCUSTOMFORCE));
if (custom == NULL) {
return SDL_OutOfMemory();
}
SDL_memset(custom, 0, sizeof(FFCUSTOMFORCE));
/* Specifics */
custom->cChannels = hap_custom->channels;
custom->dwSamplePeriod = hap_custom->period * 1000;
custom->cSamples = hap_custom->samples;
custom->rglForceData =
SDL_malloc(sizeof(LONG) * custom->cSamples * custom->cChannels);
for (i = 0; i < hap_custom->samples * hap_custom->channels; i++) { /* Copy data. */
custom->rglForceData[i] = CCONVERT(hap_custom->data[i]);
}
dest->cbTypeSpecificParams = sizeof(FFCUSTOMFORCE);
dest->lpvTypeSpecificParams = custom;
/* Generics */
dest->dwDuration = hap_custom->length * 1000; /* In microseconds. */
dest->dwTriggerButton = FFGetTriggerButton(hap_custom->button);
dest->dwTriggerRepeatInterval = hap_custom->interval;
dest->dwStartDelay = hap_custom->delay * 1000; /* In microseconds. */
/* Direction. */
if (SDL_SYS_SetDirection(dest, &hap_custom->direction, dest->cAxes) <
0) {
return -1;
}
/* Envelope */
if ((hap_custom->attack_length == 0)
&& (hap_custom->fade_length == 0)) {
SDL_free(envelope);
dest->lpEnvelope = NULL;
} else {
envelope->dwAttackLevel = CCONVERT(hap_custom->attack_level);
envelope->dwAttackTime = hap_custom->attack_length * 1000;
envelope->dwFadeLevel = CCONVERT(hap_custom->fade_level);
envelope->dwFadeTime = hap_custom->fade_length * 1000;
}
break;
default:
return SDL_SetError("Haptic: Unknown effect type.");
}
return 0;
}
/*
* Frees an FFEFFECT allocated by SDL_SYS_ToFFEFFECT.
*/
static void
SDL_SYS_HapticFreeFFEFFECT(FFEFFECT * effect, int type)
{
FFCUSTOMFORCE *custom;
SDL_free(effect->lpEnvelope);
effect->lpEnvelope = NULL;
SDL_free(effect->rgdwAxes);
effect->rgdwAxes = NULL;
if (effect->lpvTypeSpecificParams != NULL) {
if (type == SDL_HAPTIC_CUSTOM) { /* Must free the custom data. */
custom = (FFCUSTOMFORCE *) effect->lpvTypeSpecificParams;
SDL_free(custom->rglForceData);
custom->rglForceData = NULL;
}
SDL_free(effect->lpvTypeSpecificParams);
effect->lpvTypeSpecificParams = NULL;
}
SDL_free(effect->rglDirection);
effect->rglDirection = NULL;
}
/*
* Gets the effect type from the generic SDL haptic effect wrapper.
*/
CFUUIDRef
SDL_SYS_HapticEffectType(Uint16 type)
{
switch (type) {
case SDL_HAPTIC_CONSTANT:
return kFFEffectType_ConstantForce_ID;
case SDL_HAPTIC_RAMP:
return kFFEffectType_RampForce_ID;
/* !!! FIXME: put this back when we have more bits in 2.1 */
/* case SDL_HAPTIC_SQUARE:
return kFFEffectType_Square_ID; */
case SDL_HAPTIC_SINE:
return kFFEffectType_Sine_ID;
case SDL_HAPTIC_TRIANGLE:
return kFFEffectType_Triangle_ID;
case SDL_HAPTIC_SAWTOOTHUP:
return kFFEffectType_SawtoothUp_ID;
case SDL_HAPTIC_SAWTOOTHDOWN:
return kFFEffectType_SawtoothDown_ID;
case SDL_HAPTIC_SPRING:
return kFFEffectType_Spring_ID;
case SDL_HAPTIC_DAMPER:
return kFFEffectType_Damper_ID;
case SDL_HAPTIC_INERTIA:
return kFFEffectType_Inertia_ID;
case SDL_HAPTIC_FRICTION:
return kFFEffectType_Friction_ID;
case SDL_HAPTIC_CUSTOM:
return kFFEffectType_CustomForce_ID;
default:
SDL_SetError("Haptic: Unknown effect type.");
return NULL;
}
}
/*
* Creates a new haptic effect.
*/
int
SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
SDL_HapticEffect * base)
{
HRESULT ret;
CFUUIDRef type;
/* Alloc the effect. */
effect->hweffect = (struct haptic_hweffect *)
SDL_malloc(sizeof(struct haptic_hweffect));
if (effect->hweffect == NULL) {
SDL_OutOfMemory();
goto err_hweffect;
}
/* Get the type. */
type = SDL_SYS_HapticEffectType(base->type);
if (type == NULL) {
goto err_hweffect;
}
/* Get the effect. */
if (SDL_SYS_ToFFEFFECT(haptic, &effect->hweffect->effect, base) < 0) {
goto err_effectdone;
}
/* Create the actual effect. */
ret = FFDeviceCreateEffect(haptic->hwdata->device, type,
&effect->hweffect->effect,
&effect->hweffect->ref);
if (ret != FF_OK) {
SDL_SetError("Haptic: Unable to create effect: %s.", FFStrError(ret));
goto err_effectdone;
}
return 0;
err_effectdone:
SDL_SYS_HapticFreeFFEFFECT(&effect->hweffect->effect, base->type);
err_hweffect:
SDL_free(effect->hweffect);
effect->hweffect = NULL;
return -1;
}
/*
* Updates an effect.
*/
int
SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
struct haptic_effect *effect,
SDL_HapticEffect * data)
{
HRESULT ret;
FFEffectParameterFlag flags;
FFEFFECT temp;
/* Get the effect. */
SDL_memset(&temp, 0, sizeof(FFEFFECT));
if (SDL_SYS_ToFFEFFECT(haptic, &temp, data) < 0) {
goto err_update;
}
/* Set the flags. Might be worthwhile to diff temp with loaded effect and
* only change those parameters. */
flags = FFEP_DIRECTION |
FFEP_DURATION |
FFEP_ENVELOPE |
FFEP_STARTDELAY |
FFEP_TRIGGERBUTTON |
FFEP_TRIGGERREPEATINTERVAL | FFEP_TYPESPECIFICPARAMS;
/* Create the actual effect. */
ret = FFEffectSetParameters(effect->hweffect->ref, &temp, flags);
if (ret != FF_OK) {
SDL_SetError("Haptic: Unable to update effect: %s.", FFStrError(ret));
goto err_update;
}
/* Copy it over. */
SDL_SYS_HapticFreeFFEFFECT(&effect->hweffect->effect, data->type);
SDL_memcpy(&effect->hweffect->effect, &temp, sizeof(FFEFFECT));
return 0;
err_update:
SDL_SYS_HapticFreeFFEFFECT(&temp, data->type);
return -1;
}
/*
* Runs an effect.
*/
int
SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
Uint32 iterations)
{
HRESULT ret;
Uint32 iter;
/* Check if it's infinite. */
if (iterations == SDL_HAPTIC_INFINITY) {
iter = FF_INFINITE;
} else
iter = iterations;
/* Run the effect. */
ret = FFEffectStart(effect->hweffect->ref, iter, 0);
if (ret != FF_OK) {
return SDL_SetError("Haptic: Unable to run the effect: %s.",
FFStrError(ret));
}
return 0;
}
/*
* Stops an effect.
*/
int
SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
{
HRESULT ret;
ret = FFEffectStop(effect->hweffect->ref);
if (ret != FF_OK) {
return SDL_SetError("Haptic: Unable to stop the effect: %s.",
FFStrError(ret));
}
return 0;
}
/*
* Frees the effect.
*/
void
SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
{
HRESULT ret;
ret = FFDeviceReleaseEffect(haptic->hwdata->device, effect->hweffect->ref);
if (ret != FF_OK) {
SDL_SetError("Haptic: Error removing the effect from the device: %s.",
FFStrError(ret));
}
SDL_SYS_HapticFreeFFEFFECT(&effect->hweffect->effect,
effect->effect.type);
SDL_free(effect->hweffect);
effect->hweffect = NULL;
}
/*
* Gets the status of a haptic effect.
*/
int
SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic,
struct haptic_effect *effect)
{
HRESULT ret;
FFEffectStatusFlag status;
ret = FFEffectGetEffectStatus(effect->hweffect->ref, &status);
if (ret != FF_OK) {
SDL_SetError("Haptic: Unable to get effect status: %s.",
FFStrError(ret));
return -1;
}
if (status == 0) {
return SDL_FALSE;
}
return SDL_TRUE; /* Assume it's playing or emulated. */
}
/*
* Sets the gain.
*/
int
SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain)
{
HRESULT ret;
Uint32 val;
val = gain * 100; /* Mac OS X uses 0 to 10,000 */
ret = FFDeviceSetForceFeedbackProperty(haptic->hwdata->device,
FFPROP_FFGAIN, &val);
if (ret != FF_OK) {
return SDL_SetError("Haptic: Error setting gain: %s.", FFStrError(ret));
}
return 0;
}
/*
* Sets the autocentering.
*/
int
SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
{
HRESULT ret;
Uint32 val;
/* Mac OS X only has 0 (off) and 1 (on) */
if (autocenter == 0) {
val = 0;
} else {
val = 1;
}
ret = FFDeviceSetForceFeedbackProperty(haptic->hwdata->device,
FFPROP_AUTOCENTER, &val);
if (ret != FF_OK) {
return SDL_SetError("Haptic: Error setting autocenter: %s.",
FFStrError(ret));
}
return 0;
}
/*
* Pauses the device.
*/
int
SDL_SYS_HapticPause(SDL_Haptic * haptic)
{
HRESULT ret;
ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
FFSFFC_PAUSE);
if (ret != FF_OK) {
return SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret));
}
return 0;
}
/*
* Unpauses the device.
*/
int
SDL_SYS_HapticUnpause(SDL_Haptic * haptic)
{
HRESULT ret;
ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
FFSFFC_CONTINUE);
if (ret != FF_OK) {
return SDL_SetError("Haptic: Error pausing device: %s.", FFStrError(ret));
}
return 0;
}
/*
* Stops all currently playing effects.
*/
int
SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
{
HRESULT ret;
ret = FFDeviceSendForceFeedbackCommand(haptic->hwdata->device,
FFSFFC_STOPALL);
if (ret != FF_OK) {
return SDL_SetError("Haptic: Error stopping device: %s.", FFStrError(ret));
}
return 0;
}
#endif /* SDL_HAPTIC_IOKIT */
/* vi: set ts=4 sw=4 expandtab: */
| YifuLiu/AliOS-Things | components/SDL2/src/haptic/darwin/SDL_syshaptic.c | C | apache-2.0 | 40,933 |