Flatland.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (C) 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. #include <stdint.h>
  17. #include <EGL/egl.h>
  18. #include <GLES2/gl2.h>
  19. #include <gui/GLConsumer.h>
  20. namespace android {
  21. #define NELEMS(x) ((int) (sizeof(x) / sizeof((x)[0])))
  22. enum { MAX_NUM_LAYERS = 16 };
  23. enum { MAX_TEST_RUNS = 16 };
  24. class Composer;
  25. class Renderer;
  26. class GLHelper;
  27. struct LayerDesc {
  28. uint32_t flags;
  29. Renderer* (*rendererFactory)();
  30. Composer* (*composerFactory)();
  31. int32_t x;
  32. int32_t y;
  33. uint32_t width;
  34. uint32_t height;
  35. };
  36. void resetColorGenerator();
  37. class Composer {
  38. public:
  39. virtual ~Composer() {}
  40. virtual bool setUp(const LayerDesc& desc, GLHelper* helper) = 0;
  41. virtual void tearDown() = 0;
  42. virtual bool compose(GLuint texName, const sp<GLConsumer>& glc) = 0;
  43. };
  44. Composer* nocomp();
  45. Composer* opaque();
  46. Composer* opaqueShrink();
  47. Composer* blend();
  48. Composer* blendShrink();
  49. class Renderer {
  50. public:
  51. virtual ~Renderer() {}
  52. virtual bool setUp(GLHelper* helper) = 0;
  53. virtual void tearDown() = 0;
  54. virtual bool render(EGLSurface surface) = 0;
  55. };
  56. Renderer* staticGradient();
  57. } // namespace android