Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / tools / surfaceproxy.hxx
blob4b5862bf09677ba90fcb89e9e5d6f5accf0d0841
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_CANVAS_SOURCE_TOOLS_SURFACEPROXY_HXX
21 #define INCLUDED_CANVAS_SOURCE_TOOLS_SURFACEPROXY_HXX
23 #include <canvas/rendering/isurfaceproxy.hxx>
24 #include <canvas/rendering/icolorbuffer.hxx>
26 #include "pagemanager.hxx"
27 #include "surface.hxx"
29 namespace canvas
33 // SurfaceProxy
36 /** Definition of the surface proxy class.
38 Surface proxies are the connection between *one* source image
39 and *one or more* hardware surfaces (or textures). in a
40 logical structure surface proxies represent solely this
41 dependeny plus some simple cache management.
43 class SurfaceProxy : public ISurfaceProxy
45 public:
47 SurfaceProxy( const canvas::IColorBufferSharedPtr& pBuffer,
48 const PageManagerSharedPtr &pPageManager );
50 // ISurfaceProxy interface
51 virtual void setColorBufferDirty() SAL_OVERRIDE;
53 /** Render the surface content to screen.
55 @param fAlpha
56 Overall alpha for content
58 @param rPos
59 Output position
61 @param rTransform
62 Output transformation (does not affect output position)
64 virtual bool draw( double fAlpha,
65 const ::basegfx::B2DPoint& rPos,
66 const ::basegfx::B2DHomMatrix& rTransform ) SAL_OVERRIDE;
68 /** Render the surface content to screen.
70 @param fAlpha
71 Overall alpha for content
73 @param rPos
74 Output position
76 @param rArea
77 Subset of the surface to render. Coordinate system are
78 surface area pixel, given area will be clipped to the
79 surface bounds.
81 @param rTransform
82 Output transformation (does not affect output position)
84 virtual bool draw( double fAlpha,
85 const ::basegfx::B2DPoint& rPos,
86 const ::basegfx::B2DRange& rArea,
87 const ::basegfx::B2DHomMatrix& rTransform ) SAL_OVERRIDE;
89 /** Render the surface content to screen.
91 @param fAlpha
92 Overall alpha for content
94 @param rPos
95 Output position
97 @param rClipPoly
98 Clip polygon for the surface. The clip polygon is also
99 subject to the output transformation.
101 @param rTransform
102 Output transformation (does not affect output position)
104 virtual bool draw( double fAlpha,
105 const ::basegfx::B2DPoint& rPos,
106 const ::basegfx::B2DPolyPolygon& rClipPoly,
107 const ::basegfx::B2DHomMatrix& rTransform ) SAL_OVERRIDE;
109 private:
110 PageManagerSharedPtr mpPageManager;
112 // the pagemanager will distribute the image
113 // to one or more surfaces, this is why we
114 // need a list here.
115 std::vector<SurfaceSharedPtr> maSurfaceList;
117 // pointer to the source of image data
118 // which always is stored in system memory,
119 // 32bit rgba and can have any size.
120 canvas::IColorBufferSharedPtr mpBuffer;
123 typedef ::boost::shared_ptr< SurfaceProxy > SurfaceProxySharedPtr;
126 #endif
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */