Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: src/core/SkImageFilter.cpp

Issue 1901883002: Make SkImageFilter::Cache purging methods pure virtual (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkImageFilter.h ('k') | tests/ImageFilterCacheTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « include/core/SkImageFilter.h ('k') | tests/ImageFilterCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698