root/trunk/WebCore/svg/graphics/cairo/SVGPaintServerCairo.cpp

Revision 29663, 1.9 KB (checked in by darin@apple.com, 11 months ago)

set eol-style to native on tons of files to head off future mixed-line-ending problems

  • Property svn:eol-style set to native
Line 
1/*
2 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB.  If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#include "config.h"
21
22#if ENABLE(SVG)
23#include "SVGPaintServer.h"
24
25#include "GraphicsContext.h"
26#include "SVGPaintServer.h"
27#include "RenderPath.h"
28
29#include <cairo.h>
30
31namespace WebCore {
32
33void SVGPaintServer::draw(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const
34{
35    if (!setup(context, path, type))
36        return;
37
38    renderPath(context, path, type);
39    teardown(context, path, type);
40}
41
42void SVGPaintServer::teardown(GraphicsContext*&, const RenderObject*, SVGPaintTargetType, bool isPaintingText) const
43{
44    // no-op
45}
46
47void SVGPaintServer::renderPath(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const
48{
49    cairo_t* cr = context->platformContext();
50    const SVGRenderStyle* style = path->style()->svgStyle();
51
52    cairo_set_fill_rule(cr, style->fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
53
54    if ((type & ApplyToFillTargetType) && style->hasFill())
55        cairo_fill_preserve(cr);
56
57    if ((type & ApplyToStrokeTargetType) && style->hasStroke())
58        cairo_stroke_preserve(cr);
59
60    cairo_new_path(cr);
61}
62
63} // namespace WebCore
64
65#endif
Note: See TracBrowser for help on using the browser.