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
a6fee2ca
Kaydet (Commit)
a6fee2ca
authored
Kas 12, 2014
tarafından
Louis-Francis Ratté-Boulianne
Kaydeden (comit)
Markus Mohrhard
Kas 13, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
vcl: Use scissor or stencil for clipping in OpenGL backend
Change-Id: Ib6620572391999d5f8124a1a8695909d6c48643d
üst
c4e494bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
24 deletions
+71
-24
region.hxx
include/vcl/region.hxx
+3
-3
openglgdiimpl.hxx
vcl/inc/openglgdiimpl.hxx
+4
-0
gdiimpl.cxx
vcl/opengl/gdiimpl.cxx
+47
-21
region.cxx
vcl/source/gdi/region.cxx
+17
-0
No files found.
include/vcl/region.hxx
Dosyayı görüntüle @
a6fee2ca
...
...
@@ -102,6 +102,8 @@ public:
void
SetEmpty
();
void
SetNull
();
bool
IsRectangle
()
const
;
Rectangle
GetBoundRect
()
const
;
bool
HasPolyPolygonOrB2DPolyPolygon
()
const
{
return
(
getB2DPolyPolygon
()
||
getPolyPolygon
());
}
void
GetRegionRectangles
(
RectangleVector
&
rTarget
)
const
;
...
...
@@ -144,9 +146,7 @@ inline std::basic_ostream<charT, traits> & operator <<(
<<
*
rRegion
.
getB2DPolyPolygon
()
<<
")"
;
if
(
rRegion
.
getPolyPolygon
())
return
stream
<<
"PolyPolygon("
<<
*
rRegion
.
getPolyPolygon
()
<<
")"
;
return
stream
<<
"unimplemented"
;
if
(
rRegion
.
getRegionBand
())
{
// inlined because RegionBand is private to vcl
stream
<<
"RegionBand("
;
...
...
vcl/inc/openglgdiimpl.hxx
Dosyayı görüntüle @
a6fee2ca
...
...
@@ -40,6 +40,10 @@ protected:
SalVirtualDevice
*
mpVDev
;
int
mnPainting
;
// clipping
bool
mbUseScissor
;
bool
mbUseStencil
;
bool
mbOffscreen
;
GLuint
mnFramebufferId
;
OpenGLTextureSharedPtr
mpOffscreenTex
;
...
...
vcl/opengl/gdiimpl.cxx
Dosyayı görüntüle @
a6fee2ca
...
...
@@ -61,6 +61,8 @@
OpenGLSalGraphicsImpl
::
OpenGLSalGraphicsImpl
()
:
mpFrame
(
NULL
)
,
mnPainting
(
0
)
,
mbUseScissor
(
false
)
,
mbUseStencil
(
false
)
,
mbOffscreen
(
false
)
,
mnFramebufferId
(
0
)
,
mpOffscreenTex
(
nullptr
)
...
...
@@ -97,6 +99,10 @@ void OpenGLSalGraphicsImpl::PreDraw()
if
(
mbOffscreen
)
glBindFramebuffer
(
GL_FRAMEBUFFER
,
mnFramebufferId
);
glViewport
(
0
,
0
,
GetWidth
(),
GetHeight
()
);
if
(
mbUseScissor
)
glEnable
(
GL_SCISSOR_TEST
);
if
(
mbUseStencil
)
glEnable
(
GL_STENCIL_TEST
);
CHECK_GL_ERROR
();
}
...
...
@@ -105,8 +111,12 @@ void OpenGLSalGraphicsImpl::PostDraw()
{
if
(
mbOffscreen
)
glBindFramebuffer
(
GL_FRAMEBUFFER
,
0
);
if
(
mnPainting
==
0
)
else
if
(
mnPainting
==
0
)
glFlush
();
if
(
mbUseScissor
)
glDisable
(
GL_SCISSOR_TEST
);
if
(
mbUseStencil
)
glDisable
(
GL_STENCIL_TEST
);
CHECK_GL_ERROR
();
}
...
...
@@ -117,28 +127,46 @@ void OpenGLSalGraphicsImpl::freeResources()
bool
OpenGLSalGraphicsImpl
::
setClipRegion
(
const
vcl
::
Region
&
rClip
)
{
const
basegfx
::
B2DPolyPolygon
aClip
(
rClip
.
GetAsB2DPolyPolygon
()
);
SAL_INFO
(
"vcl.opengl"
,
"::setClipRegion "
<<
rClip
);
SAL_INFO
(
"vcl.opengl"
,
"::setClipRegion"
);
if
(
rClip
.
IsEmpty
()
)
{
ResetClipRegion
();
return
true
;
}
/*maContext.makeCurrent();
glViewport( 0, 0, GetWidth(), GetHeight() );
if
(
false
)
//rClip.IsRectangle() )
{
Rectangle
aRect
(
rClip
.
GetBoundRect
()
);
glEnable( GL_STENCIL_TEST );
mbUseStencil
=
false
;
mbUseScissor
=
true
;
maContext
.
makeCurrent
();
glScissor
(
aRect
.
Left
(),
GetHeight
()
-
aRect
.
Top
(),
aRect
.
GetWidth
(),
aRect
.
GetHeight
()
);
}
else
{
mbUseStencil
=
true
;
mbUseScissor
=
false
;
maContext
.
makeCurrent
();
glViewport
(
0
,
0
,
GetWidth
(),
GetHeight
()
);
glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
glStencilMask( 0xFF );
glStencilFunc( GL_NEVER, 1, 0xFF );
glStencilOp( GL_REPLACE, GL_KEEP, GL_KEEP );
glEnable
(
GL_STENCIL_TEST
);
glColorMask
(
GL_FALSE
,
GL_FALSE
,
GL_FALSE
,
GL_FALSE
);
glStencilMask
(
0xFF
);
glStencilFunc
(
GL_NEVER
,
1
,
0xFF
);
glStencilOp
(
GL_REPLACE
,
GL_KEEP
,
GL_KEEP
);
glClear( GL_STENCIL_BUFFER_BIT );
BeginSolid( SALCOLOR_NONE );
DrawPolyPolygon( aClip
);
EndSolid();
glClear
(
GL_STENCIL_BUFFER_BIT
);
BeginSolid
(
SALCOLOR_NONE
);
DrawPolyPolygon
(
rClip
.
GetAsB2DPolyPolygon
()
);
EndSolid
();
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
glStencilMask( 0x00 );
glStencilFunc( GL_EQUAL, 1, 0xFF );*/
glColorMask
(
GL_TRUE
,
GL_TRUE
,
GL_TRUE
,
GL_TRUE
);
glStencilMask
(
0x00
);
glStencilFunc
(
GL_EQUAL
,
1
,
0xFF
);
glDisable
(
GL_STENCIL_TEST
);
}
return
true
;
}
...
...
@@ -147,10 +175,8 @@ bool OpenGLSalGraphicsImpl::setClipRegion( const vcl::Region& rClip )
void
OpenGLSalGraphicsImpl
::
ResetClipRegion
()
{
SAL_INFO
(
"vcl.opengl"
,
"::ResetClipRegion"
);
maContext
.
makeCurrent
();
glDisable
(
GL_STENCIL_TEST
);
CHECK_GL_ERROR
();
mbUseScissor
=
false
;
mbUseStencil
=
false
;
}
// get the depth of the device
...
...
vcl/source/gdi/region.cxx
Dosyayı görüntüle @
a6fee2ca
...
...
@@ -1434,6 +1434,23 @@ bool vcl::Region::IsOver( const Rectangle& rRect ) const
return
!
aRegion
.
IsEmpty
();
}
bool
vcl
::
Region
::
IsRectangle
()
const
{
if
(
IsEmpty
()
||
IsNull
()
)
return
false
;
if
(
getB2DPolyPolygon
()
)
return
basegfx
::
tools
::
isRectangle
(
*
getB2DPolyPolygon
()
);
if
(
getPolyPolygon
()
)
return
getPolyPolygon
()
->
IsRect
();
if
(
getRegionBand
()
)
return
(
getRegionBand
()
->
getRectangleCount
()
==
1
);
return
false
;
}
void
vcl
::
Region
::
SetNull
()
{
// reset all content
...
...
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