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
32bddc7c
Kaydet (Commit)
32bddc7c
authored
Kas 14, 2014
tarafından
Louis-Francis Ratté-Boulianne
Kaydeden (comit)
Markus Mohrhard
Kas 15, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
vcl: Implement axial gradients in OpenGL backend
Change-Id: I93b8c3c076c79d992d467b01ca5f5eca1ed626d3
üst
b190ffe5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
1 deletion
+69
-1
openglgdiimpl.hxx
vcl/inc/openglgdiimpl.hxx
+1
-0
gdiimpl.cxx
vcl/opengl/gdiimpl.cxx
+67
-0
linearGradientFragmentShader.glsl
vcl/opengl/linearGradientFragmentShader.glsl
+1
-1
No files found.
vcl/inc/openglgdiimpl.hxx
Dosyayı görüntüle @
32bddc7c
...
...
@@ -107,6 +107,7 @@ public:
void
DrawTextureWithMask
(
OpenGLTexture
&
rTexture
,
OpenGLTexture
&
rMask
,
const
SalTwoRect
&
rPosAry
);
void
DrawMask
(
OpenGLTexture
&
rTexture
,
SalColor
nMaskColor
,
const
SalTwoRect
&
rPosAry
);
void
DrawLinearGradient
(
const
Gradient
&
rGradient
,
const
Rectangle
&
rRect
);
void
DrawAxialGradient
(
const
Gradient
&
rGradient
,
const
Rectangle
&
rRect
);
void
DrawRadialGradient
(
const
Gradient
&
rGradient
,
const
Rectangle
&
rRect
);
public
:
...
...
vcl/opengl/gdiimpl.cxx
Dosyayı görüntüle @
32bddc7c
...
...
@@ -772,6 +772,68 @@ void OpenGLSalGraphicsImpl::DrawLinearGradient( const Gradient& rGradient, const
CHECK_GL_ERROR
();
}
void
OpenGLSalGraphicsImpl
::
DrawAxialGradient
(
const
Gradient
&
rGradient
,
const
Rectangle
&
rRect
)
{
if
(
mnLinearGradientProgram
==
0
)
{
if
(
!
CreateLinearGradientProgram
()
)
return
;
}
glUseProgram
(
mnLinearGradientProgram
);
Color
aStartCol
=
rGradient
.
GetStartColor
();
Color
aEndCol
=
rGradient
.
GetEndColor
();
long
nFactor
=
rGradient
.
GetStartIntensity
();
glUniformColorIntensity
(
mnLinearGradientStartColorUniform
,
aStartCol
,
nFactor
);
nFactor
=
rGradient
.
GetEndIntensity
();
glUniformColorIntensity
(
mnLinearGradientEndColorUniform
,
aEndCol
,
nFactor
);
/**
* Draw two rectangles with linear gradient.
*
* 1 *---* 2
* | /|
* | / | Points 0 and 3 have start color
* 0 |/__| 3 Points 1, 2, 4 and 5 have end color
* |\ |
* | \ |
* | \|
* 5 *---* 4
*
*/
Rectangle
aRect
;
Point
aCenter
;
rGradient
.
GetBoundRect
(
rRect
,
aRect
,
aCenter
);
// determine points 0 and 3
Point
aPt0
(
aRect
.
Left
(),
(
aRect
.
Top
()
+
aRect
.
Bottom
()
+
1
)
/
2
);
Point
aPt3
(
aRect
.
Right
(),
(
aRect
.
Top
()
+
aRect
.
Bottom
()
+
1
)
/
2
);
Polygon
aPoly
(
7
);
aPoly
.
SetPoint
(
aPt0
,
0
);
aPoly
.
SetPoint
(
aRect
.
TopLeft
(),
1
);
aPoly
.
SetPoint
(
aRect
.
TopRight
(),
2
);
aPoly
.
SetPoint
(
aPt3
,
3
);
aPoly
.
SetPoint
(
aRect
.
BottomRight
(),
4
);
aPoly
.
SetPoint
(
aRect
.
BottomLeft
(),
5
);
aPoly
.
SetPoint
(
aPt0
,
6
);
aPoly
.
Rotate
(
aCenter
,
rGradient
.
GetAngle
()
%
3600
);
GLfloat
aTexCoord
[
12
]
=
{
0
,
1
,
1
,
0
,
2
,
0
,
3
,
1
,
4
,
0
,
5
,
0
};
GLfloat
fMin
=
1.0
-
100.0
/
(
100.0
-
rGradient
.
GetBorder
());
aTexCoord
[
3
]
=
aTexCoord
[
5
]
=
aTexCoord
[
9
]
=
aTexCoord
[
11
]
=
fMin
;
glEnableVertexAttribArray
(
GL_ATTRIB_TEX
);
glVertexAttribPointer
(
GL_ATTRIB_TEX
,
2
,
GL_FLOAT
,
GL_FALSE
,
0
,
aTexCoord
);
DrawConvexPolygon
(
aPoly
);
glDisableVertexAttribArray
(
GL_ATTRIB_TEX
);
glUseProgram
(
0
);
CHECK_GL_ERROR
();
}
void
OpenGLSalGraphicsImpl
::
DrawRadialGradient
(
const
Gradient
&
rGradient
,
const
Rectangle
&
rRect
)
{
if
(
mnRadialGradientProgram
==
0
)
...
...
@@ -1365,6 +1427,7 @@ bool OpenGLSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPoly,
return
true
;
if
(
rGradient
.
GetStyle
()
!=
GradientStyle_LINEAR
&&
rGradient
.
GetStyle
()
!=
GradientStyle_AXIAL
&&
rGradient
.
GetStyle
()
!=
GradientStyle_RADIAL
)
return
false
;
...
...
@@ -1402,6 +1465,10 @@ bool OpenGLSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPoly,
{
DrawLinearGradient
(
rGradient
,
aBoundRect
);
}
else
if
(
rGradient
.
GetStyle
()
==
GradientStyle_AXIAL
)
{
DrawAxialGradient
(
rGradient
,
aBoundRect
);
}
else
if
(
rGradient
.
GetStyle
()
==
GradientStyle_RADIAL
)
{
DrawRadialGradient
(
rGradient
,
aBoundRect
);
...
...
vcl/opengl/linearGradientFragmentShader.glsl
Dosyayı görüntüle @
32bddc7c
...
...
@@ -16,7 +16,7 @@ varying vec2 tex_coord;
void
main
(
void
)
{
gl_FragColor
=
mix
(
start_color
,
end
_color
,
gl_FragColor
=
mix
(
end_color
,
start
_color
,
clamp
(
tex_coord
.
t
,
0
.
0
,
1
.
0
));
}
...
...
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