| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 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 "SkFlattenable.h" | 8 #include "SkFlattenable.h" |
| 9 #include "SkPtrRecorder.h" | 9 #include "SkPtrRecorder.h" |
| 10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
| 11 | 11 |
| 12 /////////////////////////////////////////////////////////////////////////////// | |
| 13 | |
| 14 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
| 15 bool SkFlattenable::NeedsDeepUnflatten(const SkReadBuffer& buffer) { | |
| 16 return false; // TODO: looks like all this can go away too now? | |
| 17 } | |
| 18 #endif | |
| 19 | |
| 20 /////////////////////////////////////////////////////////////////////////////// | |
| 21 | |
| 22 SkNamedFactorySet::SkNamedFactorySet() : fNextAddedFactory(0) {} | 12 SkNamedFactorySet::SkNamedFactorySet() : fNextAddedFactory(0) {} |
| 23 | 13 |
| 24 uint32_t SkNamedFactorySet::find(SkFlattenable::Factory factory) { | 14 uint32_t SkNamedFactorySet::find(SkFlattenable::Factory factory) { |
| 25 uint32_t index = fFactorySet.find(factory); | 15 uint32_t index = fFactorySet.find(factory); |
| 26 if (index > 0) { | 16 if (index > 0) { |
| 27 return index; | 17 return index; |
| 28 } | 18 } |
| 29 const char* name = SkFlattenable::FactoryToName(factory); | 19 const char* name = SkFlattenable::FactoryToName(factory); |
| 30 if (NULL == name) { | 20 if (NULL == name) { |
| 31 return 0; | 21 return 0; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 50 | 40 |
| 51 void SkRefCntSet::incPtr(void* ptr) { | 41 void SkRefCntSet::incPtr(void* ptr) { |
| 52 ((SkRefCnt*)ptr)->ref(); | 42 ((SkRefCnt*)ptr)->ref(); |
| 53 } | 43 } |
| 54 | 44 |
| 55 void SkRefCntSet::decPtr(void* ptr) { | 45 void SkRefCntSet::decPtr(void* ptr) { |
| 56 ((SkRefCnt*)ptr)->unref(); | 46 ((SkRefCnt*)ptr)->unref(); |
| 57 } | 47 } |
| 58 | 48 |
| 59 /////////////////////////////////////////////////////////////////////////////// | 49 /////////////////////////////////////////////////////////////////////////////// |
| 60 /////////////////////////////////////////////////////////////////////////////// | |
| 61 /////////////////////////////////////////////////////////////////////////////// | |
| 62 | 50 |
| 63 #define MAX_ENTRY_COUNT 1024 | 51 #define MAX_ENTRY_COUNT 1024 |
| 64 | 52 |
| 65 struct Entry { | 53 struct Entry { |
| 66 const char* fName; | 54 const char* fName; |
| 67 SkFlattenable::Factory fFactory; | 55 SkFlattenable::Factory fFactory; |
| 68 SkFlattenable::Type fType; | 56 SkFlattenable::Type fType; |
| 69 }; | 57 }; |
| 70 | 58 |
| 71 static int gCount; | 59 static int gCount; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 report_no_entries(__FUNCTION__); | 123 report_no_entries(__FUNCTION__); |
| 136 #endif | 124 #endif |
| 137 const Entry* entries = gEntries; | 125 const Entry* entries = gEntries; |
| 138 for (int i = gCount - 1; i >= 0; --i) { | 126 for (int i = gCount - 1; i >= 0; --i) { |
| 139 if (entries[i].fFactory == fact) { | 127 if (entries[i].fFactory == fact) { |
| 140 return entries[i].fName; | 128 return entries[i].fName; |
| 141 } | 129 } |
| 142 } | 130 } |
| 143 return NULL; | 131 return NULL; |
| 144 } | 132 } |
| OLD | NEW |