⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 r2d_i.h

📁 是一个手机功能的模拟程序
💻 H
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************
                                                                          
  Name        R2DI.h                                                   
                                                                          
  Function    Riviera 2D system : Private API                       
                                                                          
  Date        Modification                                                 
  -----------------------                                                 
  06/12/2001    Create                                                       
 **************************************************************************
  History       
                                                                          
****************************************************************************/


#ifndef __R2DI_H_
#define __R2DI_H_

#include "r2d.h"
#include "rvf_api.h"


/***************************************

     CONSTANTS

***************************************/


#if (R2D_ASM == R2D_ON)
//////////////////////////////////////////
//
// R2D ASM API
//

enum{
  R2D_LCDLCD=1,
  R2D_COLORCOLOR=2,
  R2D_COLORLCD=3,
  R2D_LCDCOLOR=4
};

#endif


/***************************************

     TYPES

***************************************/

////////////////////////////////////////
//
//  Misc
//

typedef UINT32 R2D_BOOLEAN; // To avoid veneer bug a bool on 16 bits is introduced



////////////////////////////////////////
//
// Textures
//
typedef struct R2D_FREE_TEXTURE
{
	INT16 refcount;
	INT16 size; // Exponent of a power of 2
	T_R2D_ARGB_COLOR *pattern;
} T_R2D_FREE_TEXTURE;

typedef struct R2D_ANCHORED_TEXTURE
{
	INT16 refcount;
	INT16 size; // Exponent of a power of 2
	UINT32 *pattern;
} T_R2D_ANCHORED_TEXTURE;

///////////////////////////////////////
//
// FRAMEBUFFER
//


typedef struct R2D_FRAMEBUFFER
{
   // Refcounting
     INT16 refcount;
   // List of memory words containing the pixels
     UINT32 *p_memory_words;
   // End of frameBuffer used to prevent out of
   // framebuffer access
   // (It is the last word contained in the framebuffer)
   // (but that word is used for loops and is never drawn)
     UINT32 *p_frame_buffer_end;
   // Kind of framebuffer (LCD or 24 bits)
     T_R2D_FRAMEBUFFER_KIND kind;
   // Dimensions of frameBuffer
     UINT16 width,height;
   // Semaphore for concurrent accesses to the framebuffer
	 T_RVF_MUTEX * mutex;
} T_R2D_FRAMEBUFFER;

// Font cache framebuffer has other fields required to build
// the glyph from a succession of Unicode codes
typedef struct R2D_FONT_CACHE_FRAMEBUFFER
{
   // Refcounting
     INT16 refcount;
   // List of memory words containing the pixels
     UINT32 *p_memory_words;
   // End of frameBuffer used to prevent out of
   // framebuffer access
   // (It is the last word contained in the framebuffer)
     UINT32 *p_frame_buffer_end;
   // Kind of framebuffer (LCD or 24 bits)
     T_R2D_FRAMEBUFFER_KIND kind;
   // Dimensions of frameBuffer
     UINT16 width,height;
   // Semaphore for concurrent accesses to the framebuffer
	 T_RVF_MUTEX * mutex;
} T_R2D_FONT_CACHE_FRAMEBUFFER;


////////////////////////////////////////
//
// LCD API
//

typedef UINT32 (*T_R2D_DRAWING_OP)(UINT32 old,UINT32 value);


typedef T_R2D_DRAWING_OP T_R2D_DRAWING_OPERATORS[9];

////////////////////////////////////////
//
// OBJECTS
//

// Metaclass object describing the classes


typedef struct R2D_CLASS_SHAPE T_R2D_CLASS_SHAPE;
typedef struct R2D_SHAPE T_R2D_SHAPE;

typedef void (*T_R2D_shape_release_funct)(T_R2D_SHAPE *self);
typedef void (*T_R2D_shape_draw_funct)(T_R2D_SHAPE *self,T_R2D_GC_PTR gc);
typedef void (*T_R2D_shape_fill_funct)(T_R2D_SHAPE *self,T_R2D_GC_PTR gc);
typedef T_R2D_SHAPE_PTR (*T_R2D_shape_clone_funct)(T_RVF_MB_ID bank,T_R2D_SHAPE *self);
typedef void (*T_R2D_shape_translate_funct)(T_R2D_SHAPE *self,INT16 dx,INT16 dy);
typedef BOOLEAN (*T_R2D_shape_point_testing_funct)(T_R2D_SHAPE *self,INT16 x,INT16 y);


struct R2D_CLASS_SHAPE
{
  void *parent_class;
  T_R2D_shape_release_funct release;
  T_R2D_shape_draw_funct draw;
  T_R2D_shape_fill_funct fill;
  T_R2D_shape_clone_funct clone;
  T_R2D_shape_translate_funct translate;
  T_R2D_shape_point_testing_funct point_in_shape;
};

////////////////////////////////////////
//
// SHAPES OBJECTS
//

struct R2D_SHAPE
{
  INT16 refcount;
  const T_R2D_CLASS_SHAPE *p_r2d_class;
};

