Home | History | Annotate | Download | only in skc
      1 /*
      2  * Copyright 2017 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can
      5  * be found in the LICENSE file.
      6  *
      7  */
      8 
      9 #pragma once
     10 
     11 //
     12 //
     13 //
     14 
     15 #include "skc.h"
     16 #include "assert_state.h"
     17 
     18 //
     19 //
     20 //
     21 
     22 typedef enum skc_path_builder_state_e {
     23 
     24   SKC_PATH_BUILDER_STATE_READY,
     25   SKC_PATH_BUILDER_STATE_BUILDING
     26 
     27 } skc_path_builder_state_e;
     28 
     29 //
     30 // FIXME -- we might be able to bury more of this in the impl
     31 //
     32 
     33 struct skc_coords_rem_count_line
     34 {
     35   skc_uint    rem;
     36   skc_float * coords[4];
     37 };
     38 
     39 struct skc_coords_rem_count_quad
     40 {
     41   skc_uint    rem;
     42   skc_float * coords[6];
     43 };
     44 
     45 struct skc_coords_rem_count_cubic
     46 {
     47   skc_uint    rem;
     48   skc_float * coords[8];
     49 };
     50 
     51 //
     52 //
     53 //
     54 
     55 struct skc_path_builder
     56 {
     57   struct skc_context              * context;
     58 
     59   struct skc_path_builder_impl    * impl;
     60 
     61   void                           (* begin    )(struct skc_path_builder_impl * const impl);
     62   void                           (* end      )(struct skc_path_builder_impl * const impl, skc_path_t * const path);
     63   void                           (* new_line )(struct skc_path_builder_impl * const impl);
     64   void                           (* new_quad )(struct skc_path_builder_impl * const impl);
     65   void                           (* new_cubic)(struct skc_path_builder_impl * const impl);
     66   void                           (* release  )(struct skc_path_builder_impl * const impl);
     67 
     68   struct skc_coords_rem_count_line  line;
     69   struct skc_coords_rem_count_quad  quad;
     70   struct skc_coords_rem_count_cubic cubic;
     71 
     72   struct {
     73     float                           x;
     74     float                           y;
     75   } curr[2];
     76 
     77   skc_uint                          refcount;
     78 
     79   SKC_ASSERT_STATE_DECLARE(skc_path_builder_state_e);
     80 };
     81 
     82 //
     83 //
     84 //
     85