Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
ad4a72ff
Commit
ad4a72ff
authored
Apr 19, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cairo now renders layers properly (colors are not saturated after layer composition), but slower.
parent
062fc2d2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
8 deletions
+48
-8
cairo_gal.cpp
common/gal/cairo/cairo_gal.cpp
+19
-8
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+9
-0
view.cpp
common/view/view.cpp
+2
-0
cairo_gal.h
include/gal/cairo/cairo_gal.h
+6
-0
graphics_abstraction_layer.h
include/gal/graphics_abstraction_layer.h
+6
-0
opengl_gal.h
include/gal/opengl/opengl_gal.h
+6
-0
No files found.
common/gal/cairo/cairo_gal.cpp
View file @
ad4a72ff
...
...
@@ -612,6 +612,21 @@ void CAIRO_GAL::Restore()
}
void
CAIRO_GAL
::
BeginLayer
()
{
cairo_push_group
(
cairoImage
);
}
void
CAIRO_GAL
::
EndLayer
()
{
storePath
();
cairo_pop_group_to_source
(
cairoImage
);
cairo_paint_with_alpha
(
cairoImage
,
fillColor
.
a
);
}
int
CAIRO_GAL
::
BeginGroup
()
{
// If the grouping is started: the actual path is stored in the group, when
...
...
@@ -693,15 +708,13 @@ void CAIRO_GAL::DrawGroup( int aGroupNumber )
break
;
case
CMD_STROKE_PATH
:
cairo_set_source_rgba
(
cairoImage
,
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
);
cairo_set_source_rgb
(
cairoImage
,
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
);
cairo_append_path
(
cairoImage
,
it
->
cairoPath
);
cairo_stroke
(
cairoImage
);
break
;
case
CMD_FILL_PATH
:
cairo_set_source_rgba
(
cairoImage
,
fillColor
.
r
,
fillColor
.
g
,
fillColor
.
b
,
fillColor
.
a
);
cairo_set_source_rgb
(
cairoImage
,
fillColor
.
r
,
fillColor
.
g
,
fillColor
.
b
);
cairo_append_path
(
cairoImage
,
it
->
cairoPath
);
cairo_fill
(
cairoImage
);
break
;
...
...
@@ -779,15 +792,13 @@ void CAIRO_GAL::storePath()
{
if
(
isFillEnabled
)
{
cairo_set_source_rgba
(
cairoImage
,
fillColor
.
r
,
fillColor
.
g
,
fillColor
.
b
,
fillColor
.
a
);
cairo_set_source_rgb
(
cairoImage
,
fillColor
.
r
,
fillColor
.
g
,
fillColor
.
b
);
cairo_fill_preserve
(
cairoImage
);
}
if
(
isStrokeEnabled
)
{
cairo_set_source_rgba
(
cairoImage
,
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
,
strokeColor
.
a
);
cairo_set_source_rgb
(
cairoImage
,
strokeColor
.
r
,
strokeColor
.
g
,
strokeColor
.
b
);
cairo_stroke_preserve
(
cairoImage
);
}
}
...
...
common/gal/opengl/opengl_gal.cpp
View file @
ad4a72ff
...
...
@@ -1283,6 +1283,15 @@ void OPENGL_GAL::Restore()
}
void
OPENGL_GAL
::
BeginLayer
()
{
}
void
OPENGL_GAL
::
EndLayer
()
{
}
// TODO Error handling
int
OPENGL_GAL
::
BeginGroup
()
{
...
...
common/view/view.cpp
View file @
ad4a72ff
...
...
@@ -419,9 +419,11 @@ void VIEW::redrawRect( const BOX2I& aRect )
{
drawItem
drawFunc
(
this
,
l
->
id
);
m_gal
->
BeginLayer
();
m_gal
->
SetLayerDepth
(
(
double
)
l
->
renderingOrder
);
l
->
items
->
Query
(
aRect
,
drawFunc
);
l
->
isDirty
=
false
;
m_gal
->
EndLayer
();
totalItems
+=
drawFunc
.
count
;
totalDrawTime
+=
drawFunc
.
time
;
...
...
include/gal/cairo/cairo_gal.h
View file @
ad4a72ff
...
...
@@ -95,6 +95,12 @@ public:
/// @copydoc GAL::EndDrawing()
virtual
void
EndDrawing
();
/// @copydoc GAL::BeginLayer()
virtual
void
BeginLayer
();
/// @copydoc GAL::EndLayer()
virtual
void
EndLayer
();
/// @copydoc GAL::DrawLine()
virtual
void
DrawLine
(
const
VECTOR2D
&
aStartPoint
,
const
VECTOR2D
&
aEndPoint
);
...
...
include/gal/graphics_abstraction_layer.h
View file @
ad4a72ff
...
...
@@ -95,6 +95,12 @@ public:
/// @brief End the drawing, needs to be called for every new frame.
virtual
void
EndDrawing
()
=
0
;
/// @brief Begin the layer drawing, needs to be called for every new layer.
virtual
void
BeginLayer
()
=
0
;
/// @brief Finish the layer drawing, needs to be called for every new layer.
virtual
void
EndLayer
()
=
0
;
/**
* @brief Draw a line.
*
...
...
include/gal/opengl/opengl_gal.h
View file @
ad4a72ff
...
...
@@ -102,6 +102,12 @@ public:
/// @copydoc GAL::EndDrawing()
virtual
void
EndDrawing
();
/// @copydoc GAL::BeginLayer()
virtual
void
BeginLayer
();
/// @copydoc GAL::EndLayer()
virtual
void
EndLayer
();
/// @copydoc GAL::DrawLine()
virtual
void
DrawLine
(
const
VECTOR2D
&
aStartPoint
,
const
VECTOR2D
&
aEndPoint
);
...
...
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