• 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 
18 #ifndef SF_GLES11RENDERENGINE_H_
19 #define SF_GLES11RENDERENGINE_H_
20 
21 #include <stdint.h>
22 #include <sys/types.h>
23 
24 #include <GLES/gl.h>
25 #include <Transform.h>
26 
27 #include "RenderEngine.h"
28 
29 // ---------------------------------------------------------------------------
30 namespace android {
31 // ---------------------------------------------------------------------------
32 
33 class String8;
34 class Mesh;
35 class Texture;
36 
37 class GLES11RenderEngine : public RenderEngine {
38     GLuint mProtectedTexName;
39     GLint mMaxViewportDims[2];
40     GLint mMaxTextureSize;
41 
42     virtual void bindImageAsFramebuffer(EGLImageKHR image,
43             uint32_t* texName, uint32_t* fbName, uint32_t* status);
44     virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName);
45 
46 public:
47     GLES11RenderEngine();
48 
49 protected:
50     virtual ~GLES11RenderEngine();
51 
52     virtual void dump(String8& result);
53     virtual void setViewportAndProjection(size_t vpw, size_t vph,
54             Rect sourceCrop, size_t hwh, bool yswap,
55             Transform::orientation_flags rotation);
56 #ifdef USE_HWC2
57     virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque,
58             float alpha) override;
59     virtual void setupDimLayerBlending(float alpha) override;
60 #else
61     virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque,
62             int alpha);
63     virtual void setupDimLayerBlending(int alpha);
64 #endif
65     virtual void setupLayerTexturing(const Texture& texture);
66     virtual void setupLayerBlackedOut();
67     virtual void setupFillWithColor(float r, float g, float b, float a) ;
68     virtual void disableTexturing();
69     virtual void disableBlending();
70 
71     virtual void drawMesh(const Mesh& mesh);
72 
73     virtual size_t getMaxTextureSize() const;
74     virtual size_t getMaxViewportDims() const;
75 };
76 
77 // ---------------------------------------------------------------------------
78 }; // namespace android
79 // ---------------------------------------------------------------------------
80 
81 #endif /* SF_GLES11RENDERENGINE_H_ */
82