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
2113c50b
Kaydet (Commit)
2113c50b
authored
Eyl 21, 2014
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#62104 Optimize thumbnail size by using PNG8 and other tricks
Change-Id: I54ece4a1977fe93c0e7bbb11774bd8657912c6bb
üst
3a7e54f5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
29 deletions
+36
-29
gdimtf.hxx
include/vcl/gdimtf.hxx
+5
-1
graphhelp.cxx
sfx2/source/doc/graphhelp.cxx
+21
-17
gdimtf.cxx
vcl/source/gdi/gdimtf.cxx
+10
-11
No files found.
include/vcl/gdimtf.hxx
Dosyayı görüntüle @
2113c50b
...
...
@@ -24,6 +24,7 @@
#include <tools/gen.hxx>
#include <tools/link.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/bitmap.hxx>
#include <vector>
class
OutputDevice
;
...
...
@@ -214,7 +215,10 @@ public:
friend
VCL_DLLPUBLIC
SvStream
&
WriteGDIMetaFile
(
SvStream
&
rOStm
,
const
GDIMetaFile
&
rGDIMetaFile
);
/// Creates an antialiased thumbnail, with maximum width or height of nMaximumExtent.
bool
CreateThumbnail
(
BitmapEx
&
rBmpEx
,
sal_uInt32
nMaximumSize
=
256
)
const
;
bool
CreateThumbnail
(
BitmapEx
&
rBitmapEx
,
sal_uInt32
nMaximumExtent
=
256
,
BmpConversion
nColorConversion
=
BMP_CONVERSION_24BIT
,
long
nScaleFlag
=
BMP_SCALE_BESTQUALITY
)
const
;
void
UseCanvas
(
bool
_bUseCanvas
);
bool
GetUseCanvas
()
const
{
return
bUseCanvas
;
}
...
...
sfx2/source/doc/graphhelp.cxx
Dosyayı görüntüle @
2113c50b
...
...
@@ -39,6 +39,7 @@
#include <vcl/outdev.hxx>
#include <vcl/virdev.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/graphicfilter.hxx>
#include <tools/stream.hxx>
#include <tools/helpers.hxx>
...
...
@@ -52,7 +53,7 @@
#include "graphhelp.hxx"
#include "doc.hrc"
using
namespace
::
com
::
sun
::
star
;
using
namespace
css
;
SvMemoryStream
*
GraphicHelper
::
getFormatStrFromGDI_Impl
(
const
GDIMetaFile
*
pGDIMeta
,
sal_uInt32
nFormat
)
{
...
...
@@ -192,30 +193,33 @@ bool GraphicHelper::supportsMetaFileHandle_Impl()
// static
bool
GraphicHelper
::
getThumbnailFormatFromGDI_Impl
(
GDIMetaFile
*
pMetaFile
,
const
uno
::
Reference
<
io
::
XStream
>&
xStream
)
bool
GraphicHelper
::
getThumbnailFormatFromGDI_Impl
(
GDIMetaFile
*
pMetaFile
,
const
uno
::
Reference
<
io
::
XStream
>&
xStream
)
{
bool
bResult
=
false
;
SvStream
*
pStream
=
NULL
;
if
(
xStream
.
is
()
)
pStream
=
::
utl
::
UcbStreamHelper
::
CreateStream
(
xStream
)
;
if
(
!
pMetaFile
||
!
xStream
.
is
()
)
return
false
;
if
(
pMetaFile
&&
pStream
&&
!
pStream
->
GetError
()
)
{
BitmapEx
aResultBitmap
;
boost
::
scoped_ptr
<
SvStream
>
pStream
(
utl
::
UcbStreamHelper
::
CreateStream
(
xStream
));
bResult
=
pMetaFile
->
CreateThumbnail
(
aResultBitmap
);
if
(
pStream
->
GetError
())
return
false
;
if
(
bResult
)
bResult
=
(
!
aResultBitmap
.
IsEmpty
()
&&
GraphicConverter
::
Export
(
*
pStream
,
aResultBitmap
,
CVT_PNG
)
==
0
&&
(
pStream
->
Flush
(),
!
pStream
->
GetError
()
)
);
BitmapEx
aResultBitmap
;
delete
pStream
;
}
bResult
=
pMetaFile
->
CreateThumbnail
(
aResultBitmap
,
256
,
BMP_CONVERSION_8BIT_COLORS
,
BMP_SCALE_DEFAULT
);
return
bResult
;
if
(
!
bResult
||
aResultBitmap
.
IsEmpty
())
return
false
;
GraphicFilter
&
rFilter
=
GraphicFilter
::
GetGraphicFilter
();
if
(
rFilter
.
compressAsPNG
(
aResultBitmap
,
*
pStream
.
get
(),
9
)
!=
GRFILTER_OK
)
return
false
;
pStream
->
Flush
();
return
!
pStream
->
GetError
();
}
// static
...
...
vcl/source/gdi/gdimtf.cxx
Dosyayı görüntüle @
2113c50b
...
...
@@ -2879,7 +2879,7 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm )
return
rOStm
;
}
bool
GDIMetaFile
::
CreateThumbnail
(
BitmapEx
&
rB
mpEx
,
sal_uInt32
nMaximumExtent
)
const
bool
GDIMetaFile
::
CreateThumbnail
(
BitmapEx
&
rB
itmapEx
,
sal_uInt32
nMaximumExtent
,
BmpConversion
eColorConversion
,
long
nScaleFlag
)
const
{
// initialization seems to be complicated but is used to avoid rounding errors
VirtualDevice
aVDev
;
...
...
@@ -2889,8 +2889,8 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExtent) c
Size
aDrawSize
(
aVDev
.
LogicToPixel
(
GetPrefSize
(),
GetPrefMapMode
()
)
);
Size
aSizePix
(
labs
(
aBRPix
.
X
()
-
aTLPix
.
X
()
)
+
1
,
labs
(
aBRPix
.
Y
()
-
aTLPix
.
Y
()
)
+
1
);
if
(
!
rBmpEx
.
IsEmpty
()
)
rB
m
pEx
.
SetEmpty
();
if
(
!
rBitmapEx
.
IsEmpty
()
)
rB
itma
pEx
.
SetEmpty
();
// determine size that has the same aspect ratio as image size and
// fits into the rectangle determined by nMaximumExtent
...
...
@@ -2932,19 +2932,18 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBmpEx, sal_uInt32 nMaximumExtent) c
const_cast
<
GDIMetaFile
*>
(
this
)
->
Play
(
&
aVDev
,
aBackPosPix
,
aAntialias
);
// get paint bitmap
Bitmap
aB
m
p
(
aVDev
.
GetBitmap
(
aNullPt
,
aVDev
.
GetOutputSizePixel
()
)
);
Bitmap
aB
itma
p
(
aVDev
.
GetBitmap
(
aNullPt
,
aVDev
.
GetOutputSizePixel
()
)
);
// assure that we have a true color image
if
(
aBmp
.
GetBitCount
()
!=
24
)
aBmp
.
Convert
(
BMP_CONVERSION_24BIT
);
// scale down the image to the desired size - use the input scaler for the scaling operation
aBitmap
.
Scale
(
aDrawSize
,
nScaleFlag
);
//
downsize, to get the antialiased picture
aB
mp
.
Scale
(
aDrawSize
,
BMP_SCALE_BESTQUALITY
);
//
convert to desired bitmap color format
aB
itmap
.
Convert
(
eColorConversion
);
rB
mpEx
=
BitmapEx
(
aBm
p
);
rB
itmapEx
=
BitmapEx
(
aBitma
p
);
}
return
!
rB
m
pEx
.
IsEmpty
();
return
!
rB
itma
pEx
.
IsEmpty
();
}
void
GDIMetaFile
::
UseCanvas
(
bool
_bUseCanvas
)
...
...
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