/src/mozilla-central/layout/painting/MaskLayerImageCache.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "MaskLayerImageCache.h" |
8 | | |
9 | | #include "ImageContainer.h" |
10 | | #include "mozilla/layers/KnowsCompositor.h" |
11 | | |
12 | | using namespace mozilla::layers; |
13 | | |
14 | | namespace mozilla { |
15 | | |
16 | | MaskLayerImageCache::MaskLayerImageCache() |
17 | 0 | { |
18 | 0 | MOZ_COUNT_CTOR(MaskLayerImageCache); |
19 | 0 | } |
20 | | MaskLayerImageCache::~MaskLayerImageCache() |
21 | 0 | { |
22 | 0 | MOZ_COUNT_DTOR(MaskLayerImageCache); |
23 | 0 | } |
24 | | |
25 | | void |
26 | | MaskLayerImageCache::Sweep() |
27 | 0 | { |
28 | 0 | for (auto iter = mMaskImageContainers.Iter(); !iter.Done(); iter.Next()) { |
29 | 0 | const MaskLayerImageCache::MaskLayerImageKey* key = iter.Get()->mKey; |
30 | 0 | if (key->HasZeroLayerCount()) { |
31 | 0 | iter.Remove(); |
32 | 0 | } |
33 | 0 | } |
34 | 0 | } |
35 | | |
36 | | ImageContainer* |
37 | | MaskLayerImageCache::FindImageFor(const MaskLayerImageKey** aKey) |
38 | 0 | { |
39 | 0 | if (MaskLayerImageEntry* entry = mMaskImageContainers.GetEntry(**aKey)) { |
40 | 0 | *aKey = entry->mKey.get(); |
41 | 0 | return entry->mContainer; |
42 | 0 | } |
43 | 0 | |
44 | 0 | return nullptr; |
45 | 0 | } |
46 | | |
47 | | void |
48 | | MaskLayerImageCache::PutImage(const MaskLayerImageKey* aKey, |
49 | | ImageContainer* aContainer) |
50 | 0 | { |
51 | 0 | MaskLayerImageEntry* entry = mMaskImageContainers.PutEntry(*aKey); |
52 | 0 | entry->mContainer = aContainer; |
53 | 0 | } |
54 | | |
55 | | MaskLayerImageCache::MaskLayerImageKey::MaskLayerImageKey() |
56 | | : mRoundedClipRects() |
57 | | , mLayerCount(0) |
58 | 0 | { |
59 | 0 | MOZ_COUNT_CTOR(MaskLayerImageKey); |
60 | 0 | } |
61 | | |
62 | | MaskLayerImageCache::MaskLayerImageKey::MaskLayerImageKey( |
63 | | const MaskLayerImageKey& aKey) |
64 | | : mRoundedClipRects(aKey.mRoundedClipRects) |
65 | | , mLayerCount(aKey.mLayerCount) |
66 | 0 | { |
67 | 0 | MOZ_COUNT_CTOR(MaskLayerImageKey); |
68 | 0 | } |
69 | | |
70 | | MaskLayerImageCache::MaskLayerImageKey::~MaskLayerImageKey() |
71 | 0 | { |
72 | 0 | MOZ_COUNT_DTOR(MaskLayerImageKey); |
73 | 0 | } |
74 | | |
75 | | } // namespace mozilla |