| 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 "SkFlattenableBuffers.h" | 10 #include "SkFlattenableBuffers.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 189 void* SkMallocPixelRef::onLockPixels(SkColorTable** ctable) { | 189 bool SkMallocPixelRef::onNewLockPixels(LockRec* rec) { |
| 190 *ctable = fCTable; | 190 rec->fPixels = fStorage; |
| 191 return fStorage; | 191 rec->fRowBytes = fRB; |
| 192 rec->fColorTable = fCTable; |
| 193 return true; |
| 192 } | 194 } |
| 193 | 195 |
| 194 void SkMallocPixelRef::onUnlockPixels() { | 196 void SkMallocPixelRef::onUnlockPixels() { |
| 195 // nothing to do | 197 // nothing to do |
| 196 } | 198 } |
| 197 | 199 |
| 198 size_t SkMallocPixelRef::getAllocatedSizeInBytes() const { | 200 size_t SkMallocPixelRef::getAllocatedSizeInBytes() const { |
| 199 return this->info().getSafeSize(fRB); | 201 return this->info().getSafeSize(fRB); |
| 200 } | 202 } |
| 201 | 203 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 229 } | 231 } |
| 230 | 232 |
| 231 if (buffer.readBool()) { | 233 if (buffer.readBool()) { |
| 232 fCTable = SkNEW_ARGS(SkColorTable, (buffer)); | 234 fCTable = SkNEW_ARGS(SkColorTable, (buffer)); |
| 233 } else { | 235 } else { |
| 234 fCTable = NULL; | 236 fCTable = NULL; |
| 235 } | 237 } |
| 236 | 238 |
| 237 this->setPreLocked(fStorage, fRB, fCTable); | 239 this->setPreLocked(fStorage, fRB, fCTable); |
| 238 } | 240 } |
| OLD | NEW |