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
218179dd
Kaydet (Commit)
218179dd
authored
Ara 23, 2016
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
unroll code for early returns, no logic changed intended
Change-Id: Ic1cc63a5fe3ad2c949f91c395c00f5f99bd7602a
üst
6aa48242
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
78 deletions
+76
-78
svpbmp.cxx
vcl/headless/svpbmp.cxx
+76
-78
No files found.
vcl/headless/svpbmp.cxx
Dosyayı görüntüle @
218179dd
...
...
@@ -53,97 +53,95 @@ BitmapBuffer* ImplCreateDIB(
||
nBitCount
==
32
)
&&
"Unsupported BitCount!"
);
if
(
!
rSize
.
Width
()
||
!
rSize
.
Height
())
return
nullptr
;
BitmapBuffer
*
pDIB
=
nullptr
;
if
(
rSize
.
Width
()
&&
rSize
.
Height
()
)
try
{
try
{
pDIB
=
new
BitmapBuffer
;
}
catch
(
const
std
::
bad_alloc
&
)
{
pDIB
=
nullptr
;
}
pDIB
=
new
BitmapBuffer
;
}
catch
(
const
std
::
bad_alloc
&
)
{
pDIB
=
nullptr
;
}
if
(
pDIB
)
if
(
!
pDIB
)
return
nullptr
;
const
sal_uInt16
nColors
=
(
nBitCount
<=
8
)
?
(
1
<<
nBitCount
)
:
0
;
switch
(
nBitCount
)
{
case
1
:
pDIB
->
mnFormat
=
ScanlineFormat
::
N1BitLsbPal
;
break
;
case
4
:
pDIB
->
mnFormat
=
ScanlineFormat
::
N4BitMsnPal
;
break
;
case
8
:
pDIB
->
mnFormat
=
ScanlineFormat
::
N8BitPal
;
break
;
case
16
:
{
const
sal_uInt16
nColors
=
(
nBitCount
<=
8
)
?
(
1
<<
nBitCount
)
:
0
;
switch
(
nBitCount
)
{
case
1
:
pDIB
->
mnFormat
=
ScanlineFormat
::
N1BitLsbPal
;
break
;
case
4
:
pDIB
->
mnFormat
=
ScanlineFormat
::
N4BitMsnPal
;
break
;
case
8
:
pDIB
->
mnFormat
=
ScanlineFormat
::
N8BitPal
;
break
;
case
16
:
{
#ifdef OSL_BIGENDIAN
pDIB
->
mnFormat
=
ScanlineFormat
::
N16BitTcMsbMask
;
pDIB
->
mnFormat
=
ScanlineFormat
::
N16BitTcMsbMask
;
#else
pDIB
->
mnFormat
=
ScanlineFormat
::
N16BitTcLsbMask
;
pDIB
->
mnFormat
=
ScanlineFormat
::
N16BitTcLsbMask
;
#endif
ColorMaskElement
aRedMask
(
0xf800
);
aRedMask
.
CalcMaskShift
();
ColorMaskElement
aGreenMask
(
0x07e0
);
aGreenMask
.
CalcMaskShift
();
ColorMaskElement
aBlueMask
(
0x001f
);
aBlueMask
.
CalcMaskShift
();
pDIB
->
maColorMask
=
ColorMask
(
aRedMask
,
aGreenMask
,
aBlueMask
);
break
;
}
default
:
nBitCount
=
32
;
SAL_FALLTHROUGH
;
case
32
:
{
pDIB
->
mnFormat
=
SVP_CAIRO_FORMAT
;
break
;
}
}
pDIB
->
mnFormat
|=
ScanlineFormat
::
TopDown
;
pDIB
->
mnWidth
=
rSize
.
Width
();
pDIB
->
mnHeight
=
rSize
.
Height
();
pDIB
->
mnScanlineSize
=
AlignedWidth4Bytes
(
pDIB
->
mnWidth
*
nBitCount
);
pDIB
->
mnBitCount
=
nBitCount
;
if
(
nColors
)
{
pDIB
->
maPalette
=
rPal
;
pDIB
->
maPalette
.
SetEntryCount
(
nColors
);
}
try
{
size_t
size
=
pDIB
->
mnScanlineSize
*
pDIB
->
mnHeight
;
pDIB
->
mpBits
=
new
sal_uInt8
[
size
];
ColorMaskElement
aRedMask
(
0xf800
);
aRedMask
.
CalcMaskShift
();
ColorMaskElement
aGreenMask
(
0x07e0
);
aGreenMask
.
CalcMaskShift
();
ColorMaskElement
aBlueMask
(
0x001f
);
aBlueMask
.
CalcMaskShift
();
pDIB
->
maColorMask
=
ColorMask
(
aRedMask
,
aGreenMask
,
aBlueMask
);
break
;
}
default
:
nBitCount
=
32
;
SAL_FALLTHROUGH
;
case
32
:
{
pDIB
->
mnFormat
=
SVP_CAIRO_FORMAT
;
break
;
}
}
pDIB
->
mnFormat
|=
ScanlineFormat
::
TopDown
;
pDIB
->
mnWidth
=
rSize
.
Width
();
pDIB
->
mnHeight
=
rSize
.
Height
();
pDIB
->
mnScanlineSize
=
AlignedWidth4Bytes
(
pDIB
->
mnWidth
*
nBitCount
);
pDIB
->
mnBitCount
=
nBitCount
;
if
(
nColors
)
{
pDIB
->
maPalette
=
rPal
;
pDIB
->
maPalette
.
SetEntryCount
(
nColors
);
}
try
{
size_t
size
=
pDIB
->
mnScanlineSize
*
pDIB
->
mnHeight
;
pDIB
->
mpBits
=
new
sal_uInt8
[
size
];
#ifdef __SANITIZE_ADDRESS__
if
(
!
pDIB
->
mpBits
)
{
// can only happen with ASAN allocator_may_return_null=1
delete
pDIB
;
pDIB
=
nullptr
;
}
else
if
(
!
pDIB
->
mpBits
)
{
// can only happen with ASAN allocator_may_return_null=1
delete
pDIB
;
pDIB
=
nullptr
;
}
else
#endif
{
std
::
memset
(
pDIB
->
mpBits
,
0
,
size
);
}
}
catch
(
const
std
::
bad_alloc
&
)
{
delete
pDIB
;
pDIB
=
nullptr
;
}
{
std
::
memset
(
pDIB
->
mpBits
,
0
,
size
);
}
}
else
catch
(
const
std
::
bad_alloc
&
)
{
delete
pDIB
;
pDIB
=
nullptr
;
}
return
pDIB
;
}
...
...
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