Chris Craik | 0318887 | 2015-02-02 18:39:33 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 RENDERSTATE_GLOPBUILDER_H |
| 17 | #define RENDERSTATE_GLOPBUILDER_H |
| 18 | |
| 19 | #include "OpenGLRenderer.h" |
| 20 | #include "Program.h" |
| 21 | #include "utils/Macros.h" |
| 22 | |
| 23 | class SkPaint; |
| 24 | |
| 25 | namespace android { |
| 26 | namespace uirenderer { |
| 27 | |
| 28 | class Caches; |
| 29 | struct Glop; |
Chris Craik | 117bdbc | 2015-02-05 10:12:38 -0800 | [diff] [blame] | 30 | class Matrix4; |
Chris Craik | 0318887 | 2015-02-02 18:39:33 -0800 | [diff] [blame] | 31 | class RenderState; |
| 32 | class Texture; |
Chris Craik | 117bdbc | 2015-02-05 10:12:38 -0800 | [diff] [blame] | 33 | class VertexBuffer; |
Chris Craik | 0318887 | 2015-02-02 18:39:33 -0800 | [diff] [blame] | 34 | |
| 35 | class GlopBuilder { |
| 36 | PREVENT_COPY_AND_ASSIGN(GlopBuilder); |
| 37 | public: |
| 38 | GlopBuilder(RenderState& renderState, Caches& caches, Glop* outGlop); |
Chris Craik | 2ab95d7 | 2015-02-06 15:25:51 -0800 | [diff] [blame^] | 39 | |
Chris Craik | 0318887 | 2015-02-02 18:39:33 -0800 | [diff] [blame] | 40 | GlopBuilder& setMeshUnitQuad(); |
Chris Craik | 117bdbc | 2015-02-05 10:12:38 -0800 | [diff] [blame] | 41 | GlopBuilder& setMeshVertexBuffer(const VertexBuffer& vertexBuffer, bool shadowInterp); |
Chris Craik | 2ab95d7 | 2015-02-06 15:25:51 -0800 | [diff] [blame^] | 42 | GlopBuilder& setMeshIndexedQuads(void* vertexData, int quadCount); |
Chris Craik | 117bdbc | 2015-02-05 10:12:38 -0800 | [diff] [blame] | 43 | |
| 44 | GlopBuilder& setTransform(const Matrix4& ortho, const Matrix4& transform, bool fudgingOffset); |
| 45 | |
| 46 | GlopBuilder& setModelViewMapUnitToRect(const Rect destination); |
| 47 | GlopBuilder& setModelViewOffsetRect(float offsetX, float offsetY, const Rect source); |
| 48 | |
Chris Craik | 2ab95d7 | 2015-02-06 15:25:51 -0800 | [diff] [blame^] | 49 | GlopBuilder& setOptionalPaint(const SkPaint* paint, float alphaScale); |
| 50 | GlopBuilder& setPaint(const SkPaint& paint, float alphaScale); |
Chris Craik | 0318887 | 2015-02-02 18:39:33 -0800 | [diff] [blame] | 51 | void build(); |
| 52 | private: |
Chris Craik | 117bdbc | 2015-02-05 10:12:38 -0800 | [diff] [blame] | 53 | enum StageFlags { |
| 54 | kInitialStage = 0, |
| 55 | kMeshStage = 1 << 0, |
| 56 | kTransformStage = 1 << 1, |
| 57 | kModelViewStage = 1 << 2, |
| 58 | kFillStage = 1 << 3, |
| 59 | kAllStages = kMeshStage | kTransformStage | kModelViewStage | kFillStage, |
| 60 | } mStageFlags; |
| 61 | |
Chris Craik | 0318887 | 2015-02-02 18:39:33 -0800 | [diff] [blame] | 62 | ProgramDescription mDescription; |
| 63 | RenderState& mRenderState; |
| 64 | Caches& mCaches; |
| 65 | Glop* mOutGlop; |
| 66 | }; |
| 67 | |
| 68 | } /* namespace uirenderer */ |
| 69 | } /* namespace android */ |
| 70 | |
| 71 | #endif // RENDERSTATE_GLOPBUILDER_H |