Fix bug in SkMipmapCache::AddAndRef factory selection.

Discovered via ClangTidy `readability-static-accessed-through-instance`.

Change-Id: I646e3293853e65b5cc2419c8687c035aab4b669a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308659
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2020-08-07 12:14:14 -04:00 committed by Skia Commit-Bot
parent 871aa74797
commit efc17ce2ca
2 changed files with 5 additions and 1 deletions

View File

@ -280,7 +280,7 @@ const SkMipmap* SkMipmapCache::FindAndRef(const SkBitmapCacheDesc& desc,
}
static SkResourceCache::DiscardableFactory get_fact(SkResourceCache* localCache) {
return localCache ? localCache->GetDiscardableFactory()
return localCache ? localCache->discardableFactory()
: SkResourceCache::GetDiscardableFactory();
}

View File

@ -110,8 +110,11 @@ static void test_mipmap_notify(skiatest::Reporter* reporter, SkResourceCache* ca
#include "src/lazy/SkDiscardableMemoryPool.h"
static SkDiscardableMemoryPool* gPool = nullptr;
static int gFactoryCalls = 0;
static SkDiscardableMemory* pool_factory(size_t bytes) {
SkASSERT(gPool);
gFactoryCalls++;
return gPool->create(bytes);
}
@ -134,6 +137,7 @@ DEF_TEST(BitmapCache_discarded_bitmap, reporter) {
SkResourceCache cache(factory);
testBitmapCache_discarded_bitmap(reporter, &cache, factory);
}
REPORTER_ASSERT(reporter, gFactoryCalls > 0);
}
static void test_discarded_image(skiatest::Reporter* reporter, const SkMatrix& transform,