Merge lp:~niclasl/granite/threaded_blur into lp:~elementary-pantheon/granite/granite

Proposed by Niclas Lockner
Status: Merged
Approved by: David Gomes
Approved revision: 657
Merged at revision: 657
Proposed branch: lp:~niclasl/granite/threaded_blur
Merge into: lp:~elementary-pantheon/granite/granite
Diff against target: 75 lines (+20/-24)
1 file modified
lib/Drawing/BufferSurface.vala (+20/-24)
To merge this branch: bzr merge lp:~niclasl/granite/threaded_blur
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Review via email: mp+198571@code.launchpad.net

Commit message

Do the exponential blur and the gaussian blur in parallel

Description of the change

Do the exponential blur and the gaussian blur in parallel.

To post a comment you must log in.
Revision history for this message
Niclas Lockner (niclasl) wrote :

This is how the code looked before rev 494. The code in this branch is also equal to the corresponding code in Plank.

Revision history for this message
David Gomes (davidgomes) wrote :

+1 for parallel solution, very much approve.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/Drawing/BufferSurface.vala'
2--- lib/Drawing/BufferSurface.vala 2013-04-05 07:11:07 +0000
3+++ lib/Drawing/BufferSurface.vala 2013-12-11 14:24:12 +0000
4@@ -385,23 +385,21 @@
5
6 try {
7 // Process Rows
8+ var th = new Thread<void*>.try (null, () => {
9+ exponential_blur_rows (pixels, width, height, 0, height / 2, 0, width, alpha);
10+ return null;
11+ });
12+
13 exponential_blur_rows (pixels, width, height, height / 2, height, 0, width, alpha);
14-
15- var th = new Thread<void*>.try (null, () => {
16- exponential_blur_rows (pixels, width, height, 0, height / 2, 0, width, alpha);
17- return null;
18- });
19-
20 th.join ();
21
22 // Process Columns
23+ var th2 = new Thread<void*>.try (null, () => {
24+ exponential_blur_columns (pixels, width, height, 0, width / 2, 0, height, alpha);
25+ return null;
26+ });
27+
28 exponential_blur_columns (pixels, width, height, width / 2, width, 0, height, alpha);
29-
30- var th2 = new Thread<void*>.try (null, () => {
31- exponential_blur_columns (pixels, width, height, 0, width / 2, 0, height, alpha);
32- return null;
33- });
34-
35 th2.join ();
36 } catch (Error err) {
37 warning (err.message);
38@@ -517,13 +515,12 @@
39
40 try {
41 // Horizontal Pass
42+ var th = new Thread<void*>.try (null, () => {
43+ gaussian_blur_horizontal (abuffer, bbuffer, kernel, gausswidth, width, height, 0, height / 2, shiftar);
44+ return null;
45+ });
46+
47 gaussian_blur_horizontal (abuffer, bbuffer, kernel, gausswidth, width, height, height / 2, height, shiftar);
48-
49- var th = new Thread<void*>.try (null, () => {
50- gaussian_blur_horizontal (abuffer, bbuffer, kernel, gausswidth, width, height, 0, height / 2, shiftar);
51- return null;
52- });
53-
54 th.join ();
55
56 // Clear buffer
57@@ -541,13 +538,12 @@
58 }
59
60 // Vertical Pass
61+ var th2 = new Thread<void*>.try (null, () => {
62+ gaussian_blur_vertical (bbuffer, abuffer, kernel, gausswidth, width, height, 0, width / 2, shiftar);
63+ return null;
64+ });
65+
66 gaussian_blur_vertical (bbuffer, abuffer, kernel, gausswidth, width, height, width / 2, width, shiftar);
67-
68- var th2 = new Thread<void*>.try (null, () => {
69- gaussian_blur_vertical (bbuffer, abuffer, kernel, gausswidth, width, height, 0, width / 2, shiftar);
70- return null;
71- });
72-
73 th2.join ();
74 } catch (Error err) {
75 message (err.message);

Subscribers

People subscribed via source and target branches