Home | History | Annotate | Download | only in b_TensorEm
      1 /*
      2  * Copyright (C) 2008 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 /* ---- includes ----------------------------------------------------------- */
     18 
     19 #include "b_TensorEm/Int16Rect.h"
     20 #include "b_BasicEm/Math.h"
     21 #include "b_BasicEm/Functions.h"
     22 #include "b_BasicEm/Memory.h"
     23 
     24 /* ------------------------------------------------------------------------- */
     25 
     26 /* ========================================================================= */
     27 /*                                                                           */
     28 /* ---- \ghd{ auxiliary functions } ---------------------------------------- */
     29 /*                                                                           */
     30 /* ========================================================================= */
     31 
     32 /* ------------------------------------------------------------------------- */
     33 
     34 /* ========================================================================= */
     35 /*                                                                           */
     36 /* ---- \ghd{ constructor / destructor } ----------------------------------- */
     37 /*                                                                           */
     38 /* ========================================================================= */
     39 
     40 /* ------------------------------------------------------------------------- */
     41 
     42 void bts_Int16Rect_init( struct bbs_Context* cpA, struct bts_Int16Rect* ptrA )
     43 {
     44 	ptrA->x1E = 0;
     45 	ptrA->y1E = 0;
     46 	ptrA->x2E = 0;
     47 	ptrA->y2E = 0;
     48 }
     49 
     50 void bts_Int16Rect_exit( struct bbs_Context* cpA, struct bts_Int16Rect* ptrA )
     51 {
     52 	ptrA->x1E = 0;
     53 	ptrA->y1E = 0;
     54 	ptrA->x2E = 0;
     55 	ptrA->y2E = 0;
     56 }
     57 
     58 /* ========================================================================= */
     59 /*                                                                           */
     60 /* ---- \ghd{ operators } -------------------------------------------------- */
     61 /*                                                                           */
     62 /* ========================================================================= */
     63 
     64 /* ------------------------------------------------------------------------- */
     65 
     66 /* ========================================================================= */
     67 /*                                                                           */
     68 /* ---- \ghd{ query functions } -------------------------------------------- */
     69 /*                                                                           */
     70 /* ========================================================================= */
     71 
     72 /* ------------------------------------------------------------------------- */
     73 
     74 /* ========================================================================= */
     75 /*                                                                           */
     76 /* ---- \ghd{ modify functions } ------------------------------------------- */
     77 /*                                                                           */
     78 /* ========================================================================= */
     79 
     80 /* ------------------------------------------------------------------------- */
     81 
     82 struct bts_Int16Rect bts_Int16Rect_create( int16 x1A, int16 y1A, int16 x2A, int16 y2A )
     83 {
     84 	struct bts_Int16Rect rectL;
     85 	rectL.x1E = x1A;
     86 	rectL.y1E = y1A;
     87 	rectL.x2E = x2A;
     88 	rectL.y2E = y2A;
     89 	return rectL;
     90 }
     91 
     92 /* ------------------------------------------------------------------------- */
     93 
     94 /* ========================================================================= */
     95 /*                                                                           */
     96 /* ---- \ghd{ I/O } -------------------------------------------------------- */
     97 /*                                                                           */
     98 /* ========================================================================= */
     99 
    100 /* ------------------------------------------------------------------------- */
    101 
    102 uint32 bts_Int16Rect_memSize( struct bbs_Context* cpA,
    103 							  const struct bts_Int16Rect *ptrA )
    104 {
    105 	return bbs_SIZEOF16( struct bts_Int16Rect );
    106 }
    107 
    108 /* ------------------------------------------------------------------------- */
    109 
    110 uint32 bts_Int16Rect_memWrite( struct bbs_Context* cpA,
    111 							   const struct bts_Int16Rect* ptrA,
    112 							   uint16* memPtrA )
    113 {
    114 	memPtrA += bbs_memWrite16( &ptrA->x1E, memPtrA );
    115 	memPtrA += bbs_memWrite16( &ptrA->y1E, memPtrA );
    116 	memPtrA += bbs_memWrite16( &ptrA->x2E, memPtrA );
    117 	memPtrA += bbs_memWrite16( &ptrA->y2E, memPtrA );
    118 	return bbs_SIZEOF16( *ptrA );
    119 }
    120 
    121 /* ------------------------------------------------------------------------- */
    122 
    123 uint32 bts_Int16Rect_memRead( struct bbs_Context* cpA,
    124 							  struct bts_Int16Rect* ptrA,
    125 							  const uint16* memPtrA )
    126 {
    127 	if( bbs_Context_error( cpA ) ) return 0;
    128 	memPtrA += bbs_memRead16( &ptrA->x1E, memPtrA );
    129 	memPtrA += bbs_memRead16( &ptrA->y1E, memPtrA );
    130 	memPtrA += bbs_memRead16( &ptrA->x2E, memPtrA );
    131 	memPtrA += bbs_memRead16( &ptrA->y2E, memPtrA );
    132 	return bbs_SIZEOF16( *ptrA );
    133 }
    134 
    135 /* ------------------------------------------------------------------------- */
    136 
    137 /* ========================================================================= */
    138 /*                                                                           */
    139 /* ---- \ghd{ exec functions } --------------------------------------------- */
    140 /*                                                                           */
    141 /* ========================================================================= */
    142 
    143 /* ------------------------------------------------------------------------- */
    144 
    145 /* ========================================================================= */
    146 
    147 
    148