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

Side by Side Diff: src/animator/SkDisplayAdd.cpp

Issue 1273813002: Add skstd::move and skstd::forward. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: No need to change the string. Created 5 years, 4 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkDisplayAdd.h" 10 #include "SkDisplayAdd.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 bool skipAddToParent = true; 86 bool skipAddToParent = true;
87 SkASSERT(type != SkType_Replace || where); 87 SkASSERT(type != SkType_Replace || where);
88 SkTDDrawableArray* grandList SK_INIT_TO_AVOID_WARNING; 88 SkTDDrawableArray* grandList SK_INIT_TO_AVOID_WARNING;
89 SkGroup* parentGroup = NULL; 89 SkGroup* parentGroup = NULL;
90 SkGroup* thisGroup = NULL; 90 SkGroup* thisGroup = NULL;
91 int index = where ? displayList.findGroup(where, &parentList, &parentGroup, 91 int index = where ? displayList.findGroup(where, &parentList, &parentGroup,
92 &thisGroup, &grandList) : 0; 92 &thisGroup, &grandList) : 0;
93 if (index < 0) 93 if (index < 0)
94 return true; 94 return true;
95 int max = parentList->count(); 95 int max = parentList->count();
96 if (where == NULL && type == SkType_Move) 96 if (where == NULL && type == SkType_Relocate)
97 index = max; 97 index = max;
98 if (offset != SK_MaxS32) { 98 if (offset != SK_MaxS32) {
99 index += offset; 99 index += offset;
100 if (index > max) { 100 if (index > max) {
101 maker.setErrorCode(SkDisplayXMLParserError::kIndexOutOfRange); 101 maker.setErrorCode(SkDisplayXMLParserError::kIndexOutOfRange);
102 return true; // caller should not add 102 return true; // caller should not add
103 } 103 }
104 } 104 }
105 if (offset < 0 && where == NULL) 105 if (offset < 0 && where == NULL)
106 index += max + 1; 106 index += max + 1;
(...skipping 21 matching lines...) Expand all
128 } else { 128 } else {
129 if (thisGroup) 129 if (thisGroup)
130 thisGroup->markCopySize(index); 130 thisGroup->markCopySize(index);
131 *parentList->insert(index) = use; 131 *parentList->insert(index) = use;
132 if (thisGroup) 132 if (thisGroup)
133 thisGroup->markCopySet(index); 133 thisGroup->markCopySet(index);
134 if (use->isApply()) 134 if (use->isApply())
135 ((SkApply*) use)->setEmbedded(); 135 ((SkApply*) use)->setEmbedded();
136 } 136 }
137 break; 137 break;
138 case SkType_Move: { 138 case SkType_Relocate: {
139 int priorLocation = parentList->find(use); 139 int priorLocation = parentList->find(use);
140 if (priorLocation < 0) 140 if (priorLocation < 0)
141 break; 141 break;
142 *parentList->insert(index) = use; 142 *parentList->insert(index) = use;
143 if (index < priorLocation) 143 if (index < priorLocation)
144 priorLocation++; 144 priorLocation++;
145 parentList->remove(priorLocation); 145 parentList->remove(priorLocation);
146 } break; 146 } break;
147 case SkType_Remove: { 147 case SkType_Remove: {
148 SkDisplayable* old = (*parentList)[index]; 148 SkDisplayable* old = (*parentList)[index];
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 bool SkClear::enable(SkAnimateMaker& maker ) { 205 bool SkClear::enable(SkAnimateMaker& maker ) {
206 SkDisplayList& displayList = maker.fDisplayList; 206 SkDisplayList& displayList = maker.fDisplayList;
207 displayList.clear(); 207 displayList.clear();
208 return true; 208 return true;
209 } 209 }
210 210
211 211
212 #if SK_USE_CONDENSED_INFO == 0 212 #if SK_USE_CONDENSED_INFO == 0
213 213
214 const SkMemberInfo SkMove::fInfo[] = { 214 const SkMemberInfo SkRelocate::fInfo[] = {
215 SK_MEMBER_INHERITED 215 SK_MEMBER_INHERITED
216 }; 216 };
217 217
218 #endif 218 #endif
219 219
220 DEFINE_GET_MEMBER(SkMove); 220 DEFINE_GET_MEMBER(SkRelocate);
221 221
222 #if SK_USE_CONDENSED_INFO == 0 222 #if SK_USE_CONDENSED_INFO == 0
223 223
224 const SkMemberInfo SkRemove::fInfo[] = { 224 const SkMemberInfo SkRemove::fInfo[] = {
225 SK_MEMBER_ALIAS(delete, fDelete, Boolean), // !!! experimental 225 SK_MEMBER_ALIAS(delete, fDelete, Boolean), // !!! experimental
226 SK_MEMBER(offset, Int), 226 SK_MEMBER(offset, Int),
227 SK_MEMBER(where, Drawable) 227 SK_MEMBER(where, Drawable)
228 }; 228 };
229 229
230 #endif 230 #endif
231 231
232 DEFINE_GET_MEMBER(SkRemove); 232 DEFINE_GET_MEMBER(SkRemove);
233 233
234 SkRemove::SkRemove() : fDelete(false) { 234 SkRemove::SkRemove() : fDelete(false) {
235 } 235 }
236 236
237 #if SK_USE_CONDENSED_INFO == 0 237 #if SK_USE_CONDENSED_INFO == 0
238 238
239 const SkMemberInfo SkReplace::fInfo[] = { 239 const SkMemberInfo SkReplace::fInfo[] = {
240 SK_MEMBER_INHERITED 240 SK_MEMBER_INHERITED
241 }; 241 };
242 242
243 #endif 243 #endif
244 244
245 DEFINE_GET_MEMBER(SkReplace); 245 DEFINE_GET_MEMBER(SkReplace);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698