Skip to content

Commit

Permalink
2007-05-17 Sebastien Pouliot <sebastien@ximian.com>
Browse files Browse the repository at this point in the history
	* emfcodec.c: Don't play empty but valid (e.g. recording) metafiles.
	* graphics.c: Move cairo code to graphics-cairo.c and switch functions
	between the cairo and metafile backends.
	* graphics-private.h: Add the required data for the metafile backend.
	* graphics-cairo.c: New file. Moved cairo-based stuff from graphics.c.
	* graphics-cairo-private.h: New. header to cairo graphics functions.
	* graphics-metafile.c: New. Metafile graphics recording functions.
	* graphics-metafile-private.h: New. header to metafile graphics 
	functions.
	* image.c: Allow creating GpGraphics contexts on a recording metafile.
	* metafile.c: Starting support for recording.
	* metafile-private.h: Add data/functions required for recording.
	* text.c: Move non-validation code (i.e. cairo code) into text-cairo.c
	* text.h: Add copyrights header.
	* text-cairo.c: New file. Moved cairo-based stuff from text.c.
	* text-cairo-private.h: New. header to cairo-based text functions.
	* text-metafile.c: New. Metafile-based text rendering.
	* text-metafile-private.h: New. header to metafile text functions.
	* Makefile.am: Add new files, remove old one.


svn path=/trunk/libgdiplus/; revision=77550
  • Loading branch information
Sebastien Pouliot committed May 17, 2007
2 parents 0b55f21 + 42b1266 commit a5b753e
Show file tree
Hide file tree
Showing 18 changed files with 4,161 additions and 2,372 deletions.
22 changes: 22 additions & 0 deletions src/ChangeLog
@@ -1,3 +1,25 @@
2007-05-17 Sebastien Pouliot <sebastien@ximian.com>

* emfcodec.c: Don't play empty but valid (e.g. recording) metafiles.
* graphics.c: Move cairo code to graphics-cairo.c and switch functions
between the cairo and metafile backends.
* graphics-private.h: Add the required data for the metafile backend.
* graphics-cairo.c: New file. Moved cairo-based stuff from graphics.c.
* graphics-cairo-private.h: New. header to cairo graphics functions.
* graphics-metafile.c: New. Metafile graphics recording functions.
* graphics-metafile-private.h: New. header to metafile graphics
functions.
* image.c: Allow creating GpGraphics contexts on a recording metafile.
* metafile.c: Starting support for recording.
* metafile-private.h: Add data/functions required for recording.
* text.c: Move non-validation code (i.e. cairo code) into text-cairo.c
* text.h: Add copyrights header.
* text-cairo.c: New file. Moved cairo-based stuff from text.c.
* text-cairo-private.h: New. header to cairo-based text functions.
* text-metafile.c: New. Metafile-based text rendering.
* text-metafile-private.h: New. header to metafile text functions.
* Makefile.am: Add new files, remove old one.

2007-05-15 Sebastien Pouliot <sebastien@ximian.com> 2007-05-15 Sebastien Pouliot <sebastien@ximian.com>


* graphics-private.h: Add macro to check for position overflows. * graphics-private.h: Add macro to check for position overflows.
Expand Down
9 changes: 8 additions & 1 deletion src/Makefile.am
Expand Up @@ -36,6 +36,10 @@ libgdiplus_la_SOURCES = \
general-private.h \ general-private.h \
graphics.c \ graphics.c \
graphics.h \ graphics.h \
graphics-cairo.c \
graphics-cairo-private.h \
graphics-metafile.c \
graphics-metafile-private.h \
graphics-private.h \ graphics-private.h \
graphics-path.c \ graphics-path.c \
graphics-path.h \ graphics-path.h \
Expand Down Expand Up @@ -85,7 +89,10 @@ libgdiplus_la_SOURCES = \
stringformat-private.h \ stringformat-private.h \
text.c \ text.c \
text.h \ text.h \
text-private.h \ text-cairo.c \
text-cairo-private.h \
text-metafile.c \
text-metafile-private.h \
texturebrush.c \ texturebrush.c \
texturebrush.h \ texturebrush.h \
texturebrush-private.h \ texturebrush-private.h \
Expand Down
4 changes: 4 additions & 0 deletions src/emfcodec.c
Expand Up @@ -384,6 +384,10 @@ gdip_metafile_play_emf (MetafilePlayContext *context)
#ifdef DEBUG_EMF #ifdef DEBUG_EMF
int i = 1, j; int i = 1, j;
#endif #endif
/* check for empty or recording metafile */
if (!data)
return Ok;

/* reality check - each record is, at minimum, 8 bytes long (when size == 0) */ /* reality check - each record is, at minimum, 8 bytes long (when size == 0) */
while (data < end - EMF_MIN_RECORD_SIZE) { while (data < end - EMF_MIN_RECORD_SIZE) {
/* record */ /* record */
Expand Down
111 changes: 111 additions & 0 deletions src/graphics-cairo-private.h
@@ -0,0 +1,111 @@
/*
* Copyright (C) 2007 Novell, Inc (http://www.novell.com)
*
* 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Sebastien Pouliot <sebastien@ximian.com>
*/

#ifndef __GRAPHICS_CAIRO_PRIVATE_H__
#define __GRAPHICS_CAIRO_PRIVATE_H__

#include "gdiplus-private.h"
#include "brush-private.h"
#include "matrix-private.h"

/* constant for make_ellipse */
#define C1 0.552285

/*
* Cairo use doubles almost everywhere so we can define most int-based functions to the float based one
*/
#define cairo_DrawLineI cairo_DrawLine
#define cairo_DrawPieI cairo_DrawPie
#define cairo_FillPieI cairo_FillPie
#define cairo_DrawRectangleI cairo_DrawRectangle
#define cairo_FillRectangleI cairo_FillRectangle


GpStatus cairo_DrawArc (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height, float startAngle,
float sweepAngle) GDIP_INTERNAL;
GpStatus cairo_DrawArcI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height, float startAngle,
float sweepAngle) GDIP_INTERNAL;

GpStatus cairo_DrawBezier (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2, float x3, float y3,
float x4, float y4) GDIP_INTERNAL;
GpStatus cairo_DrawBezierI (GpGraphics *graphics, GpPen *pen, int x1, int y1, int x2, int y2, int x3, int y3,
int x4, int y4) GDIP_INTERNAL;
GpStatus cairo_DrawBeziers (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL;
GpStatus cairo_DrawBeziersI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) GDIP_INTERNAL;

GpStatus cairo_DrawClosedCurve2 (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count,
float tension) GDIP_INTERNAL;
GpStatus cairo_DrawClosedCurve2I (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count,
float tension) GDIP_INTERNAL;
GpStatus cairo_FillClosedCurve2 (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count,
float tension) GDIP_INTERNAL;
GpStatus cairo_FillClosedCurve2I (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count,
float tension) GDIP_INTERNAL;
GpStatus cairo_DrawCurve3 (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPointF *points, int count, int offset,
int numOfSegments, float tension) GDIP_INTERNAL;
GpStatus cairo_DrawCurve3I (GpGraphics *graphics, GpPen* pen, GDIPCONST GpPoint *points, int count, int offset,
int numOfSegments, float tension) GDIP_INTERNAL;

GpStatus cairo_DrawEllipse (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) GDIP_INTERNAL;
GpStatus cairo_DrawEllipseI (GpGraphics *graphics, GpPen *pen, int x, int y, int width, int height) GDIP_INTERNAL;
GpStatus cairo_FillEllipse (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) GDIP_INTERNAL;
GpStatus cairo_FillEllipseI (GpGraphics *graphics, GpBrush *brush, int x, int y, int width, int height) GDIP_INTERNAL;

GpStatus cairo_DrawLine (GpGraphics *graphics, GpPen *pen, float x1, float y1, float x2, float y2) GDIP_INTERNAL;
GpStatus cairo_DrawLines (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL;
GpStatus cairo_DrawLinesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) GDIP_INTERNAL;

GpStatus cairo_DrawRectangle (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height) GDIP_INTERNAL;
GpStatus cairo_FillRectangle (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height) GDIP_INTERNAL;
GpStatus cairo_DrawRectangles (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, int count) GDIP_INTERNAL;
GpStatus cairo_DrawRectanglesI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, int count) GDIP_INTERNAL;
GpStatus cairo_FillRectangles (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRectF *rects, int count) GDIP_INTERNAL;
GpStatus cairo_FillRectanglesI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpRect *rects, int count) GDIP_INTERNAL;

GpStatus cairo_DrawPath (GpGraphics *graphics, GpPen *pen, GpPath *path) GDIP_INTERNAL;
GpStatus cairo_FillPath (GpGraphics *graphics, GpBrush *brush, GpPath *path) GDIP_INTERNAL;

GpStatus cairo_DrawPie (GpGraphics *graphics, GpPen *pen, float x, float y, float width, float height,
float startAngle, float sweepAngle) GDIP_INTERNAL;
GpStatus cairo_FillPie (GpGraphics *graphics, GpBrush *brush, float x, float y, float width, float height,
float startAngle, float sweepAngle) GDIP_INTERNAL;

GpStatus cairo_DrawPolygon (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, int count) GDIP_INTERNAL;
GpStatus cairo_DrawPolygonI (GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, int count) GDIP_INTERNAL;
GpStatus cairo_FillPolygon (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPointF *points, int count,
FillMode fillMode) GDIP_INTERNAL;
GpStatus cairo_FillPolygonI (GpGraphics *graphics, GpBrush *brush, GDIPCONST GpPoint *points, int count,
FillMode fillMode) GDIP_INTERNAL;

GpStatus cairo_FillRegion (GpGraphics *graphics, GpBrush *brush, GpRegion *region) GDIP_INTERNAL;

GpStatus cairo_GraphicsClear (GpGraphics *graphics, ARGB color) GDIP_INTERNAL;
GpStatus cairo_SetCompositingMode (GpGraphics *graphics, CompositingMode compositingMode) GDIP_INTERNAL;
GpStatus cairo_SetSmoothingMode (GpGraphics *graphics, SmoothingMode mode) GDIP_INTERNAL;

GpStatus cairo_SetGraphicsClip (GpGraphics *graphics) GDIP_INTERNAL;
GpStatus cairo_ResetClip (GpGraphics *graphics) GDIP_INTERNAL;

GpStatus cairo_ResetWorldTransform (GpGraphics *graphics) GDIP_INTERNAL;
GpStatus cairo_SetWorldTransform (GpGraphics *graphics, GpMatrix *matrix) GDIP_INTERNAL;

#endif

0 comments on commit a5b753e

Please sign in to comment.