Merge lp:~michihenning/nux/1032313-series-4.0 into lp:nux
- 1032313-series-4.0
- Merge into trunk
Proposed by
Michi Henning
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Tim Penhey | ||||
Approved revision: | 662 | ||||
Merged at revision: | 665 | ||||
Proposed branch: | lp:~michihenning/nux/1032313-series-4.0 | ||||
Merge into: | lp:nux | ||||
Diff against target: |
982 lines (+103/-251) 22 files modified
Nux/Button.cpp (+0/-7) Nux/ClientArea.cpp (+0/-3) Nux/DoubleValidator.cpp (+1/-2) Nux/HexRegExpValidator.cpp (+1/-2) Nux/IntegerValidator.cpp (+1/-2) Nux/MainLoopGLib.cpp (+12/-4) Nux/WindowCompositor.cpp (+0/-7) NuxCore/FileManager/NFileManagerGNU.cpp (+1/-1) NuxCore/Logger.cpp (+2/-0) NuxCore/Object.h (+2/-5) NuxCore/TextString.cpp (+15/-24) NuxGraphics/GLTextureResourceManager.cpp (+30/-92) NuxGraphics/GLTextureResourceManager.h (+15/-48) NuxGraphics/GLVertexResourceManager.cpp (+0/-30) NuxGraphics/GLVertexResourceManager.h (+0/-8) NuxGraphics/GpuDevice.cpp (+4/-3) NuxGraphics/GpuDeviceVertex.cpp (+1/-1) NuxGraphics/GraphicsDisplayX11.cpp (+9/-8) NuxGraphics/GraphicsEngine.h (+2/-2) NuxGraphics/MeshData.cpp (+3/-0) NuxGraphics/RenderingPipeTextureBlend.cpp (+2/-2) NuxGraphics/XInputWindow.cpp (+2/-0) |
||||
To merge this branch: | bzr merge lp:~michihenning/nux/1032313-series-4.0 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Penhey (community) | Approve | ||
Review via email:
|
Commit message
Eliminated a whole bunch of compiler warnings reported by -Wextra.
Description of the change
Eliminated a whole bunch of compiler warnings reported by -Wextra. A few of these exposed real problems.
The only warnings remaining now with -Wextra are about unused parameters.
Most of the fixes are trivial, such as removing asserts that were always true, and fixing signed/unsigned comparisons.
Removed the assignment operator and copy constructor from a number of texture classes, because those derived from ObjectPtr, which is non-copyable, so these members didn't make sense. They were not called from anywhere except the Clone() methods, so I re-implemented the Clone() methods to work without a copy constructor and also change them to use covariant return types.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Nux/Button.cpp' |
2 | --- Nux/Button.cpp 2012-07-30 04:47:08 +0000 |
3 | +++ Nux/Button.cpp 2012-09-19 05:03:18 +0000 |
4 | @@ -360,13 +360,6 @@ |
5 | ref_style = eBUTTON_NORMAL; |
6 | } |
7 | |
8 | - const PainterImage *pimage = GetTheme().GetImage(ref_style); |
9 | - BaseTexture* texture = NULL; |
10 | - if (pimage != NULL) |
11 | - { |
12 | - texture = pimage->texture; |
13 | - } |
14 | - |
15 | TexCoordXForm texxform; |
16 | ROPConfig rop; |
17 | rop.Blend = true; |
18 | |
19 | === modified file 'Nux/ClientArea.cpp' |
20 | --- Nux/ClientArea.cpp 2012-08-31 05:58:53 +0000 |
21 | +++ Nux/ClientArea.cpp 2012-09-19 05:03:18 +0000 |
22 | @@ -70,9 +70,6 @@ |
23 | { |
24 | int width = GetWidth(); |
25 | int height = GetHeight(); |
26 | - int window_width, window_height; |
27 | - window_width = prev_viewport_.width; |
28 | - window_height = prev_viewport_.height; |
29 | |
30 | m_ctx.x = GetX(); |
31 | m_ctx.y = GetY(); |
32 | |
33 | === modified file 'Nux/DoubleValidator.cpp' |
34 | --- Nux/DoubleValidator.cpp 2011-10-17 21:23:50 +0000 |
35 | +++ Nux/DoubleValidator.cpp 2012-09-19 05:03:18 +0000 |
36 | @@ -118,9 +118,8 @@ |
37 | return d; |
38 | } |
39 | |
40 | - void DoubleValidator::Alternative(const char *str) |
41 | + void DoubleValidator::Alternative(const char * /* str */) |
42 | { |
43 | - str = "0.0"; |
44 | } |
45 | |
46 | void DoubleValidator::SetDecimals(int dec) |
47 | |
48 | === modified file 'Nux/HexRegExpValidator.cpp' |
49 | --- Nux/HexRegExpValidator.cpp 2011-10-17 21:23:50 +0000 |
50 | +++ Nux/HexRegExpValidator.cpp 2012-09-19 05:03:18 +0000 |
51 | @@ -117,9 +117,8 @@ |
52 | return i; |
53 | } |
54 | |
55 | - void HexRegExpValidator::Alternative(const char *str) |
56 | + void HexRegExpValidator::Alternative(const char * /* str */) |
57 | { |
58 | - str = "0x0"; |
59 | } |
60 | |
61 | NString HexRegExpValidator::ToString(int i) |
62 | |
63 | === modified file 'Nux/IntegerValidator.cpp' |
64 | --- Nux/IntegerValidator.cpp 2011-10-17 21:23:50 +0000 |
65 | +++ Nux/IntegerValidator.cpp 2012-09-19 05:03:18 +0000 |
66 | @@ -118,9 +118,8 @@ |
67 | return i; |
68 | } |
69 | |
70 | - void IntegerValidator::Alternative(const char *str) |
71 | + void IntegerValidator::Alternative(const char * /* str */) |
72 | { |
73 | - str = "0"; |
74 | } |
75 | |
76 | NString IntegerValidator::ToString(int i) |
77 | |
78 | === modified file 'Nux/MainLoopGLib.cpp' |
79 | --- Nux/MainLoopGLib.cpp 2012-08-07 20:39:44 +0000 |
80 | +++ Nux/MainLoopGLib.cpp 2012-09-19 05:03:18 +0000 |
81 | @@ -146,6 +146,8 @@ |
82 | nux_event_prepare, |
83 | nux_event_check, |
84 | nux_event_dispatch, |
85 | + NULL, |
86 | + NULL, |
87 | NULL |
88 | }; |
89 | |
90 | @@ -165,12 +167,17 @@ |
91 | return TRUE; |
92 | } |
93 | |
94 | + static GTimeVal get_time(GSource* source) |
95 | + { |
96 | + gint64 t = g_source_get_time(source); // Time in microseconds |
97 | + return GTimeVal { t / 1000000, t % 1000000 }; |
98 | + } |
99 | + |
100 | static gboolean nux_timeline_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) |
101 | { |
102 | - GTimeVal time_val; |
103 | bool has_timelines_left = false; |
104 | nux_glib_threads_lock(); |
105 | - g_source_get_current_time(source, &time_val); |
106 | + GTimeVal time_val = get_time(source); |
107 | WindowThread *window_thread = NUX_STATIC_CAST(WindowThread *, user_data); |
108 | |
109 | // pump the timelines |
110 | @@ -192,6 +199,8 @@ |
111 | nux_timeline_prepare, |
112 | nux_timeline_check, |
113 | nux_timeline_dispatch, |
114 | + NULL, |
115 | + NULL, |
116 | NULL |
117 | }; |
118 | |
119 | @@ -367,7 +376,6 @@ |
120 | |
121 | if (_MasterClock == NULL) |
122 | { |
123 | - GTimeVal time_val; |
124 | // make a source for our master clock |
125 | _MasterClock = g_source_new(&timeline_funcs, sizeof(GSource)); |
126 | |
127 | @@ -381,7 +389,7 @@ |
128 | g_source_attach(_MasterClock, main_loop_glib_context_); |
129 | |
130 | |
131 | - g_get_current_time(&time_val); |
132 | + GTimeVal time_val = get_time(_MasterClock); |
133 | last_timeline_frame_time_sec_ = time_val.tv_sec; |
134 | last_timeline_frame_time_usec_ = time_val.tv_usec; |
135 | } |
136 | |
137 | === modified file 'Nux/WindowCompositor.cpp' |
138 | --- Nux/WindowCompositor.cpp 2012-09-17 09:55:43 +0000 |
139 | +++ Nux/WindowCompositor.cpp 2012-09-19 05:03:18 +0000 |
140 | @@ -1534,13 +1534,6 @@ |
141 | // End 2D Drawing |
142 | } |
143 | |
144 | - if (key_focus_area_.IsValid()) |
145 | - { |
146 | - // key focus test |
147 | - Geometry const& geo = key_focus_area_->GetRootGeometry(); |
148 | - //GetGraphicsDisplay()->GetGraphicsEngine()->QRP_Color(geo.x, geo.y, geo.width, geo.height, color::Blue); |
149 | - } |
150 | - |
151 | window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height); |
152 | m_FrameBufferObject->Deactivate(); |
153 | |
154 | |
155 | === modified file 'NuxCore/FileManager/NFileManagerGNU.cpp' |
156 | --- NuxCore/FileManager/NFileManagerGNU.cpp 2012-07-30 21:18:22 +0000 |
157 | +++ NuxCore/FileManager/NFileManagerGNU.cpp 2012-09-19 05:03:18 +0000 |
158 | @@ -460,7 +460,7 @@ |
159 | |
160 | if (Flags & NSerializer::Append) |
161 | { |
162 | - long long Pos = lseek (FileDesc, Pos, SEEK_END); |
163 | + long long Pos = lseek (FileDesc, 0, SEEK_END); |
164 | |
165 | if (Pos == -1) |
166 | { |
167 | |
168 | === modified file 'NuxCore/Logger.cpp' |
169 | --- NuxCore/Logger.cpp 2012-03-18 21:10:06 +0000 |
170 | +++ NuxCore/Logger.cpp 2012-09-19 05:03:18 +0000 |
171 | @@ -20,8 +20,10 @@ |
172 | * |
173 | */ |
174 | |
175 | +#ifdef _MSC_VER |
176 | #pragma warning(disable: 4996) // 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' |
177 | // 'std::_Equal1': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' |
178 | +#endif |
179 | |
180 | #include "NuxCore.h" |
181 | #include "Logger.h" |
182 | |
183 | === modified file 'NuxCore/Object.h' |
184 | --- NuxCore/Object.h 2012-03-18 21:10:06 +0000 |
185 | +++ NuxCore/Object.h 2012-09-19 05:03:18 +0000 |
186 | @@ -28,6 +28,7 @@ |
187 | |
188 | #include <sigc++/trackable.h> |
189 | #include <sigc++/signal.h> |
190 | +#include <boost/utility.hpp> |
191 | #include "ObjectType.h" |
192 | #include "Property.h" |
193 | #include "PropertyTraits.h" |
194 | @@ -65,7 +66,7 @@ |
195 | Trackable does not implement reference counting. It only defines the API. It is up |
196 | to the class that inherit from Trackable to implement the reference counting. |
197 | */ |
198 | - class Trackable: public nux::Introspectable, public sigc::trackable |
199 | + class Trackable: public nux::Introspectable, public sigc::trackable, public boost::noncopyable |
200 | { |
201 | public: |
202 | NUX_DECLARE_ROOT_OBJECT_TYPE (Trackable); |
203 | @@ -160,10 +161,6 @@ |
204 | int _heap_allocated; |
205 | |
206 | private: |
207 | - // Trackable objects are not copyable. |
208 | - Trackable (const Trackable &); |
209 | - Trackable &operator= (const Trackable &); |
210 | - |
211 | static std::new_handler _new_current_handler; |
212 | |
213 | bool _owns_the_reference; |
214 | |
215 | === modified file 'NuxCore/TextString.cpp' |
216 | --- NuxCore/TextString.cpp 2012-02-18 21:32:06 +0000 |
217 | +++ NuxCore/TextString.cpp 2012-09-19 05:03:18 +0000 |
218 | @@ -30,7 +30,6 @@ |
219 | // |
220 | TCHAR *Strncpy (TCHAR *Dest, size_t Size, const TCHAR *Src, size_t MaxLen) |
221 | { |
222 | - nuxAssert (MaxLen >= 0); |
223 | STRNCPY_S (Dest, Size, Src, MaxLen); |
224 | Dest[MaxLen] = 0; |
225 | return Dest; |
226 | @@ -150,14 +149,9 @@ |
227 | |
228 | size_t len = StringLength (str); |
229 | |
230 | - if (len >= 0) |
231 | - { |
232 | - TCHAR *res = new TCHAR[len+1]; |
233 | - Strncpy (res, len + 1, str, len); |
234 | - return res; |
235 | - } |
236 | - |
237 | - return 0; |
238 | + TCHAR *res = new TCHAR[len+1]; |
239 | + Strncpy (res, len + 1, str, len); |
240 | + return res; |
241 | } |
242 | |
243 | //! Duplicate a null terminated ANSICHAR string using new[]. The resulting string is NULL terminated. Use delete[] to destroy. |
244 | @@ -531,7 +525,7 @@ |
245 | NString rev; |
246 | size_t l = Length(); |
247 | |
248 | - for (size_t i = l - 1; i >= 0; i--) |
249 | + for (int i = l - 1; i >= 0; i--) |
250 | { |
251 | rev += m_string[i]; |
252 | } |
253 | @@ -757,7 +751,7 @@ |
254 | |
255 | bool NString::IsSuffix (const TCHAR &suffix) |
256 | { |
257 | - size_t l = m_string.length() - 1; |
258 | + int l = m_string.length() - 1; |
259 | |
260 | if (l < 0) |
261 | return false; |
262 | @@ -767,7 +761,7 @@ |
263 | if (pos == tstring::npos) |
264 | return false; |
265 | |
266 | - return (pos == l); |
267 | + return (pos == (size_t)l); |
268 | } |
269 | |
270 | bool NString::IsSuffix (const TCHAR *suffix) |
271 | @@ -777,7 +771,7 @@ |
272 | if (sl == 0) |
273 | return false; |
274 | |
275 | - size_t l = m_string.length() - sl; |
276 | + int l = m_string.length() - sl; |
277 | |
278 | if (l < 0) |
279 | return false; |
280 | @@ -787,7 +781,7 @@ |
281 | if (pos == tstring::npos) |
282 | return false; |
283 | |
284 | - return (pos == l); |
285 | + return (pos == (size_t)l); |
286 | } |
287 | |
288 | //! Return True is the the string is terminated by the tstring 'suffix' |
289 | @@ -798,7 +792,7 @@ |
290 | if (sl == 0) |
291 | return false; |
292 | |
293 | - size_t l = m_string.length() - sl; |
294 | + int l = m_string.length() - sl; |
295 | |
296 | if (l < 0) |
297 | return false; |
298 | @@ -808,7 +802,7 @@ |
299 | if (pos == tstring::npos) |
300 | return false; |
301 | |
302 | - return (pos == l); |
303 | + return (pos == (size_t)l); |
304 | } |
305 | |
306 | //! Return True is the the string is terminated by the NString 'suffix' |
307 | @@ -819,7 +813,7 @@ |
308 | if (sl == 0) |
309 | return false; |
310 | |
311 | - size_t l = m_string.length() - sl; |
312 | + int l = m_string.length() - sl; |
313 | |
314 | if (l < 0) |
315 | return false; |
316 | @@ -829,13 +823,13 @@ |
317 | if (pos == tstring::npos) |
318 | return false; |
319 | |
320 | - return (pos == l); |
321 | + return (pos == (size_t)l); |
322 | } |
323 | |
324 | //! Return True if the string start with the character contained in prefix |
325 | bool NString::IsPrefix (const TCHAR &prefix) |
326 | { |
327 | - size_t l = m_string.length() - 1; |
328 | + int l = m_string.length() - 1; |
329 | |
330 | if (l < 0) |
331 | return false; |
332 | @@ -976,14 +970,11 @@ |
333 | |
334 | NString NString::GetSubString (size_t count) const |
335 | { |
336 | - nuxAssert (count >= 0); |
337 | return NString (m_string.substr (0, count) ); |
338 | } |
339 | |
340 | NString NString::GetSubString (size_t start, size_t count) const |
341 | { |
342 | - nuxAssert (start >= 0); |
343 | - nuxAssert (count >= 0); |
344 | return NString (m_string.substr (start, count) ); |
345 | } |
346 | |
347 | @@ -1040,7 +1031,7 @@ |
348 | |
349 | NString NString::TrimRight() const |
350 | { |
351 | - size_t L = Length() - 1; |
352 | + int L = Length() - 1; |
353 | |
354 | while (0 <= L) |
355 | { |
356 | @@ -1094,7 +1085,7 @@ |
357 | |
358 | NString NString::TrimRight (NString str) const |
359 | { |
360 | - size_t L = Length(); |
361 | + int L = Length(); |
362 | |
363 | if (L == 0) |
364 | return *this; |
365 | |
366 | === modified file 'NuxGraphics/GLTextureResourceManager.cpp' |
367 | --- NuxGraphics/GLTextureResourceManager.cpp 2012-07-12 02:42:06 +0000 |
368 | +++ NuxGraphics/GLTextureResourceManager.cpp 2012-09-19 05:03:18 +0000 |
369 | @@ -294,30 +294,14 @@ |
370 | return GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource(this); |
371 | } |
372 | |
373 | - Texture2D::Texture2D(NUX_FILE_LINE_DECL) |
374 | - : BaseTexture(NUX_FILE_LINE_PARAM) |
375 | - { |
376 | - } |
377 | - |
378 | - Texture2D::Texture2D(const Texture2D& texture, NUX_FILE_LINE_DECL) |
379 | - : BaseTexture(NUX_FILE_LINE_PARAM) |
380 | - { |
381 | - _image = texture._image; |
382 | + Texture2D::Texture2D(NUX_FILE_LINE_DECL) // TODO: Why can we create a texture without a texture? |
383 | + : BaseTexture(NUX_FILE_LINE_PARAM) |
384 | + { |
385 | } |
386 | |
387 | Texture2D::Texture2D(const NTextureData& texture_data, NUX_FILE_LINE_DECL) |
388 | - : BaseTexture(NUX_FILE_LINE_PARAM) |
389 | - { |
390 | - _image = texture_data; |
391 | - } |
392 | - |
393 | - Texture2D& Texture2D::operator = (const Texture2D& texture) |
394 | - { |
395 | - if (this == &texture) |
396 | - return *this; // Handle self assignment |
397 | - |
398 | - _image = texture._image; |
399 | - return *this; |
400 | + : BaseTexture(NUX_FILE_LINE_PARAM), _image(texture_data) |
401 | + { |
402 | } |
403 | |
404 | Texture2D::~Texture2D() |
405 | @@ -371,10 +355,9 @@ |
406 | } |
407 | } |
408 | |
409 | - BaseTexture* Texture2D::Clone() const |
410 | + Texture2D* Texture2D::Clone() const |
411 | { |
412 | - Texture2D* texture = new Texture2D(*this); |
413 | - return texture; |
414 | + return new Texture2D(_image); |
415 | } |
416 | |
417 | CachedBaseTexture::CachedBaseTexture(NResourceSet* ResourceManager) |
418 | @@ -491,23 +474,9 @@ |
419 | { |
420 | } |
421 | |
422 | - TextureRectangle::TextureRectangle(const TextureRectangle& texture) |
423 | - { |
424 | - _image = texture._image; |
425 | - } |
426 | - |
427 | - TextureRectangle::TextureRectangle(const NTextureData& BaseTexture) |
428 | - { |
429 | - _image = BaseTexture; |
430 | - } |
431 | - |
432 | - TextureRectangle& TextureRectangle::operator = (const TextureRectangle& texture) |
433 | - { |
434 | - if (this == &texture) |
435 | - return *this; // Handle self assignment |
436 | - |
437 | - _image = texture._image; |
438 | - return *this; |
439 | + TextureRectangle::TextureRectangle(const NTextureData& texture, NUX_FILE_LINE_DECL) |
440 | + : BaseTexture(NUX_FILE_LINE_PARAM), _image(texture) |
441 | + { |
442 | } |
443 | |
444 | TextureRectangle::~TextureRectangle() |
445 | @@ -562,10 +531,9 @@ |
446 | } |
447 | } |
448 | |
449 | - BaseTexture* TextureRectangle::Clone() const |
450 | + TextureRectangle* TextureRectangle::Clone() const |
451 | { |
452 | - TextureRectangle* texture = new TextureRectangle(*this); |
453 | - return texture; |
454 | + return new TextureRectangle(_image); |
455 | } |
456 | |
457 | CachedTextureRectangle::CachedTextureRectangle(NResourceSet* ResourceManager, TextureRectangle* SourceTexture) |
458 | @@ -638,23 +606,14 @@ |
459 | OGL_CALL(TextureRectangle->UnlockRect( MipLevel )); |
460 | } |
461 | |
462 | - TextureCube::TextureCube(NUX_FILE_LINE_DECL) |
463 | + TextureCube::TextureCube(NUX_FILE_LINE_DECL) // TODO: why can we have a texture without a texture? |
464 | : BaseTexture(NUX_FILE_LINE_PARAM) |
465 | { |
466 | } |
467 | |
468 | - TextureCube::TextureCube(const TextureCube& texture) |
469 | - { |
470 | - _image = texture._image; |
471 | - } |
472 | - |
473 | - TextureCube& TextureCube::operator = (const TextureCube& texture) |
474 | - { |
475 | - if (this == &texture) |
476 | - return *this; // Handle self assignment |
477 | - |
478 | - _image = texture._image; |
479 | - return *this; |
480 | + TextureCube::TextureCube(const NCubemapData& Image) |
481 | + : _image(Image) |
482 | + { |
483 | } |
484 | |
485 | TextureCube::~TextureCube() |
486 | @@ -709,10 +668,9 @@ |
487 | } |
488 | } |
489 | |
490 | - BaseTexture* TextureCube::Clone() const |
491 | + TextureCube* TextureCube::Clone() const |
492 | { |
493 | - TextureCube* texture = new TextureCube(*this); |
494 | - return texture; |
495 | + return new TextureCube(_image); |
496 | } |
497 | |
498 | CachedTextureCube::CachedTextureCube(NResourceSet* ResourceManager, TextureCube* SourceTexture) |
499 | @@ -786,23 +744,14 @@ |
500 | } |
501 | } |
502 | |
503 | - TextureVolume::TextureVolume(NUX_FILE_LINE_DECL) |
504 | + TextureVolume::TextureVolume(NUX_FILE_LINE_DECL) // TODO: why can we have a texture without a texture? |
505 | : BaseTexture(NUX_FILE_LINE_PARAM) |
506 | { |
507 | } |
508 | |
509 | - TextureVolume::TextureVolume(const TextureVolume& texture) |
510 | - { |
511 | - _image = texture._image; |
512 | - } |
513 | - |
514 | - TextureVolume& TextureVolume::operator = (const TextureVolume& texture) |
515 | - { |
516 | - if (this == &texture) |
517 | - return *this; // Handle self assignment |
518 | - |
519 | - _image = texture._image; |
520 | - return *this; |
521 | + TextureVolume::TextureVolume(const NVolumeData& Image) |
522 | + : _image(Image) |
523 | + { |
524 | } |
525 | |
526 | TextureVolume::~TextureVolume() |
527 | @@ -878,10 +827,9 @@ |
528 | // } |
529 | } |
530 | |
531 | - BaseTexture* TextureVolume::Clone() const |
532 | + TextureVolume* TextureVolume::Clone() const |
533 | { |
534 | - TextureVolume* texture = new TextureVolume(*this); |
535 | - return texture; |
536 | + return new TextureVolume(_image); |
537 | } |
538 | |
539 | CachedTextureVolume::CachedTextureVolume(NResourceSet* ResourceManager, TextureVolume* SourceTexture) |
540 | @@ -967,23 +915,14 @@ |
541 | // } |
542 | } |
543 | |
544 | - TextureFrameAnimation::TextureFrameAnimation(NUX_FILE_LINE_DECL) |
545 | + TextureFrameAnimation::TextureFrameAnimation(NUX_FILE_LINE_DECL) // TODO: why can we have a texture without a texture? |
546 | : BaseTexture(NUX_FILE_LINE_PARAM) |
547 | { |
548 | } |
549 | |
550 | - TextureFrameAnimation::TextureFrameAnimation(const TextureFrameAnimation& texture) |
551 | - { |
552 | - _image = texture._image; |
553 | - } |
554 | - |
555 | - TextureFrameAnimation& TextureFrameAnimation::operator = (const TextureFrameAnimation& texture) |
556 | - { |
557 | - if (this == &texture) |
558 | - return *this; // Handle self assignment |
559 | - |
560 | - _image = texture._image; |
561 | - return *this; |
562 | + TextureFrameAnimation::TextureFrameAnimation(const NAnimatedTextureData& Image) |
563 | + : _image(Image) |
564 | + { |
565 | } |
566 | |
567 | TextureFrameAnimation::~TextureFrameAnimation() |
568 | @@ -1048,10 +987,9 @@ |
569 | return _image.GetFrameTime(Frame); |
570 | } |
571 | |
572 | - BaseTexture* TextureFrameAnimation::Clone() const |
573 | + TextureFrameAnimation* TextureFrameAnimation::Clone() const |
574 | { |
575 | - TextureFrameAnimation* texture = new TextureFrameAnimation(*this); |
576 | - return texture; |
577 | + return new TextureFrameAnimation(_image); |
578 | } |
579 | |
580 | CachedTextureFrameAnimation::CachedTextureFrameAnimation(NResourceSet* ResourceManager, TextureFrameAnimation* SourceTexture) |
581 | |
582 | === modified file 'NuxGraphics/GLTextureResourceManager.h' |
583 | --- NuxGraphics/GLTextureResourceManager.h 2012-02-18 21:32:06 +0000 |
584 | +++ NuxGraphics/GLTextureResourceManager.h 2012-09-19 05:03:18 +0000 |
585 | @@ -145,10 +145,6 @@ |
586 | */ |
587 | virtual bool IsNull() const = 0; |
588 | |
589 | - /*! |
590 | - Clone the texture. |
591 | - @return A cloned version of this texture. |
592 | - */ |
593 | virtual BaseTexture* Clone() const = 0; |
594 | |
595 | /*! |
596 | @@ -177,10 +173,8 @@ |
597 | NUX_DECLARE_OBJECT_TYPE(Texture2D, BaseTexture); |
598 | |
599 | public: |
600 | - Texture2D(NUX_FILE_LINE_PROTO); |
601 | - Texture2D(const Texture2D& texture, NUX_FILE_LINE_PROTO); |
602 | - Texture2D(const NTextureData& BaseTexture, NUX_FILE_LINE_PROTO); |
603 | - Texture2D& operator = (const Texture2D& texture); |
604 | + Texture2D(NUX_FILE_LINE_PROTO); // TODO: Why can we create a texture without a texture? |
605 | + Texture2D(const NTextureData& Image, NUX_FILE_LINE_PROTO); |
606 | ~Texture2D(); |
607 | |
608 | /*! |
609 | @@ -252,11 +246,7 @@ |
610 | return IsPowerOf2(_image.GetWidth()) && IsPowerOf2(_image.GetHeight()); |
611 | } |
612 | |
613 | - /*! |
614 | - Clone the texture. |
615 | - @return A cloned version of this texture. |
616 | - */ |
617 | - virtual BaseTexture* Clone() const; |
618 | + virtual Texture2D* Clone() const; |
619 | |
620 | private: |
621 | NTextureData _image; //!< Storage for the texture data |
622 | @@ -267,10 +257,8 @@ |
623 | NUX_DECLARE_OBJECT_TYPE(TextureRectangle, BaseTexture); |
624 | |
625 | public: |
626 | - TextureRectangle(NUX_FILE_LINE_PROTO); |
627 | - TextureRectangle(const TextureRectangle& texture); |
628 | - TextureRectangle(const NTextureData& Image); |
629 | - TextureRectangle& operator = (const TextureRectangle& texture); |
630 | + TextureRectangle(NUX_FILE_LINE_PROTO); // TODO: Why can we create a texture without a texture? |
631 | + TextureRectangle(const NTextureData& Image, NUX_FILE_LINE_PROTO); |
632 | ~TextureRectangle(); |
633 | |
634 | virtual bool Update(const NBitmapData* BitmapData, bool UpdateAndCacheResource = true); |
635 | @@ -326,11 +314,7 @@ |
636 | return IsPowerOf2(_image.GetWidth()) && IsPowerOf2(_image.GetHeight()); |
637 | } |
638 | |
639 | - /*! |
640 | - Clone the texture. |
641 | - @return A cloned version of this texture. |
642 | - */ |
643 | - virtual BaseTexture* Clone() const; |
644 | + virtual TextureRectangle* Clone() const; |
645 | |
646 | private: |
647 | NTextureData _image; |
648 | @@ -341,10 +325,8 @@ |
649 | NUX_DECLARE_OBJECT_TYPE(TextureCube, BaseTexture); |
650 | |
651 | public: |
652 | - TextureCube(NUX_FILE_LINE_PROTO); |
653 | - //Texture2D(const NTextureData& Image); |
654 | - TextureCube(const TextureCube& texture); |
655 | - TextureCube& operator = (const TextureCube& texture); |
656 | + TextureCube(NUX_FILE_LINE_PROTO); // TODO: why can we have a texture without a texture? |
657 | + TextureCube(const NCubemapData& Image); |
658 | ~TextureCube(); |
659 | |
660 | virtual bool Update(const NBitmapData* BitmapData, bool UpdateAndCacheResource = true); |
661 | @@ -399,11 +381,7 @@ |
662 | return IsPowerOf2(_image.GetWidth()) && IsPowerOf2(_image.GetHeight()); |
663 | } |
664 | |
665 | - /*! |
666 | - Clone the texture. |
667 | - @return A cloned version of this texture. |
668 | - */ |
669 | - virtual BaseTexture* Clone() const; |
670 | + virtual TextureCube* Clone() const; |
671 | |
672 | private: |
673 | NCubemapData _image; |
674 | @@ -414,10 +392,8 @@ |
675 | NUX_DECLARE_OBJECT_TYPE(TextureVolume, BaseTexture); |
676 | |
677 | public: |
678 | - TextureVolume(NUX_FILE_LINE_PROTO); |
679 | - //Texture2D(const NTextureData& Image); |
680 | - TextureVolume(const TextureVolume& texture); |
681 | - TextureVolume& operator = (const TextureVolume& texture); |
682 | + TextureVolume(NUX_FILE_LINE_PROTO); // TODO: why can we have a texture without a texture? |
683 | + TextureVolume(const NVolumeData& Image); |
684 | ~TextureVolume(); |
685 | |
686 | virtual bool Update(const NBitmapData* BitmapData, bool UpdateAndCacheResource = true); |
687 | @@ -481,11 +457,7 @@ |
688 | return IsPowerOf2(_image.GetWidth()) && IsPowerOf2(_image.GetHeight()); |
689 | } |
690 | |
691 | - /*! |
692 | - Clone the texture. |
693 | - @return A cloned version of this texture. |
694 | - */ |
695 | - virtual BaseTexture* Clone() const; |
696 | + virtual TextureVolume* Clone() const; |
697 | |
698 | private: |
699 | NVolumeData _image; |
700 | @@ -496,9 +468,8 @@ |
701 | NUX_DECLARE_OBJECT_TYPE(TextureFrameAnimation, BaseTexture); |
702 | |
703 | public: |
704 | - TextureFrameAnimation(NUX_FILE_LINE_PROTO); |
705 | - TextureFrameAnimation(const TextureFrameAnimation& texture); |
706 | - TextureFrameAnimation& operator = (const TextureFrameAnimation& texture); |
707 | + TextureFrameAnimation(NUX_FILE_LINE_PROTO); // TODO: why can we have a texture without a texture? |
708 | + TextureFrameAnimation(const NAnimatedTextureData& Image); |
709 | ~TextureFrameAnimation(); |
710 | |
711 | virtual bool Update(const NBitmapData* BitmapData, bool UpdateAndCacheResource = true); |
712 | @@ -562,11 +533,7 @@ |
713 | return IsPowerOf2(_image.GetWidth()) && IsPowerOf2(_image.GetHeight()); |
714 | } |
715 | |
716 | - /*! |
717 | - Clone the texture. |
718 | - @return A cloned version of this texture. |
719 | - */ |
720 | - virtual BaseTexture* Clone() const; |
721 | + virtual TextureFrameAnimation* Clone() const; |
722 | |
723 | private: |
724 | NAnimatedTextureData _image; |
725 | |
726 | === modified file 'NuxGraphics/GLVertexResourceManager.cpp' |
727 | --- NuxGraphics/GLVertexResourceManager.cpp 2012-03-12 21:59:54 +0000 |
728 | +++ NuxGraphics/GLVertexResourceManager.cpp 2012-09-19 05:03:18 +0000 |
729 | @@ -54,21 +54,6 @@ |
730 | Allocate(num_element, size); |
731 | } |
732 | |
733 | - //! Copy constructor |
734 | - VertexBuffer::VertexBuffer(const VertexBuffer& Other) |
735 | - { |
736 | - _Data = Other._Data; |
737 | - _Stride = Other._Stride; |
738 | - } |
739 | - |
740 | - //! Assignment constructor |
741 | - VertexBuffer& VertexBuffer::operator = (const VertexBuffer& Other) |
742 | - { |
743 | - _Data = Other._Data; |
744 | - _Stride = Other._Stride; |
745 | - return *this; |
746 | - } |
747 | - |
748 | void VertexBuffer::Allocate(int num_element, int size) |
749 | { |
750 | nuxAssert(num_element > 0); |
751 | @@ -135,21 +120,6 @@ |
752 | Allocate(num_element, size); |
753 | } |
754 | |
755 | - //! Copy constructor |
756 | - IndexBuffer::IndexBuffer(const IndexBuffer& Other) |
757 | - { |
758 | - _Data = Other._Data; |
759 | - _Stride = Other._Stride; |
760 | - } |
761 | - |
762 | - //! Assignment constructor |
763 | - IndexBuffer& IndexBuffer::operator = (const IndexBuffer& Other) |
764 | - { |
765 | - _Data = Other._Data; |
766 | - _Stride = Other._Stride; |
767 | - return *this; |
768 | - } |
769 | - |
770 | void IndexBuffer::Allocate(int num_index, int size) |
771 | { |
772 | nuxAssert(num_index > 0); |
773 | |
774 | === modified file 'NuxGraphics/GLVertexResourceManager.h' |
775 | --- NuxGraphics/GLVertexResourceManager.h 2012-01-22 04:31:33 +0000 |
776 | +++ NuxGraphics/GLVertexResourceManager.h 2012-09-19 05:03:18 +0000 |
777 | @@ -39,10 +39,6 @@ |
778 | VertexBuffer(); |
779 | virtual ~VertexBuffer(); |
780 | VertexBuffer(int Size, int Stride); |
781 | - //! Copy constructor |
782 | - VertexBuffer(const VertexBuffer&); |
783 | - //! Assignment constructor |
784 | - VertexBuffer& operator = (const VertexBuffer&); |
785 | |
786 | //! Allocate space for a "num_element", each of size "size". |
787 | /*! |
788 | @@ -71,10 +67,6 @@ |
789 | IndexBuffer(); |
790 | virtual ~IndexBuffer(); |
791 | IndexBuffer(int Size, int Stride); |
792 | - //! Copy constructor |
793 | - IndexBuffer(const IndexBuffer&); |
794 | - //! Assignment constructor |
795 | - IndexBuffer& operator = (const IndexBuffer&); |
796 | |
797 | void Allocate(int Size, int Stride); |
798 | int GetSize() const; |
799 | |
800 | === modified file 'NuxGraphics/GpuDevice.cpp' |
801 | --- NuxGraphics/GpuDevice.cpp 2012-08-28 19:05:09 +0000 |
802 | +++ NuxGraphics/GpuDevice.cpp 2012-09-19 05:03:18 +0000 |
803 | @@ -308,6 +308,7 @@ |
804 | #ifndef NUX_OPENGLES_20 |
805 | // OpenGL extension initialization |
806 | GLenum Glew_Ok = 0; |
807 | + Glew_Ok = Glew_Ok; // Suppress compiler warning about set but not used variable. |
808 | #ifdef GLEW_MX |
809 | Glew_Ok = glewContextInit(glewGetContext()); |
810 | nuxAssertMsg(Glew_Ok == GLEW_OK, "[GpuDevice::GpuDevice] GL Extensions failed to initialize."); |
811 | @@ -322,7 +323,7 @@ |
812 | |
813 | nuxAssertMsg(Glew_Ok == GLEW_OK, "[GpuDevice::GpuDevice] OpenGL Extensions failed to initialize."); |
814 | #else |
815 | - Glew_Ok = glewInit(); |
816 | + glewInit(); |
817 | #endif |
818 | #endif |
819 | |
820 | @@ -986,12 +987,12 @@ |
821 | { |
822 | if (GetGpuInfo().Support_ARB_Texture_Non_Power_Of_Two()) |
823 | { |
824 | - return new Texture2D(NUX_FILE_LINE_PARAM); |
825 | + return new Texture2D(NUX_FILE_LINE_PARAM); // Why are we creating a texture without a texture here? |
826 | } |
827 | |
828 | if (GetGpuInfo().Support_EXT_Texture_Rectangle() || GetGpuInfo().Support_ARB_Texture_Rectangle()) |
829 | { |
830 | - return new TextureRectangle(NUX_FILE_LINE_PARAM); |
831 | + return new TextureRectangle(NUX_FILE_LINE_PARAM); // Why are we creating a texture without a texture here? |
832 | } |
833 | |
834 | nuxAssertMsg(0, "[NuxGraphicsResources::CreateSystemCapableTexture] No support for non power of two textures or rectangle textures"); |
835 | |
836 | === modified file 'NuxGraphics/GpuDeviceVertex.cpp' |
837 | --- NuxGraphics/GpuDeviceVertex.cpp 2011-10-28 03:45:14 +0000 |
838 | +++ NuxGraphics/GpuDeviceVertex.cpp 2012-09-19 05:03:18 +0000 |
839 | @@ -160,7 +160,7 @@ |
840 | vtxelement.Type, |
841 | GL_FALSE, |
842 | vtxelement.stride_, |
843 | - (void*)vtxelement.Offset)); |
844 | + (void*)vtxelement.Offset)); // TODO: Bug. It doesn't make sense to convert a 4-byte int into an 8-byte pointer. |
845 | |
846 | VertexDeclaration->_valid_vertex_input[shader_attribute_location] = 1; |
847 | ++decl; |
848 | |
849 | === modified file 'NuxGraphics/GraphicsDisplayX11.cpp' |
850 | --- NuxGraphics/GraphicsDisplayX11.cpp 2012-09-17 09:55:43 +0000 |
851 | +++ NuxGraphics/GraphicsDisplayX11.cpp 2012-09-19 05:03:18 +0000 |
852 | @@ -34,6 +34,7 @@ |
853 | #include "GraphicsDisplay.h" |
854 | |
855 | #include <X11/extensions/shape.h> |
856 | +#include <X11/XKBlib.h> |
857 | |
858 | namespace nux |
859 | { |
860 | @@ -177,7 +178,7 @@ |
861 | return gfx_interface_created_; |
862 | } |
863 | |
864 | - static Bool WaitForNotify( Display *dpy, XEvent *event, XPointer arg ) |
865 | + static Bool WaitForNotify( Display * /* dpy */, XEvent *event, XPointer arg ) |
866 | { |
867 | return(event->type == MapNotify) && (event->xmap.window == (Window) arg); |
868 | } |
869 | @@ -187,10 +188,10 @@ |
870 | bool GraphicsDisplay::CreateOpenGLWindow(const char* window_title, |
871 | unsigned int WindowWidth, |
872 | unsigned int WindowHeight, |
873 | - WindowStyle Style, |
874 | - const GraphicsDisplay *Parent, |
875 | + WindowStyle /* Style */, |
876 | + const GraphicsDisplay * /* Parent */, |
877 | bool fullscreen_flag, |
878 | - bool create_rendering_data) |
879 | + bool /* create_rendering_data */) |
880 | { |
881 | int xinerama_event, xinerama_error; |
882 | int xinerama_major, xinerama_minor; |
883 | @@ -1562,7 +1563,7 @@ |
884 | //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: KeyPress event."); |
885 | KeyCode keycode = xevent.xkey.keycode; |
886 | KeySym keysym = NoSymbol; |
887 | - keysym = XKeycodeToKeysym(xevent.xany.display, keycode, 0); |
888 | + keysym = XkbKeycodeToKeysym(xevent.xany.display, keycode, 0, 0); |
889 | |
890 | m_pEvent->key_modifiers = GetModifierKeyState(xevent.xkey.state); |
891 | m_pEvent->key_repeat_count = 0; |
892 | @@ -1598,7 +1599,7 @@ |
893 | //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: KeyRelease event."); |
894 | KeyCode keycode = xevent.xkey.keycode; |
895 | KeySym keysym = NoSymbol; |
896 | - keysym = XKeycodeToKeysym(xevent.xany.display, keycode, 0); |
897 | + keysym = XkbKeycodeToKeysym(xevent.xany.display, keycode, 0, 0); |
898 | |
899 | m_pEvent->key_modifiers = GetModifierKeyState(xevent.xkey.state); |
900 | m_pEvent->key_repeat_count = 0; |
901 | @@ -2382,7 +2383,7 @@ |
902 | _dnd_source_target_accepts_drop = false; |
903 | } |
904 | |
905 | - void GraphicsDisplay::HandleXDndLeave(XEvent event) |
906 | + void GraphicsDisplay::HandleXDndLeave(XEvent /* event */) |
907 | { |
908 | // reset the key things |
909 | _xdnd_types[0] = 0; |
910 | @@ -2596,7 +2597,7 @@ |
911 | if (_global_pointer_grab_callback) |
912 | (*_global_pointer_grab_callback) (false, data); |
913 | |
914 | - _global_pointer_grab_data = false; |
915 | + _global_pointer_grab_data = 0; |
916 | _global_pointer_grab_callback = 0; |
917 | |
918 | return true; |
919 | |
920 | === modified file 'NuxGraphics/GraphicsEngine.h' |
921 | --- NuxGraphics/GraphicsEngine.h 2012-09-17 09:55:43 +0000 |
922 | +++ NuxGraphics/GraphicsEngine.h 2012-09-19 05:03:18 +0000 |
923 | @@ -1016,8 +1016,8 @@ |
924 | ObjectPtr<IOpenGLShaderProgram> blend_color_tex_prog_[LAYER_BLEND_MODE_LAST]; |
925 | ObjectPtr<IOpenGLShaderProgram> blend_tex_tex_prog_[LAYER_BLEND_MODE_LAST]; |
926 | |
927 | - const char* const GetBlendModeBlendFunc(LayerBlendMode layer_blend_mode); |
928 | - const char* const GetBlendModeString(LayerBlendMode layer_blend_mode); |
929 | + const char* GetBlendModeBlendFunc(LayerBlendMode layer_blend_mode); |
930 | + const char* GetBlendModeString(LayerBlendMode layer_blend_mode); |
931 | |
932 | ObjectPtr <IOpenGLShaderProgram> GetColorBlendOverTexProgram(LayerBlendMode layer_blend_mode); |
933 | ObjectPtr <IOpenGLShaderProgram> GetTexBlendOverColorProgram(LayerBlendMode layer_blend_mode); |
934 | |
935 | === modified file 'NuxGraphics/MeshData.cpp' |
936 | --- NuxGraphics/MeshData.cpp 2011-09-20 06:03:43 +0000 |
937 | +++ NuxGraphics/MeshData.cpp 2012-09-19 05:03:18 +0000 |
938 | @@ -62,6 +62,9 @@ |
939 | case NUX_MESH_POINT: |
940 | _num_index = num_mesh_primitive; |
941 | break; |
942 | + case NUX_MESH_PRIMITIVE_UNKNOWN: |
943 | + return false; |
944 | + break; |
945 | } |
946 | _index_size = 4; |
947 | |
948 | |
949 | === modified file 'NuxGraphics/RenderingPipeTextureBlend.cpp' |
950 | --- NuxGraphics/RenderingPipeTextureBlend.cpp 2012-05-25 20:36:09 +0000 |
951 | +++ NuxGraphics/RenderingPipeTextureBlend.cpp 2012-09-19 05:03:18 +0000 |
952 | @@ -33,7 +33,7 @@ |
953 | |
954 | namespace nux |
955 | { |
956 | - const char* const |
957 | + const char* |
958 | GraphicsEngine::GetBlendModeBlendFunc(LayerBlendMode layer_blend_mode) |
959 | { |
960 | switch (layer_blend_mode) |
961 | @@ -50,7 +50,7 @@ |
962 | } |
963 | } |
964 | |
965 | -const char* const |
966 | +const char* |
967 | GraphicsEngine::GetBlendModeString(LayerBlendMode layer_blend_mode) |
968 | { |
969 | switch (layer_blend_mode) |
970 | |
971 | === modified file 'NuxGraphics/XInputWindow.cpp' |
972 | --- NuxGraphics/XInputWindow.cpp 2012-01-18 21:08:29 +0000 |
973 | +++ NuxGraphics/XInputWindow.cpp 2012-09-19 05:03:18 +0000 |
974 | @@ -125,6 +125,8 @@ |
975 | |
976 | XUnionRectWithRegion(&tmp_rect, input_window_region, input_window_region); |
977 | |
978 | + monitor = tmp_rect; |
979 | + |
980 | /* If there is no Xinerama data available just use the geometry we have */ |
981 | if (!info) |
982 | { |
This all makes good sense.