nss: upgrade to release 3.73
[LibreOffice.git] / vcl / unx / generic / gdi / x11cairotextrender.cxx
blobd49d932656ee7cbf86bd36a6ed3d612ed3bf6073
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <unx/x11/x11cairotextrender.hxx>
22 #include <unx/glyphcache.hxx>
23 #include <X11/Xregion.h>
24 #include <cairo.h>
25 #include <salframe.hxx>
26 #include <salvd.hxx>
28 X11CairoTextRender::X11CairoTextRender(X11SalGraphics& rParent)
29 : mrParent(rParent)
33 cairo_t* X11CairoTextRender::getCairoContext()
35 return mrParent.getCairoContext();
38 void X11CairoTextRender::getSurfaceOffset( double& nDX, double& nDY )
40 nDX = 0;
41 nDY = 0;
44 void X11CairoTextRender::clipRegion(cairo_t* cr)
46 Region pClipRegion = mrParent.mpClipRegion;
47 if( pClipRegion && !XEmptyRegion( pClipRegion ) )
49 for (tools::Long i = 0; i < pClipRegion->numRects; ++i)
51 cairo_rectangle(cr,
52 pClipRegion->rects[i].x1,
53 pClipRegion->rects[i].y1,
54 pClipRegion->rects[i].x2 - pClipRegion->rects[i].x1,
55 pClipRegion->rects[i].y2 - pClipRegion->rects[i].y1);
57 cairo_clip(cr);
61 size_t X11CairoTextRender::GetWidth() const
63 SalGeometryProvider *pProvider = mrParent.m_pFrame;
64 if( !pProvider )
65 pProvider = mrParent.m_pVDev;
67 if( pProvider )
68 return pProvider->GetWidth();
69 else
70 return 1;
73 size_t X11CairoTextRender::GetHeight() const
75 SalGeometryProvider *pProvider = mrParent.m_pFrame;
76 if( !pProvider )
77 pProvider = mrParent.m_pVDev;
79 if( pProvider )
80 return pProvider->GetHeight();
81 else
82 return 1;
85 void X11CairoTextRender::releaseCairoContext(cairo_t* cr)
87 X11SalGraphics::releaseCairoContext(cr);
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */