| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 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 "SkImageFilter.h" | 8 #include "SkImageFilter.h" |
| 9 #include "SkImageFilterCacheKey.h" | 9 #include "SkImageFilterCacheKey.h" |
| 10 | 10 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 | 639 |
| 640 void purgeByKeys(const Key keys[], int count) override { | 640 void purgeByKeys(const Key keys[], int count) override { |
| 641 SkAutoMutexAcquire mutex(fMutex); | 641 SkAutoMutexAcquire mutex(fMutex); |
| 642 for (int i = 0; i < count; i++) { | 642 for (int i = 0; i < count; i++) { |
| 643 if (Value* v = fLookup.find(keys[i])) { | 643 if (Value* v = fLookup.find(keys[i])) { |
| 644 this->removeInternal(v); | 644 this->removeInternal(v); |
| 645 } | 645 } |
| 646 } | 646 } |
| 647 } | 647 } |
| 648 | 648 |
| 649 SkDEBUGCODE(int count() const override { return fLookup.count(); }) |
| 649 private: | 650 private: |
| 650 void removeInternal(Value* v) { | 651 void removeInternal(Value* v) { |
| 651 if (v->fImage) { | 652 if (v->fImage) { |
| 652 fCurrentBytes -= v->fImage->getSize(); | 653 fCurrentBytes -= v->fImage->getSize(); |
| 653 } else { | 654 } else { |
| 654 fCurrentBytes -= v->fBitmap.getSize(); | 655 fCurrentBytes -= v->fBitmap.getSize(); |
| 655 } | 656 } |
| 656 fLRU.remove(v); | 657 fLRU.remove(v); |
| 657 fLookup.remove(v->fKey); | 658 fLookup.remove(v->fKey); |
| 658 delete v; | 659 delete v; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 false, /* preserveLCDText */ | 691 false, /* preserveLCDText */ |
| 691 true /*forImageFilter*/); | 692 true /*forImageFilter*/); |
| 692 SkBaseDevice* dev = fDevice->onCreateDevice(cinfo, nullptr); | 693 SkBaseDevice* dev = fDevice->onCreateDevice(cinfo, nullptr); |
| 693 if (nullptr == dev) { | 694 if (nullptr == dev) { |
| 694 const SkSurfaceProps surfaceProps(fDevice->fSurfaceProps.flags(), | 695 const SkSurfaceProps surfaceProps(fDevice->fSurfaceProps.flags(), |
| 695 kUnknown_SkPixelGeometry); | 696 kUnknown_SkPixelGeometry); |
| 696 dev = SkBitmapDevice::Create(cinfo.fInfo, surfaceProps); | 697 dev = SkBitmapDevice::Create(cinfo.fInfo, surfaceProps); |
| 697 } | 698 } |
| 698 return dev; | 699 return dev; |
| 699 } | 700 } |
| OLD | NEW |