rsMatrix2x2.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2011-2012 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. #ifndef ANDROID_RS_MATRIX_2x2_H
  17. #define ANDROID_RS_MATRIX_2x2_H
  18. #include "rsType.h"
  19. // ---------------------------------------------------------------------------
  20. namespace android {
  21. namespace renderscript {
  22. struct Matrix2x2 : public rs_matrix2x2 {
  23. inline float get(uint32_t col, uint32_t row) const {
  24. return m[col*2 + row];
  25. }
  26. inline void set(uint32_t col, uint32_t row, float v) {
  27. m[col*2 + row] = v;
  28. }
  29. void loadIdentity();
  30. void load(const float *);
  31. void load(const rs_matrix2x2 *);
  32. void loadMultiply(const rs_matrix2x2 *lhs, const rs_matrix2x2 *rhs);
  33. void transpose();
  34. void multiply(const rs_matrix2x2 *rhs) {
  35. loadMultiply(this, rhs);
  36. }
  37. };
  38. } // namespace renderscript
  39. } // namespace android
  40. #endif // ANDROID_RS_MATRIX_2x2_H