GlopBuilder.h revision 031888744e24b5c7243ac99ec98b78aff5db1c78
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
23class SkPaint;
24
25namespace android {
26namespace uirenderer {
27
28class Caches;
29struct Glop;
30class RenderState;
31class Texture;
32class Matrix4;
33
34class GlopBuilder {
35    PREVENT_COPY_AND_ASSIGN(GlopBuilder);
36public:
37    GlopBuilder(RenderState& renderState, Caches& caches, Glop* outGlop);
38    GlopBuilder& setMeshUnitQuad();
39    GlopBuilder& setTransformAndRect(ModelViewMode mode,
40            const Matrix4& ortho, const Matrix4& transform,
41            float left, float top, float right, float bottom, bool offset);
42    GlopBuilder& setPaint(const SkPaint* paint, float alphaScale);
43    GlopBuilder& setTexture(Texture* texture);
44    void build();
45private:
46    ProgramDescription mDescription;
47    RenderState& mRenderState;
48    Caches& mCaches;
49    Glop* mOutGlop;
50};
51
52} /* namespace uirenderer */
53} /* namespace android */
54
55#endif // RENDERSTATE_GLOPBUILDER_H
56