Texture.h revision 49457ac092071a8f964f7f69156093657ccdc3d0
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
19#ifndef SF_RENDER_ENGINE_TEXTURE_H
20#define SF_RENDER_ENGINE_TEXTURE_H
21
22namespace android {
23
24class Texture {
25    uint32_t mTextureName;
26    uint32_t mTextureTarget;
27    size_t mWidth;
28    size_t mHeight;
29    bool mFiltering;
30    float mTextureMatrix[16];
31
32public:
33    enum Target { TEXTURE_2D = 0x0DE1, TEXTURE_EXTERNAL = 0x8D65 };
34
35    Texture();
36    Texture(Target textureTarget, uint32_t textureName);
37    ~Texture();
38
39    void init(Target textureTarget, uint32_t textureName);
40
41    void setMatrix(float const* matrix);
42    void setFiltering(bool enabled);
43    void setDimensions(size_t width, size_t height);
44
45    uint32_t getTextureName() const;
46    uint32_t getTextureTarget() const;
47
48    float const* getMatrix() const;
49    bool getFiltering() const;
50    size_t getWidth() const;
51    size_t getHeight() const;
52};
53
54} /* namespace android */
55#endif /* SF_RENDER_ENGINE_TEXTURE_H */
56