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

Side by Side Diff: src/gpu/effects/GrTextureStripAtlas.cpp

Issue 15070011: One SkTSearch to rule them all. Allow key to be of different type than the array. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fixes to compile on gcc Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/effects/GrTextureStripAtlas.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
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 #include "GrTextureStripAtlas.h" 9 #include "GrTextureStripAtlas.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 266 }
267 } 267 }
268 } 268 }
269 row->fNext = NULL; 269 row->fNext = NULL;
270 row->fPrev = NULL; 270 row->fPrev = NULL;
271 } 271 }
272 272
273 int GrTextureStripAtlas::searchByKey(uint32_t key) { 273 int GrTextureStripAtlas::searchByKey(uint32_t key) {
274 AtlasRow target; 274 AtlasRow target;
275 target.fKey = key; 275 target.fKey = key;
276 return SkTSearch<AtlasRow, GrTextureStripAtlas::compareKeys>((const AtlasRow **)fKeyTable.begin(), 276 return SkTSearch<const AtlasRow,
277 fKeyTable.count (), 277 GrTextureStripAtlas::KeyLess>((const AtlasRow**)fKeyTable.b egin(),
278 &target, 278 fKeyTable.count(),
279 sizeof(AtlasRow *)); 279 &target,
280 } 280 sizeof(AtlasRow*));
281 }
281 282
282 #ifdef SK_DEBUG 283 #ifdef SK_DEBUG
283 void GrTextureStripAtlas::validate() { 284 void GrTextureStripAtlas::validate() {
284 285
285 // Our key table should be sorted 286 // Our key table should be sorted
286 uint32_t prev = 1 > fKeyTable.count() ? 0 : fKeyTable[0]->fKey; 287 uint32_t prev = 1 > fKeyTable.count() ? 0 : fKeyTable[0]->fKey;
287 for (int i = 1; i < fKeyTable.count(); ++i) { 288 for (int i = 1; i < fKeyTable.count(); ++i) {
288 GrAssert(prev < fKeyTable[i]->fKey); 289 GrAssert(prev < fKeyTable[i]->fKey);
289 GrAssert(fKeyTable[i]->fKey != kEmptyAtlasRowKey); 290 GrAssert(fKeyTable[i]->fKey != kEmptyAtlasRowKey);
290 prev = fKeyTable[i]->fKey; 291 prev = fKeyTable[i]->fKey;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 339
339 // If we have locked rows, we should have a locked texture, otherwise 340 // If we have locked rows, we should have a locked texture, otherwise
340 // it should be unlocked 341 // it should be unlocked
341 if (fLockedRows == 0) { 342 if (fLockedRows == 0) {
342 GrAssert(NULL == fTexture); 343 GrAssert(NULL == fTexture);
343 } else { 344 } else {
344 GrAssert(NULL != fTexture); 345 GrAssert(NULL != fTexture);
345 } 346 }
346 } 347 }
347 #endif 348 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureStripAtlas.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698