Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mathieu Westphal (Kitware)
VTK
Commits
9a3b037e
Commit
9a3b037e
authored
8 years ago
by
Dan Lipsa
Browse files
Options
Downloads
Patches
Plain Diff
BUG: lastPos = firstPos + size - 1.
In computing the text bounding box, the -1 in the formula was omitted.
parent
87f9baa6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Rendering/Core/vtkTextMapper.cxx
+7
-11
7 additions, 11 deletions
Rendering/Core/vtkTextMapper.cxx
Rendering/FreeType/vtkFreeTypeTools.cxx
+10
-5
10 additions, 5 deletions
Rendering/FreeType/vtkFreeTypeTools.cxx
with
17 additions
and
16 deletions
Rendering/Core/vtkTextMapper.cxx
+
7
−
11
View file @
9a3b037e
...
@@ -441,21 +441,17 @@ void vtkTextMapper::UpdateQuad(vtkActor2D *actor, int dpi)
...
@@ -441,21 +441,17 @@ void vtkTextMapper::UpdateQuad(vtkActor2D *actor, int dpi)
int
dims
[
3
];
int
dims
[
3
];
this
->
Image
->
GetDimensions
(
dims
);
this
->
Image
->
GetDimensions
(
dims
);
// Add a fudge factor to the texture coordinates to prevent the top
// The coordinates are calculated to be centered on a texel and
// row of pixels from being truncated on some systems. The coordinates
// trim the padding from the image. (padding is often added to
// are calculated to be centered on a texel and trim the padding from the
// create textures that have power-of-two dimensions)
// image. (padding is often added to create textures that have power-of-two
// dimensions)
float
tw
=
static_cast
<
float
>
(
this
->
TextDims
[
0
]);
float
tw
=
static_cast
<
float
>
(
this
->
TextDims
[
0
]);
float
th
=
static_cast
<
float
>
(
this
->
TextDims
[
1
]);
float
th
=
static_cast
<
float
>
(
this
->
TextDims
[
1
]);
float
iw
=
static_cast
<
float
>
(
dims
[
0
]);
float
iw
=
static_cast
<
float
>
(
dims
[
0
]);
float
ih
=
static_cast
<
float
>
(
dims
[
1
]);
float
ih
=
static_cast
<
float
>
(
dims
[
1
]);
float
tcXMin
=
1.
f
/
(
2.
f
*
iw
);
float
tcXMin
=
0
;
float
tcYMin
=
1.
f
/
(
2.
f
*
ih
);
float
tcYMin
=
0
;
float
tcXMax
=
std
::
min
(
1.0
f
,
float
tcXMax
=
static_cast
<
float
>
(
tw
)
/
iw
;
(((
2.
f
*
tw
-
1.
f
)
/
(
2.
f
))
+
0.000001
f
)
/
iw
);
float
tcYMax
=
static_cast
<
float
>
(
th
)
/
ih
;
float
tcYMax
=
std
::
min
(
1.0
f
,
(((
2.
f
*
th
-
1.
f
)
/
(
2.
f
))
+
0.000001
f
)
/
ih
);
if
(
vtkFloatArray
*
tc
=
if
(
vtkFloatArray
*
tc
=
vtkArrayDownCast
<
vtkFloatArray
>
(
vtkArrayDownCast
<
vtkFloatArray
>
(
this
->
PolyData
->
GetPointData
()
->
GetTCoords
()))
this
->
PolyData
->
GetPointData
()
->
GetTCoords
()))
...
...
This diff is collapsed.
Click to expand it.
Rendering/FreeType/vtkFreeTypeTools.cxx
+
10
−
5
View file @
9a3b037e
...
@@ -1357,6 +1357,7 @@ bool vtkFreeTypeTools::RenderStringInternal(vtkTextProperty *tprop,
...
@@ -1357,6 +1357,7 @@ bool vtkFreeTypeTools::RenderStringInternal(vtkTextProperty *tprop,
ptr
[
3
]
=
255
;
ptr
[
3
]
=
255
;
}
}
}
}
return
true
;
return
true
;
}
}
...
@@ -1509,8 +1510,12 @@ bool vtkFreeTypeTools::CalculateBoundingBox(const T& str,
...
@@ -1509,8 +1510,12 @@ bool vtkFreeTypeTools::CalculateBoundingBox(const T& str,
// The rotated padding on the text's vertical and horizontal axes:
// The rotated padding on the text's vertical and horizontal axes:
vtkVector2i
hPad
(
pad
,
0
);
vtkVector2i
hPad
(
pad
,
0
);
vtkVector2i
vPad
(
0
,
pad
);
vtkVector2i
vPad
(
0
,
pad
);
vtkVector2i
hOne
(
1
,
0
);
vtkVector2i
vOne
(
0
,
1
);
rotateVector2i
(
hPad
,
s
,
c
);
rotateVector2i
(
hPad
,
s
,
c
);
rotateVector2i
(
vPad
,
s
,
c
);
rotateVector2i
(
vPad
,
s
,
c
);
rotateVector2i
(
hOne
,
s
,
c
);
rotateVector2i
(
vOne
,
s
,
c
);
// Calculate the bottom left corner of the data rect. Start at anchor point
// Calculate the bottom left corner of the data rect. Start at anchor point
// (0, 0) and subtract out justification. Account for background/frame padding to
// (0, 0) and subtract out justification. Account for background/frame padding to
...
@@ -1522,7 +1527,7 @@ bool vtkFreeTypeTools::CalculateBoundingBox(const T& str,
...
@@ -1522,7 +1527,7 @@ bool vtkFreeTypeTools::CalculateBoundingBox(const T& str,
metaData
.
BL
=
metaData
.
BL
-
(
metaData
.
dx
*
0.5
);
metaData
.
BL
=
metaData
.
BL
-
(
metaData
.
dx
*
0.5
);
break
;
break
;
case
VTK_TEXT_RIGHT
:
case
VTK_TEXT_RIGHT
:
metaData
.
BL
=
metaData
.
BL
-
metaData
.
dx
+
hPad
;
metaData
.
BL
=
metaData
.
BL
-
metaData
.
dx
+
hPad
+
hOne
;
break
;
break
;
case
VTK_TEXT_LEFT
:
case
VTK_TEXT_LEFT
:
metaData
.
BL
=
metaData
.
BL
-
hPad
;
metaData
.
BL
=
metaData
.
BL
-
hPad
;
...
@@ -1541,7 +1546,7 @@ bool vtkFreeTypeTools::CalculateBoundingBox(const T& str,
...
@@ -1541,7 +1546,7 @@ bool vtkFreeTypeTools::CalculateBoundingBox(const T& str,
metaData
.
BL
=
metaData
.
BL
-
vPad
;
metaData
.
BL
=
metaData
.
BL
-
vPad
;
break
;
break
;
case
VTK_TEXT_TOP
:
case
VTK_TEXT_TOP
:
metaData
.
BL
=
metaData
.
BL
-
metaData
.
dy
+
vPad
;
metaData
.
BL
=
metaData
.
BL
-
metaData
.
dy
+
vPad
+
vOne
;
break
;
break
;
default:
default:
vtkErrorMacro
(
<<
"Bad vertical alignment flag: "
vtkErrorMacro
(
<<
"Bad vertical alignment flag: "
...
@@ -1550,9 +1555,9 @@ bool vtkFreeTypeTools::CalculateBoundingBox(const T& str,
...
@@ -1550,9 +1555,9 @@ bool vtkFreeTypeTools::CalculateBoundingBox(const T& str,
}
}
// Compute the other corners of the data:
// Compute the other corners of the data:
metaData
.
TL
=
metaData
.
BL
+
metaData
.
dy
;
metaData
.
TL
=
metaData
.
BL
+
metaData
.
dy
-
vOne
;
metaData
.
TR
=
metaData
.
TL
+
metaData
.
dx
;
metaData
.
TR
=
metaData
.
TL
+
metaData
.
dx
-
hOne
;
metaData
.
BR
=
metaData
.
BL
+
metaData
.
dx
;
metaData
.
BR
=
metaData
.
BL
+
metaData
.
dx
-
hOne
;
// First baseline offset from top-left corner.
// First baseline offset from top-left corner.
vtkVector2i
penOffset
(
pad
,
-
pad
);
vtkVector2i
penOffset
(
pad
,
-
pad
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment