Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
07623076
Commit
07623076
authored
Aug 30, 2012
by
David C. Lonie
Browse files
Style fixes.
Change-Id: Ic11fe649f106695a75a464f2f56e8eefb1836f0b
parent
366a880e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Rendering/MathText/vtkMathTextActor.cxx
View file @
07623076
...
...
@@ -68,7 +68,7 @@ bool vtkMathTextActor::RenderImage(vtkTextProperty *tprop,
vtkViewport
*
viewport
)
{
vtkMathTextUtilities
*
util
=
vtkMathTextUtilities
::
GetInstance
();
if
(
!
util
)
if
(
!
util
)
{
// Fall back to freetype rendering
if
(
!
this
->
FreeTypeUtilities
->
RenderString
(
tprop
,
this
->
FallbackText
?
this
->
FallbackText
:
this
->
Input
,
...
...
@@ -105,7 +105,7 @@ bool vtkMathTextActor::GetBoundingBox(vtkTextProperty *tprop,
vtkViewport
*
viewport
,
int
bbox
[
4
])
{
vtkMathTextUtilities
*
util
=
vtkMathTextUtilities
::
GetInstance
();
if
(
!
util
)
if
(
!
util
)
{
// Fall back to freetype rendering
if
(
!
this
->
FreeTypeUtilities
->
GetBoundingBox
(
tprop
,
this
->
FallbackText
?
this
->
FallbackText
:
this
->
Input
,
...
...
Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx
View file @
07623076
...
...
@@ -98,14 +98,14 @@ bool vtkMatplotlibMathTextUtilities::InitializeMaskParser()
return
false
;
}
SmartPyObject
mplMathTextLib
(
PyImport_ImportModule
(
"matplotlib.mathtext"
));
SmartPyObject
mplMathTextLib
(
PyImport_ImportModule
(
"matplotlib.mathtext"
));
if
(
this
->
CheckForError
(
mplMathTextLib
.
GetPointer
()))
{
return
false
;
}
SmartPyObject
mathTextParserClass
(
PyObject_GetAttrString
(
mplMathTextLib
.
GetPointer
(),
"MathTextParser"
));
SmartPyObject
mathTextParserClass
(
PyObject_GetAttrString
(
mplMathTextLib
.
GetPointer
(),
"MathTextParser"
));
if
(
this
->
CheckForError
(
mathTextParserClass
.
GetPointer
()))
{
return
false
;
...
...
@@ -131,14 +131,14 @@ bool vtkMatplotlibMathTextUtilities::InitializePathParser()
return
false
;
}
SmartPyObject
mplTextPathLib
(
PyImport_ImportModule
(
"matplotlib.textpath"
));
SmartPyObject
mplTextPathLib
(
PyImport_ImportModule
(
"matplotlib.textpath"
));
if
(
this
->
CheckForError
(
mplTextPathLib
.
GetPointer
()))
{
return
false
;
}
SmartPyObject
textToPathClass
(
PyObject_GetAttrString
(
mplTextPathLib
.
GetPointer
(),
"TextToPath"
));
SmartPyObject
textToPathClass
(
PyObject_GetAttrString
(
mplTextPathLib
.
GetPointer
(),
"TextToPath"
));
if
(
this
->
CheckForError
(
textToPathClass
.
GetPointer
()))
{
return
false
;
...
...
@@ -162,8 +162,8 @@ bool vtkMatplotlibMathTextUtilities::InitializeFontPropertiesClass()
return
false
;
}
SmartPyObject
mplFontManagerLib
(
PyImport_ImportModule
(
"matplotlib.font_manager"
));
SmartPyObject
mplFontManagerLib
(
PyImport_ImportModule
(
"matplotlib.font_manager"
));
if
(
this
->
CheckForError
(
mplFontManagerLib
.
GetPointer
()))
{
return
false
;
...
...
@@ -329,13 +329,13 @@ bool vtkMatplotlibMathTextUtilities::GetBoundingBox(
// matplotlib.mathtext seems to mishandle the dpi, this conversion makes the
// text size match the images produced by vtkFreeTypeUtilities, as well as the
// paths generated by StringToPath
long
int
fontSize
=
tprop
->
GetFontSize
()
*
72.0
/
static_cast
<
float
>
(
dpi
);
long
int
fontSize
=
tprop
->
GetFontSize
()
*
72.0
/
static_cast
<
float
>
(
dpi
);
SmartPyObject
resultTuple
(
PyObject_CallMethod
(
this
->
MaskParser
,
const_cast
<
char
*>
(
"to_mask"
),
const_cast
<
char
*>
(
"sii"
),
const_cast
<
char
*>
(
str
),
fontSize
,
dpi
));
SmartPyObject
resultTuple
(
PyObject_CallMethod
(
this
->
MaskParser
,
const_cast
<
char
*>
(
"to_mask"
),
const_cast
<
char
*>
(
"sii"
),
const_cast
<
char
*>
(
str
),
fontSize
,
dpi
));
if
(
this
->
CheckForError
(
resultTuple
.
GetPointer
()))
{
return
false
;
...
...
@@ -348,8 +348,8 @@ bool vtkMatplotlibMathTextUtilities::GetBoundingBox(
return
false
;
}
SmartPyObject
dimTuple
(
PyObject_GetAttrString
(
numpyArray
,
const_cast
<
char
*>
(
"shape"
)));
SmartPyObject
dimTuple
(
PyObject_GetAttrString
(
numpyArray
,
const_cast
<
char
*>
(
"shape"
)));
if
(
this
->
CheckForError
(
dimTuple
.
GetPointer
()))
{
return
false
;
...
...
@@ -404,18 +404,18 @@ bool vtkMatplotlibMathTextUtilities::RenderString(const char *str,
// matplotlib.mathtext seems to mishandle the dpi, this conversion makes the
// text size match the images produced by vtkFreeTypeUtilities, as well as the
// paths generated by StringToPath
long
int
fontSize
=
tprop
->
GetFontSize
()
*
72.0
/
static_cast
<
float
>
(
dpi
);
long
int
fontSize
=
tprop
->
GetFontSize
()
*
72.0
/
static_cast
<
float
>
(
dpi
);
double
*
dcolor
=
tprop
->
GetColor
();
unsigned
char
r
=
static_cast
<
unsigned
char
>
(
dcolor
[
0
]
*
255
);
unsigned
char
g
=
static_cast
<
unsigned
char
>
(
dcolor
[
1
]
*
255
);
unsigned
char
b
=
static_cast
<
unsigned
char
>
(
dcolor
[
2
]
*
255
);
double
alpha
=
tprop
->
GetOpacity
();
SmartPyObject
resultTuple
(
PyObject_CallMethod
(
this
->
MaskParser
,
const_cast
<
char
*>
(
"to_mask"
),
const_cast
<
char
*>
(
"sii"
),
const_cast
<
char
*>
(
str
),
fontSize
,
dpi
));
SmartPyObject
resultTuple
(
PyObject_CallMethod
(
this
->
MaskParser
,
const_cast
<
char
*>
(
"to_mask"
),
const_cast
<
char
*>
(
"sii"
),
const_cast
<
char
*>
(
str
),
fontSize
,
dpi
));
if
(
this
->
CheckForError
(
resultTuple
.
GetPointer
()))
{
return
false
;
...
...
@@ -428,24 +428,24 @@ bool vtkMatplotlibMathTextUtilities::RenderString(const char *str,
return
false
;
}
SmartPyObject
flatArray
(
PyObject_CallMethod
(
numpyArray
,
const_cast
<
char
*>
(
"flatten"
),
const_cast
<
char
*>
(
""
)));
SmartPyObject
flatArray
(
PyObject_CallMethod
(
numpyArray
,
const_cast
<
char
*>
(
"flatten"
),
const_cast
<
char
*>
(
""
)));
if
(
this
->
CheckForError
(
flatArray
.
GetPointer
()))
{
return
false
;
}
SmartPyObject
list
(
PyObject_CallMethod
(
flatArray
.
GetPointer
(),
const_cast
<
char
*>
(
"tolist"
),
const_cast
<
char
*>
(
""
)));
SmartPyObject
list
(
PyObject_CallMethod
(
flatArray
.
GetPointer
(),
const_cast
<
char
*>
(
"tolist"
),
const_cast
<
char
*>
(
""
)));
if
(
this
->
CheckForError
(
list
.
GetPointer
()))
{
return
false
;
}
SmartPyObject
dimTuple
(
PyObject_GetAttrString
(
numpyArray
,
const_cast
<
char
*>
(
"shape"
)));
SmartPyObject
dimTuple
(
PyObject_GetAttrString
(
numpyArray
,
const_cast
<
char
*>
(
"shape"
)));
if
(
this
->
CheckForError
(
dimTuple
.
GetPointer
()))
{
return
false
;
...
...
@@ -567,17 +567,16 @@ bool vtkMatplotlibMathTextUtilities::StringToPath(const char *str,
// The path is always generated at a font size of 100. Use this factor to
// recover the font.
const
float
fontScale
=
((
tprop
->
GetFontSize
())
/
100.
);
// const float fontScale = ((tprop->GetFontSize() * 120/72.) / 100.);
path
->
Reset
();
// Create the font property
SmartPyObject
pyFontProp
(
this
->
GetFontProperties
(
tprop
));
SmartPyObject
pyFontProp
(
this
->
GetFontProperties
(
tprop
));
if
(
this
->
CheckForError
(
pyFontProp
.
GetPointer
()))
{
return
false
;
}
SmartPyObject
pyResultTuple
(
SmartPyObject
pyResultTuple
(
PyObject_CallMethod
(
this
->
PathParser
,
const_cast
<
char
*>
(
"get_text_path"
),
const_cast
<
char
*>
(
"Osi"
),
...
...
@@ -616,8 +615,8 @@ bool vtkMatplotlibMathTextUtilities::StringToPath(const char *str,
for
(
Py_ssize_t
i
=
0
;
i
<
numVerts
;
++
i
)
{
SmartPyObject
pyVert
(
PySequence_GetItem
(
pyVerts
,
i
));
SmartPyObject
pyCode
(
PySequence_GetItem
(
pyCodes
,
i
));
SmartPyObject
pyVert
(
PySequence_GetItem
(
pyVerts
,
i
));
SmartPyObject
pyCode
(
PySequence_GetItem
(
pyCodes
,
i
));
if
(
this
->
CheckForError
(
pyVert
.
GetPointer
())
||
this
->
CheckForError
(
pyCode
.
GetPointer
()))
{
...
...
@@ -646,9 +645,9 @@ bool vtkMatplotlibMathTextUtilities::StringToPath(const char *str,
}
else
// Assume numpy array. Convert to list and extract elements.
{
SmartPyObject
pyVertList
(
PyObject_CallMethod
(
pyVert
.
GetPointer
(),
const_cast
<
char
*>
(
"tolist"
),
NULL
));
SmartPyObject
pyVertList
(
PyObject_CallMethod
(
pyVert
.
GetPointer
(),
const_cast
<
char
*>
(
"tolist"
),
NULL
));
if
(
this
->
CheckForError
(
pyVertList
.
GetPointer
())
||
PySequence_Size
(
pyVertList
.
GetPointer
())
<
2
)
{
...
...
@@ -659,8 +658,8 @@ bool vtkMatplotlibMathTextUtilities::StringToPath(const char *str,
pyVertYObj
=
PySequence_GetItem
(
pyVertList
.
GetPointer
(),
1
);
}
SmartPyObject
pyVertX
(
pyVertXObj
);
SmartPyObject
pyVertY
(
pyVertYObj
);
SmartPyObject
pyVertX
(
pyVertXObj
);
SmartPyObject
pyVertY
(
pyVertYObj
);
if
(
this
->
CheckForError
(
pyVertX
.
GetPointer
())
||
this
->
CheckForError
(
pyVertY
.
GetPointer
()))
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment