replicant-frameworks_native/services/surfaceflinger/RenderEngine/Texture.h
Mathias Agopian 49457ac092 Encapsulate textures into their own Texture class
the main reason for doing this is so that we can have
access to informations about a texture (like its dimension)
close to where we generate and use shaders in ES 2.0.
Previously, there wasn't any way to get to a texture's size
from a RenderEngine implementation.

Bug: 8679321

Change-Id: I388b338a70d07e3e8177dde248710ea1e4c82dff
2013-08-16 16:29:02 -07:00

56 lines
1.5 KiB
C++

/*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdint.h>
#ifndef SF_RENDER_ENGINE_TEXTURE_H
#define SF_RENDER_ENGINE_TEXTURE_H
namespace android {
class Texture {
uint32_t mTextureName;
uint32_t mTextureTarget;
size_t mWidth;
size_t mHeight;
bool mFiltering;
float mTextureMatrix[16];
public:
enum Target { TEXTURE_2D = 0x0DE1, TEXTURE_EXTERNAL = 0x8D65 };
Texture();
Texture(Target textureTarget, uint32_t textureName);
~Texture();
void init(Target textureTarget, uint32_t textureName);
void setMatrix(float const* matrix);
void setFiltering(bool enabled);
void setDimensions(size_t width, size_t height);
uint32_t getTextureName() const;
uint32_t getTextureTarget() const;
float const* getMatrix() const;
bool getFiltering() const;
size_t getWidth() const;
size_t getHeight() const;
};
} /* namespace android */
#endif /* SF_RENDER_ENGINE_TEXTURE_H */