1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef INCLUDED_CANVAS_SURFACEPROXY_HXX 29 #define INCLUDED_CANVAS_SURFACEPROXY_HXX 30 31 #include <canvas/rendering/isurfaceproxy.hxx> 32 #include <canvas/rendering/icolorbuffer.hxx> 33 34 #include "pagemanager.hxx" 35 #include "surface.hxx" 36 37 namespace canvas 38 { 39 40 ////////////////////////////////////////////////////////////////////////////////// 41 // SurfaceProxy 42 ////////////////////////////////////////////////////////////////////////////////// 43 44 /** Definition of the surface proxy class. 45 46 Surface proxies are the connection between *one* source image 47 and *one or more* hardware surfaces (or textures). in a 48 logical structure surface proxies represent soley this 49 dependeny plus some simple cache management. 50 */ 51 class SurfaceProxy : public ISurfaceProxy 52 { 53 public: 54 55 SurfaceProxy( const canvas::IColorBufferSharedPtr& pBuffer, 56 const PageManagerSharedPtr &pPageManager ); 57 58 // ISurfaceProxy interface 59 virtual void setColorBufferDirty(); 60 61 /** Render the surface content to screen. 62 63 @param fAlpha 64 Overall alpha for content 65 66 @param rPos 67 Output position 68 69 @param rTransform 70 Output transformation (does not affect output position) 71 */ 72 virtual bool draw( double fAlpha, 73 const ::basegfx::B2DPoint& rPos, 74 const ::basegfx::B2DHomMatrix& rTransform ); 75 76 /** Render the surface content to screen. 77 78 @param fAlpha 79 Overall alpha for content 80 81 @param rPos 82 Output position 83 84 @param rArea 85 Subset of the surface to render. Coordinate system are 86 surface area pixel, given area will be clipped to the 87 surface bounds. 88 89 @param rTransform 90 Output transformation (does not affect output position) 91 */ 92 virtual bool draw( double fAlpha, 93 const ::basegfx::B2DPoint& rPos, 94 const ::basegfx::B2DRange& rArea, 95 const ::basegfx::B2DHomMatrix& rTransform ); 96 97 /** Render the surface content to screen. 98 99 @param fAlpha 100 Overall alpha for content 101 102 @param rPos 103 Output position 104 105 @param rClipPoly 106 Clip polygon for the surface. The clip polygon is also 107 subject to the output transformation. 108 109 @param rTransform 110 Output transformation (does not affect output position) 111 */ 112 virtual bool draw( double fAlpha, 113 const ::basegfx::B2DPoint& rPos, 114 const ::basegfx::B2DPolyPolygon& rClipPoly, 115 const ::basegfx::B2DHomMatrix& rTransform ); 116 117 private: 118 PageManagerSharedPtr mpPageManager; 119 120 // the pagemanager will distribute the image 121 // to one or more surfaces, this is why we 122 // need a list here. 123 std::vector<SurfaceSharedPtr> maSurfaceList; 124 125 // pointer to the source of image data 126 // which always is stored in system memory, 127 // 32bit rgba and can have any size. 128 canvas::IColorBufferSharedPtr mpBuffer; 129 }; 130 131 typedef ::boost::shared_ptr< SurfaceProxy > SurfaceProxySharedPtr; 132 } 133 134 #endif 135