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

Side by Side Diff: src/core/SkMallocPixelRef.cpp

Issue 122283002: Revert of remove Sk64 from public API, and start to remove usage internally (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | src/core/SkMipMap.cpp » ('j') | 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 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 "SkFlattenableBuffers.h" 10 #include "SkFlattenableBuffers.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return NULL; // cannot meet requested rowbytes 57 return NULL; // cannot meet requested rowbytes
58 } 58 }
59 59
60 int32_t rowBytes; 60 int32_t rowBytes;
61 if (requestedRowBytes) { 61 if (requestedRowBytes) {
62 rowBytes = requestedRowBytes; 62 rowBytes = requestedRowBytes;
63 } else { 63 } else {
64 rowBytes = minRB; 64 rowBytes = minRB;
65 } 65 }
66 66
67 int64_t bigSize = (int64_t)info.fHeight * rowBytes; 67 Sk64 bigSize;
68 if (!sk_64_isS32(bigSize)) { 68 bigSize.setMul(info.fHeight, rowBytes);
69 if (!bigSize.is32()) {
69 return NULL; 70 return NULL;
70 } 71 }
71 72
72 size_t size = sk_64_asS32(bigSize); 73 size_t size = bigSize.get32();
73 void* addr = sk_malloc_flags(size, 0); 74 void* addr = sk_malloc_flags(size, 0);
74 if (NULL == addr) { 75 if (NULL == addr) {
75 return NULL; 76 return NULL;
76 } 77 }
77 78
78 return SkNEW_ARGS(SkMallocPixelRef, (info, addr, rowBytes, ctable, true)); 79 return SkNEW_ARGS(SkMallocPixelRef, (info, addr, rowBytes, ctable, true));
79 } 80 }
80 81
81 /////////////////////////////////////////////////////////////////////////////// 82 ///////////////////////////////////////////////////////////////////////////////
82 83
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 151 }
151 152
152 if (buffer.readBool()) { 153 if (buffer.readBool()) {
153 fCTable = SkNEW_ARGS(SkColorTable, (buffer)); 154 fCTable = SkNEW_ARGS(SkColorTable, (buffer));
154 } else { 155 } else {
155 fCTable = NULL; 156 fCTable = NULL;
156 } 157 }
157 158
158 this->setPreLocked(fStorage, fCTable); 159 this->setPreLocked(fStorage, fCTable);
159 } 160 }
OLDNEW
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | src/core/SkMipMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698