Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tests/SkResourceCacheTest.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/SkImageTest.cpp ('k') | tests/SkpSkGrTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h" 8 #include "Test.h"
9 #include "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 enum CachedState { 136 enum CachedState {
137 kNotInCache, 137 kNotInCache,
138 kInCache, 138 kInCache,
139 }; 139 };
140 140
141 static void check_data(skiatest::Reporter* reporter, const SkCachedData* data, 141 static void check_data(skiatest::Reporter* reporter, const SkCachedData* data,
142 int refcnt, CachedState cacheState, LockedState lockedSta te) { 142 int refcnt, CachedState cacheState, LockedState lockedSta te) {
143 REPORTER_ASSERT(reporter, data->testing_only_getRefCnt() == refcnt); 143 REPORTER_ASSERT(reporter, data->testing_only_getRefCnt() == refcnt);
144 REPORTER_ASSERT(reporter, data->testing_only_isInCache() == (kInCache == cac heState)); 144 REPORTER_ASSERT(reporter, data->testing_only_isInCache() == (kInCache == cac heState));
145 bool isLocked = (data->data() != NULL); 145 bool isLocked = (data->data() != nullptr);
146 REPORTER_ASSERT(reporter, isLocked == (lockedState == kLocked)); 146 REPORTER_ASSERT(reporter, isLocked == (lockedState == kLocked));
147 } 147 }
148 148
149 static void test_mipmapcache(skiatest::Reporter* reporter, SkResourceCache* cach e) { 149 static void test_mipmapcache(skiatest::Reporter* reporter, SkResourceCache* cach e) {
150 cache->purgeAll(); 150 cache->purgeAll();
151 151
152 SkBitmap src; 152 SkBitmap src;
153 src.allocN32Pixels(5, 5); 153 src.allocN32Pixels(5, 5);
154 src.setImmutable(); 154 src.setImmutable();
155 155
156 const SkMipMap* mipmap = SkMipMapCache::FindAndRef(src, cache); 156 const SkMipMap* mipmap = SkMipMapCache::FindAndRef(src, cache);
157 REPORTER_ASSERT(reporter, NULL == mipmap); 157 REPORTER_ASSERT(reporter, nullptr == mipmap);
158 158
159 mipmap = SkMipMapCache::AddAndRef(src, cache); 159 mipmap = SkMipMapCache::AddAndRef(src, cache);
160 REPORTER_ASSERT(reporter, mipmap); 160 REPORTER_ASSERT(reporter, mipmap);
161 161
162 { 162 {
163 const SkMipMap* mm = SkMipMapCache::FindAndRef(src, cache); 163 const SkMipMap* mm = SkMipMapCache::FindAndRef(src, cache);
164 REPORTER_ASSERT(reporter, mm); 164 REPORTER_ASSERT(reporter, mm);
165 REPORTER_ASSERT(reporter, mm == mipmap); 165 REPORTER_ASSERT(reporter, mm == mipmap);
166 mm->unref(); 166 mm->unref();
167 } 167 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 cachedBitmap.unlockPixels(); 279 cachedBitmap.unlockPixels();
280 280
281 // We can add the bitmap back to the cache and find it again. 281 // We can add the bitmap back to the cache and find it again.
282 REPORTER_ASSERT(reporter, SkBitmapCache::Add(cachedBitmap.pixelRef(), rect, cachedBitmap, cache)); 282 REPORTER_ASSERT(reporter, SkBitmapCache::Add(cachedBitmap.pixelRef(), rect, cachedBitmap, cache));
283 REPORTER_ASSERT(reporter, SkBitmapCache::Find(cachedBitmap.getGenerationID() , rect, &bm, cache)); 283 REPORTER_ASSERT(reporter, SkBitmapCache::Find(cachedBitmap.getGenerationID() , rect, &bm, cache));
284 284
285 test_mipmapcache(reporter, cache); 285 test_mipmapcache(reporter, cache);
286 test_bitmap_notify(reporter, cache); 286 test_bitmap_notify(reporter, cache);
287 test_mipmap_notify(reporter, cache); 287 test_mipmap_notify(reporter, cache);
288 } 288 }
OLDNEW
« no previous file with comments | « tests/SkImageTest.cpp ('k') | tests/SkpSkGrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698