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

Side by Side Diff: src/core/SkPictureRecord.cpp

Issue 21564008: use SkTDynamicHash in picture recording (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: smaller default size Created 7 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 #include "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
9 #include "SkTSearch.h" 9 #include "SkTSearch.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 SkAutoTDelete<SkPaint> dbmPaint(paintDict->unflatten(dbmPaintId)); 394 SkAutoTDelete<SkPaint> dbmPaint(paintDict->unflatten(dbmPaintId));
395 if (NULL == dbmPaint.get() || dbmPaint->getColor() != layerColor) { 395 if (NULL == dbmPaint.get() || dbmPaint->getColor() != layerColor) {
396 return false; 396 return false;
397 } 397 }
398 398
399 SkColor newColor = SkColorSetA(dbmPaint->getColor(), 399 SkColor newColor = SkColorSetA(dbmPaint->getColor(),
400 SkColorGetA(saveLayerPaint->getColor())); 400 SkColorGetA(saveLayerPaint->getColor()));
401 dbmPaint->setColor(newColor); 401 dbmPaint->setColor(newColor);
402 402
403 const SkFlatData* data = paintDict->findAndReturnFlat(*dbmPaint); 403 const int paintIndex = paintDict->find(*dbmPaint);
404 if (NULL == data) {
405 return false;
406 }
407 404
408 // kill the saveLayer and alter the DBMR2R's paint to be the modified one 405 // kill the saveLayer and alter the DBMR2R's paint to be the modified one
409 convert_command_to_noop(writer, saveLayerInfo.fOffset); 406 convert_command_to_noop(writer, saveLayerInfo.fOffset);
410 uint32_t* ptr = writer->peek32(dbmInfo.fOffset+dbmPaintOffset); 407 uint32_t* ptr = writer->peek32(dbmInfo.fOffset+dbmPaintOffset);
411 SkASSERT(dbmPaintId == *ptr); 408 SkASSERT(dbmPaintId == *ptr);
412 *ptr = data->index(); 409 *ptr = paintIndex;
413 return true; 410 return true;
414 } 411 }
415 412
416 /* 413 /*
417 * Restore has just been called (but not recorded), look back at the 414 * Restore has just been called (but not recorded), look back at the
418 * matching save* and see if we are in the configuration: 415 * matching save* and see if we are in the configuration:
419 * SAVE_LAYER (with NULL == bounds) 416 * SAVE_LAYER (with NULL == bounds)
420 * SAVE 417 * SAVE
421 * CLIP_RECT 418 * CLIP_RECT
422 * DRAW_BITMAP|DRAW_BITMAP_MATRIX|DRAW_BITMAP_NINE|DRAW_BITMAP_RECT_TO_R ECT 419 * DRAW_BITMAP|DRAW_BITMAP_MATRIX|DRAW_BITMAP_NINE|DRAW_BITMAP_RECT_TO_R ECT
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 void SkPictureRecord::validateRegions() const { 1469 void SkPictureRecord::validateRegions() const {
1473 int count = fRegions.count(); 1470 int count = fRegions.count();
1474 SkASSERT((unsigned) count < 0x1000); 1471 SkASSERT((unsigned) count < 0x1000);
1475 for (int index = 0; index < count; index++) { 1472 for (int index = 0; index < count; index++) {
1476 const SkFlatData* region = fRegions[index]; 1473 const SkFlatData* region = fRegions[index];
1477 SkASSERT(region); 1474 SkASSERT(region);
1478 // region->validate(); 1475 // region->validate();
1479 } 1476 }
1480 } 1477 }
1481 #endif 1478 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698