typedef struct R2D_RECT
{
  INT16 refcount;
  const T_R2D_CLASS_SHAPE *p_r2d_class;
  INT16 ul_x,ul_y,br_x,br_y;
} T_R2D_RECTANGLE;

typedef struct R2D_CIRCLE
{
  INT16 refcount;
  const T_R2D_CLASS_SHAPE *p_r2d_class;
  INT16 x,y,r;
} T_R2D_CIRCLE;

typedef T_R2D_RECTANGLE T_R2D_ELLIPSE;

typedef struct R2D_ROUNDRECT
{
  INT16 refcount;
  const T_R2D_CLASS_SHAPE *p_r2d_class;
  INT16 ul_x,ul_y,br_x,br_y;
  INT16 h,v;
} T_R2D_ROUND_RECTANGLE;

typedef struct R2D_ARC
{
  INT16 refcount;
  const T_R2D_CLASS_SHAPE *p_r2d_class;
  INT16 ul_x,ul_y,br_x,br_y;
  INT16 start_angle,stop_angle;
} T_R2D_ARC;

typedef struct R2D_TEXT
{
  INT16 refcount;
  const T_R2D_CLASS_SHAPE *p_r2d_class;
  INT16 x,y;
  T_R2D_UTF16 *p_text;
} T_R2D_TEXT;


////////////////////////////////////////
//
// GRAPHIC CONTEXT
//

typedef struct R2D_GC
{
   // Refcounting
     INT16 refcount;
   // The framebuffer
     T_R2D_FRAMEBUFFER_PTR p_frame_buffer;
   // Clip rectangle (in graphic context coordinates)
     T_R2D_SHAPE *p_clipping_shape;
   // Clipping shape in scanning coordinates
	 T_R2D_SHAPE *p_s_clipping_shape;
   // Foreground pixel value
   //  (on 24 bits per pixel. Conversion done on the fly
   //  according to the kind of framebuffer)
     T_R2D_ARGB_COLOR foreground_color;
   // Cache for computed pixel value corresponding
   // to previous color. Used for LCD with dithering off
   // to speed drawing
     UINT32 foreground_pixel_value;
   // Cache for foreground dithering used when dithering ON
     UINT32 *p_foreground_dithered_cache;
   // Background pixel value
   //  (on 24 bits per pixel. Conversion done on the fly
   //  according to the kind of framebuffer)
     T_R2D_ARGB_COLOR background_color;
   // Cache for computed pixel value corresponding
   // to previous color. Used for LCD with dithering off
   // to speed drawing
     UINT32 background_pixel_value;
   // Cache for dithering used when dithering ON
     UINT32 *p_background_dithered_cache;
   // Background texture
	 T_R2D_ANCHORED_TEXTURE *background_texture;
   // Pen position
     INT16 pen_x,pen_y;
   // pen_size in pixels
     INT16 pen_size;
   // Drawing mode
     INT16 drawing_mode;
   // Drawing operator for above drawing mode
	 T_R2D_DRAWING_OP drawing_op;
   // Context origin (H coordinates of upper-left corner of screen)
     INT16 org_x,org_y;
   // Context origin (S coordinates for texture of the point corresponding
   //                 to (0,0) H coordinates)
	 INT16 s_org_x,s_org_y;
   // Dash state
     BOOLEAN dash;
   // Text face
     T_R2D_TEXT_FACE text_face;
   // Text style
   //  (List of types requested by the user)
     T_R2D_TEXT_STYLE text_style;
   // Internal text style
   //  (list of style effect which must be computed since
   //  there are not embedded into the fonts)
     T_R2D_TEXT_STYLE internal_text_style;
   // Text size
     T_R2D_TEXT_SIZE text_size;
   // Font framebuffer
     T_R2D_FRAMEBUFFER *font_frame_buffer;
   // Font metrics pointer
     INT32 *font_metrics;
   // Font transcoding table
	 INT32 *font_table;
} T_R2D_GC;

////////////////////////////////////////
//
// FONT CONFIG
//

typedef INT32 *T_R2D_FONT_METRICS;
typedef INT32 *T_R2D_FONT_TABLE;

typedef struct R2D_FONT_DESCRIPTION
{
	T_R2D_FONT_TABLE table;
	T_R2D_FONT_METRICS metrics;
	T_R2D_FRAMEBUFFER_PTR framebuffer;
	BOOLEAN compute_bold;
} T_R2D_FONT_DESCRIPTION;


/***************************************

     FUNCTIONS

***************************************/

////////////////////////////////////////
//
//    TOOL
//    MACROS
//

// One should never call following function directly
// because when refcount is reaching 0 an object
// has generally subobject torelease before releasing
// itself

// Decrement refcount and autodelete if required
#define r2d_release(p) { \
    if (p) \
    { \
      if ((((T_R2D_REFCOUNT*)(p))->refcount)>0) { \
       ((T_R2D_REFCOUNT*)(p))->refcount--; \
       if ((((T_R2D_REFCOUNT*)(p))->refcount==0)) \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -