~ubuntu-branches/ubuntu/intrepid/xulrunner-1.9/intrepid

« back to all changes in this revision

Viewing changes to mozilla/gfx/thebes/public/gfxContext.h

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack, Alexander Sack, Fabien Tassin
  • Date: 2008-02-13 11:47:21 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080213114721-7om0mgzngvuk9czv
Tags: 1.9~b3+nobinonly-0ubuntu1
* release FIREFOX_3_0b3_RELEASE

[ Alexander Sack ]
* submit patch that ships xpcshell to bugzilla
  - rename debian/patches/ship_xpcshell.patch =>
           debian/patches/bz410617_att295212_ship_xpcshell.patch
  - update debian/patches/series
* fix tooltip in epiphany: previously displayed out of screen bounds
  (LP: #37507)
  - add debian/patches/bz233371_att297343_fix_outofscreen_embed_tooltip.patch
  - update debian/patches/series
* use default upstream gcc tweaks for improved performance - especially of the
  javascript engine
  - update debian/rules
* update global extension/plugin patch to apply cleanly against latest code
  - update debian/patches/bzXXX_gre_extension_plugin_support.patch
* fix pyxpcom build failure introduced by recent commit
  - add debian/patches/bzXXX_fix_pyxpcom_build_failure.patch
  - update debian/patches/series
* add distro independent global install locations for extensions,
  /usr/lib/mozilla/extensions and /usr/share/mozilla/extensions
  - update debian/xulrunner-1.9.dirs
* support embedded tarball layout when either there is a *.tar.bz2 in orig tarball
  or if DEBIAN_MOZCLIENT_EMBEDDED is not unset (you will need this to produce embedded
  tarballs during |get-orig-source|
  - update debian/rules
* bump minimum libnss3-dev build requirements to >= 3.12.0~1.9b3
  - update debian/control
* bump minimum libnspr4-dev build requirements to >= 4.7.0~1.9b3
  - update debian/control

[ Fabien Tassin ]
* Drop patches applied upstream
  - drop debian/patches/bz410617_att295212_ship_xpcshell.patch
  - drop debian/patches/bz404634_att294921.patch
  - drop debian/patches/bz386610_python2.5_ftbfs_amd64.patch
  - drop debian/patches/bz373918_att295042.patch
  - drop debian/patches/bz408062_unstable_pc.patch
  - drop debian/patches/bz384304_fix_recursive_symlinks.patch
  - update debian/patches/series
* Refresh diverged patches:
  - update debian/patches/bzXXX_pc_honour_system_nspr_nss.patch
  - update debian/patches/rename_venkman_addon.patch
  - update debian/patches/bz344818_cairo_xrender.patch
* Install links for all .so libs in the -dev package
  - update debian/patches/dont_install_so_in_dev.patch
* Bump gtk requirement to 2.12 as per Mozilla bug 412432
  - update debian/control
* Add #DEBHELPER# token to postinst/prerm scripts
  - update debian/xulrunner-1.9.{postinst,prerm}
* Install previously missed libdbusservice.so
  - update debian/xulrunner-1.9.install
* Update venkman patch to also rename locales
  - update debian/patches/rename_venkman_addon.patch
* Bump requirement for system cairo to >= 1.5.8 as we now need
  the newly added cairo_path_extents()
  - update debian/rules
* Include mozilla-devscripts file using -include so ifneq could be omitted
  - update debian/rules
* Fix missing .so symlinks regression
  - update debian/patches/dont_install_so_in_dev.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
 
 * ***** BEGIN LICENSE BLOCK *****
3
 
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 
 *
5
 
 * The contents of this file are subject to the Mozilla Public License Version
6
 
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 
 * the License. You may obtain a copy of the License at
8
 
 * http://www.mozilla.org/MPL/
9
 
 *
10
 
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 
 * for the specific language governing rights and limitations under the
13
 
 * License.
14
 
 *
15
 
 * The Original Code is Oracle Corporation code.
16
 
 *
17
 
 * The Initial Developer of the Original Code is Oracle Corporation.
18
 
 * Portions created by the Initial Developer are Copyright (C) 2005
19
 
 * the Initial Developer. All Rights Reserved.
20
 
 *
21
 
 * Contributor(s):
22
 
 *   Stuart Parmenter <pavlov@pavlov.net>
23
 
 *   Vladimir Vukicevic <vladimir@pobox.com>
24
 
 *
25
 
 * Alternatively, the contents of this file may be used under the terms of
26
 
 * either the GNU General Public License Version 2 or later (the "GPL"), or
27
 
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
 
 * in which case the provisions of the GPL or the LGPL are applicable instead
29
 
 * of those above. If you wish to allow use of your version of this file only
30
 
 * under the terms of either the GPL or the LGPL, and not to allow others to
31
 
 * use your version of this file under the terms of the MPL, indicate your
32
 
 * decision by deleting the provisions above and replace them with the notice
33
 
 * and other provisions required by the GPL or the LGPL. If you do not delete
34
 
 * the provisions above, a recipient may use your version of this file under
35
 
 * the terms of any one of the MPL, the GPL or the LGPL.
36
 
 *
37
 
 * ***** END LICENSE BLOCK ***** */
38
 
 
39
 
#ifndef GFX_CONTEXT_H
40
 
#define GFX_CONTEXT_H
41
 
 
42
 
#include "gfxTypes.h"
43
 
 
44
 
#include "gfxASurface.h"
45
 
#include "gfxColor.h"
46
 
#include "gfxPoint.h"
47
 
#include "gfxRect.h"
48
 
#include "gfxMatrix.h"
49
 
#include "gfxPattern.h"
50
 
#include "gfxPath.h"
51
 
 
52
 
typedef struct _cairo cairo_t;
53
 
 
54
 
/**
55
 
 * This is the main class for doing actual drawing. It is initialized using
56
 
 * a surface and can be drawn on. It manages various state information like
57
 
 * a current transformation matrix (CTM), a current path, current color,
58
 
 * etc.
59
 
 *
60
 
 * All drawing happens by creating a path and then stroking or filling it.
61
 
 * The functions like Rectangle and Arc do not do any drawing themselves.
62
 
 * When a path is drawn (stroked or filled), it is filled/stroked with a
63
 
 * pattern set by SetPattern, SetColor or SetSource.
64
 
 *
65
 
 * Note that the gfxContext takes coordinates in device pixels,
66
 
 * as opposed to app units.
67
 
 */
68
 
class THEBES_API gfxContext {
69
 
    THEBES_INLINE_DECL_REFCOUNTING(gfxContext)
70
 
 
71
 
public:
72
 
    /**
73
 
     * Initialize this context from a surface.
74
 
     */
75
 
    gfxContext(gfxASurface *surface);
76
 
    ~gfxContext();
77
 
 
78
 
    /**
79
 
     * Return the surface that this gfxContext was created with
80
 
     */
81
 
    gfxASurface *OriginalSurface();
82
 
 
83
 
    /**
84
 
     * Return the current transparency group target, if any, along
85
 
     * with its device offsets from the top.  If no group is
86
 
     * active, returns the surface the gfxContext was created with,
87
 
     * and 0,0 in dx,dy.
88
 
     */
89
 
    already_AddRefed<gfxASurface> CurrentSurface(gfxFloat *dx, gfxFloat *dy);
90
 
    already_AddRefed<gfxASurface> CurrentSurface() {
91
 
        return CurrentSurface(NULL, NULL);
92
 
    }
93
 
 
94
 
    /**
95
 
     * Return the raw cairo_t object.
96
 
     * XXX this should go away at some point.
97
 
     */
98
 
    cairo_t *GetCairo() { return mCairo; }
99
 
 
100
 
    /**
101
 
     ** State
102
 
     **/
103
 
    // XXX document exactly what bits are saved
104
 
    void Save();
105
 
    void Restore();
106
 
 
107
 
    /**
108
 
     ** Paths & Drawing
109
 
     **/
110
 
 
111
 
    /**
112
 
     * Stroke the current path using the current settings (such as line
113
 
     * width and color).
114
 
     * A path is set up using functions such as Line, Rectangle and Arc.
115
 
     *
116
 
     * Does not consume the current path.
117
 
     */
118
 
    void Stroke();
119
 
    /**
120
 
     * Fill the current path according to the current settings.
121
 
     *
122
 
     * Does not consume the current path.
123
 
     */
124
 
    void Fill();
125
 
 
126
 
    /**
127
 
     * Forgets the current path.
128
 
     */
129
 
    void NewPath();
130
 
 
131
 
    /**
132
 
     * Closes the path, i.e. connects the last drawn point to the first one.
133
 
     *
134
 
     * Filling a path will implicitly close it.
135
 
     */
136
 
    void ClosePath();
137
 
 
138
 
    /**
139
 
     * Moves the pen to a new point without drawing a line.
140
 
     */
141
 
    void MoveTo(const gfxPoint& pt);
142
 
 
143
 
    /**
144
 
     * Creates a new subpath starting at the current point.
145
 
     * Equivalent to MoveTo(CurrentPoint()).
146
 
     */
147
 
    void NewSubPath();
148
 
 
149
 
    /**
150
 
     * Returns the current point in the current path.
151
 
     */
152
 
    gfxPoint CurrentPoint() const;
153
 
 
154
 
    /**
155
 
     * Draws a line from the current point to pt.
156
 
     *
157
 
     * @see MoveTo
158
 
     */
159
 
    void LineTo(const gfxPoint& pt);
160
 
 
161
 
    /**
162
 
     * Draws a quadratic Bézier curve with control points pt1, pt2 and pt3.
163
 
     */
164
 
    void CurveTo(const gfxPoint& pt1, const gfxPoint& pt2, const gfxPoint& pt3);
165
 
 
166
 
    /**
167
 
     * Draws a clockwise arc (i.e. a circle segment).
168
 
     * @param center The center of the circle
169
 
     * @param radius The radius of the circle
170
 
     * @param angle1 Starting angle for the segment
171
 
     * @param angle2 Ending angle
172
 
     */
173
 
    void Arc(const gfxPoint& center, gfxFloat radius,
174
 
             gfxFloat angle1, gfxFloat angle2);
175
 
 
176
 
    /**
177
 
     * Draws a counter-clockwise arc (i.e. a circle segment).
178
 
     * @param center The center of the circle
179
 
     * @param radius The radius of the circle
180
 
     * @param angle1 Starting angle for the segment
181
 
     * @param angle2 Ending angle
182
 
     */
183
 
 
184
 
    void NegativeArc(const gfxPoint& center, gfxFloat radius,
185
 
                     gfxFloat angle1, gfxFloat angle2);
186
 
 
187
 
    // path helpers
188
 
    /**
189
 
     * Draws a line from start to end.
190
 
     */
191
 
    void Line(const gfxPoint& start, const gfxPoint& end); // XXX snapToPixels option?
192
 
 
193
 
    /**
194
 
     * Draws the rectangle given by rect.
195
 
     * @param snapToPixels ?
196
 
     */
197
 
    void Rectangle(const gfxRect& rect, PRBool snapToPixels = PR_FALSE);
198
 
    void Ellipse(const gfxPoint& center, const gfxSize& dimensions);
199
 
    void Polygon(const gfxPoint *points, PRUint32 numPoints);
200
 
 
201
 
    /**
202
 
     ** Transformation Matrix manipulation
203
 
     **/
204
 
 
205
 
    /**
206
 
     * Adds a translation to the current matrix. This translation takes place
207
 
     * before the previously set transformations.
208
 
     */
209
 
    void Translate(const gfxPoint& pt);
210
 
 
211
 
    /**
212
 
     * Adds a scale to the current matrix. This scaling takes place before the
213
 
     * previously set transformations.
214
 
     */
215
 
    void Scale(gfxFloat x, gfxFloat y);
216
 
 
217
 
    /**
218
 
     * Adds a rotation around the origin to the current matrix. This rotation
219
 
     * takes place before the previously set transformations.
220
 
     *
221
 
     * @param angle The angle in radians.
222
 
     */
223
 
    void Rotate(gfxFloat angle);
224
 
 
225
 
    /**
226
 
     * Post-multiplies 'other' onto the current CTM, i.e. this
227
 
     * matrix's transformation will take place before the previously set
228
 
     * transformations.
229
 
     */
230
 
    void Multiply(const gfxMatrix& other);
231
 
 
232
 
    /**
233
 
     * Replaces the current transformation matrix with matrix.
234
 
     */
235
 
    void SetMatrix(const gfxMatrix& matrix);
236
 
 
237
 
    /**
238
 
     * Sets the transformation matrix to the identity matrix.
239
 
     */
240
 
    void IdentityMatrix();
241
 
 
242
 
    /**
243
 
     * Returns the current transformation matrix.
244
 
     */
245
 
    gfxMatrix CurrentMatrix() const;
246
 
 
247
 
    /**
248
 
     * Converts a point from device to user coordinates using the inverse
249
 
     * transformation matrix.
250
 
     */
251
 
    gfxPoint DeviceToUser(const gfxPoint& point) const;
252
 
 
253
 
    /**
254
 
     * Converts a size from device to user coordinates. This does not apply
255
 
     * translation components of the matrix.
256
 
     */
257
 
    gfxSize DeviceToUser(const gfxSize& size) const;
258
 
 
259
 
    /**
260
 
     * Converts a rectangle from device to user coordinates; this has the
261
 
     * same effect as using DeviceToUser on both the rectangle's point and
262
 
     * size.
263
 
     */
264
 
    gfxRect DeviceToUser(const gfxRect& rect) const;
265
 
 
266
 
    /**
267
 
     * Converts a point from user to device coordinates using the inverse
268
 
     * transformation matrix.
269
 
     */
270
 
    gfxPoint UserToDevice(const gfxPoint& point) const;
271
 
 
272
 
    /**
273
 
     * Converts a size from user to device coordinates. This does not apply
274
 
     * translation components of the matrix.
275
 
     */
276
 
    gfxSize UserToDevice(const gfxSize& size) const;
277
 
 
278
 
    /**
279
 
     * Converts a rectangle from user to device coordinates; this has the
280
 
     * same effect as using UserToDevice on both the rectangle's point and
281
 
     * size.
282
 
     */
283
 
    gfxRect UserToDevice(const gfxRect& rect) const;
284
 
 
285
 
    /**
286
 
     * Takes the given rect and tries to align it to device pixels.  If
287
 
     * this succeeds, the method will return PR_TRUE, and the rect will
288
 
     * be in device coordinates (already transformed by the CTM).  If it 
289
 
     * fails, the method will return PR_FALSE, and the rect will not be
290
 
     * changed.
291
 
     *
292
 
     * If ignoreScale is PR_TRUE, then snapping will take place even if
293
 
     * the CTM has a scale applied.  Snapping never takes place if
294
 
     * there is a rotation in the CTM.
295
 
     */
296
 
    PRBool UserToDevicePixelSnapped(gfxRect& rect, PRBool ignoreScale = PR_FALSE) const;
297
 
 
298
 
    /**
299
 
     * Attempts to pixel snap the rectangle, add it to the current
300
 
     * path, and to set pattern as the current painting source.  This
301
 
     * should be used for drawing filled pixel-snapped rectangles (like
302
 
     * images), because the CTM at the time of the SetPattern call needs
303
 
     * to have a snapped translation, or you get smeared images.
304
 
     */
305
 
    void PixelSnappedRectangleAndSetPattern(const gfxRect& rect, gfxPattern *pattern);
306
 
 
307
 
    /**
308
 
     ** Painting sources
309
 
     **/
310
 
 
311
 
    /**
312
 
     * Uses a solid color for drawing.
313
 
     */
314
 
    void SetColor(const gfxRGBA& c);
315
 
 
316
 
    /**
317
 
     * Gets the current color.
318
 
     * returns PR_FALSE if there is something other than a color
319
 
     *         set as the current source (pattern, surface, etc)
320
 
     */
321
 
    PRBool GetColor(gfxRGBA& c);
322
 
 
323
 
    /**
324
 
     * Uses a surface for drawing. This is a shorthand for creating a
325
 
     * pattern and setting it.
326
 
     *
327
 
     * @param offset ?
328
 
     */
329
 
    void SetSource(gfxASurface *surface, const gfxPoint& offset = gfxPoint(0.0, 0.0));
330
 
 
331
 
    /**
332
 
     * Uses a pattern for drawing.
333
 
     */
334
 
    void SetPattern(gfxPattern *pattern);
335
 
 
336
 
    /**
337
 
     * Get the source pattern (solid color, normal pattern, surface, etc)
338
 
     */
339
 
    already_AddRefed<gfxPattern> GetPattern();
340
 
 
341
 
    /**
342
 
     ** Painting
343
 
     **/
344
 
    /**
345
 
     * Paints the current source surface/pattern everywhere in the current
346
 
     * clip region.
347
 
     */
348
 
    void Paint(gfxFloat alpha = 1.0);
349
 
 
350
 
    /**
351
 
     ** Painting with a Mask
352
 
     **/
353
 
    /**
354
 
     * Like Paint, except that it only draws the source where pattern is
355
 
     * non-transparent.
356
 
     */
357
 
    void Mask(gfxPattern *pattern);
358
 
 
359
 
    /**
360
 
     * Shorthand for creating a pattern and calling the pattern-taking
361
 
     * variant of Mask.
362
 
     */
363
 
    void Mask(gfxASurface *surface, const gfxPoint& offset = gfxPoint(0.0, 0.0));
364
 
 
365
 
    /**
366
 
     ** Shortcuts
367
 
     **/
368
 
 
369
 
    /**
370
 
     * Creates a new path with a rectangle from 0,0 to size.w,size.h
371
 
     * and calls cairo_fill.
372
 
     */
373
 
    void DrawSurface(gfxASurface *surface, const gfxSize& size);
374
 
 
375
 
    /**
376
 
     ** Line Properties
377
 
     **/
378
 
 
379
 
    typedef enum {
380
 
        gfxLineSolid,
381
 
        gfxLineDashed,
382
 
        gfxLineDotted
383
 
    } gfxLineType;
384
 
 
385
 
    void SetDash(gfxLineType ltype);
386
 
    void SetDash(gfxFloat *dashes, int ndash, gfxFloat offset);
387
 
    //void getDash() const;
388
 
 
389
 
    /**
390
 
     * Sets the line width that's used for line drawing.
391
 
     */
392
 
    void SetLineWidth(gfxFloat width);
393
 
 
394
 
    /**
395
 
     * Returns the currently set line width.
396
 
     *
397
 
     * @see SetLineWidth
398
 
     */
399
 
    gfxFloat CurrentLineWidth() const;
400
 
 
401
 
    enum GraphicsLineCap {
402
 
        LINE_CAP_BUTT,
403
 
        LINE_CAP_ROUND,
404
 
        LINE_CAP_SQUARE
405
 
    };
406
 
    /**
407
 
     * Sets the line caps, i.e. how line endings are drawn.
408
 
     */
409
 
    void SetLineCap(GraphicsLineCap cap);
410
 
    GraphicsLineCap CurrentLineCap() const;
411
 
 
412
 
    enum GraphicsLineJoin {
413
 
        LINE_JOIN_MITER,
414
 
        LINE_JOIN_ROUND,
415
 
        LINE_JOIN_BEVEL
416
 
    };
417
 
    /**
418
 
     * Sets the line join, i.e. how the connection between two lines is
419
 
     * drawn.
420
 
     */
421
 
    void SetLineJoin(GraphicsLineJoin join);
422
 
    GraphicsLineJoin CurrentLineJoin() const;
423
 
 
424
 
    void SetMiterLimit(gfxFloat limit);
425
 
    gfxFloat CurrentMiterLimit() const;
426
 
 
427
 
    /**
428
 
     ** Fill Properties
429
 
     **/
430
 
 
431
 
    enum FillRule {
432
 
        FILL_RULE_WINDING,
433
 
        FILL_RULE_EVEN_ODD
434
 
    };
435
 
    void SetFillRule(FillRule rule);
436
 
    FillRule CurrentFillRule() const;
437
 
 
438
 
    /**
439
 
     ** Operators and Rendering control
440
 
     **/
441
 
 
442
 
    // define enum for operators (clear, src, dst, etc)
443
 
    enum GraphicsOperator {
444
 
        OPERATOR_CLEAR,
445
 
        OPERATOR_SOURCE,
446
 
 
447
 
        OPERATOR_OVER,
448
 
        OPERATOR_IN,
449
 
        OPERATOR_OUT,
450
 
        OPERATOR_ATOP,
451
 
 
452
 
        OPERATOR_DEST,
453
 
        OPERATOR_DEST_OVER,
454
 
        OPERATOR_DEST_IN,
455
 
        OPERATOR_DEST_OUT,
456
 
        OPERATOR_DEST_ATOP,
457
 
 
458
 
        OPERATOR_XOR,
459
 
        OPERATOR_ADD,
460
 
        OPERATOR_SATURATE
461
 
    };
462
 
    /**
463
 
     * Sets the operator used for all further drawing. The operator affects
464
 
     * how drawing something will modify the destination. For example, the
465
 
     * OVER operator will do alpha blending of source and destination, while
466
 
     * SOURCE will replace the destination with the source.
467
 
     *
468
 
     * Note that if the flag FLAG_SIMPLIFY_OPERATORS is set on this
469
 
     * gfxContext, the actual operator set might change for optimization
470
 
     * purposes.  Check the comments below around that flag.
471
 
     */
472
 
    void SetOperator(GraphicsOperator op);
473
 
    GraphicsOperator CurrentOperator() const;
474
 
 
475
 
    /**
476
 
     * MODE_ALIASED means that only pixels whose centers are in the drawn area
477
 
     * should be modified, and they should be modified to take the value drawn
478
 
     * at the pixel center.
479
 
     */
480
 
    enum AntialiasMode {
481
 
        MODE_ALIASED,
482
 
        MODE_COVERAGE
483
 
    };
484
 
    void SetAntialiasMode(AntialiasMode mode);
485
 
    AntialiasMode CurrentAntialiasMode() const;
486
 
 
487
 
    /**
488
 
     ** Clipping
489
 
     **/
490
 
 
491
 
    /**
492
 
     * Clips all further drawing to the current path.
493
 
     * This does not consume the current path.
494
 
     */
495
 
    void Clip();
496
 
 
497
 
    /**
498
 
     * Undoes any clipping. Further drawings will only be restricted by the
499
 
     * surface dimensions.
500
 
     */
501
 
    void ResetClip();
502
 
 
503
 
    /**
504
 
     * Helper functions that will create a rect path and call Clip().
505
 
     * Any current path will be destroyed by these functions!
506
 
     */
507
 
    void Clip(const gfxRect& rect); // will clip to a rect
508
 
 
509
 
    /**
510
 
     * This will ensure that the surface actually has its clip set.
511
 
     * Useful if you are doing native drawing.
512
 
     */
513
 
    void UpdateSurfaceClip();
514
 
 
515
 
    /**
516
 
     * This will return the current bounds of the clip region.
517
 
     */
518
 
    gfxRect GetClipExtents();
519
 
 
520
 
    /**
521
 
     * Groups
522
 
     */
523
 
    void PushGroup(gfxASurface::gfxContentType content = gfxASurface::CONTENT_COLOR);
524
 
    already_AddRefed<gfxPattern> PopGroup();
525
 
    void PopGroupToSource();
526
 
 
527
 
    /**
528
 
     ** Hit Testing - check if given point is in the current path
529
 
     **/
530
 
    PRBool PointInFill(const gfxPoint& pt);
531
 
    PRBool PointInStroke(const gfxPoint& pt);
532
 
 
533
 
    /**
534
 
     ** Extents - returns user space extent of current path
535
 
     **/
536
 
    gfxRect GetUserFillExtent();
537
 
    gfxRect GetUserStrokeExtent();
538
 
 
539
 
    /**
540
 
     ** Obtaining a "flattened" path - path converted to all line segments
541
 
     **/
542
 
    already_AddRefed<gfxFlattenedPath> GetFlattenedPath();
543
 
 
544
 
    /**
545
 
     ** Flags
546
 
     **/
547
 
 
548
 
    enum {
549
 
        /* If this flag is set, operators other than CLEAR, SOURCE, or
550
 
         * OVER will be converted to OVER before being sent to cairo.
551
 
         *
552
 
         * This is most useful with a printing surface, where
553
 
         * operators such as ADD are used to avoid seams for on-screen
554
 
         * display, but where such errors aren't noticable in print.
555
 
         * This approach is currently used in border rendering.
556
 
         *
557
 
         * However, when printing complex renderings such as SVG,
558
 
         * care should be taken to clear this flag.
559
 
         */
560
 
        FLAG_SIMPLIFY_OPERATORS = (1 << 0)
561
 
    };
562
 
 
563
 
    void SetFlag(PRInt32 aFlag) { mFlags |= aFlag; }
564
 
    void ClearFlag(PRInt32 aFlag) { mFlags &= ~aFlag; }
565
 
    PRInt32 GetFlags() { return mFlags; }
566
 
 
567
 
private:
568
 
    cairo_t *mCairo;
569
 
    nsRefPtr<gfxASurface> mSurface;
570
 
    PRInt32 mFlags;
571
 
};
572
 
 
573
 
#endif /* GFX_CONTEXT_H */