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

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

Issue 550043003: Remove a linear search in SkPictureRecord::addTextBlob. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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 * 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 "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
9 #include "SkBBoxHierarchy.h" 9 #include "SkBBoxHierarchy.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 fWriter.writeRegion(region); 1537 fWriter.writeRegion(region);
1538 } 1538 }
1539 1539
1540 void SkPictureRecord::addText(const void* text, size_t byteLength) { 1540 void SkPictureRecord::addText(const void* text, size_t byteLength) {
1541 fContentInfo.onDrawText(); 1541 fContentInfo.onDrawText();
1542 addInt(SkToInt(byteLength)); 1542 addInt(SkToInt(byteLength));
1543 fWriter.writePad(text, byteLength); 1543 fWriter.writePad(text, byteLength);
1544 } 1544 }
1545 1545
1546 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { 1546 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) {
1547 int index = fTextBlobRefs.find(blob); 1547 int index = fTextBlobRefs.count();
1548 if (index < 0) { // not found 1548 *fTextBlobRefs.append() = blob;
1549 index = fTextBlobRefs.count(); 1549 blob->ref();
1550 *fTextBlobRefs.append() = blob;
1551 blob->ref();
1552 }
1553 // follow the convention of recording a 1-based index 1550 // follow the convention of recording a 1-based index
1554 this->addInt(index + 1); 1551 this->addInt(index + 1);
1555 } 1552 }
1556 1553
1557 /////////////////////////////////////////////////////////////////////////////// 1554 ///////////////////////////////////////////////////////////////////////////////
1558 1555
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698