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

Side by Side Diff: tests/BitmapHeapTest.cpp

Issue 1789633002: 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
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 SkShader* bitmapShader = SkShader::CreateBitmapShader(bm, SkShader::kRepeat_ TileMode, 53 auto bitmapShader = SkShader::MakeBitmapShader(bm, SkShader::kRepeat_TileMod e,
54 SkShader::kRepeat_Tile Mode); 54 SkShader::kRepeat_TileMode);
55 SkAutoTUnref<SkShader> aur(bitmapShader);
56 55
57 // Flatten, storing it in the bitmap heap. 56 // Flatten, storing it in the bitmap heap.
58 SkBitmapHeap heap(1, 1); 57 SkBitmapHeap heap(1, 1);
59 SimpleFlatController controller; 58 SimpleFlatController controller;
60 controller.setBitmapStorage(&heap); 59 controller.setBitmapStorage(&heap);
61 FlatDictionary dictionary(&controller); 60 FlatDictionary dictionary(&controller);
62 61
63 // Dictionary and heap start off empty. 62 // Dictionary and heap start off empty.
64 REPORTER_ASSERT(reporter, heap.count() == 0); 63 REPORTER_ASSERT(reporter, heap.count() == 0);
65 REPORTER_ASSERT(reporter, dictionary.count() == 0); 64 REPORTER_ASSERT(reporter, dictionary.count() == 0);
(...skipping 22 matching lines...) Expand all
88 heap.deferAddingOwners(); 87 heap.deferAddingOwners();
89 index = dictionary.find(*bitmapShader); 88 index = dictionary.find(*bitmapShader);
90 heap.endAddingOwnersDeferral(false); 89 heap.endAddingOwnersDeferral(false);
91 90
92 // The dictionary should report the same index since the new entry is identi cal. 91 // The dictionary should report the same index since the new entry is identi cal.
93 // The bitmap heap should contain the bitmap, but with no references. 92 // The bitmap heap should contain the bitmap, but with no references.
94 REPORTER_ASSERT(reporter, 1 == index); 93 REPORTER_ASSERT(reporter, 1 == index);
95 REPORTER_ASSERT(reporter, heap.count() == 1); 94 REPORTER_ASSERT(reporter, heap.count() == 1);
96 REPORTER_ASSERT(reporter, SkBitmapHeapTester::GetRefCount(heap.getEntry(0)) == 0); 95 REPORTER_ASSERT(reporter, SkBitmapHeapTester::GetRefCount(heap.getEntry(0)) == 0);
97 } 96 }
OLDNEW
« gm/pictureshadertile.cpp ('K') | « gm/xfermodes3.cpp ('k') | tests/BlitRowTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698