Loading graphics/java/android/renderscript/Allocation.java +0 −23 Original line number Diff line number Diff line Loading @@ -261,29 +261,6 @@ public class Allocation extends BaseObj { return new Allocation(id, rs, null); } static public Allocation createFromBitmap(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips, int index) throws IllegalArgumentException { rs.validate(); int id = rs.nAllocationCreateFromBitmap1(index, dstFmt.mID, genMips, b); return new Allocation(id, rs, null); } static public void addToAllocation(RenderScript rs, int index) throws IllegalArgumentException { rs.nAllocationAddToAllocationList(index); } static public void removeFromAllocation(RenderScript rs, int index) throws IllegalArgumentException { rs.nAllocationRemoveFromAllocationList(index); } static public void createAllocationList(RenderScript rs, int count) throws IllegalArgumentException { rs.nAllocationCreateAllocationList(count); } static public Allocation createFromBitmapBoxed(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips) throws IllegalArgumentException { Loading graphics/java/android/renderscript/RenderScript.java +0 −4 Original line number Diff line number Diff line Loading @@ -101,10 +101,6 @@ public class RenderScript { native int nAllocationCreateTyped(int type); native int nAllocationCreateFromBitmap(int dstFmt, boolean genMips, Bitmap bmp); native int nAllocationCreateFromBitmap1(int index, int dstFmt, boolean genMips, Bitmap bmp); native int nAllocationAddToAllocationList(int index); native int nAllocationRemoveFromAllocationList(int index); native int nAllocationCreateAllocationList(int count); native int nAllocationCreateFromBitmapBoxed(int dstFmt, boolean genMips, Bitmap bmp); native int nAllocationCreateFromAssetStream(int dstFmt, boolean genMips, int assetStream); Loading graphics/jni/android_renderscript_RenderScript.cpp +0 −50 Original line number Diff line number Diff line Loading @@ -493,52 +493,6 @@ nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, jint dstFmt, jboolean g return 0; } static int nAllocationCreateFromBitmap1(JNIEnv *_env, jobject _this, jint index, jint dstFmt, jboolean genMips, jobject jbitmap) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); SkBitmap const * nativeBitmap = (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID); const SkBitmap& bitmap(*nativeBitmap); SkBitmap::Config config = bitmap.getConfig(); RsElement e = SkBitmapToPredefined(config); if (e) { bitmap.lockPixels(); const int w = bitmap.width(); const int h = bitmap.height(); const void* ptr = bitmap.getPixels(); jint id = (jint)rsAllocationCreateFromBitmap1(con, w, h, (RsElement)dstFmt, e, genMips, ptr, index); bitmap.unlockPixels(); return id; } return 0; } static int nAllocationAddToAllocationList(JNIEnv *_env, jobject _this, jint index) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); rsAllocationAddToAllocationList(con, index); return 0; } static int nAllocationRemoveFromAllocationList(JNIEnv *_env, jobject _this, jint index) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); rsAllocationRemoveFromAllocationList(con, index); return 0; } static int nAllocationCreateAllocationList(JNIEnv *_env, jobject _this, jint index) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); rsAllocationCreateAllocationList(con, index); return 0; } static int nAllocationCreateFromAssetStream(JNIEnv *_env, jobject _this, jint dstFmt, jboolean genMips, jint native_asset) { Loading Loading @@ -1423,10 +1377,6 @@ static JNINativeMethod methods[] = { {"nAllocationCreateTyped", "(I)I", (void*)nAllocationCreateTyped }, {"nAllocationCreateFromBitmap", "(IZLandroid/graphics/Bitmap;)I", (void*)nAllocationCreateFromBitmap }, {"nAllocationCreateFromBitmap1", "(IIZLandroid/graphics/Bitmap;)I", (void*)nAllocationCreateFromBitmap1 }, {"nAllocationAddToAllocationList", "(I)I", (void*)nAllocationAddToAllocationList}, {"nAllocationRemoveFromAllocationList", "(I)I", (void*)nAllocationRemoveFromAllocationList}, {"nAllocationCreateAllocationList", "(I)I", (void*)nAllocationCreateAllocationList}, {"nAllocationCreateFromBitmapBoxed","(IZLandroid/graphics/Bitmap;)I", (void*)nAllocationCreateFromBitmapBoxed }, {"nAllocationCreateFromAssetStream","(IZI)I", (void*)nAllocationCreateFromAssetStream }, {"nAllocationUploadToTexture", "(II)V", (void*)nAllocationUploadToTexture }, Loading libs/rs/rs.spec +0 −23 Original line number Diff line number Diff line Loading @@ -109,29 +109,6 @@ AllocationCreateFromBitmap { ret RsAllocation } AllocationCreateFromBitmap1 { param uint32_t width param uint32_t height param RsElement dstFmt param RsElement srcFmt param bool genMips param const void * data param uint32_t index ret RsAllocation } AllocationAddToAllocationList { param uint32_t index } AllocationRemoveFromAllocationList { param uint32_t index } AllocationCreateAllocationList { param uint32_t count } AllocationCreateFromBitmapBoxed { param uint32_t width param uint32_t height Loading libs/rs/rsAllocation.cpp +2 −134 Original line number Diff line number Diff line Loading @@ -22,43 +22,6 @@ using namespace android; using namespace android::renderscript; static long *earlierAllocations; static unsigned int currentNumAllocations; Allocation::Allocation(Context *rsc, const Type *type, int index) : ObjectBase(rsc) { mAllocFile = __FILE__; mAllocLine = __LINE__; mPtr = NULL; mCpuWrite = false; mCpuRead = false; mGpuWrite = false; mGpuRead = false; mReadWriteRatio = 0; mUpdateSize = 0; mIsTexture = false; mTextureID = 0; mIsVertexBuffer = false; mBufferID = 0; mType.set(type); rsAssert(type); if (!earlierAllocations[index]) { mPtr = malloc(mType->getSizeBytes()); earlierAllocations[index] = (long) mPtr; } else mPtr = (void*) earlierAllocations[index]; if (!mPtr) { LOGE("Allocation::Allocation, alloc failure"); } mUseEarlierAllocation = true; } Allocation::Allocation(Context *rsc, const Type *type) : ObjectBase(rsc) { mAllocFile = __FILE__; Loading @@ -69,7 +32,6 @@ Allocation::Allocation(Context *rsc, const Type *type) : ObjectBase(rsc) mCpuRead = false; mGpuWrite = false; mGpuRead = false; mUseEarlierAllocation = false; mReadWriteRatio = 0; mUpdateSize = 0; Loading @@ -90,7 +52,6 @@ Allocation::Allocation(Context *rsc, const Type *type) : ObjectBase(rsc) Allocation::~Allocation() { if (!mUseEarlierAllocation) free(mPtr); mPtr = NULL; Loading Loading @@ -265,15 +226,6 @@ void Allocation::dumpLOGV(const char *prefix) const namespace android { namespace renderscript { RsAllocation rsi_AllocationCreateTyped(Context *rsc, RsType vtype, int index) { const Type * type = static_cast<const Type *>(vtype); Allocation * alloc = new Allocation(rsc, type, index); alloc->incUserRef(); return alloc; } RsAllocation rsi_AllocationCreateTyped(Context *rsc, RsType vtype) { const Type * type = static_cast<const Type *>(vtype); Loading Loading @@ -450,6 +402,7 @@ RsAllocation rsi_AllocationCreateFromBitmap(Context *rsc, uint32_t w, uint32_t h rsi_TypeAdd(rsc, RS_DIMENSION_LOD, 1); } RsType type = rsi_TypeCreate(rsc); RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, type); Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc); if (texAlloc == NULL) { Loading @@ -473,91 +426,6 @@ RsAllocation rsi_AllocationCreateFromBitmap(Context *rsc, uint32_t w, uint32_t h return texAlloc; } RsAllocation rsi_AllocationCreateFromBitmap1(Context *rsc, uint32_t w, uint32_t h, RsElement _dst, RsElement _src, bool genMips, const void *data, uint32_t index) { const Element *src = static_cast<const Element *>(_src); const Element *dst = static_cast<const Element *>(_dst); rsAssert(!(w & (w-1))); rsAssert(!(h & (h-1))); bool useCt = !(earlierAllocations[index]); //LOGE("rsi_AllocationCreateFromBitmap %i %i %i %i %i", w, h, dstFmt, srcFmt, genMips); rsi_TypeBegin(rsc, _dst); rsi_TypeAdd(rsc, RS_DIMENSION_X, w); rsi_TypeAdd(rsc, RS_DIMENSION_Y, h); if (genMips) { rsi_TypeAdd(rsc, RS_DIMENSION_LOD, 1); } RsType type = rsi_TypeCreate(rsc); RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, type, index); Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc); if (texAlloc == NULL) { LOGE("Memory allocation failure"); return NULL; } if (useCt) { ElementConverter_t cvt = pickConverter(dst, src); cvt(texAlloc->getPtr(), data, w * h); } if (genMips && useCt) { Adapter2D adapt(rsc, texAlloc); Adapter2D adapt2(rsc, 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_AllocationAddToAllocationList(Context *rsc, uint32_t index) { unsigned int temp = currentNumAllocations; currentNumAllocations++; earlierAllocations = (long*) realloc(earlierAllocations, (sizeof(long) * currentNumAllocations)); memmove(earlierAllocations + index + 1, earlierAllocations + index, (temp - index) * sizeof(long)); earlierAllocations[index] = 0; } void rsi_AllocationRemoveFromAllocationList(Context *rsc, uint32_t index) { if (index >= currentNumAllocations || !earlierAllocations || !earlierAllocations[index]) return; if (earlierAllocations[index]) free((void *) earlierAllocations[index]); memmove(earlierAllocations + index, earlierAllocations + index + 1, (currentNumAllocations - index - 1) * sizeof(long)); currentNumAllocations--; earlierAllocations = (long*) realloc(earlierAllocations, (sizeof(long) * currentNumAllocations)); } void rsi_AllocationCreateAllocationList(Context *rsc, uint32_t count) { if (!earlierAllocations && count > 0) { earlierAllocations = (long*) malloc(sizeof(long) * count); currentNumAllocations = count; for (int i = 0; i < currentNumAllocations; i++) earlierAllocations[i] = 0; } else if (count > 0) { for (int i = 0; i < currentNumAllocations; i++) { if (earlierAllocations[i]) free((void*) earlierAllocations[i]); earlierAllocations[i] = 0; } earlierAllocations = (long*) realloc(earlierAllocations, sizeof(long) * count); currentNumAllocations = count; for (int i = 0; i < currentNumAllocations; i++) earlierAllocations[i] = 0; } } RsAllocation rsi_AllocationCreateFromBitmapBoxed(Context *rsc, uint32_t w, uint32_t h, RsElement _dst, RsElement _src, bool genMips, const void *data) { const Element *srcE = static_cast<const Element *>(_src); Loading Loading
graphics/java/android/renderscript/Allocation.java +0 −23 Original line number Diff line number Diff line Loading @@ -261,29 +261,6 @@ public class Allocation extends BaseObj { return new Allocation(id, rs, null); } static public Allocation createFromBitmap(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips, int index) throws IllegalArgumentException { rs.validate(); int id = rs.nAllocationCreateFromBitmap1(index, dstFmt.mID, genMips, b); return new Allocation(id, rs, null); } static public void addToAllocation(RenderScript rs, int index) throws IllegalArgumentException { rs.nAllocationAddToAllocationList(index); } static public void removeFromAllocation(RenderScript rs, int index) throws IllegalArgumentException { rs.nAllocationRemoveFromAllocationList(index); } static public void createAllocationList(RenderScript rs, int count) throws IllegalArgumentException { rs.nAllocationCreateAllocationList(count); } static public Allocation createFromBitmapBoxed(RenderScript rs, Bitmap b, Element dstFmt, boolean genMips) throws IllegalArgumentException { Loading
graphics/java/android/renderscript/RenderScript.java +0 −4 Original line number Diff line number Diff line Loading @@ -101,10 +101,6 @@ public class RenderScript { native int nAllocationCreateTyped(int type); native int nAllocationCreateFromBitmap(int dstFmt, boolean genMips, Bitmap bmp); native int nAllocationCreateFromBitmap1(int index, int dstFmt, boolean genMips, Bitmap bmp); native int nAllocationAddToAllocationList(int index); native int nAllocationRemoveFromAllocationList(int index); native int nAllocationCreateAllocationList(int count); native int nAllocationCreateFromBitmapBoxed(int dstFmt, boolean genMips, Bitmap bmp); native int nAllocationCreateFromAssetStream(int dstFmt, boolean genMips, int assetStream); Loading
graphics/jni/android_renderscript_RenderScript.cpp +0 −50 Original line number Diff line number Diff line Loading @@ -493,52 +493,6 @@ nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, jint dstFmt, jboolean g return 0; } static int nAllocationCreateFromBitmap1(JNIEnv *_env, jobject _this, jint index, jint dstFmt, jboolean genMips, jobject jbitmap) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); SkBitmap const * nativeBitmap = (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID); const SkBitmap& bitmap(*nativeBitmap); SkBitmap::Config config = bitmap.getConfig(); RsElement e = SkBitmapToPredefined(config); if (e) { bitmap.lockPixels(); const int w = bitmap.width(); const int h = bitmap.height(); const void* ptr = bitmap.getPixels(); jint id = (jint)rsAllocationCreateFromBitmap1(con, w, h, (RsElement)dstFmt, e, genMips, ptr, index); bitmap.unlockPixels(); return id; } return 0; } static int nAllocationAddToAllocationList(JNIEnv *_env, jobject _this, jint index) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); rsAllocationAddToAllocationList(con, index); return 0; } static int nAllocationRemoveFromAllocationList(JNIEnv *_env, jobject _this, jint index) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); rsAllocationRemoveFromAllocationList(con, index); return 0; } static int nAllocationCreateAllocationList(JNIEnv *_env, jobject _this, jint index) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); rsAllocationCreateAllocationList(con, index); return 0; } static int nAllocationCreateFromAssetStream(JNIEnv *_env, jobject _this, jint dstFmt, jboolean genMips, jint native_asset) { Loading Loading @@ -1423,10 +1377,6 @@ static JNINativeMethod methods[] = { {"nAllocationCreateTyped", "(I)I", (void*)nAllocationCreateTyped }, {"nAllocationCreateFromBitmap", "(IZLandroid/graphics/Bitmap;)I", (void*)nAllocationCreateFromBitmap }, {"nAllocationCreateFromBitmap1", "(IIZLandroid/graphics/Bitmap;)I", (void*)nAllocationCreateFromBitmap1 }, {"nAllocationAddToAllocationList", "(I)I", (void*)nAllocationAddToAllocationList}, {"nAllocationRemoveFromAllocationList", "(I)I", (void*)nAllocationRemoveFromAllocationList}, {"nAllocationCreateAllocationList", "(I)I", (void*)nAllocationCreateAllocationList}, {"nAllocationCreateFromBitmapBoxed","(IZLandroid/graphics/Bitmap;)I", (void*)nAllocationCreateFromBitmapBoxed }, {"nAllocationCreateFromAssetStream","(IZI)I", (void*)nAllocationCreateFromAssetStream }, {"nAllocationUploadToTexture", "(II)V", (void*)nAllocationUploadToTexture }, Loading
libs/rs/rs.spec +0 −23 Original line number Diff line number Diff line Loading @@ -109,29 +109,6 @@ AllocationCreateFromBitmap { ret RsAllocation } AllocationCreateFromBitmap1 { param uint32_t width param uint32_t height param RsElement dstFmt param RsElement srcFmt param bool genMips param const void * data param uint32_t index ret RsAllocation } AllocationAddToAllocationList { param uint32_t index } AllocationRemoveFromAllocationList { param uint32_t index } AllocationCreateAllocationList { param uint32_t count } AllocationCreateFromBitmapBoxed { param uint32_t width param uint32_t height Loading
libs/rs/rsAllocation.cpp +2 −134 Original line number Diff line number Diff line Loading @@ -22,43 +22,6 @@ using namespace android; using namespace android::renderscript; static long *earlierAllocations; static unsigned int currentNumAllocations; Allocation::Allocation(Context *rsc, const Type *type, int index) : ObjectBase(rsc) { mAllocFile = __FILE__; mAllocLine = __LINE__; mPtr = NULL; mCpuWrite = false; mCpuRead = false; mGpuWrite = false; mGpuRead = false; mReadWriteRatio = 0; mUpdateSize = 0; mIsTexture = false; mTextureID = 0; mIsVertexBuffer = false; mBufferID = 0; mType.set(type); rsAssert(type); if (!earlierAllocations[index]) { mPtr = malloc(mType->getSizeBytes()); earlierAllocations[index] = (long) mPtr; } else mPtr = (void*) earlierAllocations[index]; if (!mPtr) { LOGE("Allocation::Allocation, alloc failure"); } mUseEarlierAllocation = true; } Allocation::Allocation(Context *rsc, const Type *type) : ObjectBase(rsc) { mAllocFile = __FILE__; Loading @@ -69,7 +32,6 @@ Allocation::Allocation(Context *rsc, const Type *type) : ObjectBase(rsc) mCpuRead = false; mGpuWrite = false; mGpuRead = false; mUseEarlierAllocation = false; mReadWriteRatio = 0; mUpdateSize = 0; Loading @@ -90,7 +52,6 @@ Allocation::Allocation(Context *rsc, const Type *type) : ObjectBase(rsc) Allocation::~Allocation() { if (!mUseEarlierAllocation) free(mPtr); mPtr = NULL; Loading Loading @@ -265,15 +226,6 @@ void Allocation::dumpLOGV(const char *prefix) const namespace android { namespace renderscript { RsAllocation rsi_AllocationCreateTyped(Context *rsc, RsType vtype, int index) { const Type * type = static_cast<const Type *>(vtype); Allocation * alloc = new Allocation(rsc, type, index); alloc->incUserRef(); return alloc; } RsAllocation rsi_AllocationCreateTyped(Context *rsc, RsType vtype) { const Type * type = static_cast<const Type *>(vtype); Loading Loading @@ -450,6 +402,7 @@ RsAllocation rsi_AllocationCreateFromBitmap(Context *rsc, uint32_t w, uint32_t h rsi_TypeAdd(rsc, RS_DIMENSION_LOD, 1); } RsType type = rsi_TypeCreate(rsc); RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, type); Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc); if (texAlloc == NULL) { Loading @@ -473,91 +426,6 @@ RsAllocation rsi_AllocationCreateFromBitmap(Context *rsc, uint32_t w, uint32_t h return texAlloc; } RsAllocation rsi_AllocationCreateFromBitmap1(Context *rsc, uint32_t w, uint32_t h, RsElement _dst, RsElement _src, bool genMips, const void *data, uint32_t index) { const Element *src = static_cast<const Element *>(_src); const Element *dst = static_cast<const Element *>(_dst); rsAssert(!(w & (w-1))); rsAssert(!(h & (h-1))); bool useCt = !(earlierAllocations[index]); //LOGE("rsi_AllocationCreateFromBitmap %i %i %i %i %i", w, h, dstFmt, srcFmt, genMips); rsi_TypeBegin(rsc, _dst); rsi_TypeAdd(rsc, RS_DIMENSION_X, w); rsi_TypeAdd(rsc, RS_DIMENSION_Y, h); if (genMips) { rsi_TypeAdd(rsc, RS_DIMENSION_LOD, 1); } RsType type = rsi_TypeCreate(rsc); RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, type, index); Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc); if (texAlloc == NULL) { LOGE("Memory allocation failure"); return NULL; } if (useCt) { ElementConverter_t cvt = pickConverter(dst, src); cvt(texAlloc->getPtr(), data, w * h); } if (genMips && useCt) { Adapter2D adapt(rsc, texAlloc); Adapter2D adapt2(rsc, 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_AllocationAddToAllocationList(Context *rsc, uint32_t index) { unsigned int temp = currentNumAllocations; currentNumAllocations++; earlierAllocations = (long*) realloc(earlierAllocations, (sizeof(long) * currentNumAllocations)); memmove(earlierAllocations + index + 1, earlierAllocations + index, (temp - index) * sizeof(long)); earlierAllocations[index] = 0; } void rsi_AllocationRemoveFromAllocationList(Context *rsc, uint32_t index) { if (index >= currentNumAllocations || !earlierAllocations || !earlierAllocations[index]) return; if (earlierAllocations[index]) free((void *) earlierAllocations[index]); memmove(earlierAllocations + index, earlierAllocations + index + 1, (currentNumAllocations - index - 1) * sizeof(long)); currentNumAllocations--; earlierAllocations = (long*) realloc(earlierAllocations, (sizeof(long) * currentNumAllocations)); } void rsi_AllocationCreateAllocationList(Context *rsc, uint32_t count) { if (!earlierAllocations && count > 0) { earlierAllocations = (long*) malloc(sizeof(long) * count); currentNumAllocations = count; for (int i = 0; i < currentNumAllocations; i++) earlierAllocations[i] = 0; } else if (count > 0) { for (int i = 0; i < currentNumAllocations; i++) { if (earlierAllocations[i]) free((void*) earlierAllocations[i]); earlierAllocations[i] = 0; } earlierAllocations = (long*) realloc(earlierAllocations, sizeof(long) * count); currentNumAllocations = count; for (int i = 0; i < currentNumAllocations; i++) earlierAllocations[i] = 0; } } RsAllocation rsi_AllocationCreateFromBitmapBoxed(Context *rsc, uint32_t w, uint32_t h, RsElement _dst, RsElement _src, bool genMips, const void *data) { const Element *srcE = static_cast<const Element *>(_src); Loading