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