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
5e7709c5
Kaydet (Commit)
5e7709c5
authored
Ara 15, 2014
tarafından
Luboš Luňák
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use AA for lines only when AA is active
Change-Id: I9965f58b8f06f1cec2c419dcf16d8aebf9cd97b8
üst
8286e924
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
25 deletions
+65
-25
openglgdiimpl.hxx
vcl/inc/openglgdiimpl.hxx
+9
-5
gdiimpl.cxx
vcl/opengl/gdiimpl.cxx
+53
-17
gdiimpl.cxx
vcl/opengl/win/gdiimpl.cxx
+1
-1
gdiimpl.cxx
vcl/opengl/x11/gdiimpl.cxx
+2
-2
No files found.
vcl/inc/openglgdiimpl.hxx
Dosyayı görüntüle @
5e7709c5
...
@@ -40,8 +40,9 @@ class VCL_PLUGIN_PUBLIC OpenGLSalGraphicsImpl : public SalGraphicsImpl
...
@@ -40,8 +40,9 @@ class VCL_PLUGIN_PUBLIC OpenGLSalGraphicsImpl : public SalGraphicsImpl
protected
:
protected
:
OpenGLContext
*
mpContext
;
OpenGLContext
*
mpContext
;
SalGraphics
&
mrParent
;
/// Pointer to the SalFrame or SalVirtualDevice
/// Pointer to the SalFrame or SalVirtualDevice
SalGeometryProvider
*
mpP
arent
;
SalGeometryProvider
*
mpP
rovider
;
OpenGLFramebuffer
*
mpFramebuffer
;
OpenGLFramebuffer
*
mpFramebuffer
;
OpenGLProgram
*
mpProgram
;
OpenGLProgram
*
mpProgram
;
...
@@ -66,11 +67,14 @@ public:
...
@@ -66,11 +67,14 @@ public:
bool
UseSolid
(
SalColor
nColor
,
sal_uInt8
nTransparency
);
bool
UseSolid
(
SalColor
nColor
,
sal_uInt8
nTransparency
);
bool
UseSolid
(
SalColor
nColor
,
double
fTransparency
);
bool
UseSolid
(
SalColor
nColor
,
double
fTransparency
);
bool
UseSolid
(
SalColor
nColor
);
bool
UseSolid
(
SalColor
nColor
);
bool
UseSolidAA
(
SalColor
nColor
);
bool
UseInvert
();
bool
UseInvert
();
void
DrawPoint
(
long
nX
,
long
nY
);
void
DrawPoint
(
long
nX
,
long
nY
);
void
DrawLine
(
long
nX1
,
long
nY1
,
long
nX2
,
long
nY2
);
void
DrawLine
(
long
nX1
,
long
nY1
,
long
nX2
,
long
nY2
);
void
DrawLines
(
sal_uInt32
nPoints
,
const
SalPoint
*
pPtAry
,
bool
bClose
);
void
DrawLines
(
sal_uInt32
nPoints
,
const
SalPoint
*
pPtAry
,
bool
bClose
);
void
DrawLineAA
(
long
nX1
,
long
nY1
,
long
nX2
,
long
nY2
);
void
DrawLinesAA
(
sal_uInt32
nPoints
,
const
SalPoint
*
pPtAry
,
bool
bClose
);
void
DrawConvexPolygon
(
sal_uInt32
nPoints
,
const
SalPoint
*
pPtAry
);
void
DrawConvexPolygon
(
sal_uInt32
nPoints
,
const
SalPoint
*
pPtAry
);
void
DrawConvexPolygon
(
const
Polygon
&
rPolygon
);
void
DrawConvexPolygon
(
const
Polygon
&
rPolygon
);
void
DrawRect
(
long
nX
,
long
nY
,
long
nWidth
,
long
nHeight
);
void
DrawRect
(
long
nX
,
long
nY
,
long
nWidth
,
long
nHeight
);
...
@@ -92,13 +96,13 @@ public:
...
@@ -92,13 +96,13 @@ public:
public
:
public
:
// get the width of the device
// get the width of the device
GLfloat
GetWidth
()
const
{
return
mpP
arent
?
mpParent
->
GetWidth
()
:
1
;
}
GLfloat
GetWidth
()
const
{
return
mpP
rovider
?
mpProvider
->
GetWidth
()
:
1
;
}
// get the height of the device
// get the height of the device
GLfloat
GetHeight
()
const
{
return
mpP
arent
?
mpParent
->
GetHeight
()
:
1
;
}
GLfloat
GetHeight
()
const
{
return
mpP
rovider
?
mpProvider
->
GetHeight
()
:
1
;
}
// check whether this instance is used for offscreen rendering
// check whether this instance is used for offscreen rendering
bool
IsOffscreen
()
const
{
return
mpP
arent
?
mpParent
->
IsOffScreen
()
:
true
;
}
bool
IsOffscreen
()
const
{
return
mpP
rovider
?
mpProvider
->
IsOffScreen
()
:
true
;
}
// operations to do before painting
// operations to do before painting
virtual
void
PreDraw
();
virtual
void
PreDraw
();
...
@@ -120,7 +124,7 @@ protected:
...
@@ -120,7 +124,7 @@ protected:
virtual
bool
UseContext
(
OpenGLContext
*
pContext
)
=
0
;
virtual
bool
UseContext
(
OpenGLContext
*
pContext
)
=
0
;
public
:
public
:
OpenGLSalGraphicsImpl
(
SalG
eometryProvider
*
pParent
);
OpenGLSalGraphicsImpl
(
SalG
raphics
&
pParent
,
SalGeometryProvider
*
pProvider
);
virtual
~
OpenGLSalGraphicsImpl
();
virtual
~
OpenGLSalGraphicsImpl
();
OpenGLContext
*
GetOpenGLContext
();
OpenGLContext
*
GetOpenGLContext
();
...
...
vcl/opengl/gdiimpl.cxx
Dosyayı görüntüle @
5e7709c5
...
@@ -36,9 +36,10 @@
...
@@ -36,9 +36,10 @@
#include <vector>
#include <vector>
OpenGLSalGraphicsImpl
::
OpenGLSalGraphicsImpl
(
SalG
eometryProvider
*
pParent
)
OpenGLSalGraphicsImpl
::
OpenGLSalGraphicsImpl
(
SalG
raphics
&
rParent
,
SalGeometryProvider
*
pProvider
)
:
mpContext
(
0
)
:
mpContext
(
0
)
,
mpParent
(
pParent
)
,
mrParent
(
rParent
)
,
mpProvider
(
pProvider
)
,
mpFramebuffer
(
NULL
)
,
mpFramebuffer
(
NULL
)
,
mpProgram
(
NULL
)
,
mpProgram
(
NULL
)
,
mbUseScissor
(
false
)
,
mbUseScissor
(
false
)
...
@@ -381,6 +382,18 @@ bool OpenGLSalGraphicsImpl::UseSolid( SalColor nColor )
...
@@ -381,6 +382,18 @@ bool OpenGLSalGraphicsImpl::UseSolid( SalColor nColor )
return
UseSolid
(
nColor
,
0.0
f
);
return
UseSolid
(
nColor
,
0.0
f
);
}
}
// Like UseSolid(), but sets up for AA drawing, which uses gradients to create the AA.
bool
OpenGLSalGraphicsImpl
::
UseSolidAA
(
SalColor
nColor
)
{
if
(
!
mrParent
.
getAntiAliasB2DDraw
())
return
UseSolid
(
nColor
);
if
(
!
UseProgram
(
"textureVertexShader"
,
"linearGradientFragmentShader"
)
)
return
false
;
mpProgram
->
SetColorf
(
"start_color"
,
nColor
,
0.0
f
);
mpProgram
->
SetColorf
(
"end_color"
,
nColor
,
1.0
f
);
return
true
;
}
bool
OpenGLSalGraphicsImpl
::
UseInvert
()
bool
OpenGLSalGraphicsImpl
::
UseInvert
()
{
{
if
(
!
UseSolid
(
MAKE_SALCOLOR
(
255
,
255
,
255
)
)
)
if
(
!
UseSolid
(
MAKE_SALCOLOR
(
255
,
255
,
255
)
)
)
...
@@ -402,8 +415,24 @@ void OpenGLSalGraphicsImpl::DrawPoint( long nX, long nY )
...
@@ -402,8 +415,24 @@ void OpenGLSalGraphicsImpl::DrawPoint( long nX, long nY )
void
OpenGLSalGraphicsImpl
::
DrawLine
(
long
nX1
,
long
nY1
,
long
nX2
,
long
nY2
)
void
OpenGLSalGraphicsImpl
::
DrawLine
(
long
nX1
,
long
nY1
,
long
nX2
,
long
nY2
)
{
{
GLfloat
pPoints
[
4
];
pPoints
[
0
]
=
(
2
*
nX1
)
/
GetWidth
()
-
1.0
;
pPoints
[
1
]
=
1.0
f
-
2
*
nY1
/
GetHeight
();
pPoints
[
2
]
=
(
2
*
nX2
)
/
GetWidth
()
-
1.0
;;
pPoints
[
3
]
=
1.0
f
-
2
*
nY2
/
GetHeight
();
mpProgram
->
SetVertices
(
pPoints
);
glDrawArrays
(
GL_LINES
,
0
,
2
);
}
void
OpenGLSalGraphicsImpl
::
DrawLineAA
(
long
nX1
,
long
nY1
,
long
nX2
,
long
nY2
)
{
if
(
!
mrParent
.
getAntiAliasB2DDraw
())
return
DrawLine
(
nX1
,
nY1
,
nX2
,
nY2
);
if
(
nX1
==
nX2
||
nY1
==
nY2
)
if
(
nX1
==
nX2
||
nY1
==
nY2
)
{
//
horizontal/vertical, no need for AA
{
//
Horizontal/vertical, no need for AA, both points have normal color.
GLfloat
pPoints
[
4
];
GLfloat
pPoints
[
4
];
pPoints
[
0
]
=
(
2
*
nX1
)
/
GetWidth
()
-
1.0
;
pPoints
[
0
]
=
(
2
*
nX1
)
/
GetWidth
()
-
1.0
;
...
@@ -412,6 +441,10 @@ void OpenGLSalGraphicsImpl::DrawLine( long nX1, long nY1, long nX2, long nY2 )
...
@@ -412,6 +441,10 @@ void OpenGLSalGraphicsImpl::DrawLine( long nX1, long nY1, long nX2, long nY2 )
pPoints
[
3
]
=
1.0
f
-
2
*
nY2
/
GetHeight
();
pPoints
[
3
]
=
1.0
f
-
2
*
nY2
/
GetHeight
();
mpProgram
->
SetVertices
(
pPoints
);
mpProgram
->
SetVertices
(
pPoints
);
// Still set up for the trivial "gradients", because presumably UseSolidAA() has been called.
GLfloat
aTexCoord
[
4
]
=
{
0
,
1
,
1
,
1
};
mpProgram
->
SetTextureCoord
(
aTexCoord
);
glDrawArrays
(
GL_LINES
,
0
,
2
);
glDrawArrays
(
GL_LINES
,
0
,
2
);
return
;
return
;
}
}
...
@@ -425,11 +458,6 @@ void OpenGLSalGraphicsImpl::DrawLine( long nX1, long nY1, long nX2, long nY2 )
...
@@ -425,11 +458,6 @@ void OpenGLSalGraphicsImpl::DrawLine( long nX1, long nY1, long nX2, long nY2 )
*
*
* Enjoy. Chris Tsang.*/
* Enjoy. Chris Tsang.*/
if
(
!
UseProgram
(
"textureVertexShader"
,
"linearGradientFragmentShader"
)
)
return
;
mpProgram
->
SetColorf
(
"start_color"
,
mnLineColor
,
0.0
f
);
mpProgram
->
SetColorf
(
"end_color"
,
mnLineColor
,
1.0
f
);
double
x1
=
nX1
;
double
x1
=
nX1
;
double
y1
=
nY1
;
double
y1
=
nY1
;
double
x2
=
nX2
;
double
x2
=
nX2
;
...
@@ -546,6 +574,14 @@ void OpenGLSalGraphicsImpl::DrawLines( sal_uInt32 nPoints, const SalPoint* pPtAr
...
@@ -546,6 +574,14 @@ void OpenGLSalGraphicsImpl::DrawLines( sal_uInt32 nPoints, const SalPoint* pPtAr
DrawLine
(
pPtAry
[
nPoints
-
1
].
mnX
,
pPtAry
[
nPoints
-
1
].
mnY
,
pPtAry
[
0
].
mnX
,
pPtAry
[
0
].
mnY
);
DrawLine
(
pPtAry
[
nPoints
-
1
].
mnX
,
pPtAry
[
nPoints
-
1
].
mnY
,
pPtAry
[
0
].
mnX
,
pPtAry
[
0
].
mnY
);
}
}
void
OpenGLSalGraphicsImpl
::
DrawLinesAA
(
sal_uInt32
nPoints
,
const
SalPoint
*
pPtAry
,
bool
bClose
)
{
for
(
int
i
=
0
;
i
<
int
(
nPoints
)
-
1
;
++
i
)
DrawLineAA
(
pPtAry
[
i
].
mnX
,
pPtAry
[
i
].
mnY
,
pPtAry
[
i
+
1
].
mnX
,
pPtAry
[
i
+
1
].
mnY
);
if
(
bClose
)
DrawLineAA
(
pPtAry
[
nPoints
-
1
].
mnX
,
pPtAry
[
nPoints
-
1
].
mnY
,
pPtAry
[
0
].
mnX
,
pPtAry
[
0
].
mnY
);
}
void
OpenGLSalGraphicsImpl
::
DrawConvexPolygon
(
sal_uInt32
nPoints
,
const
SalPoint
*
pPtAry
)
void
OpenGLSalGraphicsImpl
::
DrawConvexPolygon
(
sal_uInt32
nPoints
,
const
SalPoint
*
pPtAry
)
{
{
std
::
vector
<
GLfloat
>
aVertices
(
nPoints
*
2
);
std
::
vector
<
GLfloat
>
aVertices
(
nPoints
*
2
);
...
@@ -925,8 +961,8 @@ void OpenGLSalGraphicsImpl::drawLine( long nX1, long nY1, long nX2, long nY2 )
...
@@ -925,8 +961,8 @@ void OpenGLSalGraphicsImpl::drawLine( long nX1, long nY1, long nX2, long nY2 )
if
(
mnLineColor
!=
SALCOLOR_NONE
)
if
(
mnLineColor
!=
SALCOLOR_NONE
)
{
{
PreDraw
();
PreDraw
();
if
(
UseSolid
(
mnLineColor
)
)
if
(
UseSolid
AA
(
mnLineColor
)
)
DrawLine
(
nX1
,
nY1
,
nX2
,
nY2
);
DrawLine
AA
(
nX1
,
nY1
,
nX2
,
nY2
);
PostDraw
();
PostDraw
();
}
}
}
}
...
@@ -947,7 +983,7 @@ void OpenGLSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeigh
...
@@ -947,7 +983,7 @@ void OpenGLSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeigh
const
long
nY2
(
nY
+
nHeight
);
const
long
nY2
(
nY
+
nHeight
);
const
SalPoint
aPoints
[]
=
{
{
nX1
,
nY1
},
{
nX2
,
nY1
},
const
SalPoint
aPoints
[]
=
{
{
nX1
,
nY1
},
{
nX2
,
nY1
},
{
nX2
,
nY2
},
{
nX1
,
nY2
}
};
{
nX2
,
nY2
},
{
nX1
,
nY2
}
};
DrawLines
(
4
,
aPoints
,
true
);
DrawLines
(
4
,
aPoints
,
true
);
// No need for AA.
}
}
PostDraw
();
PostDraw
();
...
@@ -960,8 +996,8 @@ void OpenGLSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pP
...
@@ -960,8 +996,8 @@ void OpenGLSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pP
if
(
mnLineColor
!=
SALCOLOR_NONE
&&
nPoints
>
1
)
if
(
mnLineColor
!=
SALCOLOR_NONE
&&
nPoints
>
1
)
{
{
PreDraw
();
PreDraw
();
if
(
UseSolid
(
mnLineColor
)
)
if
(
UseSolid
AA
(
mnLineColor
)
)
DrawLines
(
nPoints
,
pPtAry
,
false
);
DrawLines
AA
(
nPoints
,
pPtAry
,
false
);
PostDraw
();
PostDraw
();
}
}
}
}
...
@@ -988,8 +1024,8 @@ void OpenGLSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPt
...
@@ -988,8 +1024,8 @@ void OpenGLSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPt
if
(
UseSolid
(
mnFillColor
)
)
if
(
UseSolid
(
mnFillColor
)
)
DrawPolygon
(
nPoints
,
pPtAry
);
DrawPolygon
(
nPoints
,
pPtAry
);
if
(
UseSolid
(
mnLineColor
)
)
if
(
UseSolid
AA
(
mnLineColor
)
)
DrawLines
(
nPoints
,
pPtAry
,
true
);
DrawLines
AA
(
nPoints
,
pPtAry
,
true
);
PostDraw
();
PostDraw
();
}
}
...
@@ -1008,11 +1044,11 @@ void OpenGLSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32*
...
@@ -1008,11 +1044,11 @@ void OpenGLSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32*
DrawPolygon
(
pPoints
[
i
],
pPtAry
[
i
]
);
DrawPolygon
(
pPoints
[
i
],
pPtAry
[
i
]
);
}
}
if
(
UseSolid
(
mnLineColor
)
)
if
(
UseSolid
AA
(
mnLineColor
)
)
{
{
// TODO Use glMultiDrawElements or primitive restart
// TODO Use glMultiDrawElements or primitive restart
for
(
sal_uInt32
i
=
0
;
i
<
nPoly
;
i
++
)
for
(
sal_uInt32
i
=
0
;
i
<
nPoly
;
i
++
)
DrawLines
(
pPoints
[
i
],
pPtAry
[
i
],
true
);
DrawLines
AA
(
pPoints
[
i
],
pPtAry
[
i
],
true
);
}
}
PostDraw
();
PostDraw
();
...
...
vcl/opengl/win/gdiimpl.cxx
Dosyayı görüntüle @
5e7709c5
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
WinOpenGLSalGraphicsImpl
::
WinOpenGLSalGraphicsImpl
(
WinSalGraphics
&
rGraphics
,
WinOpenGLSalGraphicsImpl
::
WinOpenGLSalGraphicsImpl
(
WinSalGraphics
&
rGraphics
,
SalGeometryProvider
*
mpProvider
)
:
SalGeometryProvider
*
mpProvider
)
:
OpenGLSalGraphicsImpl
(
mpProvider
),
OpenGLSalGraphicsImpl
(
rGraphics
,
mpProvider
),
mrParent
(
rGraphics
)
mrParent
(
rGraphics
)
{
{
}
}
...
...
vcl/opengl/x11/gdiimpl.cxx
Dosyayı görüntüle @
5e7709c5
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include <vcl/opengl/OpenGLHelper.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
X11OpenGLSalGraphicsImpl
::
X11OpenGLSalGraphicsImpl
(
X11SalGraphics
&
rParent
)
:
X11OpenGLSalGraphicsImpl
::
X11OpenGLSalGraphicsImpl
(
X11SalGraphics
&
rParent
)
:
OpenGLSalGraphicsImpl
(
rParent
.
GetGeometryProvider
()),
OpenGLSalGraphicsImpl
(
rParent
,
rParent
.
GetGeometryProvider
()),
mrParent
(
rParent
)
mrParent
(
rParent
)
{
{
}
}
...
@@ -38,7 +38,7 @@ X11OpenGLSalGraphicsImpl::~X11OpenGLSalGraphicsImpl()
...
@@ -38,7 +38,7 @@ X11OpenGLSalGraphicsImpl::~X11OpenGLSalGraphicsImpl()
void
X11OpenGLSalGraphicsImpl
::
Init
()
void
X11OpenGLSalGraphicsImpl
::
Init
()
{
{
// The m_pFrame and m_pVDev pointers are updated late in X11
// The m_pFrame and m_pVDev pointers are updated late in X11
mpP
arent
=
mrParent
.
GetGeometryProvider
();
mpP
rovider
=
mrParent
.
GetGeometryProvider
();
OpenGLSalGraphicsImpl
::
Init
();
OpenGLSalGraphicsImpl
::
Init
();
}
}
...
...
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