OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkMallocPixelRef.h" | 8 #include "SkMallocPixelRef.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info, | 52 SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info, |
53 size_t requestedRowBytes, | 53 size_t requestedRowBytes, |
54 SkColorTable* ctable) { | 54 SkColorTable* ctable) { |
55 if (!is_valid(info, ctable)) { | 55 if (!is_valid(info, ctable)) { |
56 return NULL; | 56 return NULL; |
57 } | 57 } |
58 | 58 |
59 int32_t minRB = SkToS32(info.minRowBytes()); | 59 int64_t minRB = info.minRowBytes64(); |
caryclark
2015/01/23 15:10:09
signature returns uint64_t
reed1
2015/01/23 15:35:39
trying a cast instead, to stay consistent with the
| |
60 if (minRB < 0) { | 60 if (!sk_64_isS32(minRB)) { |
caryclark
2015/01/23 15:10:10
... then this would need to be sk_64_asS32(uint64_
| |
61 return NULL; // allocation will be too large | 61 return NULL; // allocation will be too large |
62 } | 62 } |
63 if (requestedRowBytes > 0 && (int32_t)requestedRowBytes < minRB) { | 63 if (requestedRowBytes > 0 && (int32_t)requestedRowBytes < minRB) { |
64 return NULL; // cannot meet requested rowbytes | 64 return NULL; // cannot meet requested rowbytes |
65 } | 65 } |
66 | 66 |
67 int32_t rowBytes; | 67 int32_t rowBytes; |
68 if (requestedRowBytes) { | 68 if (requestedRowBytes) { |
69 rowBytes = SkToS32(requestedRowBytes); | 69 rowBytes = SkToS32(requestedRowBytes); |
70 } else { | 70 } else { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 size_t SkMallocPixelRef::getAllocatedSizeInBytes() const { | 198 size_t SkMallocPixelRef::getAllocatedSizeInBytes() const { |
199 return this->info().getSafeSize(fRB); | 199 return this->info().getSafeSize(fRB); |
200 } | 200 } |
201 | 201 |
202 /////////////////////////////////////////////////////////////////////////////// | 202 /////////////////////////////////////////////////////////////////////////////// |
203 | 203 |
204 SkPixelRef* SkMallocPixelRef::PRFactory::create(const SkImageInfo& info, size_t rowBytes, | 204 SkPixelRef* SkMallocPixelRef::PRFactory::create(const SkImageInfo& info, size_t rowBytes, |
205 SkColorTable* ctable) { | 205 SkColorTable* ctable) { |
206 return SkMallocPixelRef::NewAllocate(info, rowBytes, ctable); | 206 return SkMallocPixelRef::NewAllocate(info, rowBytes, ctable); |
207 } | 207 } |
OLD | NEW |