blob: ea14335dedc6e4f12b659a8605439584a6133a1e [file] [log] [blame]
Jason Sams9e0afb52011-10-31 13:23:43 -07001/*
2 * Copyright (C) 2011 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_PATH_H
18#define ANDROID_RS_PATH_H
19
20
Alex Sakhartchouk4edf0302012-03-09 10:47:27 -080021#include "rsObjectBase.h"
Jason Sams9e0afb52011-10-31 13:23:43 -070022
23// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
27class Path : public ObjectBase {
28public:
29 struct {
30 mutable void * drv;
31
32 struct State {
33 RsPathPrimitive primitive;
34 float quality;
35 };
36 State state;
37 } mHal;
38
39 Path(Context *);
40 Path(Context *, uint32_t vertexBuffersCount, uint32_t primitivesCount);
41 Path(Context *, RsPathPrimitive pp, bool isStatic, Allocation *vtx, Allocation *loop, float q);
42
43 ~Path();
44
45 void render(Context *);
Jason Samse3150cf2012-07-24 18:10:20 -070046 virtual void serialize(Context *rsc, OStream *stream) const;
Jason Sams9e0afb52011-10-31 13:23:43 -070047 virtual RsA3DClassID getClassId() const;
48
49private:
50
51
52 typedef struct {
53 float x[4];
54 float y[4];
55 } BezierSegment_t;
56
57 bool subdivideCheck(const BezierSegment_t *s, float u1, float u2);
58
59 void rasterize(const BezierSegment_t *s, uint32_t num, Allocation *alloc);
60
61
62};
63
64}
65}
66#endif //ANDROID_RS_PATH_H
67
68
69