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
1d3b6133
Kaydet (Commit)
1d3b6133
authored
Eki 01, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
desktop, vcl: support transparency in VirtualDevices with user-provided memory
Change-Id: I65c31995c02a644aa436aecd065255fab38045e4
üst
ded566ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
5 deletions
+33
-5
init.cxx
desktop/source/lib/init.cxx
+23
-1
virdev.hxx
include/vcl/virdev.hxx
+2
-0
virdev.cxx
vcl/source/gdi/virdev.cxx
+8
-4
No files found.
desktop/source/lib/init.cxx
Dosyayı görüntüle @
1d3b6133
...
@@ -755,10 +755,21 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
...
@@ -755,10 +755,21 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
InitSvpForLibreOfficeKit
();
InitSvpForLibreOfficeKit
();
ScopedVclPtrInstance
<
VirtualDevice
>
pDevice
(
nullptr
,
Size
(
1
,
1
),
(
sal_uInt16
)
32
)
;
ScopedVclPtrInstance
<
VirtualDevice
>
pDevice
(
nullptr
,
Size
(
1
,
1
),
(
sal_uInt16
)
32
)
;
// Set background to transparent by default.
memset
(
pBuffer
,
0
,
nCanvasWidth
*
nCanvasHeight
*
4
);
pDevice
->
SetBackground
(
Wallpaper
(
Color
(
COL_TRANSPARENT
)));
boost
::
shared_array
<
sal_uInt8
>
aBuffer
(
pBuffer
,
NoDelete
<
sal_uInt8
>
()
);
boost
::
shared_array
<
sal_uInt8
>
aBuffer
(
pBuffer
,
NoDelete
<
sal_uInt8
>
()
);
// Allocate a separate buffer for the alpha device.
std
::
vector
<
sal_uInt8
>
aAlpha
(
nCanvasWidth
*
nCanvasHeight
);
memset
(
aAlpha
.
data
(),
0
,
nCanvasWidth
*
nCanvasHeight
);
boost
::
shared_array
<
sal_uInt8
>
aAlphaBuffer
(
aAlpha
.
data
(),
NoDelete
<
sal_uInt8
>
());
pDevice
->
SetOutputSizePixelScaleOffsetAndBuffer
(
pDevice
->
SetOutputSizePixelScaleOffsetAndBuffer
(
Size
(
nCanvasWidth
,
nCanvasHeight
),
Fraction
(
1.0
),
Point
(),
Size
(
nCanvasWidth
,
nCanvasHeight
),
Fraction
(
1.0
),
Point
(),
aBuffer
,
true
);
aBuffer
,
aAlphaBuffer
,
true
);
pDoc
->
paintTile
(
*
pDevice
.
get
(),
nCanvasWidth
,
nCanvasHeight
,
pDoc
->
paintTile
(
*
pDevice
.
get
(),
nCanvasWidth
,
nCanvasHeight
,
nTilePosX
,
nTilePosY
,
nTileWidth
,
nTileHeight
);
nTilePosX
,
nTilePosY
,
nTileWidth
,
nTileHeight
);
...
@@ -772,6 +783,17 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
...
@@ -772,6 +783,17 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
nTilePosX
,
nTilePosY
,
nTileWidth
,
nTileHeight
);
nTilePosX
,
nTilePosY
,
nTileWidth
,
nTileHeight
);
#endif
#endif
// Overwrite pBuffer's alpha channel with the separate alpha buffer.
for
(
int
nRow
=
0
;
nRow
<
nCanvasHeight
;
++
nRow
)
{
for
(
int
nCol
=
0
;
nCol
<
nCanvasWidth
;
++
nCol
)
{
const
int
nOffset
=
(
nCanvasHeight
*
nRow
)
+
nCol
;
// VCL's transparent is 0, RGBA's transparent is 0xff.
pBuffer
[
nOffset
*
4
+
3
]
=
0xff
-
aAlpha
[
nOffset
];
}
}
static
bool
bDebug
=
getenv
(
"LOK_DEBUG"
)
!=
0
;
static
bool
bDebug
=
getenv
(
"LOK_DEBUG"
)
!=
0
;
if
(
bDebug
)
if
(
bDebug
)
{
{
...
...
include/vcl/virdev.hxx
Dosyayı görüntüle @
1d3b6133
...
@@ -48,6 +48,7 @@ private:
...
@@ -48,6 +48,7 @@ private:
const
bool
bTopDown
);
const
bool
bTopDown
);
SAL_DLLPRIVATE
bool
ImplSetOutputSizePixel
(
const
Size
&
rNewSize
,
bool
bErase
,
SAL_DLLPRIVATE
bool
ImplSetOutputSizePixel
(
const
Size
&
rNewSize
,
bool
bErase
,
const
basebmp
::
RawMemorySharedArray
&
pBuffer
,
const
basebmp
::
RawMemorySharedArray
&
pBuffer
,
const
basebmp
::
RawMemorySharedArray
&
pAlphaBuffer
,
const
bool
bTopDown
);
const
bool
bTopDown
);
VirtualDevice
(
const
VirtualDevice
&
)
SAL_DELETED_FUNCTION
;
VirtualDevice
(
const
VirtualDevice
&
)
SAL_DELETED_FUNCTION
;
...
@@ -126,6 +127,7 @@ public:
...
@@ -126,6 +127,7 @@ public:
const
Fraction
&
rScale
,
const
Fraction
&
rScale
,
const
Point
&
rNewOffset
,
const
Point
&
rNewOffset
,
const
basebmp
::
RawMemorySharedArray
&
pBuffer
,
const
basebmp
::
RawMemorySharedArray
&
pBuffer
,
const
basebmp
::
RawMemorySharedArray
&
pAlphaBuffer
,
const
bool
bTopDown
=
false
);
const
bool
bTopDown
=
false
);
bool
SetOutputSize
(
const
Size
&
rNewSize
,
bool
bErase
=
true
)
bool
SetOutputSize
(
const
Size
&
rNewSize
,
bool
bErase
=
true
)
{
return
SetOutputSizePixel
(
LogicToPixel
(
rNewSize
),
bErase
);
}
{
return
SetOutputSizePixel
(
LogicToPixel
(
rNewSize
),
bErase
);
}
...
...
vcl/source/gdi/virdev.cxx
Dosyayı görüntüle @
1d3b6133
...
@@ -393,6 +393,7 @@ void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect )
...
@@ -393,6 +393,7 @@ void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect )
bool
VirtualDevice
::
ImplSetOutputSizePixel
(
const
Size
&
rNewSize
,
bool
bErase
,
bool
VirtualDevice
::
ImplSetOutputSizePixel
(
const
Size
&
rNewSize
,
bool
bErase
,
const
basebmp
::
RawMemorySharedArray
&
pBuffer
,
const
basebmp
::
RawMemorySharedArray
&
pBuffer
,
const
basebmp
::
RawMemorySharedArray
&
pAlphaBuffer
,
const
bool
bTopDown
)
const
bool
bTopDown
)
{
{
if
(
InnerImplSetOutputSizePixel
(
rNewSize
,
bErase
,
pBuffer
,
bTopDown
)
)
if
(
InnerImplSetOutputSizePixel
(
rNewSize
,
bErase
,
pBuffer
,
bTopDown
)
)
...
@@ -409,7 +410,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
...
@@ -409,7 +410,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
{
{
mpAlphaVDev
=
VclPtr
<
VirtualDevice
>::
Create
(
*
this
,
mnAlphaDepth
);
mpAlphaVDev
=
VclPtr
<
VirtualDevice
>::
Create
(
*
this
,
mnAlphaDepth
);
mpAlphaVDev
->
InnerImplSetOutputSizePixel
(
rNewSize
,
bErase
,
mpAlphaVDev
->
InnerImplSetOutputSizePixel
(
rNewSize
,
bErase
,
basebmp
::
RawMemorySharedArray
()
,
pAlphaBuffer
,
bTopDown
);
bTopDown
);
}
}
...
@@ -443,13 +444,16 @@ void VirtualDevice::EnableRTL( bool bEnable )
...
@@ -443,13 +444,16 @@ void VirtualDevice::EnableRTL( bool bEnable )
bool
VirtualDevice
::
SetOutputSizePixel
(
const
Size
&
rNewSize
,
bool
bErase
)
bool
VirtualDevice
::
SetOutputSizePixel
(
const
Size
&
rNewSize
,
bool
bErase
)
{
{
return
ImplSetOutputSizePixel
(
rNewSize
,
bErase
,
basebmp
::
RawMemorySharedArray
(),
false
);
return
ImplSetOutputSizePixel
(
rNewSize
,
bErase
,
basebmp
::
RawMemorySharedArray
(),
basebmp
::
RawMemorySharedArray
(),
false
);
}
}
bool
VirtualDevice
::
SetOutputSizePixelScaleOffsetAndBuffer
(
bool
VirtualDevice
::
SetOutputSizePixelScaleOffsetAndBuffer
(
const
Size
&
rNewSize
,
const
Fraction
&
rScale
,
const
Point
&
rNewOffset
,
const
Size
&
rNewSize
,
const
Fraction
&
rScale
,
const
Point
&
rNewOffset
,
const
basebmp
::
RawMemorySharedArray
&
pBuffer
,
const
bool
bTopDown
)
const
basebmp
::
RawMemorySharedArray
&
pBuffer
,
const
b
asebmp
::
RawMemorySharedArray
&
pAlphaBuffer
,
const
b
ool
bTopDown
)
{
{
if
(
pAlphaBuffer
)
mnAlphaDepth
=
8
;
if
(
pBuffer
)
{
if
(
pBuffer
)
{
MapMode
mm
=
GetMapMode
();
MapMode
mm
=
GetMapMode
();
mm
.
SetOrigin
(
rNewOffset
);
mm
.
SetOrigin
(
rNewOffset
);
...
@@ -457,7 +461,7 @@ bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer(
...
@@ -457,7 +461,7 @@ bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer(
mm
.
SetScaleY
(
rScale
);
mm
.
SetScaleY
(
rScale
);
SetMapMode
(
mm
);
SetMapMode
(
mm
);
}
}
return
ImplSetOutputSizePixel
(
rNewSize
,
true
,
pBuffer
,
bTopDown
);
return
ImplSetOutputSizePixel
(
rNewSize
,
true
,
pBuffer
,
pAlphaBuffer
,
bTopDown
);
}
}
void
VirtualDevice
::
SetReferenceDevice
(
RefDevMode
i_eRefDevMode
)
void
VirtualDevice
::
SetReferenceDevice
(
RefDevMode
i_eRefDevMode
)
...
...
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