diff options
| author | 2009-09-24 15:35:17 -0400 | |
|---|---|---|
| committer | 2009-09-24 15:35:17 -0400 | |
| commit | a183cb5ebd974096afe2335cd4254de68d55021e (patch) | |
| tree | cbf1dc6308bef691d6bed89f4c0385df341f31ce /libs/rs/rsAllocation.cpp | |
| parent | e31c0b5693f8887410d54d590ebf1ccb05ba0cc8 (diff) | |
| parent | b6f2b131c42e5148b07c7cfe22b8bd5bc5b4ad4b (diff) | |
Merge change 26897 into eclair
* changes:
  Removed last bits of predefined element types from native code.  Predefined types are now constructed at the java layer from standard building blocks.
Diffstat (limited to 'libs/rs/rsAllocation.cpp')
| -rw-r--r-- | libs/rs/rsAllocation.cpp | 116 | 
1 files changed, 0 insertions, 116 deletions
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index c267e1631d4d..cb82624688aa 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -191,12 +191,6 @@ RsAllocation rsi_AllocationCreateTyped(Context *rsc, RsType vtype)      return alloc;  } -RsAllocation rsi_AllocationCreatePredefSized(Context *rsc, RsElementPredefined t, size_t count) -{ -    RsElement e = rsi_ElementGetPredefined(rsc, t); -    return rsi_AllocationCreateSized(rsc, e, count); -} -  RsAllocation rsi_AllocationCreateSized(Context *rsc, RsElement e, size_t count)  {      Type * type = new Type(); @@ -421,116 +415,6 @@ RsAllocation rsi_AllocationCreateFromBitmapBoxed(Context *rsc, uint32_t w, uint3  } - -RsAllocation rsi_AllocationCreateFromFile(Context *rsc, const char *file, bool genMips) -{ -    bool use32bpp = false; - -    typedef struct _Win3xBitmapHeader -    { -       uint16_t type; -       uint32_t totalSize; -       uint32_t reserved; -       uint32_t offset; -       int32_t hdrSize;            /* Size of this header in bytes */ -       int32_t width;           /* Image width in pixels */ -       int32_t height;          /* Image height in pixels */ -       int16_t planes;          /* Number of color planes */ -       int16_t bpp;             /* Number of bits per pixel */ -       /* Fields added for Windows 3.x follow this line */ -       int32_t compression;     /* Compression methods used */ -       int32_t sizeOfBitmap;    /* Size of bitmap in bytes */ -       int32_t horzResolution;  /* Horizontal resolution in pixels per meter */ -       int32_t vertResolution;  /* Vertical resolution in pixels per meter */ -       int32_t colorsUsed;      /* Number of colors in the image */ -       int32_t colorsImportant; /* Minimum number of important colors */ -    } __attribute__((__packed__)) WIN3XBITMAPHEADER; - -    _Win3xBitmapHeader hdr; - -    FILE *f = fopen(file, "rb"); -    if (f == NULL) { -        LOGE("rsAllocationCreateFromBitmap failed to open file %s", file); -        return NULL; -    } -    memset(&hdr, 0, sizeof(hdr)); -    fread(&hdr, sizeof(hdr), 1, f); - -    if (hdr.bpp != 24) { -        LOGE("Unsuported BMP type"); -        fclose(f); -        return NULL; -    } - -    int32_t texWidth = rsHigherPow2(hdr.width); -    int32_t texHeight = rsHigherPow2(hdr.height); - -    if (use32bpp) { -        rsi_TypeBegin(rsc, rsi_ElementGetPredefined(rsc, RS_ELEMENT_RGBA_8888)); -    } else { -        rsi_TypeBegin(rsc, rsi_ElementGetPredefined(rsc, RS_ELEMENT_RGB_565)); -    } -    rsi_TypeAdd(rsc, RS_DIMENSION_X, texWidth); -    rsi_TypeAdd(rsc, RS_DIMENSION_Y, texHeight); -    if (genMips) { -        rsi_TypeAdd(rsc, RS_DIMENSION_LOD, 1); -    } -    RsType type = rsi_TypeCreate(rsc); - -    RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, type); -    Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc); -    texAlloc->incUserRef(); -    if (texAlloc == NULL) { -        LOGE("Memory allocation failure"); -        fclose(f); -        return NULL; -    } - -    // offset to letterbox if height is not pow2 -    Adapter2D adapt(texAlloc); -    uint8_t * fileInBuf = new uint8_t[texWidth * 3]; -    uint32_t yOffset = (hdr.width - hdr.height) / 2; - -    if (use32bpp) { -        uint8_t *tmp = static_cast<uint8_t *>(adapt.getElement(0, yOffset)); -        for (int y=0; y < hdr.height; y++) { -            fseek(f, hdr.offset + (y*hdr.width*3), SEEK_SET); -            fread(fileInBuf, 1, hdr.width * 3, f); -            for(int x=0; x < hdr.width; x++) { -                tmp[0] = fileInBuf[x*3 + 2]; -                tmp[1] = fileInBuf[x*3 + 1]; -                tmp[2] = fileInBuf[x*3]; -                tmp[3] = 0xff; -                tmp += 4; -            } -        } -    } else { -        uint16_t *tmp = static_cast<uint16_t *>(adapt.getElement(0, yOffset)); -        for (int y=0; y < hdr.height; y++) { -            fseek(f, hdr.offset + (y*hdr.width*3), SEEK_SET); -            fread(fileInBuf, 1, hdr.width * 3, f); -            for(int x=0; x < hdr.width; x++) { -                *tmp = rs888to565(fileInBuf[x*3 + 2], fileInBuf[x*3 + 1], fileInBuf[x*3]); -                tmp++; -            } -        } -    } - -    fclose(f); -    delete [] fileInBuf; - -    if (genMips) { -        Adapter2D adapt2(texAlloc); -        for(uint32_t lod=0; lod < (texAlloc->getType()->getLODCount() -1); lod++) { -            adapt.setLOD(lod); -            adapt2.setLOD(lod + 1); -            mip(adapt2, adapt); -        } -    } - -    return texAlloc; -} -  void rsi_AllocationData(Context *rsc, RsAllocation va, const void *data, uint32_t sizeBytes)  {      Allocation *a = static_cast<Allocation *>(va);  |