Jason Sams | 25430d0 | 2010-02-02 15:26:40 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2009 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 | package android.renderscript; |
| 18 | |
| 19 | import java.lang.Math; |
| 20 | import android.util.Log; |
| 21 | |
| 22 | |
| 23 | /** |
| 24 | * @hide |
| 25 | * |
| 26 | **/ |
| 27 | public class Matrix2f { |
| 28 | |
| 29 | public Matrix2f() { |
| 30 | mMat = new float[4]; |
| 31 | loadIdentity(); |
| 32 | } |
| 33 | |
| 34 | public float get(int i, int j) { |
| 35 | return mMat[i*2 + j]; |
| 36 | } |
| 37 | |
| 38 | public void set(int i, int j, float v) { |
| 39 | mMat[i*2 + j] = v; |
| 40 | } |
| 41 | |
| 42 | public void loadIdentity() { |
| 43 | mMat[0] = 1; |
| 44 | mMat[1] = 0; |
| 45 | |
| 46 | mMat[2] = 0; |
| 47 | mMat[3] = 1; |
| 48 | } |
| 49 | |
| 50 | public void load(Matrix2f src) { |
| 51 | System.arraycopy(mMat, 0, src, 0, 4); |
| 52 | } |
| 53 | |
| 54 | final float[] mMat; |
| 55 | } |
| 56 | |
| 57 | |
| 58 | |