~ubuntu-branches/ubuntu/precise/cairo/precise-proposed

« back to all changes in this revision

Viewing changes to doc/public/html/cairo-cairo-device-t.html

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-01-03 16:47:46 UTC
  • mfrom: (28.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20110103164746-2arbsh0o4defgd8u
Tags: 1.10.2-1ubuntu1
* Resynchronize on Debian, the remaining delta for ubuntu is:
* debian/patches/server_side_gradients.patch:
  - don't use server side gradients, most drivers don't handle those and are
    really slow, should workaround performances issues for ati and nouveau
* debian/patches/cairo-lp-680628.patch: 
  - git backport to fix pdf printing speed issues (LP #680628).
* debian/libcairo2.symbols:
  Fix build failure with -flto (adding optional symbol).

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
Putting this all together, a function that works with devices should
86
86
look something like this:
87
87
</p>
88
 
<div class="informalexample">
89
 
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
90
 
    <tbody>
91
 
      <tr>
92
 
        <td class="listing_lines" align="right"><pre>1
93
 
2
94
 
3
95
 
4
96
 
5
97
 
6
98
 
7
99
 
8
100
 
9
101
 
10
102
 
11
103
 
12
104
 
13
105
 
14
106
 
15
107
 
16
108
 
17
109
 
18
110
 
19
111
 
20</pre></td>
112
 
        <td class="listing_code"><pre class="programlisting"><span class="type">void</span>
113
 
<span class="function">my_device_modifying_function</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">cairo_device_t</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">device</span><span class="symbol">)</span>
114
 
<span class="cbracket">{</span>
115
 
<span class="normal">  </span><span class="usertype">cairo_status_t</span><span class="normal"> status</span><span class="symbol">;</span>
116
 
 
117
 
<span class="normal">  </span><span class="comment">// Ensure the device is properly reset</span>
118
 
<span class="normal">  </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-device-t.html#cairo-device-flush">cairo_device_flush</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">device</span><span class="symbol">);</span>
119
 
<span class="normal">  </span><span class="comment">// Try to acquire the device</span>
120
 
<span class="normal">  status </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-device-t.html#cairo-device-acquire">cairo_device_acquire</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">device</span><span class="symbol">);</span>
121
 
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">status </span><span class="symbol">!=</span><span class="normal"> <a href="/usr/share/gtk-doc/html/cairo/cairo-Error-handling.html#CAIRO-STATUS-SUCCESS:CAPS">CAIRO_STATUS_SUCCESS</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
122
 
<span class="normal">    </span><span class="function">printf</span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Failed to acquire the device: %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-Error-handling.html#cairo-status-to-string">cairo_status_to_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">status</span><span class="symbol">));</span>
123
 
<span class="normal">    </span><span class="keyword">return</span><span class="symbol">;</span>
124
 
<span class="normal">  </span><span class="cbracket">}</span>
125
 
 
126
 
<span class="normal">  </span><span class="comment">// Do the custom operations on the device here.</span>
127
 
<span class="normal">  </span><span class="comment">// But do not call any Cairo functions that might acquire devices.</span>
128
 
<span class="normal">  </span>
129
 
<span class="normal">  </span><span class="comment">// Release the device when done.</span>
130
 
<span class="normal">  </span><span class="function"><a href="/usr/share/gtk-doc/html/cairo/cairo-cairo-device-t.html#cairo-device-release">cairo_device_release</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">device</span><span class="symbol">);</span>
131
 
<span class="cbracket">}</span></pre></td>
132
 
      </tr>
133
 
    </tbody>
134
 
  </table>
135
 
</div>
136
 
 
 
88
<div class="informalexample"><pre class="programlisting">
 
89
void
 
90
my_device_modifying_function (cairo_device_t *device)
 
91
{
 
92
  cairo_status_t status;
 
93
 
 
94
  // Ensure the device is properly reset
 
95
  cairo_device_flush (device);
 
96
  // Try to acquire the device
 
97
  status = cairo_device_acquire (device);
 
98
  if (status != CAIRO_STATUS_SUCCESS) {
 
99
    printf ("Failed to acquire the device: %s\n", cairo_status_to_string (status));
 
100
    return;
 
101
  }
 
102
 
 
103
  // Do the custom operations on the device here.
 
104
  // But do not call any Cairo functions that might acquire devices.
 
105
  
 
106
  // Release the device when done.
 
107
  cairo_device_release (device);
 
108
}
 
109
</pre></div>
137
110
<p>
138
111
</p>
139
112
<p>
315
288
    CAIRO_DEVICE_TYPE_SCRIPT,
316
289
    CAIRO_DEVICE_TYPE_XCB,
317
290
    CAIRO_DEVICE_TYPE_XLIB,
318
 
    CAIRO_DEVICE_TYPE_XML,
 
291
    CAIRO_DEVICE_TYPE_XML
319
292
} cairo_device_type_t;
320
293
</pre>
321
294
<p>