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

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

Issue 125063002: add rowBytes param to setPreLock, in prep for onNewLockPixels change (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 | « include/core/SkPixelRef.h ('k') | src/core/SkPixelRef.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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 if (kIndex_8_SkColorType != info.fColorType) { 146 if (kIndex_8_SkColorType != info.fColorType) {
147 ctable = NULL; 147 ctable = NULL;
148 } 148 }
149 149
150 fStorage = storage; 150 fStorage = storage;
151 fCTable = ctable; 151 fCTable = ctable;
152 fRB = rowBytes; 152 fRB = rowBytes;
153 SkSafeRef(ctable); 153 SkSafeRef(ctable);
154 154
155 this->setPreLocked(fStorage, fCTable); 155 this->setPreLocked(fStorage, rowBytes, fCTable);
156 } 156 }
157 157
158 SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage, 158 SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage,
159 size_t rowBytes, SkColorTable* ctable, 159 size_t rowBytes, SkColorTable* ctable,
160 SkMallocPixelRef::ReleaseProc proc, 160 SkMallocPixelRef::ReleaseProc proc,
161 void* context) 161 void* context)
162 : INHERITED(info) 162 : INHERITED(info)
163 , fReleaseProc(proc) 163 , fReleaseProc(proc)
164 , fReleaseProcContext(context) 164 , fReleaseProcContext(context)
165 { 165 {
166 SkASSERT(is_valid(info, ctable)); 166 SkASSERT(is_valid(info, ctable));
167 SkASSERT(rowBytes >= info.minRowBytes()); 167 SkASSERT(rowBytes >= info.minRowBytes());
168 168
169 if (kIndex_8_SkColorType != info.fColorType) { 169 if (kIndex_8_SkColorType != info.fColorType) {
170 ctable = NULL; 170 ctable = NULL;
171 } 171 }
172 172
173 fStorage = storage; 173 fStorage = storage;
174 fCTable = ctable; 174 fCTable = ctable;
175 fRB = rowBytes; 175 fRB = rowBytes;
176 SkSafeRef(ctable); 176 SkSafeRef(ctable);
177 177
178 this->setPreLocked(fStorage, fCTable); 178 this->setPreLocked(fStorage, rowBytes, fCTable);
179 } 179 }
180 180
181 181
182 SkMallocPixelRef::~SkMallocPixelRef() { 182 SkMallocPixelRef::~SkMallocPixelRef() {
183 SkSafeUnref(fCTable); 183 SkSafeUnref(fCTable);
184 if (fReleaseProc != NULL) { 184 if (fReleaseProc != NULL) {
185 fReleaseProc(fStorage, fReleaseProcContext); 185 fReleaseProc(fStorage, fReleaseProcContext);
186 } 186 }
187 } 187 }
188 188
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } else { 227 } else {
228 fStorage = NULL; 228 fStorage = NULL;
229 } 229 }
230 230
231 if (buffer.readBool()) { 231 if (buffer.readBool()) {
232 fCTable = SkNEW_ARGS(SkColorTable, (buffer)); 232 fCTable = SkNEW_ARGS(SkColorTable, (buffer));
233 } else { 233 } else {
234 fCTable = NULL; 234 fCTable = NULL;
235 } 235 }
236 236
237 this->setPreLocked(fStorage, fCTable); 237 this->setPreLocked(fStorage, fRB, fCTable);
238 } 238 }
OLDNEW
« no previous file with comments | « include/core/SkPixelRef.h ('k') | src/core/SkPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698