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

Unified Diff: src/core/SkMallocPixelRef.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkMallocPixelRef.h ('k') | tests/MallocPixelRefTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMallocPixelRef.cpp
diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp
index aa7c4f745cd5e809cb62f8c8f26c455a1197a77f..12cb05bd729302fd117c86bed3b16954ba5f9187 100644
--- a/src/core/SkMallocPixelRef.cpp
+++ b/src/core/SkMallocPixelRef.cpp
@@ -49,6 +49,7 @@ SkMallocPixelRef* SkMallocPixelRef::NewDirect(const SkImageInfo& info,
(info, addr, rowBytes, ctable, NULL, NULL));
}
+
SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info,
size_t requestedRowBytes,
SkColorTable* ctable) {
@@ -108,22 +109,19 @@ static void sk_data_releaseproc(void*, void* dataPtr) {
SkMallocPixelRef* SkMallocPixelRef::NewWithData(const SkImageInfo& info,
size_t rowBytes,
SkColorTable* ctable,
- SkData* data,
- size_t offset) {
+ SkData* data) {
SkASSERT(data != NULL);
- SkASSERT(offset <= data->size());
if (!is_valid(info, ctable)) {
return NULL;
}
if ((rowBytes < info.minRowBytes())
- || ((data->size() - offset) < info.getSafeSize(rowBytes))) {
+ || (data->size() < info.getSafeSize(rowBytes))) {
return NULL;
}
data->ref();
- const void* ptr = static_cast<const void*>(data->bytes() + offset);
SkMallocPixelRef* pr
= SkNEW_ARGS(SkMallocPixelRef,
- (info, const_cast<void*>(ptr), rowBytes, ctable,
+ (info, const_cast<void*>(data->data()), rowBytes, ctable,
sk_data_releaseproc, static_cast<void*>(data)));
SkASSERT(pr != NULL);
// We rely on the immutability of the pixels to make the
« no previous file with comments | « include/core/SkMallocPixelRef.h ('k') | tests/MallocPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698