Nux

Merge lp:~mc-return/nux/nux.merge-optimize-performance-and-style into lp:nux

Proposed by MC Return on 2012-07-30
Status: Merged
Approved by: Łukasz Zemczak on 2012-08-03
Approved revision: 657
Merged at revision: 643
Proposed branch: lp:~mc-return/nux/nux.merge-optimize-performance-and-style
Merge into: lp:nux
Diff against target: 738 lines (+77/-87)
15 files modified
Nux/EMMetrics.cpp (+4/-6)
Nux/VLayout.cpp (+17/-17)
Nux/VSplitter.cpp (+7/-7)
Nux/WindowCompositor.cpp (+7/-7)
Nux/WindowThread.cpp (+8/-8)
NuxCore/FileManager/NFileManagerGNU.cpp (+1/-3)
NuxCore/FileManager/NFileManagerWindows.cpp (+1/-3)
NuxCore/Math/Complex.cpp (+2/-1)
NuxCore/Parsing.cpp (+1/-1)
NuxGraphics/CairoGraphics.cpp (+1/-1)
NuxGraphics/FontTexture.cpp (+1/-1)
NuxGraphics/FreetypeFont.cpp (+14/-21)
NuxGraphics/GraphicsDisplayWin.cpp (+2/-1)
NuxGraphics/GraphicsDisplayX11.cpp (+5/-4)
NuxGraphics/GraphicsEngine.cpp (+6/-6)
To merge this branch: bzr merge lp:~mc-return/nux/nux.merge-optimize-performance-and-style
Reviewer Review Type Date Requested Status
MC Return (community) Resubmit on 2012-08-02
Andrea Azzarone 2012-07-30 Approve on 2012-08-02
Review via email: mp+117351@code.launchpad.net

Commit Message

Optimized performance and style following suggestions reported by cppcheck:

1. Reduced the scope of various variables.

2. Used prefix ++ operators for non-primitive types, because those can be more efficient than post-increment. Post-increment usually keeps a copy of the previous value, adds extra code and is slower.

Description of the Change

Optimizes performance and style following suggestions reported by cppcheck:

1. Reduces the scope of various variables.

2. Uses prefix ++ operators for non-primitive types, because those can be more efficient than post-increment. Post-increment usually keeps a copy of the previous value, adds extra code and is slower.

To post a comment you must log in.
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve
Unity Merger (unity-merger) wrote :

Attempt to merge into lp:nux failed due to conflicts:

text conflict in NuxGraphics/GraphicsDisplayX11.cpp

657. By MC Return on 2012-08-02

Merged trunk and fixed conflicts

