示例#1
0
        /*
         * =================
         * D_SCAlloc
         * =================
         */
        static surfcache_t     D_SCAlloc(int width, int size)
        {
            surfcache_t @new;

            if ((width < 0) || (width > 256))
            {
                sys_linux.Sys_Error("D_SCAlloc: bad cache width " + width + "\n");
            }

            if ((size <= 0) || (size > 0x10000))
            {
                sys_linux.Sys_Error("D_SCAlloc: bad cache size " + size + "\n");
            }

            if (size > sc_size)
            {
                sys_linux.Sys_Error("D_SCAlloc: " + size + " > cache size");
            }

            // create a fragment out of any leftovers
            @new       = new surfcache_t();
            @new.size  = size;
            @new.data  = new byte[size];
            @new.width = (uint)width;
            @new.owner = null;                  // should be set properly after return
            return(@new);
        }
示例#2
0
        /*
        =================
        D_SCAlloc
        =================
        */
        static surfcache_t D_SCAlloc(int width, int size)
        {
            surfcache_t             @new;

            if ((width < 0) || (width > 256))
                sys_linux.Sys_Error ("D_SCAlloc: bad cache width " + width + "\n");

            if ((size <= 0) || (size > 0x10000))
                sys_linux.Sys_Error ("D_SCAlloc: bad cache size " + size + "\n");

            if (size > sc_size)
                sys_linux.Sys_Error ("D_SCAlloc: " + size + " > cache size");

            // create a fragment out of any leftovers
            @new = new surfcache_t();
            @new.size = size;
            @new.data = new byte[size];
            @new.width = (uint)width;
            @new.owner = null;              // should be set properly after return
            return @new;
        }