~unity-team/unity/trusty-1332509

« back to all changes in this revision

Viewing changes to unity-shared/TextureCache.cpp

  • Committer: CI bot
  • Author(s): Stephen M. Webb, Marco Trevisan (Treviño), Andrea Azzarone, Pawel Szubert, Chris Townsend, Andrea Azzarone, Eleni Maria Stea
  • Date: 2014-08-26 13:48:28 UTC
  • mfrom: (3800.1.24 prepare-7.2.3-SRU)
  • Revision ID: ps-jenkins@lists.canonical.com-20140826134828-fkev1oisyfl9kbt3
Prepare fixes for upstream micro-release 7.2.3. Fixes: 1283415, 1292391, 1306211, 1312107, 1320051, 1320071, 1324114, 1339629, 1340171, 1340394, 1340477, 1340992, 1340996, 1342208, 1342731, 1347735

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
namespace unity
28
28
{
29
29
DECLARE_LOGGER(logger, "unity.internal.texturecache");
 
30
namespace
 
31
{
 
32
// Stolen from boost
 
33
template <class T>
 
34
inline std::size_t hash_combine(std::size_t seed, T const& v)
 
35
{
 
36
  return seed ^ (std::hash<T>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2));
 
37
}
 
38
}
30
39
 
31
40
TextureCache& TextureCache::GetDefault()
32
41
{
42
51
 
43
52
std::size_t TextureCache::Hash(std::string const& id, int width, int height)
44
53
{
45
 
  return ((std::hash<std::string>()(id)
46
 
          ^ (std::hash<int>()(width) << 1)) >> 1)
47
 
          ^ (std::hash<int>()(height) << 1);
 
54
  return hash_combine(hash_combine(std::hash<std::string>()(id), width), height);
48
55
}
49
56
 
50
57
TextureCache::BaseTexturePtr TextureCache::FindTexture(std::string const& texture_id,