Merge "CanvasRenderer::Drawable: Add GetBoundingBox api" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles-impl / gles2-graphics-memory.h
1 #ifndef DALI_GRAPHICS_GLES_MEMORY_H
2 #define DALI_GRAPHICS_GLES_MEMORY_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/graphics-api/graphics-memory.h>
23 #include <cstdint>
24
25 // INTERNAL INCLUDES
26 #include "gles-graphics-buffer.h"
27 #include "gles-graphics-texture.h"
28
29 namespace Dali::Graphics
30 {
31 class EglGraphicsController;
32 namespace GLES
33 {
34 class Memory2 : public Dali::Graphics::Memory
35 {
36 public:
37   Memory2(const Graphics::MapBufferInfo& mapInfo, EglGraphicsController& controller);
38
39   Memory2(const Graphics::MapTextureInfo& mapInfo, EglGraphicsController& controller);
40
41   ~Memory2() override;
42
43   void* LockRegion(uint32_t offset, uint32_t size) override;
44
45   void Unlock(bool flush) override;
46
47   void Flush() override;
48
49   EglGraphicsController& mController;
50
51   enum class MapObjectType
52   {
53     NONE,
54     BUFFER,
55     TEXTURE
56   };
57
58   MapObjectType mMapObjectType{MapObjectType::NONE};
59
60   union
61   {
62     Graphics::MapTextureInfo mMapTextureInfo{};
63     Graphics::MapBufferInfo  mMapBufferInfo;
64   };
65
66   void* mMappedPointer{nullptr};
67   bool mIsAllocatedLocally{false};
68 };
69 } // namespace GLES
70 } // namespace Dali::Graphics
71
72 #endif