OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkData.h" | 8 #include "SkData.h" |
9 #include "SkMallocPixelRef.h" | 9 #include "SkMallocPixelRef.h" |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 SkAutoMalloc memory(size); | 57 SkAutoMalloc memory(size); |
58 SkAutoTUnref<SkMallocPixelRef> pr( | 58 SkAutoTUnref<SkMallocPixelRef> pr( |
59 SkMallocPixelRef::NewDirect(info, memory.get(), rowBytes, NULL)); | 59 SkMallocPixelRef::NewDirect(info, memory.get(), rowBytes, NULL)); |
60 REPORTER_ASSERT(reporter, pr.get() != NULL); | 60 REPORTER_ASSERT(reporter, pr.get() != NULL); |
61 REPORTER_ASSERT(reporter, memory.get() == pr->pixels()); | 61 REPORTER_ASSERT(reporter, memory.get() == pr->pixels()); |
62 } | 62 } |
63 { | 63 { |
64 SkAutoTUnref<SkMallocPixelRef> pr( | 64 SkAutoTUnref<SkMallocPixelRef> pr( |
65 SkMallocPixelRef::NewAllocate(info, rowBytes, NULL)); | 65 SkMallocPixelRef::NewAllocate(info, rowBytes, NULL)); |
66 REPORTER_ASSERT(reporter, pr.get() != NULL); | 66 REPORTER_ASSERT(reporter, pr.get() != NULL); |
67 REPORTER_ASSERT(reporter, NULL != pr->pixels()); | 67 REPORTER_ASSERT(reporter, pr->pixels()); |
68 } | 68 } |
69 { | 69 { |
70 void* addr = static_cast<void*>(new uint8_t[size]); | 70 void* addr = static_cast<void*>(new uint8_t[size]); |
71 SkAutoTUnref<SkMallocPixelRef> pr( | 71 SkAutoTUnref<SkMallocPixelRef> pr( |
72 SkMallocPixelRef::NewWithProc(info, rowBytes, NULL, addr, | 72 SkMallocPixelRef::NewWithProc(info, rowBytes, NULL, addr, |
73 delete_uint8_proc, NULL)); | 73 delete_uint8_proc, NULL)); |
74 REPORTER_ASSERT(reporter, pr.get() != NULL); | 74 REPORTER_ASSERT(reporter, pr.get() != NULL); |
75 REPORTER_ASSERT(reporter, addr == pr->pixels()); | 75 REPORTER_ASSERT(reporter, addr == pr->pixels()); |
76 } | 76 } |
77 { | 77 { |
(...skipping 26 matching lines...) Expand all Loading... |
104 SkData* dataPtr = data.get(); | 104 SkData* dataPtr = data.get(); |
105 REPORTER_ASSERT(reporter, dataPtr->unique()); | 105 REPORTER_ASSERT(reporter, dataPtr->unique()); |
106 SkAutoTUnref<SkMallocPixelRef> pr( | 106 SkAutoTUnref<SkMallocPixelRef> pr( |
107 SkMallocPixelRef::NewWithData(info, rowBytes, NULL, data.get())); | 107 SkMallocPixelRef::NewWithData(info, rowBytes, NULL, data.get())); |
108 REPORTER_ASSERT(reporter, !(dataPtr->unique())); | 108 REPORTER_ASSERT(reporter, !(dataPtr->unique())); |
109 data.reset(NULL); | 109 data.reset(NULL); |
110 REPORTER_ASSERT(reporter, dataPtr->unique()); | 110 REPORTER_ASSERT(reporter, dataPtr->unique()); |
111 REPORTER_ASSERT(reporter, dataPtr->data() == pr->pixels()); | 111 REPORTER_ASSERT(reporter, dataPtr->data() == pr->pixels()); |
112 } | 112 } |
113 } | 113 } |
OLD | NEW |