1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_OPENGL_TEXTURE_H
21 #define INCLUDED_VCL_INC_OPENGL_TEXTURE_H
24 #include <vcl/dllapi.h>
25 #include <vcl/salgtype.hxx>
27 #include <tools/gen.hxx>
32 class ImplOpenGLTexture
41 std::unique_ptr
<std::vector
<int>> mpSlotReferences
;
44 ImplOpenGLTexture( int nWidth
, int nHeight
, bool bAllocate
);
45 ImplOpenGLTexture( int nWidth
, int nHeight
, int nFormat
, int nType
, void const * pData
);
46 ImplOpenGLTexture( int nX
, int nY
, int nWidth
, int nHeight
);
49 bool InsertBuffer(int nX
, int nY
, int nWidth
, int nHeight
, int nFormat
, int nType
, sal_uInt8
* pData
);
51 void IncreaseRefCount(int nSlotNumber
)
54 if (mpSlotReferences
&& nSlotNumber
>= 0)
56 if (mpSlotReferences
->at(nSlotNumber
) == 0)
58 mpSlotReferences
->at(nSlotNumber
)++;
62 void DecreaseRefCount(int nSlotNumber
)
65 if (mpSlotReferences
&& nSlotNumber
>= 0)
67 mpSlotReferences
->at(nSlotNumber
)--;
68 if (mpSlotReferences
->at(nSlotNumber
) == 0)
75 return mnRefCount
> 0;
78 bool InitializeSlots(int nSlotSize
);
82 class VCL_DLLPUBLIC OpenGLTexture
85 // if the rect size doesn't match the mpImpl one, this instance
86 // is a sub-area from the real OpenGL texture
88 ImplOpenGLTexture
* mpImpl
;
93 OpenGLTexture(ImplOpenGLTexture
* pImpl
, Rectangle aRectangle
, int nSlotNumber
= 0);
95 OpenGLTexture( int nWidth
, int nHeight
, bool bAllocate
= true );
96 OpenGLTexture( int nWidth
, int nHeight
, int nFormat
, int nType
, void const * pData
);
97 OpenGLTexture( int nX
, int nY
, int nWidth
, int nHeight
);
98 OpenGLTexture( const OpenGLTexture
& rTexture
);
99 OpenGLTexture( const OpenGLTexture
& rTexture
, int nX
, int nY
, int nWidth
, int nHeight
);
100 virtual ~OpenGLTexture();
102 bool IsUnique() const;
105 int GetWidth() const;
106 int GetHeight() const;
107 void GetCoord( GLfloat
* pCoord
, const SalTwoRect
& rPosAry
, bool bInverted
=false ) const;
108 void GetWholeCoord( GLfloat
* pCoord
) const;
113 void Read( GLenum nFormat
, GLenum nType
, sal_uInt8
* pData
);
115 GLenum
GetFilter() const;
116 void SetFilter( GLenum nFilter
);
118 operator bool() const;
119 OpenGLTexture
& operator=( const OpenGLTexture
& rTexture
);
120 bool operator==( const OpenGLTexture
& rTexture
) const;
121 bool operator!=( const OpenGLTexture
& rTexture
) const;
124 #endif // INCLUDED_VCL_INC_OPENGL_TEXTURE_H
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */