• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright 2006 The Android Open Source Project
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8 
9 
10 #include "SkTagList.h"
11 
~SkTagList()12 SkTagList::~SkTagList()
13 {
14 }
15 
Find(SkTagList * rec,U8CPU tag)16 SkTagList* SkTagList::Find(SkTagList* rec, U8CPU tag)
17 {
18     SkASSERT(tag < kSkTagListCount);
19 
20     while (rec != nullptr)
21     {
22         if (rec->fTag == tag)
23             break;
24         rec = rec->fNext;
25     }
26     return rec;
27 }
28 
DeleteTag(SkTagList ** head,U8CPU tag)29 void SkTagList::DeleteTag(SkTagList** head, U8CPU tag)
30 {
31     SkASSERT(tag < kSkTagListCount);
32 
33     SkTagList* rec = *head;
34     SkTagList* prev = nullptr;
35 
36     while (rec != nullptr)
37     {
38         SkTagList* next = rec->fNext;
39 
40         if (rec->fTag == tag)
41         {
42             if (prev)
43                 prev->fNext = next;
44             else
45                 *head = next;
46             delete rec;
47             break;
48         }
49         prev = rec;
50         rec = next;
51     }
52 }
53 
DeleteAll(SkTagList * rec)54 void SkTagList::DeleteAll(SkTagList* rec)
55 {
56     while (rec)
57     {
58         SkTagList* next = rec->fNext;
59         delete rec;
60         rec = next;
61     }
62 }
63