• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FRAMEWORKS_ANIMATION_SERVER_SERVER_INCLUDE_TEXTURE_H
17 #define FRAMEWORKS_ANIMATION_SERVER_SERVER_INCLUDE_TEXTURE_H
18 
19 #include <cstdint>
20 
21 class Texture {
22 public:
23     // from buffer
24     Texture(void *buffer, int32_t width, int32_t height);
25 
26     // from texture
27     Texture(uint32_t texture);
28     ~Texture();
29 
30     void Bind(uint32_t slot = 0) const;
31     void Unbind();
32 
GetWidth()33     inline int32_t GetWidth() const
34     {
35         return width_;
36     }
37 
GetHeight()38     inline int32_t GetHeight() const
39     {
40         return height_;
41     }
42 
43 private:
44     uint32_t rendererID_ = 0;
45     void *buffer_ = nullptr;
46     int32_t width_ = 0;
47     int32_t height_ = 0;
48 };
49 
50 #endif // FRAMEWORKS_ANIMATION_SERVER_SERVER_INCLUDE_TEXTURE_H
51