rsProgramRaster.h revision 721acc495b859c6d884725a4f9b5523583dd11c7
1/*
2 * Copyright (C) 2009 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#ifndef ANDROID_RS_PROGRAM_RASTER_H
18#define ANDROID_RS_PROGRAM_RASTER_H
19
20#include "rsProgram.h"
21
22// ---------------------------------------------------------------------------
23namespace android {
24namespace renderscript {
25
26class ProgramRasterState;
27
28class ProgramRaster : public Program {
29public:
30    ProgramRaster(Context *rsc,
31                  bool pointSmooth,
32                  bool lineSmooth,
33                  bool pointSprite,
34                  float lineWidth,
35                  RsCullMode cull);
36    virtual ~ProgramRaster();
37
38    virtual void setup(const Context *, ProgramRasterState *);
39    virtual void serialize(OStream *stream) const;
40    virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_RASTER; }
41    static ProgramRaster *createFromStream(Context *rsc, IStream *stream);
42
43    struct Hal {
44        mutable void *drv;
45
46        struct State {
47            bool pointSmooth;
48            bool lineSmooth;
49            bool pointSprite;
50            float lineWidth;
51            RsCullMode cull;
52        };
53        State state;
54    };
55    Hal mHal;
56
57protected:
58};
59
60class ProgramRasterState {
61public:
62    ProgramRasterState();
63    ~ProgramRasterState();
64    void init(Context *rsc);
65    void deinit(Context *rsc);
66
67    ObjectBaseRef<ProgramRaster> mDefault;
68    ObjectBaseRef<ProgramRaster> mLast;
69};
70
71
72}
73}
74#endif
75
76
77
78
79