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