Merge lp:~unity-team/unity/unity.fix-750374 into lp:unity
- unity.fix-750374
- Merge into trunk
Proposed by
Mirco Müller
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Gord Allott | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 1122 | ||||
Proposed branch: | lp:~unity-team/unity/unity.fix-750374 | ||||
Merge into: | lp:unity | ||||
Diff against target: |
406 lines (+21/-288) 2 files modified
src/PlacesVScrollBar.cpp (+19/-248) src/PlacesVScrollBar.h (+2/-40) |
||||
To merge this branch: | bzr merge lp:~unity-team/unity/unity.fix-750374 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gord Allott (community) | Approve | ||
David Barth (community) | Approve | ||
Review via email: mp+57359@code.launchpad.net |
Commit message
Description of the change
Adapt to late design-change. Remove state-handling for vertical Dash-scrollbar. Change rendering of said scrollbar. Fixes LP: #750374
To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote : | # |
Added additional checks to protect against potential segfaults.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/PlacesVScrollBar.cpp' | |||
2 | --- src/PlacesVScrollBar.cpp 2011-04-10 16:45:40 +0000 | |||
3 | +++ src/PlacesVScrollBar.cpp 2011-04-13 09:01:38 +0000 | |||
4 | @@ -25,33 +25,10 @@ | |||
5 | 25 | const int BLUR_SIZE = 7; | 25 | const int BLUR_SIZE = 7; |
6 | 26 | 26 | ||
7 | 27 | PlacesVScrollBar::PlacesVScrollBar (NUX_FILE_LINE_DECL) | 27 | PlacesVScrollBar::PlacesVScrollBar (NUX_FILE_LINE_DECL) |
9 | 28 | : VScrollBar (NUX_FILE_LINE_PARAM) | 28 | : VScrollBar (NUX_FILE_LINE_PARAM), |
10 | 29 | _slider (NULL), | ||
11 | 30 | _track (NULL) | ||
12 | 29 | { | 31 | { |
13 | 30 | m_SlideBar->OnMouseEnter.connect (sigc::mem_fun (this, | ||
14 | 31 | &PlacesVScrollBar::RecvMouseEnter)); | ||
15 | 32 | |||
16 | 33 | m_SlideBar->OnMouseLeave.connect (sigc::mem_fun (this, | ||
17 | 34 | &PlacesVScrollBar::RecvMouseLeave)); | ||
18 | 35 | |||
19 | 36 | m_SlideBar->OnMouseDown.connect (sigc::mem_fun (this, | ||
20 | 37 | &PlacesVScrollBar::RecvMouseDown)); | ||
21 | 38 | |||
22 | 39 | m_SlideBar->OnMouseUp.connect (sigc::mem_fun (this, | ||
23 | 40 | &PlacesVScrollBar::RecvMouseUp)); | ||
24 | 41 | |||
25 | 42 | m_SlideBar->OnMouseDrag.connect (sigc::mem_fun (this, | ||
26 | 43 | &PlacesVScrollBar::RecvMouseDrag)); | ||
27 | 44 | |||
28 | 45 | _drag = false; | ||
29 | 46 | _entered = false; | ||
30 | 47 | |||
31 | 48 | _slider[STATE_OFF] = NULL; | ||
32 | 49 | _slider[STATE_OVER] = NULL; | ||
33 | 50 | _slider[STATE_DOWN] = NULL; | ||
34 | 51 | _track = NULL; | ||
35 | 52 | |||
36 | 53 | _state = STATE_OFF; | ||
37 | 54 | |||
38 | 55 | m_SlideBar->SetMinimumSize (PLACES_VSCROLLBAR_WIDTH + 2 * BLUR_SIZE, | 32 | m_SlideBar->SetMinimumSize (PLACES_VSCROLLBAR_WIDTH + 2 * BLUR_SIZE, |
39 | 56 | PLACES_VSCROLLBAR_HEIGHT + 2 * BLUR_SIZE); | 33 | PLACES_VSCROLLBAR_HEIGHT + 2 * BLUR_SIZE); |
40 | 57 | m_Track->SetMinimumSize (PLACES_VSCROLLBAR_WIDTH + 2 * BLUR_SIZE, | 34 | m_Track->SetMinimumSize (PLACES_VSCROLLBAR_WIDTH + 2 * BLUR_SIZE, |
41 | @@ -62,84 +39,14 @@ | |||
42 | 62 | 39 | ||
43 | 63 | PlacesVScrollBar::~PlacesVScrollBar () | 40 | PlacesVScrollBar::~PlacesVScrollBar () |
44 | 64 | { | 41 | { |
53 | 65 | if (_slider[STATE_OFF]) | 42 | if (_slider) |
54 | 66 | _slider[STATE_OFF]->UnReference (); | 43 | _slider->UnReference (); |
47 | 67 | |||
48 | 68 | if (_slider[STATE_OVER]) | ||
49 | 69 | _slider[STATE_OVER]->UnReference (); | ||
50 | 70 | |||
51 | 71 | if (_slider[STATE_DOWN]) | ||
52 | 72 | _slider[STATE_DOWN]->UnReference (); | ||
55 | 73 | 44 | ||
56 | 74 | if (_track) | 45 | if (_track) |
57 | 75 | _track->UnReference (); | 46 | _track->UnReference (); |
58 | 76 | } | 47 | } |
59 | 77 | 48 | ||
60 | 78 | void | 49 | void |
61 | 79 | PlacesVScrollBar::RecvMouseEnter (int x, | ||
62 | 80 | int y, | ||
63 | 81 | unsigned long button_flags, | ||
64 | 82 | unsigned long key_flags) | ||
65 | 83 | { | ||
66 | 84 | _entered = true; | ||
67 | 85 | if (!_drag) | ||
68 | 86 | { | ||
69 | 87 | _state = STATE_OVER; | ||
70 | 88 | NeedRedraw (); | ||
71 | 89 | } | ||
72 | 90 | } | ||
73 | 91 | |||
74 | 92 | void | ||
75 | 93 | PlacesVScrollBar::RecvMouseLeave (int x, | ||
76 | 94 | int y, | ||
77 | 95 | unsigned long button_flags, | ||
78 | 96 | unsigned long key_flags) | ||
79 | 97 | { | ||
80 | 98 | _entered = false; | ||
81 | 99 | if (!_drag) | ||
82 | 100 | { | ||
83 | 101 | _state = STATE_OFF; | ||
84 | 102 | NeedRedraw (); | ||
85 | 103 | } | ||
86 | 104 | } | ||
87 | 105 | |||
88 | 106 | void | ||
89 | 107 | PlacesVScrollBar::RecvMouseDown (int x, | ||
90 | 108 | int y, | ||
91 | 109 | unsigned long button_flags, | ||
92 | 110 | unsigned long key_flags) | ||
93 | 111 | { | ||
94 | 112 | _state = STATE_DOWN; | ||
95 | 113 | NeedRedraw (); | ||
96 | 114 | } | ||
97 | 115 | |||
98 | 116 | void | ||
99 | 117 | PlacesVScrollBar::RecvMouseUp (int x, | ||
100 | 118 | int y, | ||
101 | 119 | unsigned long button_flags, | ||
102 | 120 | unsigned long key_flags) | ||
103 | 121 | { | ||
104 | 122 | _drag = false; | ||
105 | 123 | if (_entered) | ||
106 | 124 | _state = STATE_OVER; | ||
107 | 125 | else | ||
108 | 126 | _state = STATE_OFF; | ||
109 | 127 | NeedRedraw (); | ||
110 | 128 | } | ||
111 | 129 | |||
112 | 130 | void | ||
113 | 131 | PlacesVScrollBar::RecvMouseDrag (int x, | ||
114 | 132 | int y, | ||
115 | 133 | int dx, | ||
116 | 134 | int dy, | ||
117 | 135 | unsigned long button_flags, | ||
118 | 136 | unsigned long key_flags) | ||
119 | 137 | { | ||
120 | 138 | _drag = true; | ||
121 | 139 | NeedRedraw (); | ||
122 | 140 | } | ||
123 | 141 | |||
124 | 142 | void | ||
125 | 143 | PlacesVScrollBar::PreLayoutManagement () | 50 | PlacesVScrollBar::PreLayoutManagement () |
126 | 144 | { | 51 | { |
127 | 145 | nux::VScrollBar::PreLayoutManagement (); | 52 | nux::VScrollBar::PreLayoutManagement (); |
128 | @@ -166,7 +73,7 @@ | |||
129 | 166 | nux::GetPainter().PaintBackground (gfxContext, base); | 73 | nux::GetPainter().PaintBackground (gfxContext, base); |
130 | 167 | 74 | ||
131 | 168 | // check if textures have been computed... if they haven't, exit function | 75 | // check if textures have been computed... if they haven't, exit function |
133 | 169 | if (!_slider[STATE_OFF]) | 76 | if (!_slider) |
134 | 170 | return; | 77 | return; |
135 | 171 | 78 | ||
136 | 172 | //texxform.SetWrap (nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); | 79 | //texxform.SetWrap (nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); |
137 | @@ -194,7 +101,7 @@ | |||
138 | 194 | slider_geo.y, | 101 | slider_geo.y, |
139 | 195 | slider_geo.width, | 102 | slider_geo.width, |
140 | 196 | slider_geo.height, | 103 | slider_geo.height, |
142 | 197 | _slider[_state]->GetDeviceTexture (), | 104 | _slider->GetDeviceTexture (), |
143 | 198 | texxform, | 105 | texxform, |
144 | 199 | color); | 106 | color); |
145 | 200 | } | 107 | } |
146 | @@ -212,145 +119,8 @@ | |||
147 | 212 | nux::CairoGraphics* cairoGraphics = NULL; | 119 | nux::CairoGraphics* cairoGraphics = NULL; |
148 | 213 | cairo_t* cr = NULL; | 120 | cairo_t* cr = NULL; |
149 | 214 | nux::NBitmapData* bitmap = NULL; | 121 | nux::NBitmapData* bitmap = NULL; |
289 | 215 | double half_height = 0.0f; | 122 | |
290 | 216 | 123 | // update texture of slider | |
152 | 217 | // update texture of off-state of slider | ||
153 | 218 | width = m_SlideBar->GetBaseWidth (); | ||
154 | 219 | height = m_SlideBar->GetBaseHeight (); | ||
155 | 220 | cairoGraphics = new nux::CairoGraphics (CAIRO_FORMAT_ARGB32, width, height); | ||
156 | 221 | width -= 2 * BLUR_SIZE; | ||
157 | 222 | height -= 2 * BLUR_SIZE; | ||
158 | 223 | |||
159 | 224 | cr = cairoGraphics->GetContext (); | ||
160 | 225 | |||
161 | 226 | cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); | ||
162 | 227 | cairo_paint (cr); | ||
163 | 228 | |||
164 | 229 | cairo_set_operator (cr, CAIRO_OPERATOR_OVER); | ||
165 | 230 | cairo_set_line_width (cr, 1.0f); | ||
166 | 231 | cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.75f); | ||
167 | 232 | cairoGraphics->DrawRoundedRectangle (cr, | ||
168 | 233 | 1.0f, | ||
169 | 234 | BLUR_SIZE + 1.5f, | ||
170 | 235 | BLUR_SIZE + 1.5f, | ||
171 | 236 | (double) (width - 1) / 2.0f, | ||
172 | 237 | (double) width - 3.0f, | ||
173 | 238 | (double) height - 3.0f); | ||
174 | 239 | cairo_fill_preserve (cr); | ||
175 | 240 | cairoGraphics->BlurSurface (BLUR_SIZE - 3); | ||
176 | 241 | cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); | ||
177 | 242 | cairo_fill_preserve (cr); | ||
178 | 243 | cairo_set_operator (cr, CAIRO_OPERATOR_OVER); | ||
179 | 244 | cairo_set_source_rgba (cr, 0.125f, 0.125f, 0.125f, 0.75f); | ||
180 | 245 | cairo_fill_preserve (cr); | ||
181 | 246 | cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.5f); | ||
182 | 247 | cairo_stroke (cr); | ||
183 | 248 | |||
184 | 249 | cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 1.0f); | ||
185 | 250 | half_height = (double) (height + 2 * BLUR_SIZE) / 2.0f; | ||
186 | 251 | cairo_move_to (cr, BLUR_SIZE + 2.5f, half_height - 2.0f); | ||
187 | 252 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height - 2.0f); | ||
188 | 253 | cairo_move_to (cr, BLUR_SIZE + 2.5f, half_height); | ||
189 | 254 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height); | ||
190 | 255 | cairo_move_to (cr, BLUR_SIZE + 2.5f, half_height + 2.0f); | ||
191 | 256 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height + 2.0f); | ||
192 | 257 | cairo_stroke (cr); | ||
193 | 258 | |||
194 | 259 | //cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/slider_off.png"); | ||
195 | 260 | |||
196 | 261 | bitmap = cairoGraphics->GetBitmap (); | ||
197 | 262 | |||
198 | 263 | if (_slider[STATE_OFF]) | ||
199 | 264 | _slider[STATE_OFF]->UnReference (); | ||
200 | 265 | |||
201 | 266 | _slider[STATE_OFF] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture (); | ||
202 | 267 | _slider[STATE_OFF]->Update (bitmap); | ||
203 | 268 | |||
204 | 269 | cairo_destroy (cr); | ||
205 | 270 | delete bitmap; | ||
206 | 271 | delete cairoGraphics; | ||
207 | 272 | |||
208 | 273 | // update texture of over-state of slider | ||
209 | 274 | width = m_SlideBar->GetBaseWidth (); | ||
210 | 275 | height = m_SlideBar->GetBaseHeight (); | ||
211 | 276 | cairoGraphics = new nux::CairoGraphics (CAIRO_FORMAT_ARGB32, width, height); | ||
212 | 277 | width -= 2 * BLUR_SIZE; | ||
213 | 278 | height -= 2 * BLUR_SIZE; | ||
214 | 279 | |||
215 | 280 | cr = cairoGraphics->GetContext (); | ||
216 | 281 | |||
217 | 282 | cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); | ||
218 | 283 | cairo_paint (cr); | ||
219 | 284 | |||
220 | 285 | cairo_set_operator (cr, CAIRO_OPERATOR_OVER); | ||
221 | 286 | cairo_set_line_width (cr, 1.0f); | ||
222 | 287 | cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.25f); | ||
223 | 288 | cairoGraphics->DrawRoundedRectangle (cr, | ||
224 | 289 | 1.0f, | ||
225 | 290 | BLUR_SIZE + 1.5f, | ||
226 | 291 | BLUR_SIZE + 1.5f, | ||
227 | 292 | (double) (width - 1) / 2.0f, | ||
228 | 293 | (double) width - 3.0f, | ||
229 | 294 | (double) height - 3.0f); | ||
230 | 295 | |||
231 | 296 | cairo_fill_preserve (cr); | ||
232 | 297 | cairoGraphics->BlurSurface (BLUR_SIZE - 3); | ||
233 | 298 | cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); | ||
234 | 299 | cairo_fill_preserve (cr); | ||
235 | 300 | cairo_set_operator (cr, CAIRO_OPERATOR_OVER); | ||
236 | 301 | |||
237 | 302 | cairo_surface_t* tmp_surf = NULL; | ||
238 | 303 | cairo_t* tmp_cr = NULL; | ||
239 | 304 | tmp_surf = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 6, 4); | ||
240 | 305 | tmp_cr = cairo_create (tmp_surf); | ||
241 | 306 | cairo_set_line_width (tmp_cr, 1.0f); | ||
242 | 307 | cairo_set_antialias (tmp_cr, CAIRO_ANTIALIAS_NONE); | ||
243 | 308 | cairo_set_operator (tmp_cr, CAIRO_OPERATOR_CLEAR); | ||
244 | 309 | cairo_paint (tmp_cr); | ||
245 | 310 | cairo_set_operator (tmp_cr, CAIRO_OPERATOR_OVER); | ||
246 | 311 | cairo_set_source_rgba (tmp_cr, 1.0f, 1.0f, 1.0f, 0.25f); | ||
247 | 312 | cairo_paint (tmp_cr); | ||
248 | 313 | cairo_set_source_rgba (tmp_cr, 1.0f, 1.0f, 1.0f, 0.5f); | ||
249 | 314 | cairo_rectangle (tmp_cr, 0.f, 0.f, 1.0f, 1.0f); | ||
250 | 315 | cairo_rectangle (tmp_cr, 1.f, 1.f, 1.0f, 1.0f); | ||
251 | 316 | cairo_rectangle (tmp_cr, 2.f, 2.f, 1.0f, 1.0f); | ||
252 | 317 | cairo_rectangle (tmp_cr, 3.f, 3.f, 1.0f, 1.0f); | ||
253 | 318 | cairo_rectangle (tmp_cr, 4.f, 0.f, 1.0f, 1.0f); | ||
254 | 319 | cairo_rectangle (tmp_cr, 5.f, 1.f, 1.0f, 1.0f); | ||
255 | 320 | cairo_fill (tmp_cr); | ||
256 | 321 | cairo_destroy (tmp_cr); | ||
257 | 322 | cairo_set_source_surface (cr, tmp_surf, BLUR_SIZE + 1.5f, BLUR_SIZE + 1.5f); | ||
258 | 323 | cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT); | ||
259 | 324 | //cairo_surface_write_to_png (tmp_surf, "/tmp/tmp_surf.png"); | ||
260 | 325 | |||
261 | 326 | cairo_fill_preserve (cr); | ||
262 | 327 | cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 0.5f); | ||
263 | 328 | cairo_stroke (cr); | ||
264 | 329 | |||
265 | 330 | cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 1.0f); | ||
266 | 331 | cairo_move_to (cr, BLUR_SIZE + 2.5f, half_height - 2.0f); | ||
267 | 332 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height - 2.0f); | ||
268 | 333 | cairo_move_to (cr, BLUR_SIZE + 2.5f, half_height); | ||
269 | 334 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height); | ||
270 | 335 | cairo_move_to (cr, BLUR_SIZE + 2.5f, half_height + 2.0f); | ||
271 | 336 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height + 2.0f); | ||
272 | 337 | cairo_stroke (cr); | ||
273 | 338 | |||
274 | 339 | //cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/slider_over.png"); | ||
275 | 340 | |||
276 | 341 | bitmap = cairoGraphics->GetBitmap (); | ||
277 | 342 | |||
278 | 343 | if (_slider[STATE_OVER]) | ||
279 | 344 | _slider[STATE_OVER]->UnReference (); | ||
280 | 345 | |||
281 | 346 | _slider[STATE_OVER] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture (); | ||
282 | 347 | _slider[STATE_OVER]->Update (bitmap); | ||
283 | 348 | |||
284 | 349 | cairo_destroy (cr); | ||
285 | 350 | delete bitmap; | ||
286 | 351 | delete cairoGraphics; | ||
287 | 352 | |||
288 | 353 | // update texture of down-state of slider | ||
291 | 354 | width = m_SlideBar->GetBaseWidth (); | 124 | width = m_SlideBar->GetBaseWidth (); |
292 | 355 | height = m_SlideBar->GetBaseHeight (); | 125 | height = m_SlideBar->GetBaseHeight (); |
293 | 356 | cairoGraphics = new nux::CairoGraphics (CAIRO_FORMAT_ARGB32, width, height); | 126 | cairoGraphics = new nux::CairoGraphics (CAIRO_FORMAT_ARGB32, width, height); |
294 | @@ -375,7 +145,7 @@ | |||
295 | 375 | cairoGraphics->BlurSurface (BLUR_SIZE - 3); | 145 | cairoGraphics->BlurSurface (BLUR_SIZE - 3); |
296 | 376 | cairo_fill (cr); | 146 | cairo_fill (cr); |
297 | 377 | 147 | ||
299 | 378 | cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); | 148 | /*cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); |
300 | 379 | cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 1.0f); | 149 | cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 1.0f); |
301 | 380 | cairo_move_to (cr, BLUR_SIZE + 2.5f, half_height - 2.0f); | 150 | cairo_move_to (cr, BLUR_SIZE + 2.5f, half_height - 2.0f); |
302 | 381 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height - 2.0f); | 151 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height - 2.0f); |
303 | @@ -383,17 +153,18 @@ | |||
304 | 383 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height); | 153 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height); |
305 | 384 | cairo_move_to (cr, BLUR_SIZE + 2.5f, half_height + 2.0f); | 154 | cairo_move_to (cr, BLUR_SIZE + 2.5f, half_height + 2.0f); |
306 | 385 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height + 2.0f); | 155 | cairo_line_to (cr, BLUR_SIZE + 2.5f + 5.0f, half_height + 2.0f); |
308 | 386 | cairo_stroke (cr); | 156 | cairo_stroke (cr);*/ |
309 | 387 | 157 | ||
311 | 388 | //cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/slider_down.png"); | 158 | //cairo_surface_write_to_png (cairo_get_target (cr), "/tmp/slider.png"); |
312 | 389 | 159 | ||
313 | 390 | bitmap = cairoGraphics->GetBitmap (); | 160 | bitmap = cairoGraphics->GetBitmap (); |
314 | 391 | 161 | ||
317 | 392 | if (_slider[STATE_DOWN]) | 162 | if (_slider) |
318 | 393 | _slider[STATE_DOWN]->UnReference (); | 163 | _slider->UnReference (); |
319 | 394 | 164 | ||
322 | 395 | _slider[STATE_DOWN] = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture (); | 165 | _slider = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture (); |
323 | 396 | _slider[STATE_DOWN]->Update (bitmap); | 166 | if (_slider) |
324 | 167 | _slider->Update (bitmap); | ||
325 | 397 | 168 | ||
326 | 398 | cairo_destroy (cr); | 169 | cairo_destroy (cr); |
327 | 399 | delete bitmap; | 170 | delete bitmap; |
328 | @@ -437,10 +208,10 @@ | |||
329 | 437 | _track->UnReference (); | 208 | _track->UnReference (); |
330 | 438 | 209 | ||
331 | 439 | _track = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture (); | 210 | _track = nux::GetThreadGLDeviceFactory()->CreateSystemCapableTexture (); |
333 | 440 | _track->Update (bitmap); | 211 | if (_track) |
334 | 212 | _track->Update (bitmap); | ||
335 | 441 | 213 | ||
336 | 442 | cairo_destroy (cr); | 214 | cairo_destroy (cr); |
337 | 443 | delete bitmap; | 215 | delete bitmap; |
338 | 444 | delete cairoGraphics; | 216 | delete cairoGraphics; |
339 | 445 | cairo_surface_destroy (tmp_surf); | ||
340 | 446 | } | 217 | } |
341 | 447 | 218 | ||
342 | === modified file 'src/PlacesVScrollBar.h' | |||
343 | --- src/PlacesVScrollBar.h 2011-03-24 02:44:38 +0000 | |||
344 | +++ src/PlacesVScrollBar.h 2011-04-13 09:01:38 +0000 | |||
345 | @@ -27,47 +27,12 @@ | |||
346 | 27 | #include "Nux/VScrollBar.h" | 27 | #include "Nux/VScrollBar.h" |
347 | 28 | #include "NuxImage/CairoGraphics.h" | 28 | #include "NuxImage/CairoGraphics.h" |
348 | 29 | 29 | ||
349 | 30 | typedef enum | ||
350 | 31 | { | ||
351 | 32 | STATE_OFF = 0, | ||
352 | 33 | STATE_OVER, | ||
353 | 34 | STATE_DOWN, | ||
354 | 35 | STATE_LAST | ||
355 | 36 | } State; | ||
356 | 37 | |||
357 | 38 | class PlacesVScrollBar : public nux::VScrollBar | 30 | class PlacesVScrollBar : public nux::VScrollBar |
358 | 39 | { | 31 | { |
359 | 40 | public: | 32 | public: |
360 | 41 | PlacesVScrollBar (NUX_FILE_LINE_PROTO); | 33 | PlacesVScrollBar (NUX_FILE_LINE_PROTO); |
361 | 42 | ~PlacesVScrollBar (); | 34 | ~PlacesVScrollBar (); |
362 | 43 | 35 | ||
363 | 44 | void RecvMouseEnter (int x, | ||
364 | 45 | int y, | ||
365 | 46 | unsigned long button_flags, | ||
366 | 47 | unsigned long key_flags); | ||
367 | 48 | |||
368 | 49 | void RecvMouseLeave (int x, | ||
369 | 50 | int y, | ||
370 | 51 | unsigned long button_flags, | ||
371 | 52 | unsigned long key_flags); | ||
372 | 53 | |||
373 | 54 | void RecvMouseDown (int x, | ||
374 | 55 | int y, | ||
375 | 56 | unsigned long button_flags, | ||
376 | 57 | unsigned long key_flags); | ||
377 | 58 | |||
378 | 59 | void RecvMouseUp (int x, | ||
379 | 60 | int y, | ||
380 | 61 | unsigned long button_flags, | ||
381 | 62 | unsigned long key_flags); | ||
382 | 63 | |||
383 | 64 | void RecvMouseDrag (int x, | ||
384 | 65 | int y, | ||
385 | 66 | int dx, | ||
386 | 67 | int dy, | ||
387 | 68 | unsigned long button_flags, | ||
388 | 69 | unsigned long key_flags); | ||
389 | 70 | |||
390 | 71 | protected: | 36 | protected: |
391 | 72 | virtual void PreLayoutManagement (); | 37 | virtual void PreLayoutManagement (); |
392 | 73 | virtual long PostLayoutManagement (long LayoutResult); | 38 | virtual long PostLayoutManagement (long LayoutResult); |
393 | @@ -79,11 +44,8 @@ | |||
394 | 79 | void UpdateTexture (); | 44 | void UpdateTexture (); |
395 | 80 | 45 | ||
396 | 81 | private: | 46 | private: |
402 | 82 | bool _drag; | 47 | nux::BaseTexture* _slider; |
403 | 83 | bool _entered; | 48 | nux::BaseTexture* _track; |
399 | 84 | State _state; | ||
400 | 85 | nux::BaseTexture* _slider[STATE_LAST]; | ||
401 | 86 | nux::BaseTexture* _track; | ||
404 | 87 | }; | 49 | }; |
405 | 88 | 50 | ||
406 | 89 | #endif // PLACES_VSCROLLBAR_H | 51 | #endif // PLACES_VSCROLLBAR_H |
line 319: is the returned value always defined? the next line relies on that assumption.