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
afd759a5
Kaydet (Commit)
afd759a5
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 stencil mask to clip gradient shape
Change-Id: I5dc17a20ab65f0b0bad4741a7d1ec76a0e028e23
üst
6ff6d0b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
30 deletions
+50
-30
openglgdiimpl.hxx
vcl/inc/openglgdiimpl.hxx
+2
-0
gdiimpl.cxx
vcl/opengl/gdiimpl.cxx
+48
-30
No files found.
vcl/inc/openglgdiimpl.hxx
Dosyayı görüntüle @
afd759a5
...
...
@@ -74,6 +74,8 @@ protected:
GLuint
mnRadialGradientEndColorUniform
;
GLuint
mnRadialGradientCenterUniform
;
void
ImplSetClipBit
(
const
vcl
::
Region
&
rClip
,
GLuint
nMask
);
bool
CreateSolidProgram
(
void
);
bool
CreateTextureProgram
(
void
);
bool
CreateMaskedTextureProgram
(
void
);
...
...
vcl/opengl/gdiimpl.cxx
Dosyayı görüntüle @
afd759a5
...
...
@@ -102,7 +102,10 @@ void OpenGLSalGraphicsImpl::PreDraw()
if
(
mbUseScissor
)
glEnable
(
GL_SCISSOR_TEST
);
if
(
mbUseStencil
)
{
glStencilFunc
(
GL_EQUAL
,
1
,
0x1
);
glEnable
(
GL_STENCIL_TEST
);
}
CHECK_GL_ERROR
();
}
...
...
@@ -125,6 +128,24 @@ void OpenGLSalGraphicsImpl::freeResources()
// TODO Delete shaders, programs and textures if not shared
}
void
OpenGLSalGraphicsImpl
::
ImplSetClipBit
(
const
vcl
::
Region
&
rClip
,
GLuint
nMask
)
{
glEnable
(
GL_STENCIL_TEST
);
glColorMask
(
GL_FALSE
,
GL_FALSE
,
GL_FALSE
,
GL_FALSE
);
glStencilMask
(
nMask
);
glStencilFunc
(
GL_NEVER
,
nMask
,
0xFF
);
glStencilOp
(
GL_REPLACE
,
GL_KEEP
,
GL_KEEP
);
glClear
(
GL_STENCIL_BUFFER_BIT
);
BeginSolid
(
MAKE_SALCOLOR
(
0xFF
,
0xFF
,
0xFF
)
);
DrawPolyPolygon
(
rClip
.
GetAsB2DPolyPolygon
()
);
EndSolid
();
glColorMask
(
GL_TRUE
,
GL_TRUE
,
GL_TRUE
,
GL_TRUE
);
glStencilMask
(
0x00
);
glDisable
(
GL_STENCIL_TEST
);
}
bool
OpenGLSalGraphicsImpl
::
setClipRegion
(
const
vcl
::
Region
&
rClip
)
{
SAL_INFO
(
"vcl.opengl"
,
"::setClipRegion "
<<
rClip
);
...
...
@@ -150,22 +171,7 @@ bool OpenGLSalGraphicsImpl::setClipRegion( const vcl::Region& rClip )
mbUseScissor
=
false
;
maContext
.
makeCurrent
();
glViewport
(
0
,
0
,
GetWidth
(),
GetHeight
()
);
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
(
rClip
.
GetAsB2DPolyPolygon
()
);
EndSolid
();
glColorMask
(
GL_TRUE
,
GL_TRUE
,
GL_TRUE
,
GL_TRUE
);
glStencilMask
(
0x00
);
glStencilFunc
(
GL_EQUAL
,
1
,
0xFF
);
glDisable
(
GL_STENCIL_TEST
);
ImplSetClipBit
(
rClip
,
0x01
);
}
return
true
;
...
...
@@ -1333,42 +1339,54 @@ bool OpenGLSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPoly,
if
(
aBoundRect
.
IsEmpty
()
)
return
true
;
if
(
rGradient
.
GetStyle
()
!=
GradientStyle_LINEAR
&&
rGradient
.
GetStyle
()
!=
GradientStyle_RADIAL
)
return
false
;
aBoundRect
.
Left
()
--
;
aBoundRect
.
Top
()
--
;
aBoundRect
.
Right
()
++
;
aBoundRect
.
Bottom
()
++
;
//TODO: lfrb: some missing transformation with the polygon in outdev
PreDraw
();
ImplSetClipBit
(
vcl
::
Region
(
rPolyPoly
),
0x02
);
if
(
mbUseStencil
)
{
glEnable
(
GL_STENCIL_TEST
);
glStencilFunc
(
GL_EQUAL
,
3
,
0xFF
);
}
else
{
glEnable
(
GL_STENCIL_TEST
);
glStencilFunc
(
GL_EQUAL
,
2
,
0xFF
);
}
// if border >= 100%, draw solid rectangle with start color
if
(
rGradient
.
GetBorder
()
>=
100.0
)
{
Color
aCol
=
rGradient
.
GetStartColor
();
long
nF
=
rGradient
.
GetStartIntensity
();
PreDraw
();
BeginSolid
(
MAKE_SALCOLOR
(
aCol
.
GetRed
()
*
nF
/
100
,
aCol
.
GetGreen
()
*
nF
/
100
,
aCol
.
GetBlue
()
*
nF
/
100
)
);
DrawRect
(
aBoundRect
);
EndSolid
();
PostDraw
();
return
true
;
}
//TODO: lfrb: some missing transformation with the polygon in outdev
if
(
rGradient
.
GetStyle
()
==
GradientStyle_LINEAR
)
else
if
(
rGradient
.
GetStyle
()
==
GradientStyle_LINEAR
)
{
PreDraw
();
DrawLinearGradient
(
rGradient
,
aBoundRect
);
PostDraw
();
return
true
;
}
else
if
(
rGradient
.
GetStyle
()
==
GradientStyle_RADIAL
)
{
PreDraw
();
DrawRadialGradient
(
rGradient
,
aBoundRect
);
PostDraw
();
return
true
;
}
return
false
;
if
(
!
mbUseStencil
)
glDisable
(
GL_STENCIL_TEST
);
PostDraw
();
return
true
;
}
void
OpenGLSalGraphicsImpl
::
beginPaint
()
...
...
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