示例#1
0
void fsPrim::init2(PrimMode prim_mode, bool is_share_data, PrimData* prim_data, u16 max_data_num, fsID scr_id, fsDraw* parent)
{
    if (m_rend)
    {
        m_rend->uninit();
    }

    m_private_flag.setOn(FLAG_INITIALIZED);

    setPrimMode(prim_mode);

    if (is_share_data)
    {
        if (!prim_data || max_data_num == 0)
        {
            fsThrow(ExceptionInvalidArgument);
        }

        if (m_prim_data && !m_is_share_data.getType())
        {
            fsDeleteArray(m_prim_data, PrimData);
        }

        m_is_share_data = true;
        m_prim_data = const_cast<PrimData*>(prim_data);
        m_max_data_num = max_data_num;
    }
    else
    {
        if (m_prim_data && m_is_share_data.getType())
        {
            m_prim_data = NULL;
            m_max_data_num = 0;
        }

        m_is_share_data = false;

        reallocData(max_data_num);
    }

    setCurDataNum(max_data_num);
    setTextureID(fsID::ZERO);

    if (parent)
    {
        setParent(parent);
    }
    else
    {
        setScreenID(scr_id);
    }
}
示例#2
0
void aappend(Array *array, int index, void *element) {
    if (index < 0 || index > array->size) return;
    
    if (index + 1 >= array->capacity) {
        reallocData(array);
    }
    
    int i;
    for (i = array->size - 1; i >= index; i--) {
        array->data[i + 1] = array->data[i];
    }
    
    array->data[index] = element;
    array->size++;
}
示例#3
0
文件: pr61033.C 项目: 0day-ci/gcc
 operator+=(QChar) {
   if (d->ref.isShared() || d->alloc)
     reallocData();
   d->data()[d->size++] = 0;
   d->data()[0] = '\0';
 }