~docky-core/plank/respect-struts

« back to all changes in this revision

Viewing changes to lib/Drawing/DockSurface.vala

  • Committer: Rico Tzschichholz
  • Date: 2015-07-16 08:24:10 UTC
  • Revision ID: ricotz@ubuntu.com-20150716082410-tkbn5mqoxbe6j41n
Add ability to cache multiple sizes of drawn items

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
                }
126
126
                
127
127
                /**
 
128
                 * Create a scaled copy of the surface
 
129
                 *
 
130
                 * @param width the resulting width
 
131
                 * @param height the resulting height
 
132
                 * @return scaled copy of this surface
 
133
                 */
 
134
                public DockSurface scaled_copy (int width, int height)
 
135
                {
 
136
                        var result = new DockSurface.with_dock_surface (width, height, this);
 
137
                        unowned Cairo.Context cr = result.Context;
 
138
                        
 
139
                        cr.save ();
 
140
                        cr.scale ((double) width / Width, (double) height / Height);
 
141
                        cr.set_source_surface (Internal, 0, 0);
 
142
                        cr.paint ();
 
143
                        cr.restore ();
 
144
                        
 
145
                        return result;
 
146
                }
 
147
                
 
148
                /**
128
149
                 * Saves the current dock surface to a {@link Gdk.Pixbuf}.
129
150
                 *
130
151
                 * @return the {@link Gdk.Pixbuf}