| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 delete_uint8_proc, NULL)); | 97 delete_uint8_proc, NULL)); |
| 98 REPORTER_ASSERT(reporter, addr == pr->pixels()); | 98 REPORTER_ASSERT(reporter, addr == pr->pixels()); |
| 99 } | 99 } |
| 100 { | 100 { |
| 101 void* addr = sk_malloc_throw(size); | 101 void* addr = sk_malloc_throw(size); |
| 102 SkAutoDataUnref data(SkData::NewFromMalloc(addr, size)); | 102 SkAutoDataUnref data(SkData::NewFromMalloc(addr, size)); |
| 103 REPORTER_ASSERT(reporter, data.get() != NULL); | 103 REPORTER_ASSERT(reporter, data.get() != NULL); |
| 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(), 4)); | 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, | 111 REPORTER_ASSERT(reporter, dataPtr->data() == pr->pixels()); |
| 112 static_cast<const void*>(dataPtr->bytes() + 4) == pr->pixels()); | |
| 113 } | 112 } |
| 114 } | 113 } |
| OLD | NEW |