Merge lp:~unity-team/unity/unity.perspective-icon into lp:unity

Proposed by Jay Taoko
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 483
Proposed branch: lp:~unity-team/unity/unity.perspective-icon
Merge into: lp:unity
Diff against target: 712 lines (+333/-216)
4 files modified
unity-private/launcher/scrollerchild.vala (+1/-1)
unity/icon-postprocessor.vala (+304/-213)
vapi/clutk-0.3.vapi (+27/-2)
vapi/cogl-1.0.vapi (+1/-0)
To merge this branch: bzr merge lp:~unity-team/unity/unity.perspective-icon
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Review via email: mp+33864@code.launchpad.net

Description of the change

Apply perspective correction to icons in the launcher. Solves the distorted texture problem.

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

You probably forgot to mention your branch lp:~unity-team/clutk/clutk.perspective-icon being a prerequisite for this one.

Revision history for this message
Mirco Müller (macslow) wrote :

Code look ok and works well with lp:~unity-team/clutk/clutk.perspective-icon. Approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-private/launcher/scrollerchild.vala'
2--- unity-private/launcher/scrollerchild.vala 2010-08-26 15:11:32 +0000
3+++ unity-private/launcher/scrollerchild.vala 2010-08-27 03:00:56 +0000
4@@ -457,7 +457,7 @@
5 var tex = GtkClutter.texture_new_from_pixbuf (scaled_buf);
6 var color = GtkClutter.texture_new_from_pixbuf (color_buf);
7
8- processed_icon = new UnityIcon (tex as Clutter.Texture, color as Clutter.Texture);
9+ processed_icon = new UnityIcon (scaled_buf, color_buf);
10 processed_icon.set_parent (this);
11 processed_icon.rotation = rotation;
12
13
14=== modified file 'unity/icon-postprocessor.vala'
15--- unity/icon-postprocessor.vala 2010-08-18 16:09:44 +0000
16+++ unity/icon-postprocessor.vala 2010-08-27 03:00:56 +0000
17@@ -16,8 +16,6 @@
18 *
19 * Authored by Gordon Allott <gord.allott@canonical.com>
20 */
21-using Cairo;
22-
23 namespace Unity
24 {
25 /* General colour theory utility functions, could maybe be somewhere else
26@@ -288,68 +286,71 @@
27
28 public class UnityIcon : Ctk.Actor
29 {
30- public Clutter.Texture? icon {get; construct;}
31- public Clutter.Texture? bg_color {get; construct;}
32+ public Gdk.Pixbuf icon {get; construct;}
33+ public Gdk.Pixbuf bg_color {get; construct;}
34
35- private Cogl.Material bg_mat;
36- private Cogl.Material fg_mat;
37- private Cogl.Material icon_material;
38- private Cogl.Material bgcol_material;
39+ private uint tex_id_bg = 0; // the background
40+ private uint tex_id_mask = 0; // the mask
41+ private uint tex_id_fg = 0; // the foreground
42+ private uint tex_id_content = 0 ;//the icon graphic
43+ private uint tex_id_color = 0; // the colour of our background
44
45 public float rotation {get; set;}
46 public float stored_height = 0;
47 public float stored_ymod = 0;
48
49- public UnityIcon (Clutter.Texture? icon, Clutter.Texture? bg_tex)
50+ public UnityIcon (Gdk.Pixbuf? icon, Gdk.Pixbuf? bg_color)
51 {
52- Object (icon: icon, bg_color: bg_tex);
53+ Object (icon: icon, bg_color: bg_color);
54 }
55
56 construct
57 {
58- icon_material = new Cogl.Material ();
59- bgcol_material = new Cogl.Material ();
60-
61- if (!(unity_icon_bg_layer is Clutter.Texture))
62- {
63- unity_icon_bg_layer = new ThemeImage ("prism_icon_background");
64- unity_icon_fg_layer = new ThemeImage ("prism_icon_foreground");
65- unity_icon_mk_layer = new ThemeImage ("prism_icon_mask");
66- }
67-
68- if (icon is Clutter.Texture)
69- {
70- icon.set_parent (this);
71- var icon_mat = new Cogl.Material ();
72- Cogl.Texture icon_tex = (Cogl.Texture)(icon.get_cogl_texture ());
73- Cogl.Texture mask_tex = (Cogl.Texture)(unity_icon_mk_layer.get_cogl_texture ());
74- icon_mat.set_layer (0, icon_tex);
75- icon_mat.set_layer_filters (1, Cogl.MaterialFilter.LINEAR, Cogl.MaterialFilter.LINEAR);
76- icon_mat.set_layer (1, mask_tex);
77- icon_material = icon_mat;
78- }
79- if (bg_color is Clutter.Texture)
80- {
81- bg_color.set_parent (this);
82- bgcol_material = new Cogl.Material ();
83- Cogl.Texture color = (Cogl.Texture)(bg_color.get_cogl_texture ());
84- Cogl.Texture mask_tex = (Cogl.Texture)(unity_icon_mk_layer.get_cogl_texture ());
85- bgcol_material.set_layer (0, color);
86- bgcol_material.set_layer_filters (1, Cogl.MaterialFilter.LINEAR, Cogl.MaterialFilter.LINEAR);
87- bgcol_material.set_layer (1, mask_tex);
88- }
89-
90- var mat = new Cogl.Material ();
91- Cogl.Texture tex = (Cogl.Texture)(unity_icon_bg_layer.get_cogl_texture ());
92- mat.set_layer (0, tex);
93- bg_mat = mat;
94-
95- mat = new Cogl.Material ();
96- tex = (Cogl.Texture)(unity_icon_fg_layer.get_cogl_texture ());
97- mat.set_layer (0, tex);
98- fg_mat = mat;
99- notify["rotation"].connect (() => { queue_relayout (); });
100- stored_height = 48;
101+ // try and find the bg
102+ string basefilepath = Path.build_filename (Config.PKGDATADIR, "prism_icon_background.png");
103+ string absolutefilepath = Path.build_filename ("/usr/share/unity/themes", "prism_icon_background.png");
104+ if (FileUtils.test (basefilepath, FileTest.EXISTS))
105+ {
106+ tex_id_bg = Ctk.create_opengl_texture_from_file (basefilepath);
107+ }
108+ else if (FileUtils.test (absolutefilepath, FileTest.EXISTS))
109+ {
110+ tex_id_bg = Ctk.create_opengl_texture_from_file (absolutefilepath);
111+ }
112+
113+ // now the mask
114+ basefilepath = Path.build_filename (Config.PKGDATADIR, "prism_icon_mask.png");
115+ absolutefilepath = Path.build_filename ("/usr/share/unity/themes", "prism_icon_mask.png");
116+ if (FileUtils.test (basefilepath, FileTest.EXISTS))
117+ {
118+ tex_id_mask = Ctk.create_opengl_texture_from_file (basefilepath);
119+ }
120+ else if (FileUtils.test (absolutefilepath, FileTest.EXISTS))
121+ {
122+ tex_id_mask = Ctk.create_opengl_texture_from_file (absolutefilepath);
123+ }
124+
125+ //now the fg
126+ basefilepath = Path.build_filename (Config.PKGDATADIR, "prism_icon_foreground.png");
127+ absolutefilepath = Path.build_filename ("/usr/share/unity/themes", "prism_icon_foreground.png");
128+ if (FileUtils.test (basefilepath, FileTest.EXISTS))
129+ {
130+ tex_id_fg = Ctk.create_opengl_texture_from_file (basefilepath);
131+ }
132+ else if (FileUtils.test (absolutefilepath, FileTest.EXISTS))
133+ {
134+ tex_id_fg = Ctk.create_opengl_texture_from_file (absolutefilepath);
135+ }
136+
137+ if (icon is Gdk.Pixbuf)
138+ {
139+ tex_id_content = Ctk.create_opengl_texture_from_pixbuf (icon);
140+ }
141+
142+ if (bg_color is Gdk.Pixbuf)
143+ {
144+ tex_id_color = Ctk.create_opengl_texture_from_pixbuf (bg_color);
145+ }
146 }
147
148 public override void get_preferred_width (float for_height,
149@@ -369,10 +370,6 @@
150 public override void allocate (Clutter.ActorBox box, Clutter.AllocationFlags flags)
151 {
152 base.allocate (box, flags);
153- if (icon is Clutter.Texture)
154- icon.allocate (box, flags);
155- if (bg_color is Clutter.Texture)
156- bg_color.allocate (box, flags);
157 }
158
159 public override void pick (Clutter.Color color)
160@@ -395,8 +392,11 @@
161 float p2_x, p2_y;
162 float p3_x, p3_y;
163 float p4_x, p4_y;
164- float z, w;
165+ float z;
166+ float w1, w2, w3, w4;
167
168+ Cogl.flush ();
169+
170 Clutter.ActorBox box = Clutter.ActorBox ();
171 self.get_stored_allocation (out box);
172
173@@ -414,14 +414,16 @@
174 p2_x = 25.0f; p2_y = -25.0f;
175 p3_x = 25.0f; p3_y = 25.0f;
176 p4_x = -25.0f; p4_y = 25.0f;
177- z = base_z;
178- w = 1.0f;
179-
180- viewmatrix.transform_point (out p1_x, out p1_y, out z, out w); p1_x /= w; p1_y /= w; z = base_z; w = 1.0f;
181- viewmatrix.transform_point (out p2_x, out p2_y, out z, out w); p2_x /= w; p2_y /= w; z = base_z; w = 1.0f;
182- viewmatrix.transform_point (out p3_x, out p3_y, out z, out w); p3_x /= w; p3_y /= w; z = base_z; w = 1.0f;
183- viewmatrix.transform_point (out p4_x, out p4_y, out z, out w); p4_x /= w; p4_y /= w; z = base_z; w = 1.0f;
184-
185+ z = 0.0f;
186+ w1 = 1.0f;
187+ w2 = 1.0f;
188+ w3 = 1.0f;
189+ w4 = 1.0f;
190+
191+ viewmatrix.transform_point (out p1_x, out p1_y, out z, out w1); p1_x /= w1; p1_y /= w1; z = 0.0f;
192+ viewmatrix.transform_point (out p2_x, out p2_y, out z, out w2); p2_x /= w2; p2_y /= w2; z = 0.0f;
193+ viewmatrix.transform_point (out p3_x, out p3_y, out z, out w3); p3_x /= w3; p3_y /= w3; z = 0.0f;
194+ viewmatrix.transform_point (out p4_x, out p4_y, out z, out w4); p4_x /= w4; p4_y /= w4; z = 0.0f;
195
196 //transform into screen co-ordinates
197 p1_x = (50 * (p1_x + 1) / 2);
198@@ -446,61 +448,79 @@
199 p4_x = Math.ceilf (p4_x); p4_y = Math.floorf (p4_y);
200 }
201
202- self.stored_height = p3_y - p1_y;
203- self.stored_ymod = (50 - self.stored_height) / 2.0f;
204-/*
205- p1_y += self.stored_ymod;
206- p2_y += self.stored_ymod;
207- p3_y += self.stored_ymod;
208- p4_y += self.stored_ymod;
209-*/
210+ float pos_x = 0;
211+ float pos_y = 0;
212
213- Cogl.TextureVertex[4] points = {
214- Cogl.TextureVertex () {
215- x = p1_x,
216- y = p1_y,
217- z = 0.0f,
218- tx = 0.0f,
219- ty = 0.0f,
220- color = Cogl.Color () {
221- red = 0xff,
222- green = 0xff,
223- blue = 0xff,
224- alpha = 0xff
225- }
226- },
227- Cogl.TextureVertex () {
228- x = p2_x,
229- y = p2_y,
230- z = 0.0f,
231- tx = 1.0f,
232- ty = 0.0f,
233- color = Cogl.Color () {
234- red = 0xff,
235- green = 0xff,
236- blue = 0xff,
237- alpha = 0xff
238- }
239- },
240- Cogl.TextureVertex () {
241- x = p3_x,
242- y = p3_y,
243- z = 0.0f,
244- tx = 1.0f,
245- ty = 1.0f,
246- color = Cogl.Color () {
247- red = 0xff,
248- green = 0xff,
249- blue = 0xff,
250- alpha = 0xff
251- }
252- },
253- Cogl.TextureVertex () {
254- x = p4_x,
255- y = p4_y,
256- z = 0.0f,
257- tx = 0.0f,
258- ty = 1.0f,
259+ float actor_x = 0;
260+ float actor_y = 0;
261+ float actor_width = 0;
262+ float actor_height = 0;
263+ Ctk.get_actor_screen_coord (self as Ctk.Actor, out actor_x, out actor_y, out actor_width, out actor_height);
264+
265+/* self.get_transformed_position(out pos_x, out pos_y);
266+ pos_x = pos_x -4;
267+ pos_y = pos_y / 2;*/
268+ pos_x = actor_x;
269+ pos_y = actor_y;
270+
271+ Ctk.ProjectedTextureVertex[4] vertex0 = {
272+ Ctk.ProjectedTextureVertex () {
273+ x = p1_x + pos_x,
274+ y = p1_y + pos_y,
275+ z = 0.0f,
276+ w = w1,
277+ s = 0.0f,
278+ t = 0.0f,
279+ r = 0.0f,
280+ q = 1.0f,
281+ color = Cogl.Color () {
282+ red = 0xff,
283+ green = 0xff,
284+ blue = 0xff,
285+ alpha = 0xff
286+ }
287+ },
288+ Ctk.ProjectedTextureVertex () {
289+ x = p2_x + pos_x,
290+ y = p2_y + pos_y,
291+ z = 0.0f,
292+ w = w2,
293+ s = 1.0f,
294+ t = 0.0f,
295+ r = 0.0f,
296+ q = 1.0f,
297+ color = Cogl.Color () {
298+ red = 0xff,
299+ green = 0xff,
300+ blue = 0xff,
301+ alpha = 0xff
302+ }
303+ },
304+ Ctk.ProjectedTextureVertex () {
305+ x = p3_x + pos_x,
306+ y = p3_y + pos_y,
307+ z = 0.0f,
308+ w = w3,
309+ s = 1.0f,
310+ t = 1.0f,
311+ r = 0.0f,
312+ q = 1.0f,
313+ color = Cogl.Color () {
314+ red = 0xff,
315+ green = 0xff,
316+ blue = 0xff,
317+ alpha = 0xff
318+ }
319+ },
320+ Ctk.ProjectedTextureVertex () {
321+ x = p4_x + pos_x,
322+ y = p4_y + pos_y,
323+ z = 0.0f,
324+ w = w4,
325+ s = 0.0f,
326+ t = 1.0f,
327+ r = 0.0f,
328+ q = 1.0f,
329 color = Cogl.Color () {
330 red = 0xff,
331 green = 0xff,
332@@ -511,30 +531,103 @@
333 };
334
335 uchar opacity = self.get_opacity ();
336-
337 //debug (@"opacity is set to $opacity");
338-
339- self.bg_mat.set_color4ub (opacity, opacity, opacity, opacity);
340- self.bgcol_material.set_color4ub (opacity, opacity, opacity, opacity);
341- self.icon_material.set_color4ub (opacity, opacity, opacity, opacity);
342- self.fg_mat.set_color4ub (opacity, opacity, opacity, opacity);
343-
344- if (self.bg_color is Clutter.Texture)
345- {
346- Cogl.set_source (self.bgcol_material);
347- Cogl.polygon (points, true);
348- }
349- else
350- {
351- Cogl.set_source (self.bg_mat);
352- Cogl.polygon (points, true);
353- }
354- if (self.icon is Clutter.Texture)
355- {
356+
357+// stdout.printf("******Vertex \n");
358+// stdout.printf("*BOX: %f, %f, %f, %f \n", box.x1, box.x2, box.y1, box.y2);
359+// stdout.printf("*Position: %f, %f \n", pos_x, pos_y);
360+// stdout.printf("*V0: %f, %f, %f, %f \n", vertex[0].x, vertex[0].y, vertex[0].z, vertex[0].w);
361+// stdout.printf("*V1: %f, %f, %f, %f \n", vertex[1].x, vertex[1].y, vertex[1].z, vertex[1].w);
362+// stdout.printf("*V2: %f, %f, %f, %f \n", vertex[2].x, vertex[2].y, vertex[2].z, vertex[2].w);
363+// stdout.printf("*V3: %f, %f, %f, %f \n", vertex[3].x, vertex[3].y, vertex[3].z, vertex[3].w);
364+// stdout.printf("******Point \n");
365+// stdout.printf("*V0: %f, %f, %f \n", points[0].x, points[0].y, points[0].z);
366+// stdout.printf("*V1: %f, %f, %f \n", points[1].x, points[1].y, points[1].z);
367+// stdout.printf("*V2: %f, %f, %f \n", points[2].x, points[2].y, points[2].z);
368+// stdout.printf("*V3: %f, %f, %f \n", points[3].x, points[3].y, points[3].z);
369+
370+
371+ Clutter.Stage stage = global_shell.get_stage ();
372+ int stage_width = (int) stage.get_width ();
373+ int stage_height = (int) stage.get_height ();
374+
375+ Ctk.render_projected_polygon_2Tex (vertex0[0], self.tex_id_bg, self.tex_id_color, stage_width, stage_height);
376+
377+ Ctk.ProjectedTextureVertex[4] vertex1 = {
378+ Ctk.ProjectedTextureVertex () {
379+ x = p1_x + pos_x,
380+ y = p1_y + pos_y,
381+ z = 0.0f,
382+ w = w1,
383+ s = 0.0f,
384+ t = 0.0f,
385+ r = 0.0f,
386+ q = 1.0f,
387+ color = Cogl.Color () {
388+ red = 0xC0,
389+ green = 0xC0,
390+ blue = 0xC0,
391+ alpha = 0xC0
392+ }
393+ },
394+ Ctk.ProjectedTextureVertex () {
395+ x = p2_x + pos_x,
396+ y = p2_y + pos_y,
397+ z = 0.0f,
398+ w = w2,
399+ s = 1.0f,
400+ t = 0.0f,
401+ r = 0.0f,
402+ q = 1.0f,
403+ color = Cogl.Color () {
404+ red = 0xC0,
405+ green = 0xC0,
406+ blue = 0xC0,
407+ alpha = 0xC0
408+ }
409+ },
410+ Ctk.ProjectedTextureVertex () {
411+ x = p3_x + pos_x,
412+ y = p3_y + pos_y,
413+ z = 0.0f,
414+ w = w3,
415+ s = 1.0f,
416+ t = 1.0f,
417+ r = 0.0f,
418+ q = 1.0f,
419+ color = Cogl.Color () {
420+ red = 0xC0,
421+ green = 0xC0,
422+ blue = 0xC0,
423+ alpha = 0xC0
424+ }
425+ },
426+ Ctk.ProjectedTextureVertex () {
427+ x = p4_x + pos_x,
428+ y = p4_y + pos_y,
429+ z = 0.0f,
430+ w = w4,
431+ s = 0.0f,
432+ t = 1.0f,
433+ r = 0.0f,
434+ q = 1.0f,
435+ color = Cogl.Color () {
436+ red = 0xC0,
437+ green = 0xC0,
438+ blue = 0xC0,
439+ alpha = 0xC0
440+ }
441+ }
442+ };
443+
444+ if (self.icon is Gdk.Pixbuf)
445+ {
446+//
447 // we also need to transform the smaller (potentially) icon
448 int base_width, base_height;
449 float xpad, ypad;
450- self.icon.get_base_size (out base_width, out base_height);
451+ base_width = self.icon.get_width ();
452+ base_height = self.icon.get_height ();
453 xpad = 1 + (box.get_width () - base_width) / 2.0f;
454 ypad = ((box.get_height () - base_height) / 2.0f) - 1;
455
456@@ -542,13 +635,16 @@
457 p2_x = 25.0f; p2_y = -25.0f;
458 p3_x = 25.0f; p3_y = 25.0f;
459 p4_x = -25.0f; p4_y = 25.0f;
460- z = base_z;
461- w = 1.0f;
462+ z = 0.0f;
463+ w1 = 1.0f;
464+ w2 = 1.0f;
465+ w3 = 1.0f;
466+ w4 = 1.0f;
467
468- viewmatrix.transform_point (out p1_x, out p1_y, out z, out w); p1_x /= w; p1_y /= w; z = base_z; w = 1.0f;
469- viewmatrix.transform_point (out p2_x, out p2_y, out z, out w); p2_x /= w; p2_y /= w; z = base_z; w = 1.0f;
470- viewmatrix.transform_point (out p3_x, out p3_y, out z, out w); p3_x /= w; p3_y /= w; z = base_z; w = 1.0f;
471- viewmatrix.transform_point (out p4_x, out p4_y, out z, out w); p4_x /= w; p4_y /= w; z = base_z; w = 1.0f;
472+ viewmatrix.transform_point (out p1_x, out p1_y, out z, out w1); p1_x /= w1; p1_y /= w1; z = 0.0f;
473+ viewmatrix.transform_point (out p2_x, out p2_y, out z, out w2); p2_x /= w2; p2_y /= w2; z = 0.0f;
474+ viewmatrix.transform_point (out p3_x, out p3_y, out z, out w3); p3_x /= w3; p3_y /= w3; z = 0.0f;
475+ viewmatrix.transform_point (out p4_x, out p4_y, out z, out w4); p4_x /= w4; p4_y /= w4; z = 0.0f;
476
477 //transform into screen co-ordinates
478 p1_x = xpad + (base_width * (p1_x + 1) / 2);
479@@ -573,59 +669,64 @@
480 p4_x = Math.ceilf (p4_x); p4_y = Math.floorf (p4_y);
481 }
482
483-/*
484- p1_y += self.stored_ymod;
485- p2_y += self.stored_ymod;
486- p3_y += self.stored_ymod;
487- p4_y += self.stored_ymod;
488-*/
489-
490- Cogl.TextureVertex[4] icon_points = {
491- Cogl.TextureVertex () {
492- x = p1_x,
493- y = p1_y,
494- z = 0.0f,
495- tx = 0.0f,
496- ty = 0.0f,
497- color = Cogl.Color () {
498- red = 0xff,
499- green = 0xff,
500- blue = 0xff,
501- alpha = 0xff
502- }
503- },
504- Cogl.TextureVertex () {
505- x = p2_x,
506- y = p2_y,
507- z = 0.0f,
508- tx = 1.0f,
509- ty = 0.0f,
510- color = Cogl.Color () {
511- red = 0xff,
512- green = 0xff,
513- blue = 0xff,
514- alpha = 0xff
515- }
516- },
517- Cogl.TextureVertex () {
518- x = p3_x,
519- y = p3_y,
520- z = 0.0f,
521- tx = 1.0f,
522- ty = 1.0f,
523- color = Cogl.Color () {
524- red = 0xff,
525- green = 0xff,
526- blue = 0xff,
527- alpha = 0xff
528- }
529- },
530- Cogl.TextureVertex () {
531- x = p4_x,
532- y = p4_y,
533- z = 0.0f,
534- tx = 0.0f,
535- ty = 1.0f,
536+ Ctk.ProjectedTextureVertex[4] vertex2 = {
537+ Ctk.ProjectedTextureVertex () {
538+ x = p1_x + pos_x,
539+ y = p1_y + pos_y,
540+ z = 0.0f,
541+ w = w1,
542+ s = 0.0f,
543+ t = 0.0f,
544+ r = 0.0f,
545+ q = 1.0f,
546+ color = Cogl.Color () {
547+ red = 0xff,
548+ green = 0xff,
549+ blue = 0xff,
550+ alpha = 0xff
551+ }
552+ },
553+ Ctk.ProjectedTextureVertex () {
554+ x = p2_x + pos_x,
555+ y = p2_y + pos_y,
556+ z = 0.0f,
557+ w = w2,
558+ s = 1.0f,
559+ t = 0.0f,
560+ r = 0.0f,
561+ q = 1.0f,
562+ color = Cogl.Color () {
563+ red = 0xff,
564+ green = 0xff,
565+ blue = 0xff,
566+ alpha = 0xff
567+ }
568+ },
569+ Ctk.ProjectedTextureVertex () {
570+ x = p3_x + pos_x,
571+ y = p3_y + pos_y,
572+ z = 0.0f,
573+ w = w3,
574+ s = 1.0f,
575+ t = 1.0f,
576+ r = 0.0f,
577+ q = 1.0f,
578+ color = Cogl.Color () {
579+ red = 0xff,
580+ green = 0xff,
581+ blue = 0xff,
582+ alpha = 0xff
583+ }
584+ },
585+ Ctk.ProjectedTextureVertex () {
586+ x = p4_x + pos_x,
587+ y = p4_y + pos_y,
588+ z = 0.0f,
589+ w = w4,
590+ s = 0.0f,
591+ t = 1.0f,
592+ r = 0.0f,
593+ q = 1.0f,
594 color = Cogl.Color () {
595 red = 0xff,
596 green = 0xff,
597@@ -635,18 +736,11 @@
598 }
599 };
600
601- int width, height;
602- self.icon.get_base_size (out width, out height);
603-
604- xpad = (box.get_width () - width) / 2.0f;
605- ypad = (box.get_height () - height) / 2.0f;
606-
607- Cogl.set_source (self.icon_material);
608- Cogl.polygon (icon_points, true);
609+ Ctk.render_projected_polygon_2Tex (vertex2[0], self.tex_id_bg, self.tex_id_content, stage_width, stage_height);
610 }
611-
612- Cogl.set_source (self.fg_mat);
613- Cogl.polygon (points, true);
614+
615+
616+ Ctk.render_projected_polygon (vertex1[0], self.tex_id_fg, stage_width, stage_height);
617 }
618
619 public override void paint ()
620@@ -677,14 +771,11 @@
621 public override void map ()
622 {
623 base.map ();
624- if (icon is Clutter.Actor)
625- icon.map ();
626 }
627
628 public override void unmap ()
629 {
630 base.unmap ();
631- icon.unmap ();
632 }
633 }
634 }
635
636=== modified file 'vapi/clutk-0.3.vapi'
637--- vapi/clutk-0.3.vapi 2010-08-02 08:24:04 +0000
638+++ vapi/clutk-0.3.vapi 2010-08-27 03:00:56 +0000
639@@ -18,8 +18,8 @@
640 public void recurse_get_stored_allocation_box (out Clutter.ActorBox box);
641 public void remove_all_effects ();
642 public void remove_effect (Ctk.Effect effect);
643- public void set_background (Clutter.Actor? bg);
644- public void set_background_for_state (Ctk.ActorState state, Clutter.Actor? bg);
645+ public void set_background (Clutter.Actor bg);
646+ public void set_background_for_state (Ctk.ActorState state, Clutter.Actor bg);
647 public void set_damaged (bool damaged);
648 public static void set_default_direction (Gtk.TextDirection dir);
649 public void set_effects_painting (bool painting);
650@@ -391,6 +391,19 @@
651 [CCode (has_construct_function = false)]
652 public MenuSeperator ();
653 }
654+ [Compact]
655+ [CCode (cheader_filename = "clutk/clutk.h")]
656+ public struct ProjectedTextureVertex {
657+ public Cogl.Color color;
658+ public float q;
659+ public float r;
660+ public float s;
661+ public float t;
662+ public float w;
663+ public float x;
664+ public float y;
665+ public float z;
666+ }
667 [CCode (cheader_filename = "clutk/clutk.h")]
668 public class RadioMenuItem : Ctk.CheckMenuItem, Clutter.Scriptable, Ctk.Focusable, Clutter.Container {
669 [CCode (has_construct_function = false)]
670@@ -583,6 +596,12 @@
671 [CCode (cheader_filename = "clutk/clutk.h")]
672 public static void cleanup ();
673 [CCode (cheader_filename = "clutk/clutk.h")]
674+ public static uint create_opengl_texture_from_file (string filename);
675+ [CCode (cheader_filename = "clutk/clutk.h")]
676+ public static uint create_opengl_texture_from_pixbuf (Gdk.Pixbuf pixbuf);
677+ [CCode (cheader_filename = "clutk/clutk.h")]
678+ public static void delete_opengl_texture (uint opengl_texture_id);
679+ [CCode (cheader_filename = "clutk/clutk.h")]
680 public static void dnd_init (Gtk.Widget widget, Gtk.TargetEntry[] targets);
681 [CCode (cheader_filename = "clutk/clutk.h")]
682 public static Gdk.Atom drag_dest_find_target (Gdk.DragContext context, Gtk.TargetList target_list);
683@@ -595,11 +614,17 @@
684 [CCode (cheader_filename = "clutk/clutk.h")]
685 public static double em_to_pixel (double em_value);
686 [CCode (cheader_filename = "clutk/clutk.h")]
687+ public static void get_actor_screen_coord (Ctk.Actor actor, out float x, out float y, out float width, out float height);
688+ [CCode (cheader_filename = "clutk/clutk.h")]
689 public static void init ([CCode (array_length_pos = 0.9)] ref unowned string[] argv);
690 [CCode (cheader_filename = "clutk/clutk.h")]
691 public static void init_after ([CCode (array_length_pos = 0.9)] ref unowned string[] argv);
692 [CCode (cheader_filename = "clutk/clutk.h")]
693 public static double pixel_to_em (int pixel_value);
694 [CCode (cheader_filename = "clutk/clutk.h")]
695+ public static void render_projected_polygon (Ctk.ProjectedTextureVertex V, uint tex_mask_id, int window_w, int window_h);
696+ [CCode (cheader_filename = "clutk/clutk.h")]
697+ public static void render_projected_polygon_2Tex (Ctk.ProjectedTextureVertex V, uint tex_mask_id, uint tex_id, int window_w, int window_h);
698+ [CCode (cheader_filename = "clutk/clutk.h")]
699 public static void surface_blur (Cairo.Surface surface, uint radius);
700 }
701
702=== modified file 'vapi/cogl-1.0.vapi'
703--- vapi/cogl-1.0.vapi 2010-06-16 12:42:46 +0000
704+++ vapi/cogl-1.0.vapi 2010-08-27 03:00:56 +0000
705@@ -136,6 +136,7 @@
706 public bool is_sliced ();
707 public bool set_region (int src_x, int src_y, int dst_x, int dst_y, uint dst_width, uint dst_height, int width, int height, Cogl.PixelFormat format, uint rowstride, uchar[] data);
708 public Texture.with_size (uint width, uint height, Cogl.TextureFlags flags, Cogl.PixelFormat internal_format);
709+ public bool get_gl_texture (out uint out_gl_handle, out uint out_gl_target);
710 }
711 [Compact]
712 [CCode (ref_function = "cogl_handle_buffer_ref", unref_function = "cogl_handle_buffer_unref", cname = "CoglHandle", cheader_filename = "cogl/cogl.h")]