Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
f6a34255
Kaydet (Commit)
f6a34255
authored
Eyl 19, 2011
tarafından
Marc-Andre Laverdiere
Kaydeden (comit)
Caolán McNamara
Eyl 27, 2011
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Minor refactoring on WMF loading
üst
5e9b48bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
84 deletions
+55
-84
enhwmf.cxx
svtools/source/filter/wmf/enhwmf.cxx
+52
-84
winmtf.hxx
svtools/source/filter/wmf/winmtf.hxx
+3
-0
No files found.
svtools/source/filter/wmf/enhwmf.cxx
Dosyayı görüntüle @
f6a34255
...
...
@@ -351,14 +351,14 @@ void EnhWMFReader::ReadGDIComment()
* pWMF: the stream containings the polygons
* */
template
<
class
T
>
Polygon
WMFReadPolygon
(
sal_uInt16
nStartIndex
,
sal_uInt16
nPoints
,
SvStream
&
rWMF
)
Polygon
EnhWMFReader
::
ReadPolygon
(
sal_uInt16
nStartIndex
,
sal_uInt16
nPoints
)
{
Polygon
aPolygon
(
nPoints
);
for
(
sal_uInt16
i
=
nStartIndex
;
i
<
nPoints
&&
rWMF
.
good
();
i
++
)
for
(
sal_uInt16
i
=
nStartIndex
;
i
<
nPoints
&&
pWMF
->
good
();
i
++
)
{
T
nX
,
nY
;
r
WMF
>>
nX
>>
nY
;
if
(
!
rWMF
.
good
())
*
p
WMF
>>
nX
>>
nY
;
if
(
pWMF
->
good
())
break
;
aPolygon
[
i
]
=
Point
(
nX
,
nY
);
}
...
...
@@ -366,6 +366,44 @@ Polygon WMFReadPolygon(sal_uInt16 nStartIndex, sal_uInt16 nPoints, SvStream& rWM
return
aPolygon
;
}
template
<
class
T
>
void
EnhWMFReader
::
ReadAndDrawPolyPolygon
()
{
sal_uInt32
i
,
nPoly
,
nGesPoints
,
nPoints
;
pWMF
->
SeekRel
(
0x10
);
// Number of polygons
*
pWMF
>>
nPoly
>>
nGesPoints
;
if
(
pWMF
->
good
()
&&
(
nGesPoints
<
SAL_MAX_UINT32
/
sizeof
(
Point
)
)
&&
//check against numeric overflowing
(
nPoly
<
SAL_MAX_UINT32
/
sizeof
(
sal_uInt16
)
)
&&
(
(
nPoly
*
sizeof
(
sal_uInt16
)
)
<=
(
nEndPos
-
pWMF
->
Tell
()
)
))
{
//Get number of points in each polygon
sal_uInt16
*
pnPoints
=
new
sal_uInt16
[
nPoly
];
for
(
i
=
0
;
i
<
nPoly
&&
pWMF
->
good
();
i
++
)
{
*
pWMF
>>
nPoints
;
pnPoints
[
i
]
=
(
sal_uInt16
)
nPoints
;
}
//end for
if
(
pWMF
->
good
()
&&
(
nGesPoints
*
(
sizeof
(
T
)
+
sizeof
(
T
))
)
<=
(
nEndPos
-
pWMF
->
Tell
()
)
)
{
// Get polygon points
Point
*
pPtAry
=
new
Point
[
nGesPoints
];
for
(
i
=
0
;
i
<
nGesPoints
&&
pWMF
->
good
();
i
++
)
{
T
nX
,
nY
;
*
pWMF
>>
nX
>>
nY
;
pPtAry
[
i
]
=
Point
(
nX
,
nY
);
}
//end for
// Create PolyPolygon Actions
PolyPolygon
aPolyPoly
(
(
sal_uInt16
)
nPoly
,
pnPoints
,
pPtAry
);
pOut
->
DrawPolyPolygon
(
aPolyPoly
,
bRecordPath
);
delete
[]
pPtAry
;
}
//end if
delete
[]
pnPoints
;
}
//end if
}
sal_Bool
EnhWMFReader
::
ReadEnhWMF
()
{
sal_uInt32
nStretchBltMode
=
0
;
...
...
@@ -452,7 +490,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
i
++
;
nPoints
++
;
}
Polygon
aPoly
=
WMFReadPolygon
<
sal_Int32
>
(
i
,
nPoints
,
*
pWMF
);
Polygon
aPoly
=
ReadPolygon
<
sal_Int32
>
(
i
,
nPoints
);
pOut
->
DrawPolyBezier
(
aPoly
,
bFlag
,
bRecordPath
);
}
break
;
...
...
@@ -461,7 +499,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
{
pWMF
->
SeekRel
(
16
);
*
pWMF
>>
nPoints
;
Polygon
aPoly
=
WMFReadPolygon
<
sal_Int32
>
(
0
,
nPoints
,
*
pWMF
);
Polygon
aPoly
=
ReadPolygon
<
sal_Int32
>
(
0
,
nPoints
);
pOut
->
DrawPolygon
(
aPoly
,
bRecordPath
);
}
break
;
...
...
@@ -478,7 +516,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
i
++
;
nPoints
++
;
}
Polygon
aPolygon
=
WMFReadPolygon
<
sal_Int32
>
(
i
,
nPoints
,
*
pWMF
);
Polygon
aPolygon
=
ReadPolygon
<
sal_Int32
>
(
i
,
nPoints
);
pOut
->
DrawPolyLine
(
aPolygon
,
bFlag
,
bRecordPath
);
}
break
;
...
...
@@ -523,42 +561,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
case
EMR_POLYPOLYGON
:
{
sal_uInt32
i
,
nPoly
,
nGesPoints
;
pWMF
->
SeekRel
(
0x10
);
// Number of polygons:
*
pWMF
>>
nPoly
>>
nGesPoints
;
if
(
(
nGesPoints
<
SAL_MAX_UINT32
/
sizeof
(
Point
)
)
&&
(
nPoly
<
SAL_MAX_UINT32
/
sizeof
(
sal_uInt16
)
)
)
{
if
(
(
nPoly
*
sizeof
(
sal_uInt16
)
)
<=
(
nEndPos
-
pWMF
->
Tell
()
)
)
{
sal_uInt16
*
pnPoints
=
new
sal_uInt16
[
nPoly
];
for
(
i
=
0
;
i
<
nPoly
;
i
++
)
{
*
pWMF
>>
nPoints
;
pnPoints
[
i
]
=
(
sal_uInt16
)
nPoints
;
}
if
(
(
nGesPoints
*
(
sizeof
(
sal_uInt32
)
+
sizeof
(
sal_uInt32
))
)
<=
(
nEndPos
-
pWMF
->
Tell
()
)
)
{
// Get polygon points
Point
*
pPtAry
=
new
Point
[
nGesPoints
];
for
(
i
=
0
;
i
<
nGesPoints
;
i
++
)
{
*
pWMF
>>
nX32
>>
nY32
;
pPtAry
[
i
]
=
Point
(
nX32
,
nY32
);
}
// Produce PolyPolygon Actions
PolyPolygon
aPolyPoly
(
(
sal_uInt16
)
nPoly
,
pnPoints
,
pPtAry
);
pOut
->
DrawPolyPolygon
(
aPolyPoly
,
bRecordPath
);
delete
[]
pPtAry
;
}
delete
[]
pnPoints
;
}
}
ReadAndDrawPolyPolygon
<
sal_uInt32
>
();
}
break
;
...
...
@@ -1235,7 +1238,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
i
++
;
nPoints
++
;
}
Polygon
aPoly
=
WMFReadPolygon
<
sal_Int16
>
(
i
,
nPoints
,
*
pWMF
);
Polygon
aPoly
=
ReadPolygon
<
sal_Int16
>
(
i
,
nPoints
);
pOut
->
DrawPolyBezier
(
aPoly
,
bFlag
,
bRecordPath
);
// Line( aPoly, bFlag );
}
break
;
...
...
@@ -1244,7 +1247,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
{
pWMF
->
SeekRel
(
16
);
*
pWMF
>>
nPoints
;
Polygon
aPoly
=
WMFReadPolygon
<
sal_Int16
>
(
0
,
nPoints
,
*
pWMF
);
Polygon
aPoly
=
ReadPolygon
<
sal_Int16
>
(
0
,
nPoints
);
pOut
->
DrawPolygon
(
aPoly
,
bRecordPath
);
}
break
;
...
...
@@ -1261,7 +1264,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
i
++
;
nPoints
++
;
}
Polygon
aPoly
=
WMFReadPolygon
<
sal_Int16
>
(
i
,
nPoints
,
*
pWMF
);
Polygon
aPoly
=
ReadPolygon
<
sal_Int16
>
(
i
,
nPoints
);
pOut
->
DrawPolyLine
(
aPoly
,
bFlag
,
bRecordPath
);
}
break
;
...
...
@@ -1287,7 +1290,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
// Get polygon points:
for
(
i
=
0
;
(
i
<
nPoly
)
&&
pWMF
->
good
();
i
++
)
{
Polygon
aPolygon
=
WMFReadPolygon
<
sal_Int16
>
(
0
,
pnPoints
[
i
],
*
pWMF
);
Polygon
aPolygon
=
ReadPolygon
<
sal_Int16
>
(
0
,
pnPoints
[
i
]
);
pOut
->
DrawPolyLine
(
aPolygon
,
sal_False
,
bRecordPath
);
}
delete
[]
pnPoints
;
...
...
@@ -1298,42 +1301,7 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
case
EMR_POLYPOLYGON16
:
{
sal_uInt16
*
pnPoints
;
Point
*
pPtAry
;
sal_uInt32
i
,
nPoly
,
nGesPoints
;
pWMF
->
SeekRel
(
0x10
);
// Number of polygons
*
pWMF
>>
nPoly
>>
nGesPoints
;
if
(
(
nGesPoints
<
SAL_MAX_UINT32
/
sizeof
(
Point
)
)
&&
(
nPoly
<
SAL_MAX_UINT32
/
sizeof
(
sal_uInt16
)
)
)
{
if
(
(
static_cast
<
sal_uInt32
>
(
nPoly
)
*
sizeof
(
sal_uInt16
)
)
<=
(
nEndPos
-
pWMF
->
Tell
()
)
)
{
pnPoints
=
new
sal_uInt16
[
nPoly
];
for
(
i
=
0
;
i
<
nPoly
;
i
++
)
{
*
pWMF
>>
nPoints
;
pnPoints
[
i
]
=
(
sal_uInt16
)
nPoints
;
}
if
(
(
nGesPoints
*
(
sizeof
(
sal_uInt16
)
+
sizeof
(
sal_uInt16
))
)
<=
(
nEndPos
-
pWMF
->
Tell
()
)
)
{
// Get polygon points
pPtAry
=
new
Point
[
nGesPoints
];
for
(
i
=
0
;
i
<
nGesPoints
;
i
++
)
{
sal_Int16
nX16
(
0
),
nY16
(
0
);
*
pWMF
>>
nX16
>>
nY16
;
pPtAry
[
i
]
=
Point
(
nX16
,
nY16
);
}
// Create PolyPolygon Actions
PolyPolygon
aPolyPoly
(
(
sal_uInt16
)
nPoly
,
pnPoints
,
pPtAry
);
pOut
->
DrawPolyPolygon
(
aPolyPoly
,
bRecordPath
);
delete
[]
pPtAry
;
}
delete
[]
pnPoints
;
}
}
ReadAndDrawPolyPolygon
<
sal_uInt16
>
();
}
break
;
...
...
@@ -1537,7 +1505,7 @@ sal_Bool EnhWMFReader::ReadHeader()
//-----------------------------------------------------------------------------------
Rectangle
EnhWMFReader
::
ReadRectangle
(
sal_Int32
x1
,
sal_Int32
y1
,
sal_Int32
x2
,
sal_Int32
y2
)
Rectangle
EnhWMFReader
::
ReadRectangle
(
sal_Int32
x1
,
sal_Int32
y1
,
sal_Int32
x2
,
sal_Int32
y2
)
{
Point
aTL
(
Point
(
x1
,
y1
)
);
Point
aBR
(
Point
(
--
x2
,
--
y2
)
);
...
...
svtools/source/filter/wmf/winmtf.hxx
Dosyayı görüntüle @
f6a34255
...
...
@@ -836,6 +836,9 @@ public:
sal_Bool
ReadEnhWMF
();
void
ReadEMFPlusComment
(
sal_uInt32
length
,
sal_Bool
&
bHaveDC
);
void
ReadGDIComment
();
private
:
template
<
class
T
>
void
ReadAndDrawPolyPolygon
();
template
<
class
T
>
Polygon
ReadPolygon
(
sal_uInt16
nStartIndex
,
sal_uInt16
nPoints
);
};
//============================ WMFReader ==================================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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