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
a43dd351
Commit
a43dd351
authored
May 15, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assured that there are no excessive initializations
parent
1a4c6781
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
cairo_gal.cpp
common/gal/cairo/cairo_gal.cpp
+23
-12
cairo_gal.h
include/gal/cairo/cairo_gal.h
+1
-0
No files found.
common/gal/cairo/cairo_gal.cpp
View file @
a43dd351
...
...
@@ -47,6 +47,8 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
paintListener
=
aPaintListener
;
isGrouping
=
false
;
isInitialized
=
false
;
isDeleteSavedPixels
=
false
;
zoomFactor
=
1.0
;
SetSize
(
aParent
->
GetSize
()
);
...
...
@@ -76,10 +78,6 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
lineJoinMap
[
LINE_JOIN_ROUND
]
=
CAIRO_LINE_JOIN_ROUND
;
lineJoinMap
[
LINE_JOIN_MITER
]
=
CAIRO_LINE_JOIN_MITER
;
isDeleteSavedPixels
=
false
;
isGrouping
=
false
;
// Initialize the cursor shape
SetCursorColor
(
COLOR4D
(
1.0
,
1.0
,
1.0
,
1.0
)
);
initCursor
(
21
);
...
...
@@ -91,13 +89,13 @@ CAIRO_GAL::CAIRO_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
SetGridColor
(
COLOR4D
(
0.5
,
0.5
,
0.5
,
0.3
)
);
SetCoarseGrid
(
10
);
SetGridLineWidth
(
0.5
);
Refresh
();
}
CAIRO_GAL
::~
CAIRO_GAL
()
{
deinitSurface
();
delete
cursorPixels
;
delete
cursorPixelsSaved
;
...
...
@@ -139,6 +137,9 @@ void CAIRO_GAL::skipMouseEvent( wxMouseEvent& aEvent )
void
CAIRO_GAL
::
initSurface
()
{
if
(
isInitialized
)
return
;
// The size of the client area needs to be greater than zero
clientRectangle
=
parentWindow
->
GetClientRect
();
...
...
@@ -184,14 +185,21 @@ void CAIRO_GAL::initSurface()
lineWidth
=
0
;
isDeleteSavedPixels
=
true
;
isInitialized
=
true
;
}
void
CAIRO_GAL
::
deinitSurface
()
{
if
(
!
isInitialized
)
return
;
// Destroy Cairo objects
cairo_destroy
(
cairoImage
);
cairo_surface_destroy
(
cairoSurface
);
isInitialized
=
false
;
}
...
...
@@ -548,12 +556,15 @@ void CAIRO_GAL::SetLayerDepth( double aLayerDepth )
{
super
::
SetLayerDepth
(
aLayerDepth
);
if
(
isInitialized
)
{
storePath
();
cairo_pop_group_to_source
(
cairoImage
);
cairo_paint_with_alpha
(
cairoImage
,
fillColor
.
a
);
cairo_push_group
(
cairoImage
);
}
}
...
...
include/gal/cairo/cairo_gal.h
View file @
a43dd351
...
...
@@ -359,6 +359,7 @@ private:
unsigned
int
*
bitmapBuffer
;
///< Storage of the cairo image
unsigned
int
*
bitmapBufferBackup
;
///< Backup storage of the cairo image
int
stride
;
///< Stride value for Cairo
bool
isInitialized
;
///< Are Cairo image & surface ready to use
// Mapping between Cairo and GAL line attributes
std
::
map
<
LineCap
,
cairo_line_cap_t
>
lineCapMap
;
///< Line cap style mapping
...
...
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