- // got to the end so no match, decode N patch and append new item to cache
- if( border == Rect< int >( 0, 0, 0, 0 ) )
+ NPatchInfo& info(mCache[cacheIndex]);
+
+ info.mData->RemoveObserver(textureObserver);
+
+ if(--info.mReferenceCount <= 0)
+ {
+ mCache.erase(mCache.begin() + cacheIndex);
+ }
+}
+
+void NPatchLoader::Process(bool postProcessor)
+{
+ for(auto& iter : mRemoveQueue)
+ {
+ Remove(iter.first, iter.second);
+ }
+ mRemoveQueue.clear();
+
+ if(Adaptor::IsAvailable())
+ {
+ Adaptor::Get().UnregisterProcessor(*this, true);
+ mRemoveProcessorRegistered = false;
+ }
+}
+
+NPatchDataPtr NPatchLoader::GetNPatchData(const VisualUrl& url, const Rect<int>& border, bool& preMultiplyOnLoad)
+{
+ std::size_t hash = CalculateHash(url.GetUrl());
+ std::vector<NPatchInfo>::size_type index = UNINITIALIZED_ID;
+ const std::vector<NPatchInfo>::size_type count = mCache.size();
+
+ NPatchInfo* infoPtr = nullptr;
+
+ for(; index < count; ++index)