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 "SkBitmapCache.h" | 8 #include "SkBitmapCache.h" |
9 #include "SkMutex.h" | 9 #include "SkMutex.h" |
10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // For compatibility with SkBitmap calling lockPixels, we still want
to increment | 150 // For compatibility with SkBitmap calling lockPixels, we still want
to increment |
151 // fLockCount even if we failed. If we updated SkBitmap we could rem
ove this oddity. | 151 // fLockCount even if we failed. If we updated SkBitmap we could rem
ove this oddity. |
152 fLockCount += 1; | 152 fLockCount += 1; |
153 return false; | 153 return false; |
154 } | 154 } |
155 } | 155 } |
156 if (fRec.fPixels) { | 156 if (fRec.fPixels) { |
157 validate_pixels_ctable(fInfo, fRec.fColorTable); | 157 validate_pixels_ctable(fInfo, fRec.fColorTable); |
158 return true; | 158 return true; |
159 } | 159 } |
| 160 // no pixels, so we failed (somehow) |
| 161 --fLockCount; |
160 return false; | 162 return false; |
161 } | 163 } |
162 | 164 |
163 bool SkPixelRef::lockPixels(LockRec* rec) { | 165 bool SkPixelRef::lockPixels(LockRec* rec) { |
164 if (this->lockPixels()) { | 166 if (this->lockPixels()) { |
165 *rec = fRec; | 167 *rec = fRec; |
166 return true; | 168 return true; |
167 } | 169 } |
168 return false; | 170 return false; |
169 } | 171 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 } | 346 } |
345 | 347 |
346 result->fUnlockProc = unlock_legacy_result; | 348 result->fUnlockProc = unlock_legacy_result; |
347 result->fUnlockContext = SkRef(this); // this is balanced in our fUnlockPr
oc | 349 result->fUnlockContext = SkRef(this); // this is balanced in our fUnlockPr
oc |
348 result->fCTable = fRec.fColorTable; | 350 result->fCTable = fRec.fColorTable; |
349 result->fPixels = fRec.fPixels; | 351 result->fPixels = fRec.fPixels; |
350 result->fRowBytes = fRec.fRowBytes; | 352 result->fRowBytes = fRec.fRowBytes; |
351 result->fSize.set(fInfo.width(), fInfo.height()); | 353 result->fSize.set(fInfo.width(), fInfo.height()); |
352 return true; | 354 return true; |
353 } | 355 } |
OLD | NEW |