nss: upgrade to release 3.73
[LibreOffice.git] / vcl / inc / opengl / salbmp.hxx
blob61d2d37e90c270aa4643dcb4bde29fd98621dee0
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 final : 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;
83 bool InterpretAs8Bit() override;
85 public:
87 void Create( const OpenGLTexture& rTex, tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight );
88 OpenGLTexture& GetTexture() const;
89 const BitmapPalette& GetBitmapPalette() const { return maPalette; }
91 private:
93 GLuint CreateTexture();
94 bool AllocateUserData();
95 void DeallocateUserData();
96 bool ReadTexture();
98 private:
100 bool ImplScaleFilter( const rtl::Reference< OpenGLContext > &xContext, const double& rScaleX, const double& rScaleY, GLenum nFilter );
101 static void ImplCreateKernel( const double& fScale, const vcl::Kernel& rKernel, GLfloat*& pWeights, sal_uInt32& aKernelSize );
102 bool ImplScaleConvolution(const rtl::Reference< OpenGLContext > &xContext, const double& rScaleX, const double& rScaleY, const vcl::Kernel& rKernel);
103 bool ImplScaleArea( const rtl::Reference< OpenGLContext > &xContext,
104 double rScaleX, double rScaleY );
106 public:
108 void ImplScale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag );
111 #endif // INCLUDED_VCL_INC_OPENGL_SALBMP_H
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */