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

Side by Side Diff: tests/BitmapHeapTest.cpp

Issue 1790353002: Revert of more shader-->sp conversions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « gm/xfermodes3.cpp ('k') | tests/BlitRowTest.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 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"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 }; 43 };
44 44
45 DEF_TEST(BitmapHeap, reporter) { 45 DEF_TEST(BitmapHeap, reporter) {
46 // Create a bitmap shader. 46 // Create a bitmap shader.
47 SkBitmap bm; 47 SkBitmap bm;
48 bm.allocN32Pixels(2, 2); 48 bm.allocN32Pixels(2, 2);
49 bm.eraseColor(SK_ColorRED); 49 bm.eraseColor(SK_ColorRED);
50 uint32_t* pixel = bm.getAddr32(1,0); 50 uint32_t* pixel = bm.getAddr32(1,0);
51 *pixel = SK_ColorBLUE; 51 *pixel = SK_ColorBLUE;
52 52
53 auto bitmapShader = SkShader::MakeBitmapShader(bm, SkShader::kRepeat_TileMod e, 53 SkShader* bitmapShader = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_ TileMode,
54 SkShader::kRepeat_TileMode); 54 SkShader::kRepeat_Tile Mode);
55 SkAutoTUnref<SkShader> aur(bitmapShader);
55 56
56 // Flatten, storing it in the bitmap heap. 57 // Flatten, storing it in the bitmap heap.
57 SkBitmapHeap heap(1, 1); 58 SkBitmapHeap heap(1, 1);
58 SimpleFlatController controller; 59 SimpleFlatController controller;
59 controller.setBitmapStorage(&heap); 60 controller.setBitmapStorage(&heap);
60 FlatDictionary dictionary(&controller); 61 FlatDictionary dictionary(&controller);
61 62
62 // Dictionary and heap start off empty. 63 // Dictionary and heap start off empty.
63 REPORTER_ASSERT(reporter, heap.count() == 0); 64 REPORTER_ASSERT(reporter, heap.count() == 0);
64 REPORTER_ASSERT(reporter, dictionary.count() == 0); 65 REPORTER_ASSERT(reporter, dictionary.count() == 0);
(...skipping 22 matching lines...) Expand all
87 heap.deferAddingOwners(); 88 heap.deferAddingOwners();
88 index = dictionary.find(*bitmapShader); 89 index = dictionary.find(*bitmapShader);
89 heap.endAddingOwnersDeferral(false); 90 heap.endAddingOwnersDeferral(false);
90 91
91 // The dictionary should report the same index since the new entry is identi cal. 92 // The dictionary should report the same index since the new entry is identi cal.
92 // The bitmap heap should contain the bitmap, but with no references. 93 // The bitmap heap should contain the bitmap, but with no references.
93 REPORTER_ASSERT(reporter, 1 == index); 94 REPORTER_ASSERT(reporter, 1 == index);
94 REPORTER_ASSERT(reporter, heap.count() == 1); 95 REPORTER_ASSERT(reporter, heap.count() == 1);
95 REPORTER_ASSERT(reporter, SkBitmapHeapTester::GetRefCount(heap.getEntry(0)) == 0); 96 REPORTER_ASSERT(reporter, SkBitmapHeapTester::GetRefCount(heap.getEntry(0)) == 0);
96 } 97 }
OLDNEW
« no previous file with comments | « gm/xfermodes3.cpp ('k') | tests/BlitRowTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698