MC Return (mc-return) :
review: Resubmit

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/EMMetrics.cpp'
2--- Nux/EMMetrics.cpp 2012-02-26 03:55:44 +0000
3+++ Nux/EMMetrics.cpp 2012-08-02 17:49:17 +0000
4@@ -22,17 +22,15 @@
5 {
6 EMMetrics::EMMetrics(Display* dpy, int scr, double points)
7 {
8- double xres = 0.0;
9- double yres = 0.0;
10 double dpi = 96.0; // default DPI if no Display provided (e.g. unit-test)
11
12 if (dpy)
13 {
14 // determine current system DPI, remember that: 1 inch == 2.54 cm == 25.4 mm
15- xres = ((static_cast<double> DisplayWidth(dpy,scr) * 25.4) /
16- (static_cast<double> DisplayWidthMM(dpy,scr)));
17- yres = ((static_cast<double> DisplayHeight(dpy,scr) * 25.4) /
18- (static_cast<double> DisplayHeightMM(dpy,scr)));
19+ double xres = ((static_cast<double> DisplayWidth(dpy,scr) * 25.4) /
20+ (static_cast<double> DisplayWidthMM(dpy,scr)));
21+ double yres = ((static_cast<double> DisplayHeight(dpy,scr) * 25.4) /
22+ (static_cast<double> DisplayHeightMM(dpy,scr)));
23 dpi = (xres + yres) / 2.0;
24 }
25
26
27=== modified file 'Nux/VLayout.cpp'
28--- Nux/VLayout.cpp 2011-12-10 06:39:14 +0000
29+++ Nux/VLayout.cpp 2012-08-02 17:49:17 +0000
30@@ -73,7 +73,7 @@
31 {
32 std::list<Area *>::iterator it;
33
34- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
35+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
36 {
37 if ((*it)->IsView())
38 {
39@@ -102,7 +102,7 @@
40
41 std::list<Area *>::iterator it;
42
43- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
44+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
45 {
46 // gather all the space used by elements
47 if ((*it)->IsVisible())
48@@ -186,7 +186,7 @@
49
50 std::list<Area *>::iterator it;
51
52- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
53+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
54 {
55 (*it)->SetLayoutDone(false);
56 }
57@@ -225,7 +225,7 @@
58 bool unadjusted_layout = false;
59 size_t num_element = 0;
60
61- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
62+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
63 {
64 if ((*it)->IsVisible())
65 num_element++;
66@@ -255,7 +255,7 @@
67 ComputeStacking(height, offset_space, space_after_element);
68 current_y += offset_space;
69
70- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
71+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
72 {
73 if (!(*it)->IsVisible())
74 continue;
75@@ -358,7 +358,7 @@
76 // We check if that is the case and force a recompute.
77 std::vector<int> FullSizeUnadjusted;
78
79- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
80+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
81 {
82 if (!(*it)->IsVisible())
83 continue;
84@@ -459,7 +459,7 @@
85 int temp = m_contentWidth;
86 std::vector<int>::iterator IntIterator = FullSizeUnadjusted.begin();
87
88- for (IntIterator = FullSizeUnadjusted.begin(); IntIterator != FullSizeUnadjusted.end(); IntIterator++)
89+ for (IntIterator = FullSizeUnadjusted.begin(); IntIterator != FullSizeUnadjusted.end(); ++IntIterator)
90 {
91 if ((*IntIterator) < temp)
92 {
93@@ -533,7 +533,7 @@
94 int max_stretchfactor = GetMaxStretchFactor();
95 std::list<Area *>::iterator it;
96
97- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
98+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
99 {
100 if (!(*it)->IsVisible())
101 continue;
102@@ -551,7 +551,7 @@
103 {
104 // It is unlikely that we get here!
105 int h = 0;
106- for (it = _layout_element_list.begin(); it != _layout_element_list.end() && !need_recompute; it++)
107+ for (it = _layout_element_list.begin(); it != _layout_element_list.end() && !need_recompute; ++it)
108 {
109 if (!(*it)->IsVisible())
110 continue;
111@@ -563,7 +563,7 @@
112 return;
113 }
114
115- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
116+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
117 {
118 if (!(*it)->IsVisible())
119 continue;
120@@ -576,7 +576,7 @@
121
122 if (available_height <= 2)
123 {
124- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
125+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
126 {
127 if (!(*it)->IsVisible())
128 continue;
129@@ -610,7 +610,7 @@
130 Area *LastElementThatCanBeResized = 0;
131 int total_distributed_size = 0;
132
133- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
134+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
135 {
136 if (!(*it)->IsVisible())
137 continue;
138@@ -640,7 +640,7 @@
139 //
140 need_recompute = false;;
141
142- for (it = _layout_element_list.begin(); it != _layout_element_list.end() && !need_recompute; it++)
143+ for (it = _layout_element_list.begin(); it != _layout_element_list.end() && !need_recompute; ++it)
144 {
145 if (!(*it)->IsVisible())
146 continue;
147@@ -736,7 +736,7 @@
148 unsigned int sf;
149 std::list<Area *>::iterator it;
150
151- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
152+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
153 {
154 if (!(*it)->IsVisible())
155 continue;
156@@ -763,7 +763,7 @@
157 {
158 unsigned int num_element = 0;
159
160- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
161+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
162 {
163 if ((*it)->IsVisible())
164 num_element++;
165@@ -784,7 +784,7 @@
166 ComputeStacking(height, offset_space, element_margin);
167 current_y += offset_space;
168
169- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
170+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
171 {
172 if (!(*it)->IsVisible())
173 continue;
174@@ -832,7 +832,7 @@
175 }
176 }
177
178- for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
179+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); ++it)
180 {
181 if (!(*it)->IsVisible())
182 continue;
183
184=== modified file 'Nux/VSplitter.cpp'
185--- Nux/VSplitter.cpp 2011-12-06 16:29:06 +0000
186+++ Nux/VSplitter.cpp 2012-08-02 17:49:17 +0000
187@@ -60,14 +60,14 @@
188 // Delete all the interface object: This is a problem... The widget should be destroy by there associated parameters
189 //delete vlayout;
190 std::vector< Area* >::iterator it0;
191- for (it0 = m_InterfaceObject.begin(); it0 != m_InterfaceObject.end(); it0++)
192+ for (it0 = m_InterfaceObject.begin(); it0 != m_InterfaceObject.end(); ++it0)
193 {
194 (*it0)->UnParentObject();
195 }
196 m_InterfaceObject.clear();
197
198 std::vector< MySplitter* >::iterator it2;
199- for (it2 = m_SplitterObject.begin(); it2 != m_SplitterObject.end(); it2++)
200+ for (it2 = m_SplitterObject.begin(); it2 != m_SplitterObject.end(); ++it2)
201 {
202 (*it2)->UnParentObject();
203 }
204@@ -85,7 +85,7 @@
205 GetPainter().PaintBackground(graphics_engine, base);
206 std::vector<MySplitter *>::iterator it_splitter;
207
208- for (it_splitter = m_SplitterObject.begin(); it_splitter != m_SplitterObject.end(); it_splitter++)
209+ for (it_splitter = m_SplitterObject.begin(); it_splitter != m_SplitterObject.end(); ++it_splitter)
210 {
211 Geometry geo = (*it_splitter)->GetGeometry();
212 Geometry grip_geo;
213@@ -124,7 +124,7 @@
214
215 for (it = m_InterfaceObject.begin(), it_splitter = m_SplitterObject.begin();
216 it != m_InterfaceObject.end();
217- it++, it_splitter++)
218+ ++it, ++it_splitter)
219 {
220 Geometry sgeo = (*it_splitter)->GetGeometry();
221 graphics_engine.PushClippingRectangle(Rect(
222@@ -554,7 +554,7 @@
223 {
224 std::vector<Area *>::iterator it;
225
226- for (it = m_InterfaceObject.begin(); it != m_InterfaceObject.end(); it++)
227+ for (it = m_InterfaceObject.begin(); it != m_InterfaceObject.end(); ++it)
228 {
229 //(*it)->DoneRedraw();
230 if ((*it)->Type().IsDerivedFromType(View::StaticObjectType))
231@@ -577,7 +577,7 @@
232 return NULL;
233
234 std::vector<MySplitter*>::iterator splitter_it;
235- for (splitter_it = m_SplitterObject.begin(); splitter_it != m_SplitterObject.end(); splitter_it++)
236+ for (splitter_it = m_SplitterObject.begin(); splitter_it != m_SplitterObject.end(); ++splitter_it)
237 {
238 Area* found_area = (*splitter_it)->FindAreaUnderMouse(mouse_position, event_type);
239 if (found_area)
240@@ -585,7 +585,7 @@
241 }
242
243 std::vector<Area *>::iterator it;
244- for (it = m_InterfaceObject.begin(); it != m_InterfaceObject.end(); it++)
245+ for (it = m_InterfaceObject.begin(); it != m_InterfaceObject.end(); ++it)
246 {
247 Area* found_area = (*it)->FindAreaUnderMouse(mouse_position, event_type);
248
249
250=== modified file 'Nux/WindowCompositor.cpp'
251--- Nux/WindowCompositor.cpp 2012-06-26 13:38:50 +0000
252+++ Nux/WindowCompositor.cpp 2012-08-02 17:49:17 +0000
253@@ -656,7 +656,7 @@
254 // Find the MenuPage under the mouse
255 MenuPage* hit_menu_page = NULL;
256 std::list<MenuPage*>::iterator menu_it;
257- for (menu_it = _menu_chain->begin(); menu_it != _menu_chain->end(); menu_it++)
258+ for (menu_it = _menu_chain->begin(); menu_it != _menu_chain->end(); ++menu_it)
259 {
260 // The leaf of the menu chain is in the front of the list.
261 hit_menu_page = NUX_STATIC_CAST(MenuPage*, (*menu_it)->FindAreaUnderMouse(Point(event.x, event.y), event.type));
262@@ -762,7 +762,7 @@
263 // We should never get here for a NUX_MOUSE_PRESSED event.
264 MenuPage* hit_menu_page = NULL;
265 std::list<MenuPage*>::iterator menu_it;
266- for (menu_it = _menu_chain->begin(); menu_it != _menu_chain->end(); menu_it++)
267+ for (menu_it = _menu_chain->begin(); menu_it != _menu_chain->end(); ++menu_it)
268 {
269 // The leaf of the menu chain is in the front of the list.
270 hit_menu_page = NUX_STATIC_CAST(MenuPage*, (*menu_it)->FindAreaUnderMouse(Point(event.x, event.y), event.type));
271@@ -1182,7 +1182,7 @@
272 int top_pos = -1;
273 int bot_pos = -1;
274
275- for (it_top = _view_window_list.begin(), i = 0; it_top != _view_window_list.end(); it_top++, i++)
276+ for (it_top = _view_window_list.begin(), i = 0; it_top != _view_window_list.end(); ++it_top, ++i)
277 {
278 if (*it == bottom_floating_view)
279 {
280@@ -1341,7 +1341,7 @@
281
282 std::list<MenuPage*>::reverse_iterator rev_it_menu;
283
284- for (rev_it_menu = _menu_chain->rbegin(); rev_it_menu != _menu_chain->rend( ); rev_it_menu++)
285+ for (rev_it_menu = _menu_chain->rbegin(); rev_it_menu != _menu_chain->rend( ); ++rev_it_menu)
286 {
287 SetProcessingTopView(m_MenuWindow.GetPointer());
288 (*rev_it_menu)->ProcessDraw(window_thread_->GetGraphicsEngine(), force_draw);
289@@ -1698,7 +1698,7 @@
290 if (OverrideCurrentMenuChain)
291 {
292 // Remove the current menu chain
293- for (it = _menu_chain->begin(); it != _menu_chain->end(); it++)
294+ for (it = _menu_chain->begin(); it != _menu_chain->end(); ++it)
295 {
296 // Stop all pages
297 (*it)->StopMenu();
298@@ -1758,7 +1758,7 @@
299 }
300 else
301 {
302- menu_it++;
303+ ++menu_it;
304 }
305 }
306
307@@ -1977,7 +1977,7 @@
308 {
309 WindowList::iterator it;
310
311- for (it = _view_window_list.begin(); it != _view_window_list.end(); it++)
312+ for (it = _view_window_list.begin(); it != _view_window_list.end(); ++it)
313 {
314 if (!(*it).IsValid())
315 continue;
316
317=== modified file 'Nux/WindowThread.cpp'
318--- Nux/WindowThread.cpp 2012-06-07 15:32:45 +0000
319+++ Nux/WindowThread.cpp 2012-08-02 17:49:17 +0000
320@@ -304,7 +304,7 @@
321 StartLayoutCycle();
322 std::list<Area *>::iterator it;
323
324- for (it = _queued_layout_list.begin(); it != _queued_layout_list.end(); it++)
325+ for (it = _queued_layout_list.begin(); it != _queued_layout_list.end(); ++it)
326 {
327 Area *area = *it;
328
329@@ -822,7 +822,7 @@
330 {
331 std::list<AbstractThread*>::iterator it;
332
333- for (it = children_thread_list_.begin(); it != children_thread_list_.end(); it++)
334+ for (it = children_thread_list_.begin(); it != children_thread_list_.end(); ++it)
335 {
336 (*it)->SetThreadState(THREADSTOP);
337
338@@ -989,7 +989,7 @@
339 {
340 std::list<AbstractThread*>::iterator it;
341
342- for (it = children_thread_list_.begin(); it != children_thread_list_.end(); it++)
343+ for (it = children_thread_list_.begin(); it != children_thread_list_.end(); ++it)
344 {
345 if (NUX_STATIC_CAST(WindowThread *, *it)->Type().IsObjectType(WindowThread::StaticObjectType))
346 {
347@@ -1010,7 +1010,7 @@
348 {
349 std::list<AbstractThread*>::iterator it;
350
351- for (it = children_thread_list_.begin(); it != children_thread_list_.end(); it++)
352+ for (it = children_thread_list_.begin(); it != children_thread_list_.end(); ++it)
353 {
354 if (NUX_STATIC_CAST(WindowThread *, *it)->Type().IsObjectType(WindowThread::StaticObjectType))
355 {
356@@ -1511,7 +1511,7 @@
357
358 std::map < int, EventInspectorStorage >::iterator it;
359
360- for (it = _event_inspectors_map.begin(); it != _event_inspectors_map.end(); it++)
361+ for (it = _event_inspectors_map.begin(); it != _event_inspectors_map.end(); ++it)
362 {
363 if ((*it).second._function == function)
364 {
365@@ -1536,7 +1536,7 @@
366
367 std::map < int, EventInspectorStorage >::iterator it;
368
369- for (it = _event_inspectors_map.begin(); it != _event_inspectors_map.end(); it++)
370+ for (it = _event_inspectors_map.begin(); it != _event_inspectors_map.end(); ++it)
371 {
372 if ((*it).second._uid == event_inspector_id)
373 {
374@@ -1553,7 +1553,7 @@
375
376 std::map < int, EventInspectorStorage >::iterator it;
377
378- for (it = _event_inspectors_map.begin(); it != _event_inspectors_map.end(); it++)
379+ for (it = _event_inspectors_map.begin(); it != _event_inspectors_map.end(); ++it)
380 {
381 if ((*it).second._function == function)
382 {
383@@ -1576,7 +1576,7 @@
384 bool discard_event = false;
385 std::map < int, EventInspectorStorage >::iterator it;
386
387- for (it = _event_inspectors_map.begin(); it != _event_inspectors_map.end(); it++)
388+ for (it = _event_inspectors_map.begin(); it != _event_inspectors_map.end(); ++it)
389 {
390 EventInspector callback = (*it).second._function;
391
392
393=== modified file 'NuxCore/FileManager/NFileManagerGNU.cpp'
394--- NuxCore/FileManager/NFileManagerGNU.cpp 2012-02-19 00:02:14 +0000
395+++ NuxCore/FileManager/NFileManagerGNU.cpp 2012-08-02 17:49:17 +0000
396@@ -458,11 +458,9 @@
397 return NULL;
398 }
399
400- long long Pos = 0;
401-
402 if (Flags & NSerializer::Append)
403 {
404- Pos = lseek (FileDesc, Pos, SEEK_END);
405+ long long Pos = lseek (FileDesc, Pos, SEEK_END);
406
407 if (Pos == -1)
408 {
409
410=== modified file 'NuxCore/FileManager/NFileManagerWindows.cpp'
411--- NuxCore/FileManager/NFileManagerWindows.cpp 2012-02-18 21:32:06 +0000
412+++ NuxCore/FileManager/NFileManagerWindows.cpp 2012-08-02 17:49:17 +0000
413@@ -419,8 +419,6 @@
414 Create |= (Flags & NSerializer::NoOverWrite) ? CREATE_NEW /*fail if the file already exist*/ : CREATE_ALWAYS /*create the file if it does not exist*/;
415 HANDLE Handle = ::CreateFile (Filename, Access, SharedModeFlags, NULL, Create, FILE_ATTRIBUTE_NORMAL, NULL);
416
417- int Pos = 0;
418-
419 if (Handle == INVALID_HANDLE_VALUE)
420 {
421 if (Flags & NSerializer::OutputErrorIfFail)
422@@ -431,7 +429,7 @@
423
424 if ( (Flags & NSerializer::Append) && (Handle != INVALID_HANDLE_VALUE) )
425 {
426- Pos = ::SetFilePointer (Handle, 0, 0, FILE_END);
427+ int Pos = ::SetFilePointer (Handle, 0, 0, FILE_END);
428 }
429
430 return Handle;
431
432=== modified file 'NuxCore/Math/Complex.cpp'
433--- NuxCore/Math/Complex.cpp 2011-10-21 22:06:35 +0000
434+++ NuxCore/Math/Complex.cpp 2012-08-02 17:49:17 +0000
435@@ -190,7 +190,7 @@
436
437 float ComplexNumber::absolute()
438 {
439- float x, y, result, temp;
440+ float x, y, result;
441
442 x = (float) std::fabs (real_);
443 y = (float) std::fabs (imaginary_);
444@@ -203,6 +203,7 @@
445 result = x;
446 else
447 {
448+ float temp;
449 if (x > y)
450 {
451 temp = y / x;
452
453=== modified file 'NuxCore/Parsing.cpp'
454--- NuxCore/Parsing.cpp 2011-10-21 22:06:35 +0000
455+++ NuxCore/Parsing.cpp 2012-08-02 17:49:17 +0000
456@@ -60,10 +60,10 @@
457 bool Parse_tchar (const TCHAR *Stream, const TCHAR *Match, TCHAR *Value, int Size, int MaxLen)
458 {
459 const TCHAR *Found = Strfind (Stream, Match);
460- const TCHAR *Start;
461
462 if (Found)
463 {
464+ const TCHAR *Start;
465 Start = Found + StringLength (Match);
466
467 if (*Start == '\x22') // Character '"'
468
469=== modified file 'NuxGraphics/CairoGraphics.cpp'
470--- NuxGraphics/CairoGraphics.cpp 2012-07-11 01:08:33 +0000
471+++ NuxGraphics/CairoGraphics.cpp 2012-08-02 17:49:17 +0000
472@@ -634,7 +634,7 @@
473 cairo_set_antialias(_cr, CAIRO_ANTIALIAS_NONE);
474
475 std::list<Rect>::iterator it;
476- for (it = region.begin(); it != region.end(); it++)
477+ for (it = region.begin(); it != region.end(); ++it)
478 {
479 Rect rect = (*it);
480
481
482=== modified file 'NuxGraphics/FontTexture.cpp'
483--- NuxGraphics/FontTexture.cpp 2012-06-09 04:54:37 +0000
484+++ NuxGraphics/FontTexture.cpp 2012-08-02 17:49:17 +0000
485@@ -53,7 +53,7 @@
486 FontTexture::~FontTexture()
487 {
488 std::vector<BaseTexture*>::iterator it;
489- for (it = TextureArray.begin(); it != TextureArray.end(); it++)
490+ for (it = TextureArray.begin(); it != TextureArray.end(); ++it)
491 {
492 (*it)->UnReference();
493 }
494
495=== modified file 'NuxGraphics/FreetypeFont.cpp'
496--- NuxGraphics/FreetypeFont.cpp 2011-04-06 21:54:09 +0000
497+++ NuxGraphics/FreetypeFont.cpp 2012-08-02 17:49:17 +0000
498@@ -260,7 +260,7 @@
499 {
500 list <FontFamily *>::iterator iter;
501
502- for (iter = m_font_list->begin(); iter != m_font_list->end(); iter++)
503+ for (iter = m_font_list->begin(); iter != m_font_list->end(); ++iter)
504 {
505 if (strcmp ( (*iter)->font_name, font_name) == 0)
506 {
507@@ -309,7 +309,7 @@
508 {
509 list <FontFamily *>::iterator iter;
510
511- for (iter = m_font_list->begin(); iter != m_font_list->end(); iter++)
512+ for (iter = m_font_list->begin(); iter != m_font_list->end(); ++iter)
513 {
514 if (strcmp ( (*iter)->font_name, font_name) == 0)
515 {
516@@ -337,7 +337,7 @@
517 {
518 list <FontFamily *>::iterator iter;
519
520- for (iter = m_font_list->begin(); iter != m_font_list->end(); iter++)
521+ for (iter = m_font_list->begin(); iter != m_font_list->end(); ++iter)
522 {
523 if (strcmp ( (*iter)->font_name, font_name) == 0)
524 {
525@@ -362,7 +362,7 @@
526 {
527 list <FontFamily *>::iterator iter;
528
529- for (iter = m_font_list->begin(); iter != m_font_list->end(); iter++)
530+ for (iter = m_font_list->begin(); iter != m_font_list->end(); ++iter)
531 {
532 if (strcmp ( (*iter)->font_name, font_name) == 0)
533 {
534@@ -390,7 +390,7 @@
535 {
536 list <FontFamily *>::iterator iter;
537
538- for (iter = m_font_list->begin(); iter != m_font_list->end(); iter++)
539+ for (iter = m_font_list->begin(); iter != m_font_list->end(); ++iter)
540 {
541 if (strcmp ( (*iter)->font_name, font_name) == 0)
542 {
543@@ -405,7 +405,7 @@
544 {
545 list <FontFamily *>::iterator iter;
546
547- for (iter = m_font_list->begin(); iter != m_font_list->end(); iter++)
548+ for (iter = m_font_list->begin(); iter != m_font_list->end(); ++iter)
549 {
550 if (strcmp ( (*iter)->font_name, font_name) == 0)
551 {
552@@ -421,11 +421,11 @@
553 list <FontFamily *>::iterator iter;
554 list <FontStyle *>::iterator iter1;
555
556- for (iter = m_font_list->begin(); iter != m_font_list->end(); iter++)
557+ for (iter = m_font_list->begin(); iter != m_font_list->end(); ++iter)
558 {
559 if (strcmp ( (*iter)->font_name, font_name) == 0)
560 {
561- for (iter1 = ( (*iter)->style_list)->begin(); iter1 != ( (*iter)->style_list)->end(); iter1++)
562+ for (iter1 = ( (*iter)->style_list)->begin(); iter1 != ( (*iter)->style_list)->end(); ++iter1)
563 if (strcmp ( (*iter1)->style_name, style_name) == 0)
564 {
565 return (*iter1);
566@@ -909,13 +909,6 @@
567 ComputeGlyphString (stringBBox.x, stringBBox.y, Str.c_str() );
568 RenderGlyph (pageSize, Str.c_str(), alignment);
569
570- int bmpX;
571- int bmpY;
572- int bmpWidth;
573- int bmpHeight;
574- float u;
575- float v;
576-
577 if (trailingchar == 0)
578 return;
579
580@@ -935,10 +928,10 @@
581 int posX = gGlyphs[gNumGlyphs-1].pos.x + last_cd.hadvance;
582 int posY = gGlyphs[gNumGlyphs-1].pos.y; // - dot_cd.bitmap_top_bearing;
583
584- bmpWidth = dot_cd.bitmap_width;
585- bmpHeight = dot_cd.bitmap_height;
586- u = float (dot_cd.bitmap_width) / dot_cd.glTexWidth;
587- v = float (dot_cd.bitmap_height) / dot_cd.glTexHeight;
588+ int bmpWidth = dot_cd.bitmap_width;
589+ int bmpHeight = dot_cd.bitmap_height;
590+ float u = float (dot_cd.bitmap_width) / dot_cd.glTexWidth;
591+ float v = float (dot_cd.bitmap_height) / dot_cd.glTexHeight;
592
593 // glBindTexture(GL_TEXTURE_2D, dot_gltexid);
594 // glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
595@@ -955,8 +948,8 @@
596
597 while (posX + dot_cd.hadvance < page_right_border_posX)
598 {
599- bmpX = posX + dot_cd.bitmap_left_bearing;
600- bmpY = posY - dot_cd.bitmap_top_bearing;
601+ int bmpX = posX + dot_cd.bitmap_left_bearing;
602+ int bmpY = posY - dot_cd.bitmap_top_bearing;
603
604 glBegin (GL_QUADS);
605 glMultiTexCoord2fARB (GL_TEXTURE0_ARB, 0.0f, 0.0f);
606
607=== modified file 'NuxGraphics/GraphicsDisplayWin.cpp'
608--- NuxGraphics/GraphicsDisplayWin.cpp 2012-05-31 21:32:52 +0000
609+++ NuxGraphics/GraphicsDisplayWin.cpp 2012-08-02 17:49:17 +0000
610@@ -905,7 +905,7 @@
611 static int mouse_event(HWND window, Event *event, int what, int button,
612 WPARAM wParam, LPARAM lParam)
613 {
614- static int px, py, pmx, pmy;
615+ static int pmx, pmy;
616 event->x = (signed short) LOWORD(lParam);
617 event->y = (signed short) HIWORD(lParam);
618 event->x_root = 0;
619@@ -1020,6 +1020,7 @@
620
621 switch(what)
622 {
623+ static int px, py;
624 case 1: // double-click
625
626 if (event->is_click)
627
628=== modified file 'NuxGraphics/GraphicsDisplayX11.cpp'
629--- NuxGraphics/GraphicsDisplayX11.cpp 2012-05-31 21:32:52 +0000
630+++ NuxGraphics/GraphicsDisplayX11.cpp 2012-08-02 17:49:17 +0000
631@@ -1221,7 +1221,7 @@
632 m_pEvent->Reset();
633 // Erase mouse event and mouse doubleclick states. Keep the mouse states.
634 m_pEvent->mouse_state &= 0x0F000000;
635- bool bProcessEvent = true;
636+
637 bool got_event;
638
639 // Process event matching this window
640@@ -1229,6 +1229,7 @@
641
642 if (XPending(m_X11Display))
643 {
644+ bool bProcessEvent = true;
645 XNextEvent(m_X11Display, &xevent);
646
647 if (!_event_filters.empty())
648@@ -1337,11 +1338,11 @@
649 m_pEvent->Reset();
650 // Erase mouse event and mouse doubleclick states. Keep the mouse states.
651 m_pEvent->mouse_state &= 0x0F000000;
652- bool bProcessEvent = true;
653
654 // Process event matching this window
655 if (true /*(NUX_REINTERPRET_CAST(XAnyEvent*, xevent))->window == m_X11Window*/)
656 {
657+ bool bProcessEvent = true;
658 // Detect auto repeat keys. X11 sends a combination of KeyRelease/KeyPress(at the same time) when a key auto repeats.
659 // Here, we make sure we process only the keyRelease when the key is effectively released.
660 if ((xevent->type == KeyPress) || (xevent->type == KeyRelease))
661@@ -1971,9 +1972,9 @@
662 if (XGetWindowProperty(GetX11Display(), result, XInternAtom(GetX11Display(), "XdndAware", false), 0, 1, False,
663 XA_ATOM, &type, &format, &n, &a, &data) == Success)
664 {
665- long dnd_version = 0;
666 if (data)
667 {
668+ long dnd_version = 0;
669 dnd_version = ((Atom *)data)[0];
670
671 if (dnd_version < 5)
672@@ -2167,7 +2168,7 @@
673 Atom type_atoms[types.size()];
674
675 i = 0;
676- for (it = types.begin(); it != types.end(); it++)
677+ for (it = types.begin(); it != types.end(); ++it)
678 {
679 type_atoms[i] = XInternAtom(display, *it, false);
680 i++;
681
682=== modified file 'NuxGraphics/GraphicsEngine.cpp'
683--- NuxGraphics/GraphicsEngine.cpp 2012-05-25 20:36:09 +0000
684+++ NuxGraphics/GraphicsEngine.cpp 2012-08-02 17:49:17 +0000
685@@ -718,7 +718,7 @@
686 _clip_offset_y = 0;
687
688 std::list<Point>::iterator it;
689- for (it = _clip_offset_stack.begin(); it != _clip_offset_stack.end(); it++)
690+ for (it = _clip_offset_stack.begin(); it != _clip_offset_stack.end(); ++it)
691 {
692 _clip_offset_x += (*it).x;
693 _clip_offset_y += (*it).y;
694@@ -739,7 +739,7 @@
695 _clip_offset_y = 0;
696
697 std::list<Point>::iterator it;
698- for (it = _clip_offset_stack.begin(); it != _clip_offset_stack.end(); it++)
699+ for (it = _clip_offset_stack.begin(); it != _clip_offset_stack.end(); ++it)
700 {
701 _clip_offset_x += (*it).x;
702 _clip_offset_y += (*it).y;
703@@ -789,7 +789,7 @@
704 Matrix4 temp;
705 std::list<Matrix4>::iterator it;
706
707- for (it = m_2DModelViewMatricesStack.begin(); it != m_2DModelViewMatricesStack.end(); it++)
708+ for (it = m_2DModelViewMatricesStack.begin(); it != m_2DModelViewMatricesStack.end(); ++it)
709 {
710 temp = _model_view_matrix;
711 _model_view_matrix = temp * (*it);
712@@ -848,7 +848,7 @@
713 Matrix4 temp;
714 std::list<Matrix4>::iterator it;
715
716- for (it = m_2DModelViewMatricesStack.begin(); it != m_2DModelViewMatricesStack.end(); it++)
717+ for (it = m_2DModelViewMatricesStack.begin(); it != m_2DModelViewMatricesStack.end(); ++it)
718 {
719 temp = _model_view_matrix;
720 _model_view_matrix = (*it) * temp;
721@@ -876,7 +876,7 @@
722 Matrix4 temp;
723 std::list<Matrix4>::iterator it;
724
725- for (it = m_2DModelViewMatricesStack.begin(); it != m_2DModelViewMatricesStack.end(); it++)
726+ for (it = m_2DModelViewMatricesStack.begin(); it != m_2DModelViewMatricesStack.end(); ++it)
727 {
728 temp = _model_view_matrix;
729 _model_view_matrix = temp * (*it);
730@@ -894,7 +894,7 @@
731 Matrix4 temp;
732 std::list<Matrix4>::iterator it;
733
734- for (it = m_2DModelViewMatricesStack.begin(); it != m_2DModelViewMatricesStack.end(); it++)
735+ for (it = m_2DModelViewMatricesStack.begin(); it != m_2DModelViewMatricesStack.end(); ++it)
736 {
737 temp = _model_view_matrix;
738 _model_view_matrix = temp * (*it);

Subscribers

People subscribed via source and target branches