Source/WebCore/ChangeLog

 12020-03-09 Carlos Garcia Campos <cgarcia@igalia.com>
 2
 3 [Cairo] Remove PlatformPathCairo
 4 https://bugs.webkit.org/show_bug.cgi?id=208807
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 We have a class CairoPath defined in PlatformPathCairo.h that simply wraps a cairo_t. We can use the cairo_t
 9 directly as PlatformPath and simplify the cairo path implementation.
 10
 11 * platform/SourcesCairo.txt:
 12 * platform/graphics/Path.h:
 13 (WebCore::Path::platformPath const):
 14 * platform/graphics/cairo/CairoOperations.cpp:
 15 (WebCore::Cairo::fillRectWithRoundedHole):
 16 (WebCore::Cairo::fillPath):
 17 (WebCore::Cairo::strokePath):
 18 (WebCore::Cairo::clipPath):
 19 * platform/graphics/cairo/CairoUtilities.cpp:
 20 (WebCore::appendWebCorePathToCairoContext):
 21 * platform/graphics/cairo/FontCairo.cpp:
 22 (WebCore::Font::platformPathForGlyph const):
 23 * platform/graphics/cairo/PathCairo.cpp:
 24 (WebCore::Path::Path):
 25 (WebCore::Path::ensurePlatformPath):
 26 (WebCore::Path::operator=):
 27 (WebCore::Path::clear):
 28 (WebCore::Path::isEmptySlowCase const):
 29 (WebCore::Path::currentPointSlowCase const):
 30 (WebCore::Path::translate):
 31 (WebCore::Path::moveToSlowCase):
 32 (WebCore::Path::addLineToSlowCase):
 33 (WebCore::Path::addRect):
 34 (WebCore::Path::addQuadCurveTo):
 35 (WebCore::Path::addBezierCurveTo):
 36 (WebCore::Path::addArcSlowCase):
 37 (WebCore::Path::addArcTo):
 38 (WebCore::Path::addEllipse):
 39 (WebCore::Path::addPath):
 40 (WebCore::Path::closeSubpath):
 41 (WebCore::Path::boundingRectSlowCase const):
 42 (WebCore::Path::strokeBoundingRect const):
 43 (WebCore::Path::contains const):
 44 (WebCore::Path::strokeContains const):
 45 (WebCore::Path::applySlowCase const):
 46 (WebCore::Path::transform):
 47 * platform/graphics/cairo/PlatformPathCairo.cpp: Removed.
 48 * platform/graphics/cairo/PlatformPathCairo.h: Removed.
 49
1502020-03-07 Darin Adler <darin@apple.com>
251
352 Begin moving off of live ranges for WebKit internals

Source/WebCore/platform/SourcesCairo.txt

@@platform/graphics/cairo/NativeImageCairo.cpp
4040platform/graphics/cairo/PathCairo.cpp
4141platform/graphics/cairo/PatternCairo.cpp
4242platform/graphics/cairo/PlatformContextCairo.cpp
43 platform/graphics/cairo/PlatformPathCairo.cpp
4443platform/graphics/cairo/RefPtrCairo.cpp

Source/WebCore/platform/graphics/Path.h

@@class PlatformContextDirect2D;
5555}
5656
5757#elif USE(CAIRO)
 58#include "RefPtrCairo.h"
5859
59 namespace WebCore {
60 class CairoPath;
61 }
62 typedef WebCore::CairoPath PlatformPath;
 60// cairo_path_fixed_t isn't exposed in Cairo's public API, so we need to use context.
 61typedef cairo_t PlatformPath;
6362
6463#elif USE(WINGDI)
6564

@@typedef PlatformPath* PlatformPathPtr;
8079using PlatformPathStorageType = RetainPtr<CGMutablePathRef>;
8180#elif USE(DIRECT2D)
8281using PlatformPathStorageType = COMPtr<ID2D1GeometryGroup>;
 82#elif USE(CAIRO)
 83using PlatformPathStorageType = RefPtr<cairo_t>;
8384#else
8485using PlatformPathStorageType = PlatformPathPtr;
8586#endif

@@public:
188189 PlatformPathPtr platformPath() const { return m_path.get(); }
189190#elif USE(CG)
190191 WEBCORE_EXPORT PlatformPathPtr platformPath() const;
 192#elif USE(CAIRO)
 193 PlatformPathPtr platformPath() const { return m_path.get(); }
191194#else
192195 PlatformPathPtr platformPath() const { return m_path; }
193196#endif

Source/WebCore/platform/graphics/cairo/CairoOperations.cpp

4646#include "ImageBuffer.h"
4747#include "Path.h"
4848#include "PlatformContextCairo.h"
49 #include "PlatformPathCairo.h"
5049#include "ShadowBlur.h"
5150#include <algorithm>
5251#include <cairo.h>

@@void fillRectWithRoundedHole(PlatformContextCairo& platformContext, const FloatR
780779 cairo_t* cr = platformContext.cr();
781780
782781 cairo_save(cr);
783  setPathOnCairoContext(platformContext.cr(), path.platformPath()->context());
 782 setPathOnCairoContext(platformContext.cr(), path.platformPath());
784783 fillCurrentCairoPath(platformContext, fillSource);
785784 cairo_restore(cr);
786785}

@@void fillPath(PlatformContextCairo& platformContext, const Path& path, const Fil
789788{
790789 cairo_t* cr = platformContext.cr();
791790
792  setPathOnCairoContext(cr, path.platformPath()->context());
 791 setPathOnCairoContext(cr, path.platformPath());
793792 drawPathShadow(platformContext, fillSource, { }, shadowState, Fill);
794793 fillCurrentCairoPath(platformContext, fillSource);
795794}

@@void strokePath(PlatformContextCairo& platformContext, const Path& path, const S
812811{
813812 cairo_t* cr = platformContext.cr();
814813
815  setPathOnCairoContext(cr, path.platformPath()->context());
 814 setPathOnCairoContext(cr, path.platformPath());
816815 drawPathShadow(platformContext, { }, strokeSource, shadowState, Stroke);
817816 prepareForStroking(cr, strokeSource, PreserveAlpha);
818817 cairo_stroke(cr);

@@void clipPath(PlatformContextCairo& platformContext, const Path& path, WindRule
12851284 cairo_t* cr = platformContext.cr();
12861285
12871286 if (!path.isNull())
1288  setPathOnCairoContext(cr, path.platformPath()->context());
 1287 setPathOnCairoContext(cr, path.platformPath());
12891288
12901289 cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
12911290 cairo_set_fill_rule(cr, clipRule == WindRule::EvenOdd ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);

Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp

3535#include "FloatRect.h"
3636#include "IntRect.h"
3737#include "Path.h"
38 #include "PlatformPathCairo.h"
3938#include "RefPtrCairo.h"
4039#include "Region.h"
4140#include <wtf/Assertions.h>

@@void appendWebCorePathToCairoContext(cairo_t* context, const Path& path)
109108{
110109 if (path.isEmpty())
111110 return;
112  appendPathToCairoContext(context, path.platformPath()->context());
 111 appendPathToCairoContext(context, path.platformPath());
113112}
114113
115114void appendRegionToCairoContext(cairo_t* to, const cairo_region_t* region)

Source/WebCore/platform/graphics/cairo/FontCairo.cpp

4343#include "ImageBuffer.h"
4444#include "Pattern.h"
4545#include "PlatformContextCairo.h"
46 #include "PlatformPathCairo.h"
4746#include "ShadowBlur.h"
4847
4948namespace WebCore {

@@void FontCascade::drawGlyphs(GraphicsContext& context, const Font& font, const G
8382Path Font::platformPathForGlyph(Glyph glyph) const
8483{
8584 Path path;
86  path.ensurePlatformPath();
 85 cairo_t* cr = path.ensurePlatformPath();
8786
8887 cairo_glyph_t cairoGlyph = { glyph, 0, 0 };
89  cairo_set_scaled_font(path.platformPath()->context(), platformData().scaledFont());
90  cairo_glyph_path(path.platformPath()->context(), &cairoGlyph, 1);
 88 cairo_set_scaled_font(cr, platformData().scaledFont());
 89 cairo_glyph_path(cr, &cairoGlyph, 1);
9190
9291 float syntheticBoldOffset = this->syntheticBoldOffset();
9392 if (syntheticBoldOffset) {
94  cairo_translate(path.platformPath()->context(), syntheticBoldOffset, 0);
95  cairo_glyph_path(path.platformPath()->context(), &cairoGlyph, 1);
 93 cairo_translate(cr, syntheticBoldOffset, 0);
 94 cairo_glyph_path(cr, &cairoGlyph, 1);
9695 }
9796 return path;
9897}

Source/WebCore/platform/graphics/cairo/PathCairo.cpp

55 2005, 2007 Apple Inc. All Rights reserved.
66 2007 Alp Toker <alp@atoker.com>
77 2008 Dirk Schulze <krit@webkit.org>
8  2011 Igalia S.L.
 8 2011, 2020 Igalia S.L.
99
1010 This library is free software; you can redistribute it and/or
1111 modify it under the terms of the GNU Library General Public

3131#include "CairoUtilities.h"
3232#include "FloatRect.h"
3333#include "GraphicsContextImplCairo.h"
34 #include "PlatformPathCairo.h"
3534#include "StrokeStyleApplier.h"
3635#include <math.h>
3736#include <wtf/MathExtras.h>

3938
4039namespace WebCore {
4140
42 Path::Path()
43  : m_path(0)
44 {
45 }
 41Path::Path() = default;
4642
47 Path::~Path()
48 {
49  if (m_path)
50  delete m_path;
51 }
 43Path::~Path() = default;
5244
5345Path::Path(const Path& other)
54  : m_path(0)
5546{
5647 if (other.isNull())
5748 return;
5849
59  cairo_t* cr = ensurePlatformPath()->context();
60  auto pathCopy = cairo_copy_path(other.platformPath()->context());
 50 cairo_t* cr = ensurePlatformPath();
 51 auto pathCopy = cairo_copy_path(other.platformPath());
6152 cairo_append_path(cr, pathCopy);
6253 cairo_path_destroy(pathCopy);
6354}
64 
 55
6556Path::Path(Path&& other)
6657{
6758 m_path = other.m_path;

@@Path::Path(Path&& other)
7061
7162PlatformPathPtr Path::ensurePlatformPath()
7263{
73  if (!m_path)
74  m_path = new CairoPath();
75  return m_path;
 64 if (!m_path) {
 65 RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_A8, 1, 1));
 66 m_path = adoptRef(cairo_create(surface.get()));
 67 }
 68 return m_path.get();
7669}
7770
7871Path& Path::operator=(const Path& other)

@@Path& Path::operator=(const Path& other)
8174 return *this;
8275
8376 if (other.isNull()) {
84  if (m_path) {
85  delete m_path;
86  m_path = 0;
87  }
88  } else {
89  clear();
90  cairo_t* cr = ensurePlatformPath()->context();
91  auto pathCopy = cairo_copy_path(other.platformPath()->context());
92  cairo_append_path(cr, pathCopy);
93  cairo_path_destroy(pathCopy);
 77 m_path = nullptr;
 78 return *this;
9479 }
9580
 81 clear();
 82 cairo_t* cr = ensurePlatformPath();
 83 auto pathCopy = cairo_copy_path(other.platformPath());
 84 cairo_append_path(cr, pathCopy);
 85 cairo_path_destroy(pathCopy);
 86
9687 return *this;
9788}
98 
 89
9990Path& Path::operator=(Path&& other)
10091{
10192 if (this == &other)
10293 return *this;
103  if (m_path)
104  delete m_path;
 94
10595 m_path = other.m_path;
10696 other.m_path = nullptr;
10797 return *this;

@@void Path::clear()
112102 if (isNull())
113103 return;
114104
115  cairo_t* cr = platformPath()->context();
116  cairo_identity_matrix(cr);
117  cairo_new_path(cr);
 105 cairo_identity_matrix(m_path.get());
 106 cairo_new_path(m_path.get());
118107}
119108
120109bool Path::isEmptySlowCase() const
121110{
122  return !cairo_has_current_point(platformPath()->context());
 111 return !cairo_has_current_point(m_path.get());
123112}
124113
125114FloatPoint Path::currentPointSlowCase() const
126115{
 116 ASSERT(m_path);
127117 // FIXME: Is this the correct way?
128118 double x;
129119 double y;
130  cairo_get_current_point(platformPath()->context(), &x, &y);
 120 cairo_get_current_point(m_path.get(), &x, &y);
131121 return FloatPoint(x, y);
132122}
133123
134124void Path::translate(const FloatSize& p)
135125{
136  cairo_t* cr = ensurePlatformPath()->context();
137  cairo_translate(cr, -p.width(), -p.height());
 126 cairo_translate(ensurePlatformPath(), -p.width(), -p.height());
138127}
139128
140129void Path::moveToSlowCase(const FloatPoint& p)
141130{
142  cairo_t* cr = ensurePlatformPath()->context();
143  cairo_move_to(cr, p.x(), p.y());
 131 cairo_move_to(ensurePlatformPath(), p.x(), p.y());
144132}
145133
146134void Path::addLineToSlowCase(const FloatPoint& p)
147135{
148  cairo_t* cr = ensurePlatformPath()->context();
149  cairo_line_to(cr, p.x(), p.y());
 136 cairo_line_to(ensurePlatformPath(), p.x(), p.y());
150137}
151138
152139void Path::addRect(const FloatRect& rect)
153140{
154  cairo_t* cr = ensurePlatformPath()->context();
155  cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
 141 cairo_rectangle(ensurePlatformPath(), rect.x(), rect.y(), rect.width(), rect.height());
156142}
157143
158 /*
159  * inspired by libsvg-cairo
160  */
161144void Path::addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& point)
162145{
163  cairo_t* cr = ensurePlatformPath()->context();
164146 double x, y;
165147 double x1 = controlPoint.x();
166148 double y1 = controlPoint.y();
167149 double x2 = point.x();
168150 double y2 = point.y();
 151 cairo_t* cr = ensurePlatformPath();
169152 cairo_get_current_point(cr, &x, &y);
170153 cairo_curve_to(cr,
171  x + 2.0 / 3.0 * (x1 - x), y + 2.0 / 3.0 * (y1 - y),
172  x2 + 2.0 / 3.0 * (x1 - x2), y2 + 2.0 / 3.0 * (y1 - y2),
173  x2, y2);
 154 x + 2.0 / 3.0 * (x1 - x), y + 2.0 / 3.0 * (y1 - y),
 155 x2 + 2.0 / 3.0 * (x1 - x2), y2 + 2.0 / 3.0 * (y1 - y2),
 156 x2, y2);
174157}
175158
176159void Path::addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint& controlPoint3)
177160{
178  cairo_t* cr = ensurePlatformPath()->context();
179  cairo_curve_to(cr, controlPoint1.x(), controlPoint1.y(),
180  controlPoint2.x(), controlPoint2.y(),
181  controlPoint3.x(), controlPoint3.y());
 161 cairo_curve_to(ensurePlatformPath(), controlPoint1.x(), controlPoint1.y(),
 162 controlPoint2.x(), controlPoint2.y(), controlPoint3.x(), controlPoint3.y());
182163}
183164
184165void Path::addArcSlowCase(const FloatPoint& p, float r, float startAngle, float endAngle, bool anticlockwise)
185166{
186  cairo_t* cr = ensurePlatformPath()->context();
 167 cairo_t* cr = ensurePlatformPath();
187168 float sweep = endAngle - startAngle;
188169 const float twoPI = 2 * piFloat;
189170 if ((sweep <= -twoPI || sweep >= twoPI)

@@void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
213194 if (isEmpty())
214195 return;
215196
216  cairo_t* cr = platformPath()->context();
217 
 197 cairo_t* cr = platformPath();
218198 double x0, y0;
219199 cairo_get_current_point(cr, &x0, &y0);
220200 FloatPoint p0(x0, y0);

@@void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
231211 FloatPoint p1p2((p2.x() - p1.x()),(p2.y() - p1.y()));
232212 float p1p0_length = std::hypot(p1p0.x(), p1p0.y());
233213 float p1p2_length = std::hypot(p1p2.x(), p1p2.y());
234 
235214 double cos_phi = (p1p0.x() * p1p2.x() + p1p0.y() * p1p2.y()) / (p1p0_length * p1p2_length);
236215 // all points on a line logic
237216 if (cos_phi == -1) {

@@void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
290269
291270void Path::addEllipse(FloatPoint point, float radiusX, float radiusY, float rotation, float startAngle, float endAngle, bool anticlockwise)
292271{
293  cairo_t* cr = ensurePlatformPath()->context();
 272 cairo_t* cr = ensurePlatformPath();
294273 cairo_save(cr);
295274 cairo_translate(cr, point.x(), point.y());
296275 cairo_rotate(cr, rotation);

@@void Path::addEllipse(FloatPoint point, float radiusX, float radiusY, float rota
306285
307286void Path::addEllipse(const FloatRect& rect)
308287{
309  cairo_t* cr = ensurePlatformPath()->context();
 288 cairo_t* cr = ensurePlatformPath();
310289 cairo_save(cr);
311290 float yRadius = .5 * rect.height();
312291 float xRadius = .5 * rect.width();

@@void Path::addPath(const Path& path, const AffineTransform& transform)
325304 if (cairo_matrix_invert(&matrix) != CAIRO_STATUS_SUCCESS)
326305 return;
327306
328  cairo_t* cr = path.platformPath()->context();
 307 cairo_t* cr = path.platformPath();
329308 cairo_save(cr);
330309 cairo_transform(cr, &matrix);
331310 auto pathCopy = cairo_copy_path(cr);
332311 cairo_restore(cr);
333  cairo_append_path(ensurePlatformPath()->context(), pathCopy);
 312 cairo_append_path(ensurePlatformPath(), pathCopy);
334313 cairo_path_destroy(pathCopy);
335314}
336315
337316void Path::closeSubpath()
338317{
339  cairo_t* cr = ensurePlatformPath()->context();
340  cairo_close_path(cr);
 318 cairo_close_path(ensurePlatformPath());
341319}
342320
343321FloatRect Path::boundingRectSlowCase() const
344322{
345  cairo_t* cr = platformPath()->context();
 323 ASSERT(m_path);
346324 double x0, x1, y0, y1;
347  cairo_path_extents(cr, &x0, &y0, &x1, &y1);
 325 cairo_path_extents(m_path.get(), &x0, &y0, &x1, &y1);
348326 return FloatRect(x0, y0, x1 - x0, y1 - y0);
349327}
350328

@@FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) const
354332 if (isNull())
355333 return FloatRect();
356334
357  cairo_t* cr = platformPath()->context();
 335 ASSERT(m_path);
358336 if (applier) {
359  GraphicsContext gc(GraphicsContextImplCairo::createFactory(cr));
 337 GraphicsContext gc(GraphicsContextImplCairo::createFactory(m_path.get()));
360338 applier->strokeStyle(&gc);
361339 }
362340
363341 double x0, x1, y0, y1;
364  cairo_stroke_extents(cr, &x0, &y0, &x1, &y1);
 342 cairo_stroke_extents(m_path.get(), &x0, &y0, &x1, &y1);
365343 return FloatRect(x0, y0, x1 - x0, y1 - y0);
366344}
367345

@@bool Path::contains(const FloatPoint& point, WindRule rule) const
369347{
370348 if (isNull() || !std::isfinite(point.x()) || !std::isfinite(point.y()))
371349 return false;
372  cairo_t* cr = platformPath()->context();
373  cairo_fill_rule_t cur = cairo_get_fill_rule(cr);
374  cairo_set_fill_rule(cr, rule == WindRule::EvenOdd ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
375  bool contains = cairo_in_fill(cr, point.x(), point.y());
376  cairo_set_fill_rule(cr, cur);
 350
 351 ASSERT(m_path);
 352 cairo_fill_rule_t cur = cairo_get_fill_rule(m_path.get());
 353 cairo_set_fill_rule(m_path.get(), rule == WindRule::EvenOdd ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
 354 bool contains = cairo_in_fill(m_path.get(), point.x(), point.y());
 355 cairo_set_fill_rule(m_path.get(), cur);
377356 return contains;
378357}
379358

@@bool Path::strokeContains(StrokeStyleApplier& applier, const FloatPoint& point)
382361 if (isNull())
383362 return false;
384363
385  cairo_t* cr = platformPath()->context();
 364 ASSERT(m_path);
386365 {
387  GraphicsContext graphicsContext(GraphicsContextImplCairo::createFactory(cr));
 366 GraphicsContext graphicsContext(GraphicsContextImplCairo::createFactory(m_path.get()));
388367 applier.strokeStyle(&graphicsContext);
389368 }
390369
391  return cairo_in_stroke(cr, point.x(), point.y());
 370 return cairo_in_stroke(m_path.get(), point.x(), point.y());
392371}
393372
394373void Path::applySlowCase(const PathApplierFunction& function) const
395374{
396  cairo_t* cr = platformPath()->context();
397  auto pathCopy = cairo_copy_path(cr);
 375 ASSERT(m_path);
 376 auto pathCopy = cairo_copy_path(m_path.get());
398377 cairo_path_data_t* data;
399378 PathElement pathElement;
400379

@@FloatRect Path::fastBoundingRectSlowCase() const
434413
435414void Path::transform(const AffineTransform& transform)
436415{
437  cairo_t* cr = ensurePlatformPath()->context();
438416 cairo_matrix_t matrix = toCairoMatrix(transform);
439417 cairo_matrix_invert(&matrix);
440  cairo_transform(cr, &matrix);
 418 cairo_transform(ensurePlatformPath(), &matrix);
441419}
442420
443421bool Path::isNull() const

Source/WebCore/platform/graphics/cairo/PlatformPathCairo.cpp

1 /*
2  * Copyright (C) 2011 Collabora Ltd.
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 #include "PlatformPathCairo.h"
22 
23 #if USE(CAIRO)
24 
25 #include <cairo.h>
26 
27 namespace WebCore {
28 
29 CairoPath::CairoPath()
30 {
31  // cairo_t takes its own reference of the surface, meaning we don't have to keep one.
32  auto surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_A8, 1, 1));
33  m_context = adoptRef(cairo_create(surface.get()));
34 }
35 
36 } // namespace WebCore
37 
38 #endif // USE(CAIRO)

Source/WebCore/platform/graphics/cairo/PlatformPathCairo.h

1 /*
2  * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk>
3  * Copyright (C) 2010 Igalia S.L.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #pragma once
22 
23 #if USE(CAIRO)
24 
25 #include "RefPtrCairo.h"
26 
27 namespace WebCore {
28 
29 // This is necessary since cairo_path_fixed_t isn't exposed in Cairo's public API.
30 class CairoPath {
31 public:
32  CairoPath();
33  ~CairoPath() = default;
34 
35  cairo_t* context() { return m_context.get(); }
36 
37 private:
38  RefPtr<cairo_t> m_context;
39 };
40 
41 } // namespace WebCore
42 
43 #endif // USE(CAIRO)