• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <stdint.h>
18 #include <ui/mat4.h>
19 
20 #ifndef SF_RENDER_ENGINE_TEXTURE_H
21 #define SF_RENDER_ENGINE_TEXTURE_H
22 
23 namespace android {
24 
25 class Texture {
26     uint32_t mTextureName;
27     uint32_t mTextureTarget;
28     size_t mWidth;
29     size_t mHeight;
30     bool mFiltering;
31     mat4 mTextureMatrix;
32 
33 public:
34     enum Target { TEXTURE_2D = 0x0DE1, TEXTURE_EXTERNAL = 0x8D65 };
35 
36     Texture();
37     Texture(Target textureTarget, uint32_t textureName);
38     ~Texture();
39 
40     void init(Target textureTarget, uint32_t textureName);
41 
42     void setMatrix(float const* matrix);
43     void setFiltering(bool enabled);
44     void setDimensions(size_t width, size_t height);
45 
46     uint32_t getTextureName() const;
47     uint32_t getTextureTarget() const;
48 
49     const mat4& getMatrix() const;
50     bool getFiltering() const;
51     size_t getWidth() const;
52     size_t getHeight() const;
53 };
54 
55 } /* namespace android */
56 #endif /* SF_RENDER_ENGINE_TEXTURE_H */
57