bump product version to 6.4.0.3
[LibreOffice.git] / vcl / inc / opengl / salbmp.hxx
blobad00ff486b8fba19688dd46d9960f4c510ca74c0
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_OPENGL_SALBMP_H
21 #define INCLUDED_VCL_INC_OPENGL_SALBMP_H
23 #include <vcl/opengl/OpenGLContext.hxx>
25 #include <opengl/texture.hxx>
27 #include <salbmp.hxx>
29 #include <memory>
31 struct BitmapBuffer;
32 class BitmapPalette;
33 namespace vcl
35 class Kernel;
38 class VCL_PLUGIN_PUBLIC OpenGLSalBitmap : public SalBitmap
40 private:
41 OpenGLTexture maTexture;
42 bool mbDirtyTexture;
43 BitmapPalette maPalette;
44 std::shared_ptr<sal_uInt8> mpUserBuffer;
45 sal_uInt16 mnBits;
46 sal_uInt32 mnBytesPerRow;
47 int mnWidth;
48 int mnHeight;
50 virtual void updateChecksum() const override;
52 bool calcChecksumGL(OpenGLTexture& rInputTexture, BitmapChecksum& rChecksum) const;
54 public:
55 OpenGLSalBitmap();
56 virtual ~OpenGLSalBitmap() override;
58 public:
60 // SalBitmap methods
61 bool Create( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal ) override;
62 bool Create( const SalBitmap& rSalBmp ) override;
63 bool Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) override;
64 bool Create( const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount ) override;
65 virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas,
66 Size& rSize,
67 bool bMask = false ) override;
69 void Destroy() final override;
71 Size GetSize() const override;
72 sal_uInt16 GetBitCount() const override;
74 BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) override;
75 void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
77 bool GetSystemData( BitmapSystemData& rData ) override;
79 bool ScalingSupported() const override;
80 bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) override;
81 bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol ) override;
82 bool ConvertToGreyscale() override;
84 public:
86 void Create( const OpenGLTexture& rTex, long nX, long nY, long nWidth, long nHeight );
87 OpenGLTexture& GetTexture() const;
88 const BitmapPalette& GetBitmapPalette() const { return maPalette; }
90 private:
92 GLuint CreateTexture();
93 bool AllocateUserData();
94 void DeallocateUserData();
95 bool ReadTexture();
97 private:
99 bool ImplScaleFilter( const rtl::Reference< OpenGLContext > &xContext, const double& rScaleX, const double& rScaleY, GLenum nFilter );
100 static void ImplCreateKernel( const double& fScale, const vcl::Kernel& rKernel, GLfloat*& pWeights, sal_uInt32& aKernelSize );
101 bool ImplScaleConvolution(const rtl::Reference< OpenGLContext > &xContext, const double& rScaleX, const double& rScaleY, const vcl::Kernel& rKernel);
102 bool ImplScaleArea( const rtl::Reference< OpenGLContext > &xContext,
103 double rScaleX, double rScaleY );
105 public:
107 void ImplScale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag );
110 #endif // INCLUDED_VCL_INC_OPENGL_SALBMP_H
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */