diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/platform/graphics/cairo/CairoUtilities.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/platform/graphics/cairo/CairoUtilities.h')
-rw-r--r-- | Source/WebCore/platform/graphics/cairo/CairoUtilities.h | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/Source/WebCore/platform/graphics/cairo/CairoUtilities.h b/Source/WebCore/platform/graphics/cairo/CairoUtilities.h index df3680c01..9528e0210 100644 --- a/Source/WebCore/platform/graphics/cairo/CairoUtilities.h +++ b/Source/WebCore/platform/graphics/cairo/CairoUtilities.h @@ -11,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -24,8 +24,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CairoUtilities_h -#define CairoUtilities_h +#pragma once + +#if USE(CAIRO) #include "GraphicsTypes.h" #include "IntSize.h" @@ -34,6 +35,10 @@ // This function was added pretty much simultaneous to when 1.13 was branched. #define HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE CAIRO_VERSION_MAJOR > 1 || (CAIRO_VERSION_MAJOR == 1 && CAIRO_VERSION_MINOR >= 13) +#if USE(FREETYPE) +#include <cairo-ft.h> +#endif + namespace WebCore { class AffineTransform; class Color; @@ -42,6 +47,32 @@ class FloatPoint; class IntSize; class IntRect; class Path; +class Region; + +#if USE(FREETYPE) +class CairoFtFaceLocker { +public: + CairoFtFaceLocker(cairo_scaled_font_t* scaledFont) + : m_scaledFont(scaledFont) + , m_ftFace(cairo_ft_scaled_font_lock_face(scaledFont)) + { + } + + ~CairoFtFaceLocker() + { + if (m_ftFace) + cairo_ft_scaled_font_unlock_face(m_scaledFont); + } + + FT_Face ftFace() const { return m_ftFace; } + +private: + cairo_scaled_font_t* m_scaledFont { nullptr }; + FT_Face m_ftFace { nullptr }; +}; + +const cairo_font_options_t* getDefaultCairoFontOptions(); +#endif void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr); void setSourceRGBAFromColor(cairo_t*, const Color&); @@ -49,18 +80,21 @@ void appendPathToCairoContext(cairo_t* to, cairo_t* from); void setPathOnCairoContext(cairo_t* to, cairo_t* from); void appendWebCorePathToCairoContext(cairo_t* context, const Path& path); void appendRegionToCairoContext(cairo_t*, const cairo_region_t*); -cairo_operator_t toCairoOperator(CompositeOperator op); -cairo_operator_t toCairoOperator(BlendMode blendOp); +cairo_operator_t toCairoOperator(CompositeOperator, BlendMode = BlendModeNormal); void drawPatternToCairoContext(cairo_t* cr, cairo_surface_t* image, const IntSize& imageSize, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, cairo_operator_t op, const FloatRect& destRect); -PassRefPtr<cairo_surface_t> copyCairoImageSurface(cairo_surface_t*); +RefPtr<cairo_surface_t> copyCairoImageSurface(cairo_surface_t*); void copyRectFromCairoSurfaceToContext(cairo_surface_t* from, cairo_t* to, const IntSize& offset, const IntRect&); void copyRectFromOneSurfaceToAnother(cairo_surface_t* from, cairo_surface_t* to, const IntSize& offset, const IntRect&, const IntSize& = IntSize(), cairo_operator_t = CAIRO_OPERATOR_OVER); IntSize cairoSurfaceSize(cairo_surface_t*); +void flipImageSurfaceVertically(cairo_surface_t*); void cairoSurfaceSetDeviceScale(cairo_surface_t*, double xScale, double yScale); +void cairoSurfaceGetDeviceScale(cairo_surface_t*, double& xScale, double& yScale); + +RefPtr<cairo_region_t> toCairoRegion(const Region&); } // namespace WebCore -#endif // CairoUtilities_h +#endif // USE(CAIRO) |