OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkBitmapProcState.h" | 8 #include "SkBitmapProcState.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkFilterProc.h" | 10 #include "SkFilterProc.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 fScaledBitmap.reset(); | 352 fScaledBitmap.reset(); |
353 return false; | 353 return false; |
354 } | 354 } |
355 } | 355 } |
356 } | 356 } |
357 fBitmap = &fScaledBitmap; | 357 fBitmap = &fScaledBitmap; |
358 unlocker.release(); | 358 unlocker.release(); |
359 return true; | 359 return true; |
360 } | 360 } |
361 | 361 |
362 void SkBitmapProcState::endContext() { | |
363 SkDELETE(fBitmapFilter); | |
364 fBitmapFilter = NULL; | |
365 fScaledBitmap.reset(); | |
366 | |
367 if (fScaledCacheID) { | |
368 SkScaledImageCache::Unlock(fScaledCacheID); | |
369 fScaledCacheID = NULL; | |
370 } | |
371 } | |
372 | |
373 SkBitmapProcState::~SkBitmapProcState() { | 362 SkBitmapProcState::~SkBitmapProcState() { |
374 if (fScaledCacheID) { | 363 if (fScaledCacheID) { |
375 SkScaledImageCache::Unlock(fScaledCacheID); | 364 SkScaledImageCache::Unlock(fScaledCacheID); |
376 } | 365 } |
377 SkDELETE(fBitmapFilter); | 366 SkDELETE(fBitmapFilter); |
378 } | 367 } |
379 | 368 |
380 bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { | 369 bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { |
381 SkASSERT(fOrigBitmap.width() && fOrigBitmap.height()); | 370 SkASSERT(fOrigBitmap.width() && fOrigBitmap.height()); |
382 | 371 |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 } else { | 1025 } else { |
1037 size >>= 2; | 1026 size >>= 2; |
1038 } | 1027 } |
1039 | 1028 |
1040 if (fFilterLevel != SkPaint::kNone_FilterLevel) { | 1029 if (fFilterLevel != SkPaint::kNone_FilterLevel) { |
1041 size >>= 1; | 1030 size >>= 1; |
1042 } | 1031 } |
1043 | 1032 |
1044 return size; | 1033 return size; |
1045 } | 1034 } |
OLD | NEW |