| 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 "SkPixelRef.h" | 9 #include "SkPixelRef.h" |
| 10 #include "SkThread.h" | 10 #include "SkThread.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 bool SkPixelRef::requestLock(const LockRequest& request, LockResult* result) { | 257 bool SkPixelRef::requestLock(const LockRequest& request, LockResult* result) { |
| 258 SkASSERT(result); | 258 SkASSERT(result); |
| 259 if (request.fSize.isEmpty()) { | 259 if (request.fSize.isEmpty()) { |
| 260 return false; | 260 return false; |
| 261 } | 261 } |
| 262 // until we support subsets, we have to check this... |
| 263 if (request.fSize.width() != fInfo.width() || request.fSize.height() != fInf
o.height()) { |
| 264 return false; |
| 265 } |
| 262 | 266 |
| 263 if (fPreLocked) { | 267 if (fPreLocked) { |
| 264 result->fUnlockProc = NULL; | 268 result->fUnlockProc = NULL; |
| 265 result->fUnlockContext = NULL; | 269 result->fUnlockContext = NULL; |
| 266 result->fCTable = fRec.fColorTable; | 270 result->fCTable = fRec.fColorTable; |
| 267 result->fPixels = fRec.fPixels; | 271 result->fPixels = fRec.fPixels; |
| 268 result->fRowBytes = fRec.fRowBytes; | 272 result->fRowBytes = fRec.fRowBytes; |
| 269 result->fSize.set(fInfo.width(), fInfo.height()); | 273 result->fSize.set(fInfo.width(), fInfo.height()); |
| 270 } else { | 274 } else { |
| 271 SkAutoMutexAcquire ac(*fMutex); | 275 SkAutoMutexAcquire ac(*fMutex); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 387 } |
| 384 | 388 |
| 385 result->fUnlockProc = unlock_legacy_result; | 389 result->fUnlockProc = unlock_legacy_result; |
| 386 result->fUnlockContext = SkRef(this); // this is balanced in our fUnlockPr
oc | 390 result->fUnlockContext = SkRef(this); // this is balanced in our fUnlockPr
oc |
| 387 result->fCTable = fRec.fColorTable; | 391 result->fCTable = fRec.fColorTable; |
| 388 result->fPixels = fRec.fPixels; | 392 result->fPixels = fRec.fPixels; |
| 389 result->fRowBytes = fRec.fRowBytes; | 393 result->fRowBytes = fRec.fRowBytes; |
| 390 result->fSize.set(fInfo.width(), fInfo.height()); | 394 result->fSize.set(fInfo.width(), fInfo.height()); |
| 391 return true; | 395 return true; |
| 392 } | 396 } |
| OLD | NEW |