blob: f96d270370524700ceb473b27c38ceb515e7f02c [file] [log] [blame]
Jason Sams87fe59a2011-04-20 15:09:01 -07001/*
2 * Copyright (C) 2011 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#ifndef ANDROID_RS_MATRIX_3x3_H
18#define ANDROID_RS_MATRIX_3x3_H
19
20#include "rsType.h"
21
22
23// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
27struct Matrix3x3 : public rs_matrix3x3 {
28 inline float get(uint32_t row, uint32_t col) const {
29 return m[row*3 + col];
30 }
31
32 inline void set(uint32_t row, uint32_t col, float v) {
33 m[row*3 + col] = v;
34 }
35
36 void loadIdentity();
37 void load(const float *);
38 void load(const rs_matrix3x3 *);
39
40 void loadMultiply(const rs_matrix3x3 *lhs, const rs_matrix3x3 *rhs);
41
42 void transpose();
43
44 void multiply(const rs_matrix3x3 *rhs) {
45 Matrix3x3 tmp;
46 tmp.loadMultiply(this, rhs);
47 load(&tmp);
48 }
49};
50
51}
52}
53
54
55
56
57#endif
58
59
60
61
62