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

Side by Side Diff: tests/SkResourceCacheTest.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 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/SerializationTest.cpp ('k') | tests/SurfaceTest.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 #include "Test.h" 7 #include "Test.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkGraphics.h" 9 #include "SkGraphics.h"
10 #include "SkBitmapCache.h" 10 #include "SkBitmapCache.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 SkGraphics::SetResourceCacheSingleAllocationByteLimit(originalAllocationLimi t); 72 SkGraphics::SetResourceCacheSingleAllocationByteLimit(originalAllocationLimi t);
73 SkGraphics::SetResourceCacheTotalByteLimit(originalByteLimit); 73 SkGraphics::SetResourceCacheTotalByteLimit(originalByteLimit);
74 } 74 }
75 75
76 #if 0 // skia:2912 76 #if 0 // skia:2912
77 77
78 static SkBitmap createAllocatedBitmap(const SkImageInfo& info) { 78 static SkBitmap createAllocatedBitmap(const SkImageInfo& info) {
79 SkBitmap cachedBitmap; 79 SkBitmap cachedBitmap;
80 cachedBitmap.setInfo(info); 80 cachedBitmap.setInfo(info);
81 SkBitmap::Allocator* allocator = SkBitmapCache::GetAllocator(); 81 SkBitmap::Allocator* allocator = SkBitmapCache::GetAllocator();
82 if (NULL != allocator) { 82 if (allocator) {
83 allocator->allocPixelRef(&cachedBitmap, 0); 83 allocator->allocPixelRef(&cachedBitmap, 0);
84 } else { 84 } else {
85 cachedBitmap.allocPixels(); 85 cachedBitmap.allocPixels();
86 } 86 }
87 87
88 return cachedBitmap; 88 return cachedBitmap;
89 } 89 }
90 90
91 // http://skbug.com/2894 91 // http://skbug.com/2894
92 DEF_TEST(BitmapCache_add_rect, reporter) { 92 DEF_TEST(BitmapCache_add_rect, reporter) {
(...skipping 10 matching lines...) Expand all
103 REPORTER_ASSERT(reporter, ! SkBitmapCache::Find(cachedBitmap.getGenerationID (), rect, &bm)); 103 REPORTER_ASSERT(reporter, ! SkBitmapCache::Find(cachedBitmap.getGenerationID (), rect, &bm));
104 104
105 // Should not be in the cache 105 // Should not be in the cache
106 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(cachedBitmap.getGenerationID( ), rect, &bm)); 106 REPORTER_ASSERT(reporter, !SkBitmapCache::Find(cachedBitmap.getGenerationID( ), rect, &bm));
107 107
108 REPORTER_ASSERT(reporter, SkBitmapCache::Add(cachedBitmap.getGenerationID(), rect, cachedBitmap)); 108 REPORTER_ASSERT(reporter, SkBitmapCache::Add(cachedBitmap.getGenerationID(), rect, cachedBitmap));
109 // Should be in the cache, we just added it 109 // Should be in the cache, we just added it
110 REPORTER_ASSERT(reporter, SkBitmapCache::Find(cachedBitmap.getGenerationID() , rect, &bm)); 110 REPORTER_ASSERT(reporter, SkBitmapCache::Find(cachedBitmap.getGenerationID() , rect, &bm));
111 } 111 }
112 #endif 112 #endif
OLDNEW
« no previous file with comments | « tests/SerializationTest.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698