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

Side by Side Diff: tests/BitmapHeapTest.cpp

Issue 719853002: Follow up. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapHeap.h" 9 #include "SkBitmapHeap.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
11 #include "SkFlattenable.h" 11 #include "SkFlattenable.h"
12 #include "SkWriteBuffer.h" 12 #include "SkWriteBuffer.h"
13 #include "SkPictureFlat.h" 13 #include "SkPictureFlat.h"
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 #include "SkShader.h" 15 #include "SkShader.h"
16 #include "Test.h" 16 #include "Test.h"
17 17
18 struct SimpleFlatController : public SkFlatController { 18 struct SimpleFlatController : public SkFlatController {
19 SimpleFlatController() : SkFlatController() {} 19 SimpleFlatController() : SkFlatController() {}
20 virtual void* allocThrow(size_t bytes) { return sk_malloc_throw(bytes); } 20 virtual void* allocThrow(size_t bytes) SK_OVERRIDE { return sk_malloc_throw( bytes); }
21 virtual void unalloc(void* ptr) { sk_free(ptr); } 21 virtual void unalloc(void* ptr) SK_OVERRIDE { sk_free(ptr); }
22 void setBitmapStorage(SkBitmapHeap* h) { this->setBitmapHeap(h); } 22 void setBitmapStorage(SkBitmapHeap* h) { this->setBitmapHeap(h); }
23 }; 23 };
24 24
25 struct SkShaderTraits { 25 struct SkShaderTraits {
26 static void Flatten(SkWriteBuffer& buffer, const SkShader& shader) { 26 static void Flatten(SkWriteBuffer& buffer, const SkShader& shader) {
27 buffer.writeFlattenable(&shader); 27 buffer.writeFlattenable(&shader);
28 } 28 }
29 }; 29 };
30 typedef SkFlatDictionary<SkShader, SkShaderTraits> FlatDictionary; 30 typedef SkFlatDictionary<SkShader, SkShaderTraits> FlatDictionary;
31 31
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 heap.deferAddingOwners(); 82 heap.deferAddingOwners();
83 index = dictionary.find(*bitmapShader); 83 index = dictionary.find(*bitmapShader);
84 heap.endAddingOwnersDeferral(false); 84 heap.endAddingOwnersDeferral(false);
85 85
86 // The dictionary should report the same index since the new entry is identi cal. 86 // The dictionary should report the same index since the new entry is identi cal.
87 // The bitmap heap should contain the bitmap, but with no references. 87 // The bitmap heap should contain the bitmap, but with no references.
88 REPORTER_ASSERT(reporter, 1 == index); 88 REPORTER_ASSERT(reporter, 1 == index);
89 REPORTER_ASSERT(reporter, heap.count() == 1); 89 REPORTER_ASSERT(reporter, heap.count() == 1);
90 REPORTER_ASSERT(reporter, SkBitmapHeapTester::GetRefCount(heap.getEntry(0)) == 0); 90 REPORTER_ASSERT(reporter, SkBitmapHeapTester::GetRefCount(heap.getEntry(0)) == 0);
91 } 91 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698