• 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 <string.h>
18 
19 #include "Texture.h"
20 
21 namespace android {
22 
Texture()23 Texture::Texture()
24       : mTextureName(0), mTextureTarget(TEXTURE_2D), mWidth(0), mHeight(0), mFiltering(false) {}
25 
Texture(Target textureTarget,uint32_t textureName)26 Texture::Texture(Target textureTarget, uint32_t textureName)
27       : mTextureName(textureName),
28         mTextureTarget(textureTarget),
29         mWidth(0),
30         mHeight(0),
31         mFiltering(false) {}
32 
init(Target textureTarget,uint32_t textureName)33 void Texture::init(Target textureTarget, uint32_t textureName) {
34     mTextureName = textureName;
35     mTextureTarget = textureTarget;
36 }
37 
~Texture()38 Texture::~Texture() {}
39 
setMatrix(float const * matrix)40 void Texture::setMatrix(float const* matrix) {
41     mTextureMatrix = mat4(matrix);
42 }
43 
setFiltering(bool enabled)44 void Texture::setFiltering(bool enabled) {
45     mFiltering = enabled;
46 }
47 
setDimensions(size_t width,size_t height)48 void Texture::setDimensions(size_t width, size_t height) {
49     mWidth = width;
50     mHeight = height;
51 }
52 
getTextureName() const53 uint32_t Texture::getTextureName() const {
54     return mTextureName;
55 }
56 
getTextureTarget() const57 uint32_t Texture::getTextureTarget() const {
58     return mTextureTarget;
59 }
60 
getMatrix() const61 const mat4& Texture::getMatrix() const {
62     return mTextureMatrix;
63 }
64 
getFiltering() const65 bool Texture::getFiltering() const {
66     return mFiltering;
67 }
68 
getWidth() const69 size_t Texture::getWidth() const {
70     return mWidth;
71 }
72 
getHeight() const73 size_t Texture::getHeight() const {
74     return mHeight;
75 }
76 
77 } /* namespace android */
78