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
6807c13a
Kaydet (Commit)
6807c13a
authored
Nis 10, 2014
tarafından
Tor Lillqvist
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More iOS-only debugging hackery: write CGImages out as PNGs for inspection
Change-Id: I966189a74414ea83b2ec7f5035cd7c9d4d674179
üst
d0315bd4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
salbmp.cxx
vcl/quartz/salbmp.cxx
+37
-1
No files found.
vcl/quartz/salbmp.cxx
Dosyayı görüntüle @
6807c13a
...
@@ -46,6 +46,38 @@ static const unsigned long k32BitRedColorMask = 0x00ff0000;
...
@@ -46,6 +46,38 @@ static const unsigned long k32BitRedColorMask = 0x00ff0000;
static
const
unsigned
long
k32BitGreenColorMask
=
0x0000ff00
;
static
const
unsigned
long
k32BitGreenColorMask
=
0x0000ff00
;
static
const
unsigned
long
k32BitBlueColorMask
=
0x000000ff
;
static
const
unsigned
long
k32BitBlueColorMask
=
0x000000ff
;
#if defined IOS && defined DBG_UTIL
#include <MobileCoreServices/UTCoreTypes.h>
#include <ImageIO/ImageIO.h>
static
void
writeImageToFile
(
CGImageRef
image
,
const
char
*
baseName
)
{
static
int
counter
=
0
;
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
documentsDirectory
=
[
paths
objectAtIndex
:
0
];
NSString
*
path
=
[
NSString
stringWithFormat
:
@
"%@/%s.%d.png"
,
documentsDirectory
,
baseName
,
counter
++
];
CFURLRef
url
=
(
CFURLRef
)[
NSURL
fileURLWithPath
:
path
];
CGImageDestinationRef
destination
=
CGImageDestinationCreateWithURL
(
url
,
kUTTypePNG
,
1
,
NULL
);
CGImageDestinationAddImage
(
destination
,
image
,
nil
);
if
(
!
CGImageDestinationFinalize
(
destination
))
{
NSLog
(
@
"Failed to write image to %@"
,
path
);
}
else
{
SAL_DEBUG
(
"--- saved image "
<<
baseName
<<
" to "
<<
[
path
UTF8String
]);
}
CFRelease
(
destination
);
}
#define DBG_WRITE_IMAGE(image, name) writeImageToFile(image, name)
#else
#define DBG_WRITE_IMAGE(image, name)
/* empty */
#endif
static
bool
isValidBitCount
(
sal_uInt16
nBitCount
)
static
bool
isValidBitCount
(
sal_uInt16
nBitCount
)
{
{
return
(
nBitCount
==
1
)
||
(
nBitCount
==
4
)
||
(
nBitCount
==
8
)
||
(
nBitCount
==
16
)
||
(
nBitCount
==
24
)
||
(
nBitCount
==
32
);
return
(
nBitCount
==
1
)
||
(
nBitCount
==
4
)
||
(
nBitCount
==
8
)
||
(
nBitCount
==
16
)
||
(
nBitCount
==
24
)
||
(
nBitCount
==
32
);
...
@@ -753,6 +785,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
...
@@ -753,6 +785,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
// CGImageCreateWithMask() only likes masks or greyscale images => convert if needed
// CGImageCreateWithMask() only likes masks or greyscale images => convert if needed
// TODO: isolate in an extra method?
// TODO: isolate in an extra method?
DBG_WRITE_IMAGE
(
xMask
,
"xMask"
);
if
(
!
CGImageIsMask
(
xMask
)
||
rMask
.
GetBitCount
()
!=
8
)
//(CGImageGetColorSpace(xMask) != GetSalData()->mxGraySpace) )
if
(
!
CGImageIsMask
(
xMask
)
||
rMask
.
GetBitCount
()
!=
8
)
//(CGImageGetColorSpace(xMask) != GetSalData()->mxGraySpace) )
{
{
const
CGRect
xImageRect
=
CGRectMake
(
0
,
0
,
nWidth
,
nHeight
);
//the rect has no offset
const
CGRect
xImageRect
=
CGRectMake
(
0
,
0
,
nWidth
,
nHeight
);
//the rect has no offset
...
@@ -763,7 +796,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
...
@@ -763,7 +796,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
void
*
pMaskMem
=
rtl_allocateMemory
(
nMaskBytesPerRow
*
nHeight
);
void
*
pMaskMem
=
rtl_allocateMemory
(
nMaskBytesPerRow
*
nHeight
);
CGContextRef
xMaskContext
=
CGBitmapContextCreate
(
pMaskMem
,
CGContextRef
xMaskContext
=
CGBitmapContextCreate
(
pMaskMem
,
nWidth
,
nHeight
,
8
,
nMaskBytesPerRow
,
GetSalData
()
->
mxGraySpace
,
kCGImageAlphaNone
);
nWidth
,
nHeight
,
8
,
nMaskBytesPerRow
,
GetSalData
()
->
mxGraySpace
,
kCGImageAlphaNone
);
CG_TRACE
(
"CGBitmapContextCreate("
<<
nWidth
<<
"x"
<<
nHeight
<<
"x8) = "
<<
xMaskContext
);
CG_TRACE
(
"CGBitmapContextCreate("
<<
nWidth
<<
"x"
<<
nHeight
<<
"x8
,"
<<
nMaskBytesPerRow
<<
"
) = "
<<
xMaskContext
);
CG_TRACE
(
"CGContextDrawImage("
<<
xMaskContext
<<
","
<<
xImageRect
<<
","
<<
xMask
<<
")"
);
CG_TRACE
(
"CGContextDrawImage("
<<
xMaskContext
<<
","
<<
xImageRect
<<
","
<<
xMask
<<
")"
);
CGContextDrawImage
(
xMaskContext
,
xImageRect
,
xMask
);
CGContextDrawImage
(
xMaskContext
,
xImageRect
,
xMask
);
CG_TRACE
(
"CFRelease("
<<
xMask
<<
")"
);
CG_TRACE
(
"CFRelease("
<<
xMask
<<
")"
);
...
@@ -773,6 +806,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
...
@@ -773,6 +806,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
static
const
CGFloat
*
pDecode
=
NULL
;
static
const
CGFloat
*
pDecode
=
NULL
;
xMask
=
CGImageMaskCreate
(
nWidth
,
nHeight
,
8
,
8
,
nMaskBytesPerRow
,
xDataProvider
,
pDecode
,
false
);
xMask
=
CGImageMaskCreate
(
nWidth
,
nHeight
,
8
,
8
,
nMaskBytesPerRow
,
xDataProvider
,
pDecode
,
false
);
CG_TRACE
(
"CGImageMaskCreate("
<<
nWidth
<<
","
<<
nHeight
<<
",8,8) = "
<<
xMask
);
CG_TRACE
(
"CGImageMaskCreate("
<<
nWidth
<<
","
<<
nHeight
<<
",8,8) = "
<<
xMask
);
DBG_WRITE_IMAGE
(
xMask
,
"xMask.new"
);
CFRelease
(
xDataProvider
);
CFRelease
(
xDataProvider
);
CG_TRACE
(
"CFRelease("
<<
xMaskContext
<<
")"
);
CG_TRACE
(
"CFRelease("
<<
xMaskContext
<<
")"
);
CFRelease
(
xMaskContext
);
CFRelease
(
xMaskContext
);
...
@@ -784,6 +818,8 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
...
@@ -784,6 +818,8 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
// combine image and alpha mask
// combine image and alpha mask
CGImageRef
xMaskedImage
=
CGImageCreateWithMask
(
xImage
,
xMask
);
CGImageRef
xMaskedImage
=
CGImageCreateWithMask
(
xImage
,
xMask
);
CG_TRACE
(
"CGImageCreateWithMask("
<<
xImage
<<
","
<<
xMask
<<
") = "
<<
xMaskedImage
);
CG_TRACE
(
"CGImageCreateWithMask("
<<
xImage
<<
","
<<
xMask
<<
") = "
<<
xMaskedImage
);
DBG_WRITE_IMAGE
(
xImage
,
"xImage"
);
DBG_WRITE_IMAGE
(
xMaskedImage
,
"xMaskedImage"
);
CG_TRACE
(
"CFRelease("
<<
xMask
<<
")"
);
CG_TRACE
(
"CFRelease("
<<
xMask
<<
")"
);
CFRelease
(
xMask
);
CFRelease
(
xMask
);
CG_TRACE
(
"CFRelease("
<<
xImage
<<
")"
);
CG_TRACE
(
"CFRelease("
<<
xImage
<<
")"
);
...
...
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