1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 20 #include <unx/x11/x11cairotextrender.hxx> 21 22 #include <unx/glyphcache.hxx> 23 #include <X11/Xregion.h> 24 #include <cairo.h> 25 #include <salframe.hxx> 26 #include <salvd.hxx> 27 X11CairoTextRender(X11SalGraphics & rParent)28X11CairoTextRender::X11CairoTextRender(X11SalGraphics& rParent) 29 : mrParent(rParent) 30 { 31 } 32 getCairoContext()33cairo_t* X11CairoTextRender::getCairoContext() 34 { 35 return mrParent.getCairoContext(); 36 } 37 getSurfaceOffset(double & nDX,double & nDY)38void X11CairoTextRender::getSurfaceOffset( double& nDX, double& nDY ) 39 { 40 nDX = 0; 41 nDY = 0; 42 } 43 clipRegion(cairo_t * cr)44void X11CairoTextRender::clipRegion(cairo_t* cr) 45 { 46 Region pClipRegion = mrParent.mpClipRegion; 47 if( pClipRegion && !XEmptyRegion( pClipRegion ) ) 48 { 49 for (tools::Long i = 0; i < pClipRegion->numRects; ++i) 50 { 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); 56 } 57 cairo_clip(cr); 58 } 59 } 60 releaseCairoContext(cairo_t * cr)61void X11CairoTextRender::releaseCairoContext(cairo_t* cr) 62 { 63 X11SalGraphics::releaseCairoContext(cr); 64 } 65 66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 67