Home | History | Annotate | Download | only in rs
      1 /*
      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 
     21 #include "rsObjectBase.h"
     22 
     23 // ---------------------------------------------------------------------------
     24 namespace android {
     25 namespace renderscript {
     26 
     27 class Path : public ObjectBase {
     28 public:
     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 *);
     46     virtual void serialize(Context *rsc, OStream *stream) const;
     47     virtual RsA3DClassID getClassId() const;
     48 
     49 private:
     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 
     70