summaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorRuss Allbery <rra@debian.org>2008-04-05 11:49:47 -0700
committerRuss Allbery <rra@debian.org>2008-04-05 11:49:47 -0700
commitfe15fa62fee6fe5e5f09e2ad6156be97e2b4f357 (patch)
treeadea8d5c43b20a8fb47f3f83d2032c2e46cb5b52 /render.c
parenta7b397b9cba0433df7783403a153767f918af350 (diff)
Imported Upstream version 0.9.0
Diffstat (limited to 'render.c')
-rw-r--r--render.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/render.c b/render.c
index 6d834b0..dda0059 100644
--- a/render.c
+++ b/render.c
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id: render.c,v 1.71 2008/01/20 23:38:08 c_anthon Exp $
+ * $Id: render.c,v 1.75 2008/03/13 18:15:34 Superfly_Jon Exp $
*/
#include "config.h"
@@ -57,7 +57,7 @@ static randctx rc;
/* aaanPositions[Clockwise][x][point number][x, y. deltay] */
int positions[ 2 ][ 30 ][ 3 ] = { {
- { BAR_X, BAR_Y_0, CHEQUER_HEIGHT }, /* bar - player 0 */
+ { BAR_X, BAR_Y_1, -CHEQUER_HEIGHT }, /* bar - player 1 */
{ POINT_X(1), TOP_POINT_Y, CHEQUER_HEIGHT },
{ POINT_X(2), TOP_POINT_Y, CHEQUER_HEIGHT },
{ POINT_X(3), TOP_POINT_Y, CHEQUER_HEIGHT },
@@ -82,7 +82,7 @@ int positions[ 2 ][ 30 ][ 3 ] = { {
{ POINT_X(22), BOT_POINT_Y, -CHEQUER_HEIGHT },
{ POINT_X(23), BOT_POINT_Y, -CHEQUER_HEIGHT },
{ POINT_X(24), BOT_POINT_Y, -CHEQUER_HEIGHT },
- { BAR_X, BAR_Y_1, -(CHEQUER_HEIGHT) }, /* bar player 1 */
+ { BAR_X, BAR_Y_0, (CHEQUER_HEIGHT) }, /* bar player 0 */
{ BEAROFF_RIGHT_X, TOP_POINT_Y, CHEQUER_WIDTH }, /* player 0 tray right */
{ BEAROFF_RIGHT_X, BOT_POINT_Y, -CHEQUER_WIDTH }, /* player 0 tray right */
{ BEAROFF_LEFT_X, TOP_POINT_Y, CHEQUER_WIDTH }, /* player 0 tray left */
@@ -2042,7 +2042,7 @@ extern void RenderCubeFaces( renderdata *prd, unsigned char *puch,
file = BuildFilename(FONT_VERA_SERIF_BOLD);
if( !FT_New_Face( ftl, file, 0, &ftf ) &&
- !FT_Set_Pixel_Sizes( ftf, 0, 4.5 * prd->nSize ) ) {
+ !FT_Set_Pixel_Sizes( ftf, 0, 3 * prd->nSize ) ) {
fFreetype = TRUE;
for( i = 0; i < 10; i++ ) {
@@ -2061,7 +2061,7 @@ extern void RenderCubeFaces( renderdata *prd, unsigned char *puch,
}
g_free(file);
#endif
-
+
for( i = 0; i < 6; i++ ) {
/* Clear destination buffer (no blending at present - so all overwriten anyway) */
memset(puch, 0, nStride * CUBE_LABEL_HEIGHT * prd->nSize);
@@ -2072,8 +2072,8 @@ extern void RenderCubeFaces( renderdata *prd, unsigned char *puch,
#if HAVE_FREETYPE
if( fFreetype )
- RenderNumber( puch, nStride, aftg, 2 << i, 3 * prd->nSize,
- 4.8 * prd->nSize, 0, 0, 0x80 );
+ RenderNumber( puch, nStride, aftg, 2 << i,
+ 2 * prd->nSize, 3 * prd->nSize, 0, 0, 0x80 );
else
#endif
RenderBasicNumber( puch, nStride, 4 * prd->nSize, 2 << i,
@@ -2092,8 +2092,8 @@ extern void RenderCubeFaces( renderdata *prd, unsigned char *puch,
#if HAVE_FREETYPE
if( fFreetype )
- RenderNumber( puch, nStride, aftgSmall, 2 << i, 3 * prd->nSize,
- 63 * prd->nSize / 16, 0, 0, 0x80 );
+ RenderNumber( puch, nStride, aftgSmall, 2 << i, 2 * prd->nSize,
+ 3 * prd->nSize, 0, 0, 0x80 );
else
#endif
RenderBasicNumber( puch, nStride, 3 * prd->nSize, 2 << i,
@@ -2125,7 +2125,7 @@ static void RenderResignFaces( renderdata *prd, unsigned char *puch,
file = BuildFilename(FONT_VERA_SERIF_BOLD);
if( !FT_New_Face( ftl, file, 0, &ftf ) &&
- !FT_Set_Pixel_Sizes( ftf, 0, 5 * prd->nSize ) ) {
+ !FT_Set_Pixel_Sizes( ftf, 0, 4 * prd->nSize ) ) {
fFreetype = TRUE;
for( i = 0; i < 10; i++ ) {
@@ -2133,7 +2133,7 @@ static void RenderResignFaces( renderdata *prd, unsigned char *puch,
FT_Get_Glyph( ftf->glyph, aftg + i );
}
- FT_Set_Pixel_Sizes( ftf, 0, 21 * prd->nSize / 8 );
+ FT_Set_Pixel_Sizes( ftf, 0, 3 * prd->nSize );
for( i = 0; i < 10; i++ ) {
FT_Load_Char( ftf, '0' + i, FT_LOAD_RENDER );
@@ -2156,8 +2156,8 @@ static void RenderResignFaces( renderdata *prd, unsigned char *puch,
#if HAVE_FREETYPE
if( fFreetype )
RenderNumber( puch, nStride, aftg, i + 1,
- 3 * prd->nSize,
- 78 * prd->nSize / 16, 0, 0, 0x80 );
+ 2 * prd->nSize,
+ 3.5 * prd->nSize, 0, 0, 0x80 );
else
#endif
RenderBasicNumber( puch, nStride, 4 * prd->nSize,
@@ -2392,7 +2392,7 @@ static void Copy_RGB_to_RGBA( unsigned char *puchDest, int nDestStride,
}
#if USE_GTK
-static void RenderArrow(unsigned char* puch, double arColour[4], int nSize, int up)
+static void RenderArrow(unsigned char* puch, double arColour[4], int nSize, int left)
{
cairo_surface_t* surface = cairo_image_surface_create_for_data (puch, CAIRO_FORMAT_RGB24,
nSize * ARROW_WIDTH,
@@ -2400,18 +2400,19 @@ static void RenderArrow(unsigned char* puch, double arColour[4], int nSize, int
nSize * ARROW_WIDTH * 4);
cairo_t* cr = cairo_create(surface);
-#define AR_LINE_WIDTH 0.01
+#define AR_LINE_WIDTH 0.02
#define AR_WIDTH 0.4
-#define AR_HEAD_SIZE 0.4
+#define AR_HEAD_SIZE 0.35
cairo_scale(cr, nSize * ARROW_WIDTH, nSize * ARROW_HEIGHT);
- if (!up)
- { /* Rotate by 180 degrees */
- cairo_translate(cr, .5, .5);
- cairo_rotate(cr, G_PI);
- cairo_translate(cr, -.5, -.5);
- }
+ /* Point arrows correct way */
+ cairo_translate(cr, .5, .5);
+ if (left)
+ cairo_rotate(cr, -G_PI / 2);
+ else
+ cairo_rotate(cr, G_PI / 2);
+ cairo_translate(cr, -.5, -.5);
cairo_set_line_width (cr, AR_LINE_WIDTH);
@@ -2438,10 +2439,10 @@ static void RenderArrow(unsigned char* puch, double arColour[4], int nSize, int
}
extern void RenderArrows( renderdata *prd, unsigned char* puch0,
- unsigned char* puch1, int nStride )
+ unsigned char* puch1, int nStride, int fClockwise )
{
- RenderArrow(puch0, prd->aarColour[0], prd->nSize, TRUE);
- RenderArrow(puch1, prd->aarColour[1], prd->nSize, FALSE);
+ RenderArrow(puch0, prd->aarColour[0], prd->nSize, fClockwise);
+ RenderArrow(puch1, prd->aarColour[1], prd->nSize, fClockwise);
}
#endif
@@ -2467,7 +2468,7 @@ static void DrawChequers( renderdata *prd, unsigned char *puch, int nStride,
int x, int y, int cx, int cy ) {
int i, c, yChequer;
- c = ( !iPoint || iPoint == 25 ) ? 3 : 5;
+ c = ( iPoint == 0 || iPoint == 25 ) ? 3 : 5;
yChequer = positions[ prd->fClockwise ][ iPoint ][ 1 ] * prd->nSize;
for( i = 0; i < n; i++ ) {
@@ -2719,11 +2720,9 @@ extern void CalculateArea( renderdata *prd, unsigned char *puch, int nStride,
if( prd->showMoveIndicator &&
intersects( x, y, cx, cy,
anArrowPosition[ 0 ], anArrowPosition[ 1 ],
- ARROW_WIDTH * prd->nSize, ARROW_HEIGHT * prd->nSize ) ) {
-
- g_assert( anArrowPosition );
-
- AlphaBlendClip2( puch, nStride,
+ ARROW_WIDTH * prd->nSize, ARROW_HEIGHT * prd->nSize ) )
+ {
+ AlphaBlendClip2( puch, nStride,
anArrowPosition[ 0 ] - x, anArrowPosition[ 1 ] - y,
cx, cy,
puch, nStride,
@@ -2732,7 +2731,7 @@ extern void CalculateArea( renderdata *prd, unsigned char *puch, int nStride,
prd->nSize * ARROW_WIDTH * 4,
0, 0,
prd->nSize * ARROW_WIDTH, prd->nSize * ARROW_HEIGHT );
- }
+ }
#endif
}
@@ -2817,7 +2816,7 @@ extern void RenderImages( renderdata *prd, renderimages *pri ) {
pri->achResign, nSize * RESIGN_WIDTH * 4 );
#if USE_GTK
if (prd->showMoveIndicator)
- RenderArrows( prd, pri->auchArrow[0], pri->auchArrow[1], nSize * ARROW_WIDTH * 4 );
+ RenderArrows( prd, pri->auchArrow[0], pri->auchArrow[1], nSize * ARROW_WIDTH * 4, prd->fClockwise );
#endif
RenderBoardLabels( prd, pri->achLabels[ 0 ], pri->achLabels[ 1 ],