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

Side by Side Diff: tests/MallocPixelRefTest.cpp

Issue 243483002: Remove offset to SkMallocPixelRef::NewWithData - use SkData::NewSubset instead. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: AnotherPatchSet Created 6 years, 8 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 | « src/core/SkMallocPixelRef.cpp ('k') | 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 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
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 }
OLDNEW
« no previous file with comments | « src/core/SkMallocPixelRef.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698