// get cached request
RequestIdMap::iterator foundRequestIter = mRequestCache.find( cachedReqId );
DALI_ASSERT_DEBUG( foundRequestIter != mRequestCache.end() );
- const Request& cachedRequest = *(foundRequestIter->second);
- const ImageAttributes* storedAttributes = cachedRequest.attributes;
-
- // compare attributes: NULL means default attributes
- if( !attributes )
- {
- attributes = &ImageAttributes::DEFAULT_ATTRIBUTES;
- }
- if( !storedAttributes )
+ if( foundRequestIter != mRequestCache.end() )
{
- storedAttributes = &ImageAttributes::DEFAULT_ATTRIBUTES;
- }
+ const Request& cachedRequest = *(foundRequestIter->second);
+ const ImageAttributes* storedAttributes = cachedRequest.attributes;
- if( *attributes != *storedAttributes )
- {
- continue;
- }
+ // compare attributes: NULL means default attributes
+ if( !attributes )
+ {
+ attributes = &ImageAttributes::DEFAULT_ATTRIBUTES;
+ }
+ if( !storedAttributes )
+ {
+ storedAttributes = &ImageAttributes::DEFAULT_ATTRIBUTES;
+ }
- if( filename.compare( cachedRequest.url ) )
- {
- // hash collision, filenames don't match
- continue;
- }
+ if( *attributes != *storedAttributes )
+ {
+ continue;
+ }
+
+ if( filename.compare( cachedRequest.url ) )
+ {
+ // hash collision, filenames don't match
+ continue;
+ }
- // we've found an exact match
- return foundRequestIter->second;
+ // we've found an exact match
+ return foundRequestIter->second;
+ }
}
return NULL;
// get cached request
RequestIdMap::iterator foundRequestIter = mRequestCache.find( cachedReqId );
DALI_ASSERT_DEBUG( foundRequestIter != mRequestCache.end() );
- Request& cachedRequest = *(foundRequestIter->second);
- if( filename.compare( cachedRequest.url ) )
- {
- // hash collision, filenames don't match
- continue;
- }
-
- if( !cachedRequest.resourceId )
- {
- continue;
- }
-
- ticket = mResourceClient.RequestResourceTicket( cachedRequest.resourceId );
- if( !ticket )
- {
- cachedRequest.resourceId = 0;
- continue;
- }
-
- DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceBitmap ||
- ticket->GetTypePath().type->id == ResourceNativeImage ||
- ticket->GetTypePath().type->id == ResourceTargetImage );
-
- // check for compatible ImageAttributes
- const ImageAttributes& storedAttributes = static_cast<ImageTicket*>(ticket.Get())->GetAttributes();
- if( !attr )
+ if( foundRequestIter != mRequestCache.end() )
{
- attr = &ImageAttributes::DEFAULT_ATTRIBUTES;
- }
-
- // in case both attributes are default or they are matching custom ones
- if( CompareAttributes( *attr, storedAttributes ) )
- {
- // found compatible resource
- foundCompatible = true;
- break;
+ Request& cachedRequest = *(foundRequestIter->second);
+ if( filename.compare( cachedRequest.url ) )
+ {
+ // hash collision, filenames don't match
+ continue;
+ }
+
+ if( !cachedRequest.resourceId )
+ {
+ continue;
+ }
+
+ ticket = mResourceClient.RequestResourceTicket( cachedRequest.resourceId );
+ if( !ticket )
+ {
+ cachedRequest.resourceId = 0;
+ continue;
+ }
+
+ DALI_ASSERT_DEBUG( ticket->GetTypePath().type->id == ResourceBitmap ||
+ ticket->GetTypePath().type->id == ResourceNativeImage ||
+ ticket->GetTypePath().type->id == ResourceTargetImage );
+
+ // check for compatible ImageAttributes
+ const ImageAttributes& storedAttributes = static_cast<ImageTicket*>(ticket.Get())->GetAttributes();
+ if( !attr )
+ {
+ attr = &ImageAttributes::DEFAULT_ATTRIBUTES;
+ }
+
+ // in case both attributes are default or they are matching custom ones
+ if( CompareAttributes( *attr, storedAttributes ) )
+ {
+ // found compatible resource
+ foundCompatible = true;
+ break;
+ }
}
} // for( it ...
} // foundRequests.first
DALI_ASSERT_DEBUG(intervals > 0);
std::vector<VertexToTextureCoord>::const_iterator iter = insertionList.begin();
- std::vector<VertexToTextureCoord>::const_iterator end = insertionList.end()-1;
-
- const float length = end->x - iter->x;
- const float intervalSize = length / static_cast<float>(intervals);
- float x = iter->x;
-
- for(;iter!=end;++iter)
+ if( iter != insertionList.end() )
{
- float x0 = iter[0].x;
- float u0 = iter[0].u;
- float x1 = iter[1].x;
- float u1 = iter[1].u;
+ std::vector<VertexToTextureCoord>::const_iterator end = insertionList.end()-1;
+
+ const float length = end->x - iter->x;
+ const float intervalSize = length / static_cast<float>(intervals);
+ float x = iter->x;
- for(;x<x1;x+=intervalSize)
+ for(;iter!=end;++iter)
{
- float progress = (x - x0) / (x1 - x0); // progress value between current interval and next.
- float u = u0 + (u1 - u0) * progress; // u 1D texture coordinate value for this x position.
- intervalList.push_back( VertexToTextureCoord( x, u ) );
+ float x0 = iter[0].x;
+ float u0 = iter[0].u;
+ float x1 = iter[1].x;
+ float u1 = iter[1].u;
+
+ for(;x<x1;x+=intervalSize)
+ {
+ float progress = (x - x0) / (x1 - x0); // progress value between current interval and next.
+ float u = u0 + (u1 - u0) * progress; // u 1D texture coordinate value for this x position.
+ intervalList.push_back( VertexToTextureCoord( x, u ) );
+ }
+ intervalList.push_back( VertexToTextureCoord( x1, u1 ) );
}
- intervalList.push_back( VertexToTextureCoord( x1, u1 ) );
}
}
{
ShaderCacheIter shaderIter = mImpl->mShaders.find(id);
DALI_ASSERT_DEBUG( mImpl->mShaders.end() != shaderIter );
- ShaderDataPtr shaderDataPtr = shaderIter->second;
- std::vector<unsigned char>().swap(shaderDataPtr->buffer);
+ if( mImpl->mShaders.end() != shaderIter )
+ {
+ ShaderDataPtr shaderDataPtr = shaderIter->second;
+ std::vector<unsigned char>().swap(shaderDataPtr->buffer);
+ }
}
}
}
{
MeshCacheIter mesh = mImpl->mMeshes.find(iter->first);
DALI_ASSERT_DEBUG( mImpl->mMeshes.end() != mesh );
-
- mImpl->mDiscardQueue.Add( updateBufferIndex, mesh->second );
- mImpl->mMeshes.erase( mesh );
+ if( mImpl->mMeshes.end() != mesh )
+ {
+ mImpl->mDiscardQueue.Add( updateBufferIndex, mesh->second );
+ mImpl->mMeshes.erase( mesh );
+ }
}
break;