Avoid potential negative array index access to cached text.
[LibreOffice.git] / vcl / inc / headless / svpvd.hxx
blobf1666b689aca74e45a86af5315e50693e1ddb1d1
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 #ifndef INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX
21 #define INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX
23 #include <salvd.hxx>
24 #include <basegfx/vector/b2ivector.hxx>
26 #include <vector>
28 class SvpSalGraphics;
29 typedef struct _cairo_surface cairo_surface_t;
31 class VCL_DLLPUBLIC SvpSalVirtualDevice : public SalVirtualDevice
33 cairo_surface_t* m_pRefSurface;
34 cairo_surface_t* m_pSurface;
35 bool m_bOwnsSurface; // nearly always true, except for edge case of tdf#127529
36 basegfx::B2IVector m_aFrameSize;
37 std::vector< SvpSalGraphics* > m_aGraphics;
39 bool CreateSurface(tools::Long nNewDX, tools::Long nNewDY, sal_uInt8 *const pBuffer);
41 protected:
42 SvpSalGraphics* AddGraphics(SvpSalGraphics* aGraphics);
44 public:
45 SvpSalVirtualDevice(cairo_surface_t* pRefSurface, cairo_surface_t* pPreExistingTarget);
46 virtual ~SvpSalVirtualDevice() override;
48 // SalVirtualDevice
49 virtual SalGraphics* AcquireGraphics() override;
50 virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
52 virtual bool SetSize( tools::Long nNewDX, tools::Long nNewDY ) override;
53 virtual bool SetSizeUsingBuffer( tools::Long nNewDX, tools::Long nNewDY,
54 sal_uInt8 * pBuffer
55 ) override;
57 cairo_surface_t* GetSurface() const { return m_pSurface; }
59 // SalGeometryProvider
60 virtual tools::Long GetWidth() const override;
61 virtual tools::Long GetHeight() const override;
64 #endif // INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */