Commit 33ce16d6 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

tkpath version bump (and currently a new fork until this gets merged upstream)...

tkpath version bump (and currently a new fork until this gets merged upstream) fixing scaling bug where applying scale matrix (or scaling) objects would leave artifacts since its bbox translation did not take into account transformation matrix
parent e6140898
2013-09-12 Ivica Ico Bukvic <ico@vt.edu>
* moved bbox and totalBbox to Tk_PathItem to make it visible
to Translate calls that previously failed to take into
account transforms via matrices (e.g. scale). This resulted
in artifacts left behind when translating objects with
scaling matrices applied to them (the same solves scale
calls and potentially ensuing artifacts as well)
* adapted all objects to reflect aforesaid change
* merged patch by Sean McKnight found at:
https://sourceforge.net/p/tclbitprint/patches/3/
2012-07-04 George Petasis <petasis@iit.demokritos.gr>
* generic/tkpUtil.c: Fix in the tkStateKeyObjType definistion, in
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for tkpath 0.3.2.
# Generated by GNU Autoconf 2.68 for tkpath 0.3.3.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
......@@ -557,8 +557,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='tkpath'
PACKAGE_TARNAME='tkpath'
PACKAGE_VERSION='0.3.2'
PACKAGE_STRING='tkpath 0.3.2'
PACKAGE_VERSION='0.3.3'
PACKAGE_STRING='tkpath 0.3.3'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
......@@ -1292,7 +1292,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures tkpath 0.3.2 to adapt to many kinds of systems.
\`configure' configures tkpath 0.3.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1353,7 +1353,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of tkpath 0.3.2:";;
short | recursive ) echo "Configuration of tkpath 0.3.3:";;
esac
cat <<\_ACEOF
......@@ -1457,7 +1457,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
tkpath configure 0.3.2
tkpath configure 0.3.3
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
......@@ -1914,7 +1914,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by tkpath $as_me 0.3.2, which was
It was created by tkpath $as_me 0.3.3, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
......@@ -10260,7 +10260,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by tkpath $as_me 0.3.2, which was
This file was extended by tkpath $as_me 0.3.3, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -10313,7 +10313,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
tkpath config.status 0.3.2
tkpath config.status 0.3.3
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
......
......@@ -18,7 +18,7 @@ dnl to configure the system for the local environment.
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------
AC_INIT([tkpath], [0.3.2])
AC_INIT([tkpath], [0.3.3])
#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 2005-2008 Mats Bengtsson
*
* $Id$
* $Id: path.c,v 1.39 2012/07/05 06:41:15 petasis Exp $
*/
#include "tkp.h"
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 2007-2008 Mats Bengtsson
*
* $Id$
* $Id: tkCanvEllipse.c,v 1.30 2010/04/30 10:16:00 ebrunel Exp $
*/
#include "tkIntPath.h"
......
......@@ -7,7 +7,7 @@
*
* TODO: o Add tkwin option here and there so we can free stop colors!
*
* $Id$
* $Id: tkCanvGradient.c,v 1.3 2012/07/04 19:43:18 petasis Exp $
*/
#include "tkIntPath.h"
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 2008 Mats Bengtsson
*
* $Id$
* $Id: tkCanvGroup.c,v 1.9 2008/07/23 07:08:37 matben Exp $
*/
#include <float.h>
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 2005-2008 Mats Bengtsson
*
* $Id$
* $Id: tkCanvPath.c,v 1.55 2012/07/04 19:43:18 petasis Exp $
*/
#include "tkIntPath.h"
......@@ -35,10 +35,6 @@ typedef struct PathItem {
int pathLen;
Tcl_Obj *normPathObjPtr;/* The object containing the normalized path. */
PathAtom *atomPtr;
PathRect bbox; /* Bounding box with zero width outline.
* Untransformed coordinates. */
PathRect totalBbox; /* Bounding box including stroke.
* Untransformed coordinates. */
int maxNumSegments; /* Max number of straight segments (for subpath)
* needed for Area and Point functions. */
long flags; /* Various flags, see enum. */
......@@ -215,8 +211,8 @@ CreatePath(
pathPtr->pathLen = 0;
pathPtr->normPathObjPtr = NULL;
pathPtr->atomPtr = NULL;
pathPtr->bbox = NewEmptyPathRect();
pathPtr->totalBbox = NewEmptyPathRect();
itemPtr->bbox = NewEmptyPathRect();
itemPtr->totalBbox = NewEmptyPathRect();
pathPtr->maxNumSegments = 0;
pathPtr->flags = 0L;
......@@ -404,10 +400,10 @@ ComputePathBbox(
* Get an approximation of the path's bounding box
* assuming zero stroke width.
*/
pathPtr->bbox = GetGenericBarePathBbox(pathPtr->atomPtr);
pathPtr->totalBbox = GetGenericPathTotalBboxFromBare(pathPtr->atomPtr,
&style, &pathPtr->bbox);
SetGenericPathHeaderBbox(&itemExPtr->header, style.matrixPtr, &pathPtr->totalBbox);
itemPtr->bbox = GetGenericBarePathBbox(pathPtr->atomPtr);
itemPtr->totalBbox = GetGenericPathTotalBboxFromBare(pathPtr->atomPtr,
&style, &itemPtr->bbox);
SetGenericPathHeaderBbox(&itemExPtr->header, style.matrixPtr, &itemPtr->totalBbox);
TkPathCanvasFreeInheritedStyle(&style);
}
......@@ -586,7 +582,7 @@ DisplayPath(
if (pathPtr->pathLen > 2) {
style = TkPathCanvasInheritStyle(itemPtr, 0);
TkPathDrawPath(Tk_PathCanvasTkwin(canvas), drawable, pathPtr->atomPtr,
&style, &m, &pathPtr->bbox);
&style, &m, &itemPtr->bbox);
TkPathCanvasFreeInheritedStyle(&style);
}
}
......@@ -903,10 +899,10 @@ ScalePath(
pathPtr->flags |= kPathItemNeedNewNormalizedPath;
/* Just scale the bbox'es as well. */
ScalePathRect(&pathPtr->bbox, originX, originY, scaleX, scaleY);
NormalizePathRect(&pathPtr->bbox);
ScalePathRect(&itemPtr->bbox, originX, originY, scaleX, scaleY);
NormalizePathRect(&itemPtr->bbox);
ScalePathRect(&pathPtr->totalBbox, originX, originY, scaleX, scaleY);
ScalePathRect(&itemPtr->totalBbox, originX, originY, scaleX, scaleY);
NormalizePathRect(&r);
ScaleItemHeader(itemPtr, originX, originY, scaleX, scaleY);
}
......@@ -948,8 +944,8 @@ TranslatePath(
pathPtr->flags |= kPathItemNeedNewNormalizedPath;
/* Just translate the bbox'es as well. */
TranslatePathRect(&pathPtr->bbox, deltaX, deltaY);
TranslatePathRect(&pathPtr->totalBbox, deltaX, deltaY);
TranslatePathRect(&itemPtr->bbox, deltaX, deltaY);
TranslatePathRect(&itemPtr->totalBbox, deltaX, deltaY);
TranslateItemHeader(itemPtr, deltaX, deltaY);
}
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 2008 Mats Bengtsson
*
* $Id$
* $Id: tkCanvPathUtil.c,v 1.34 2008/08/10 08:02:17 matben Exp $
*/
#include "tkPathStyle.h"
......@@ -1963,10 +1963,14 @@ TranslateItemHeader(Tk_PathItem *itemPtr, double deltaX, double deltaY)
/* If all coords == -1 the item is hidden. */
if ((itemPtr->x1 != -1) || (itemPtr->x2 != -1) ||
(itemPtr->y1 != -1) || (itemPtr->y2 != -1)) {
itemPtr->x1 += (int) deltaX;
itemPtr->x2 += (int) deltaX;
itemPtr->y1 += (int) deltaY;
itemPtr->y2 += (int) deltaY;
Tk_PathStyle style;
style = TkPathCanvasInheritStyle(itemPtr, kPathMergeStyleNotFill);
SetGenericPathHeaderBbox(itemPtr, style.matrixPtr, &itemPtr->totalBbox);
TkPathCanvasFreeInheritedStyle(&style);
/*itemPtr->x1 += (int) deltaX;
itemPtr->x2 += (int) deltaX;
itemPtr->y1 += (int) deltaY;
itemPtr->y2 += (int) deltaY;*/
}
}
......
......@@ -5,7 +5,7 @@
*
* Copyright (c) 2007-2008 Mats Bengtsson
*
* $Id$
* $Id: tkCanvPathUtil.h,v 1.24 2008/07/16 13:17:28 matben Exp $
*/
#ifndef INCLUDED_TKCANVPATHUTIL_H
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 2007-2008 Mats Bengtsson
*
* $Id$
* $Id: tkCanvPimage.c,v 1.27 2010/04/30 10:16:00 ebrunel Exp $
*/
#include "tkIntPath.h"
......@@ -42,8 +42,6 @@ typedef struct PimageItem {
Tk_PhotoHandle photo;
double width; /* If 0 use natural width or height. */
double height;
PathRect bbox; /* Bounding box with zero width outline.
* Untransformed coordinates. */
} PimageItem;
......@@ -192,7 +190,7 @@ CreatePimage(Tcl_Interp *interp, Tk_PathCanvas canvas, struct Tk_PathItem *itemP
pimagePtr->photo = NULL;
pimagePtr->height = 0;
pimagePtr->width = 0;
pimagePtr->bbox = NewEmptyPathRect();
itemPtr->bbox = NewEmptyPathRect();
if (optionTable == NULL) {
optionTable = Tk_CreateOptionTable(interp, optionSpecs);
......@@ -267,6 +265,7 @@ GetTMatrix(PimageItem *pimagePtr)
void
ComputePimageBbox(Tk_PathCanvas canvas, PimageItem *pimagePtr)
{
Tk_PathItem *itemPtr = (Tk_PathItem *)pimagePtr;
Tk_PathState state = pimagePtr->header.state;
TMatrix matrix;
int width = 0, height = 0;
......@@ -291,7 +290,7 @@ ComputePimageBbox(Tk_PathCanvas canvas, PimageItem *pimagePtr)
bbox.y1 = pimagePtr->coord[1];
bbox.x2 = bbox.x1 + width;
bbox.y2 = bbox.y1 + height;
pimagePtr->bbox = bbox;
itemPtr->bbox = bbox;
matrix = GetTMatrix(pimagePtr);
SetGenericPathHeaderBbox(&pimagePtr->header, &matrix, &bbox);
}
......@@ -472,7 +471,7 @@ PimageToPoint(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double *pointPtr)
{
PimageItem *pimagePtr = (PimageItem *) itemPtr;
TMatrix m = GetTMatrix(pimagePtr);
return PathRectToPointWithMatrix(pimagePtr->bbox, &m, pointPtr);
return PathRectToPointWithMatrix(itemPtr->bbox, &m, pointPtr);
}
static int
......@@ -480,7 +479,7 @@ PimageToArea(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double *areaPtr)
{
PimageItem *pimagePtr = (PimageItem *) itemPtr;
TMatrix m = GetTMatrix(pimagePtr);
return PathRectToAreaWithMatrix(pimagePtr->bbox, &m, areaPtr);
return PathRectToAreaWithMatrix(itemPtr->bbox, &m, areaPtr);
}
static int
......@@ -502,7 +501,7 @@ TranslatePimage(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double deltaX, doubl
PimageItem *pimagePtr = (PimageItem *) itemPtr;
/* Just translate the bbox'es as well. */
TranslatePathRect(&(pimagePtr->bbox), deltaX, deltaY);
TranslatePathRect(&(itemPtr->bbox), deltaX, deltaY);
pimagePtr->coord[0] += deltaX;
pimagePtr->coord[1] += deltaY;
TranslateItemHeader(itemPtr, deltaX, deltaY);
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 2007-2008 Mats Bengtsson
*
* $Id$
* $Id: tkCanvPline.c,v 1.25 2010/04/30 10:16:00 ebrunel Exp $
*/
#include "tkIntPath.h"
......@@ -25,8 +25,6 @@ typedef struct PlineItem {
Tk_PathItemEx headerEx; /* Generic stuff that's the same for all
* path types. MUST BE FIRST IN STRUCTURE. */
PathRect coords; /* Coordinates (unorders bare bbox). */
PathRect totalBbox; /* Bounding box including stroke.
* Untransformed coordinates. */
} PlineItem;
......@@ -131,7 +129,7 @@ CreatePline(Tcl_Interp *interp, Tk_PathCanvas canvas, struct Tk_PathItem *itemPt
itemExPtr->canvas = canvas;
itemExPtr->styleObj = NULL;
itemExPtr->styleInst = NULL;
plinePtr->totalBbox = NewEmptyPathRect();
itemPtr->totalBbox = NewEmptyPathRect();
if (optionTable == NULL) {
optionTable = Tk_CreateOptionTable(interp, optionSpecs);
......@@ -214,7 +212,7 @@ PlineCoords(Tcl_Interp *interp, Tk_PathCanvas canvas, Tk_PathItem *itemPtr,
int result;
result = ProcessCoords(interp, canvas, itemPtr, objc, objv);
if ((result == TCL_OK) && (objc == 1)) {
if ((result == TCL_OK) && ((objc == 1) || (objc == 4))) {
ComputePlineBbox(canvas, plinePtr);
}
return result;
......@@ -242,8 +240,8 @@ ComputePlineBbox(Tk_PathCanvas canvas, PlineItem *plinePtr)
r.x2 = MAX(plinePtr->coords.x1, plinePtr->coords.x2);
r.y1 = MIN(plinePtr->coords.y1, plinePtr->coords.y2);
r.y2 = MAX(plinePtr->coords.y1, plinePtr->coords.y2);
plinePtr->totalBbox = GetGenericPathTotalBboxFromBare(NULL, &style, &r);
SetGenericPathHeaderBbox(&itemExPtr->header, style.matrixPtr, &plinePtr->totalBbox);
itemPtr->totalBbox = GetGenericPathTotalBboxFromBare(NULL, &style, &r);
SetGenericPathHeaderBbox(&itemExPtr->header, style.matrixPtr, &itemPtr->totalBbox);
TkPathCanvasFreeInheritedStyle(&style);
}
......@@ -410,7 +408,7 @@ ScalePline(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double originX, double or
{
PlineItem *plinePtr = (PlineItem *) itemPtr;
ScalePathRect(&plinePtr->totalBbox, originX, originY, scaleX, scaleY);
ScalePathRect(&itemPtr->totalBbox, originX, originY, scaleX, scaleY);
ScalePathRect(&plinePtr->coords, originX, originY, scaleX, scaleY);
ScaleItemHeader(itemPtr, originX, originY, scaleX, scaleY);
}
......@@ -421,7 +419,7 @@ TranslatePline(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double deltaX, double
PlineItem *plinePtr = (PlineItem *) itemPtr;
/* Just translate the bbox as well. */
TranslatePathRect(&plinePtr->totalBbox, deltaX, deltaY);
TranslatePathRect(&itemPtr->totalBbox, deltaX, deltaY);
TranslatePathRect(&plinePtr->coords, deltaX, deltaY);
TranslateItemHeader(itemPtr, deltaX, deltaY);
}
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 2007-2008 Mats Bengtsson
*
* $Id$
* $Id: tkCanvPpoly.c,v 1.25 2010/04/30 10:16:00 ebrunel Exp $
*/
#include "tkIntPath.h"
......@@ -26,10 +26,6 @@ typedef struct PpolyItem {
* path types. MUST BE FIRST IN STRUCTURE. */
char type; /* Polyline or polygon. */
PathAtom *atomPtr;
PathRect bbox; /* Bounding box with zero width outline.
* Untransformed coordinates. */
PathRect totalBbox; /* Bounding box including stroke.
* Untransformed coordinates. */
int maxNumSegments; /* Max number of straight segments (for subpath)
* needed for Area and Point functions. */
} PpolyItem;
......@@ -198,8 +194,8 @@ CreateAny(Tcl_Interp *interp, Tk_PathCanvas canvas, struct Tk_PathItem *itemPtr,
itemExPtr->styleInst = NULL;
ppolyPtr->atomPtr = NULL;
ppolyPtr->type = type;
ppolyPtr->bbox = NewEmptyPathRect();
ppolyPtr->totalBbox = NewEmptyPathRect();
itemPtr->bbox = NewEmptyPathRect();
itemPtr->totalBbox = NewEmptyPathRect();
ppolyPtr->maxNumSegments = 0;
if (ppolyPtr->type == kPpolyTypePolyline) {
......@@ -280,10 +276,10 @@ ComputePpolyBbox(Tk_PathCanvas canvas, PpolyItem *ppolyPtr)
return;
}
style = TkPathCanvasInheritStyle(itemPtr, kPathMergeStyleNotFill);
ppolyPtr->bbox = GetGenericBarePathBbox(ppolyPtr->atomPtr);
ppolyPtr->totalBbox = GetGenericPathTotalBboxFromBare(ppolyPtr->atomPtr,
&style, &ppolyPtr->bbox);
SetGenericPathHeaderBbox(&itemExPtr->header, style.matrixPtr, &ppolyPtr->totalBbox);
itemPtr->bbox = GetGenericBarePathBbox(ppolyPtr->atomPtr);
itemPtr->totalBbox = GetGenericPathTotalBboxFromBare(ppolyPtr->atomPtr,
&style, &itemPtr->bbox);
SetGenericPathHeaderBbox(&itemExPtr->header, style.matrixPtr, &itemPtr->totalBbox);
TkPathCanvasFreeInheritedStyle(&style);
}
......@@ -384,7 +380,7 @@ DisplayPpoly(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, Display *display, Drawa
style = TkPathCanvasInheritStyle(itemPtr, 0);
TkPathDrawPath(Tk_PathCanvasTkwin(canvas), drawable, ppolyPtr->atomPtr, &style,
&m, &ppolyPtr->bbox);
&m, &itemPtr->bbox);
TkPathCanvasFreeInheritedStyle(&style);
}
......@@ -440,8 +436,8 @@ ScalePpoly(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double originX, double or
PpolyItem *ppolyPtr = (PpolyItem *) itemPtr;
ScalePathAtoms(ppolyPtr->atomPtr, originX, originY, scaleX, scaleY);
ScalePathRect(&ppolyPtr->bbox, originX, originY, scaleX, scaleY);
ScalePathRect(&ppolyPtr->totalBbox, originX, originY, scaleX, scaleY);
ScalePathRect(&itemPtr->bbox, originX, originY, scaleX, scaleY);
ScalePathRect(&itemPtr->totalBbox, originX, originY, scaleX, scaleY);
ScaleItemHeader(itemPtr, originX, originY, scaleX, scaleY);
}
......@@ -451,9 +447,9 @@ TranslatePpoly(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double deltaX, double
PpolyItem *ppolyPtr = (PpolyItem *) itemPtr;
TranslatePathAtoms(ppolyPtr->atomPtr, deltaX, deltaY);
TranslatePathRect(&ppolyPtr->bbox, deltaX, deltaY);
TranslatePathRect(&ppolyPtr->totalBbox, deltaX, deltaY);
TranslateItemHeader(itemPtr, deltaX, deltaY);
TranslatePathRect(&itemPtr->bbox, deltaX, deltaY);
TranslatePathRect(&itemPtr->totalBbox, deltaX, deltaY);
TranslateItemHeader(itemPtr, deltaX, deltaY);
}
/*
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 2007-2008 Mats Bengtsson
*
* $Id$
* $Id: tkCanvPrect.c,v 1.28 2010/04/30 10:16:00 ebrunel Exp $
*/
#include "tkIntPath.h"
......@@ -26,10 +26,6 @@ typedef struct PrectItem {
* path types. MUST BE FIRST IN STRUCTURE. */
double rx; /* Radius of corners. */
double ry;
PathRect rect; /* Bounding box with zero width outline.
* Untransformed coordinates. */
PathRect totalBbox; /* Bounding box including stroke.
* Untransformed coordinates. */
int maxNumSegments; /* Max number of straight segments (for subpath)
* needed for Area and Point functions. */
} PrectItem;
......@@ -153,8 +149,8 @@ CreatePrect(Tcl_Interp *interp, Tk_PathCanvas canvas, Tk_PathItem *itemPtr,
itemExPtr->canvas = canvas;
itemExPtr->styleObj = NULL;
itemExPtr->styleInst = NULL;
prectPtr->rect = NewEmptyPathRect();
prectPtr->totalBbox = NewEmptyPathRect();
itemPtr->bbox = NewEmptyPathRect();
itemPtr->totalBbox = NewEmptyPathRect();
prectPtr->maxNumSegments = 100; /* Crude overestimate. */
if (optionTable == NULL) {
......@@ -172,7 +168,7 @@ CreatePrect(Tcl_Interp *interp, Tk_PathCanvas canvas, Tk_PathItem *itemPtr,
break;
}
}
if (CoordsForRectangularItems(interp, canvas, &prectPtr->rect, i, objv) != TCL_OK) {
if (CoordsForRectangularItems(interp, canvas, &itemPtr->bbox, i, objv) != TCL_OK) {
goto error;
}
if (ConfigurePrect(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) {
......@@ -196,7 +192,7 @@ PrectCoords(Tcl_Interp *interp, Tk_PathCanvas canvas, Tk_PathItem *itemPtr,
PrectItem *prectPtr = (PrectItem *) itemPtr;
int result;
result = CoordsForRectangularItems(interp, canvas, &prectPtr->rect, objc, objv);
result = CoordsForRectangularItems(interp, canvas, &itemPtr->bbox, objc, objv);
if ((result == TCL_OK) && ((objc == 1) || (objc == 4))) {
ComputePrectBbox(canvas, prectPtr);
}
......@@ -220,8 +216,8 @@ ComputePrectBbox(Tk_PathCanvas canvas, PrectItem *prectPtr)
return;
}
style = TkPathCanvasInheritStyle(itemPtr, kPathMergeStyleNotFill);
prectPtr->totalBbox = GetGenericPathTotalBboxFromBare(NULL, &style, &prectPtr->rect);
SetGenericPathHeaderBbox(&itemExPtr->header, style.matrixPtr, &prectPtr->totalBbox);
itemPtr->totalBbox = GetGenericPathTotalBboxFromBare(NULL, &style, &itemPtr->bbox);
SetGenericPathHeaderBbox(&itemExPtr->header, style.matrixPtr, &itemPtr->totalBbox);
TkPathCanvasFreeInheritedStyle(&style);
}
......@@ -293,13 +289,14 @@ ConfigurePrect(Tcl_Interp *interp, Tk_PathCanvas canvas, Tk_PathItem *itemPtr,
static PathAtom *
MakePathAtoms(PrectItem *prectPtr)
{
Tk_PathItem *itemPtr = (Tk_PathItem *) prectPtr;
PathAtom *atomPtr;
double points[4];
points[0] = prectPtr->rect.x1;
points[1] = prectPtr->rect.y1;
points[2] = prectPtr->rect.x2;
points[3] = prectPtr->rect.y2;
points[0] = itemPtr->bbox.x1;
points[1] = itemPtr->bbox.y1;
points[2] = itemPtr->bbox.x2;
points[3] = itemPtr->bbox.y2;
TkPathMakePrectAtoms(points, prectPtr->rx, prectPtr->ry, &atomPtr);
return atomPtr;
}
......@@ -336,7 +333,7 @@ DisplayPrect(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, Display *display, Drawa
style = TkPathCanvasInheritStyle(itemPtr, 0);
atomPtr = MakePathAtoms(prectPtr);
TkPathDrawPath(Tk_PathCanvasTkwin(canvas), drawable, atomPtr,
&style, &m, &prectPtr->rect);
&style, &m, &itemPtr->bbox);
TkPathFreeAtoms(atomPtr);
TkPathCanvasFreeInheritedStyle(&style);
}
......@@ -354,7 +351,7 @@ PrectToPoint(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double *pointPtr)
PrectItem *prectPtr = (PrectItem *) itemPtr;
Tk_PathStyle style;
TMatrix *mPtr;
PathRect *rectPtr = &prectPtr->rect;
PathRect *rectPtr = &itemPtr->bbox;
double bareRect[4];
double width, dist;
int rectiLinear = 0;
......@@ -405,7 +402,7 @@ PrectToArea(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double *areaPtr)
Tk_PathItemEx *itemExPtr = &prectPtr->headerEx;
Tk_PathStyle style = itemExPtr->style; /* NB: We *copy* the style for temp usage. */
TMatrix *mPtr;
PathRect *rectPtr = &(prectPtr->rect);
PathRect *rectPtr = &(itemPtr->bbox);
double bareRect[4];
double width;
int rectiLinear = 0;
......@@ -459,20 +456,20 @@ static void
ScalePrect(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double originX, double originY,
double scaleX, double scaleY)
{
PrectItem *prectPtr = (PrectItem *) itemPtr;
//PrectItem *prectPtr = (PrectItem *) itemPtr;
ScalePathRect(&prectPtr->rect, originX, originY, scaleX, scaleY);
ScalePathRect(&itemPtr->bbox, originX, originY, scaleX, scaleY);
ScaleItemHeader(itemPtr, originX, originY, scaleX, scaleY);
}
static void
TranslatePrect(Tk_PathCanvas canvas, Tk_PathItem *itemPtr, double deltaX, double deltaY)
{
PrectItem *prectPtr = (PrectItem *) itemPtr;
//PrectItem *prectPtr = (PrectItem *) itemPtr;
/* Just translate the bbox'es as well. */
TranslatePathRect(&prectPtr->rect, deltaX, deltaY);
TranslatePathRect(&prectPtr->totalBbox, deltaX, deltaY);
TranslatePathRect(&itemPtr->bbox, deltaX, deltaY);
TranslatePathRect(&itemPtr->totalBbox, deltaX, deltaY);
TranslateItemHeader(itemPtr, deltaX, deltaY);
}
......
/*
* tkCanvPtext.c --
*
* This file implements a text canvas item modelled after its
486 * This file implements a text canvas item modelled after its
* SVG counterpart. See http://www.w3.org/TR/SVG11/.
*
* Copyright (c) 2007-2008 Mats Bengtsson
*
* $Id$
* $Id: tkCanvPtext.c,v 1.26 2010/04/30 10:16:00 ebrunel Exp $
*/
#include "tkIntPath.h"
......@@ -28,8 +28,6 @@ typedef struct PtextItem {
int textAnchor;
double x;
double y;
PathRect bbox; /* Bounding box with zero width outline.
* Untransformed coordinates. */
Tcl_Obj *utf8Obj; /* The actual text to display; UTF-8 */
int numChars; /* Length of text in characters. */
int numBytes; /* Length of text in bytes. */
......@@ -201,7 +199,7 @@ CreatePtext(Tcl_Interp *interp, Tk_PathCanvas canvas,
itemExPtr->canvas = canvas;
itemExPtr->styleObj = NULL;
itemExPtr->styleInst = NULL;