Example #1
0
bool CCTexture2D::DoesTextureExist(const char *path, const CCResourceType resourceType)
{
	CCText filename = path;
	filename.stripDirectory();
	filename.toLowerCase();
	return JNIDoesTextureExist( filename.buffer, resourceType == Resource_Packaged );
}
Example #2
0
bool CCTexturePNG::load(const char *path, const CCResourceType resourceType, const bool generateMipMap)
{
#if defined PROFILEON
    CCProfiler profile( "CCTexturePNG::load()" );
#endif

	CCText filename = path;
	filename.stripDirectory();
	filename.toLowercase();

	glName = JniLoad( filename.buffer, resourceType == Resource_Packaged, generateMipMap );
	if( glName > 0 )
	{
		allocatedWidth = imageWidth = JniGetImageWidth();
		imageHeight = JniGetImageHeight();
		allocatedHeight = JniGetAllocatedHeight();

		rawWidth = JniGetRawWidth();
		rawHeight = JniGetRawHeight();

		// TODO: pretend it's always 4 bytes on Android, look into getting actual pixel size data
		allocatedBytes = allocatedWidth * allocatedHeight * 4;
		return true;
	}
	return false;
}
Example #3
0
const bool CCTexturePNG::load(const char *name, const CCResourceType resourceType, const bool generateMipMap)
{
#if defined PROFILEON
    CCProfiler profile( "CCTexturePNG::load()" );
#endif

	CCText filename = name;
	filename.stripDirectory();
	filename.toLowercase();

	glName = jniLoad( filename.buffer, generateMipMap, resourceType == Resource_Packaged );
	if( glName > 0 )
	{
		allocatedWidth = imageWidth = jniGetWidth();
		allocatedHeight = imageHeight = jniGetHeight();
		jniReleaseRawData();
		return true;
	}
	return false;
}