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

Side by Side Diff: src/pdf/SkPDFFont.cpp

Issue 15675025: One allocation for an SkData which makes a copy. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Clean Created 7 years, 6 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 * 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 <ctype.h> 8 #include <ctype.h>
9 9
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 SkDynamicMemoryWStream cmap; 530 SkDynamicMemoryWStream cmap;
531 append_tounicode_header(&cmap); 531 append_tounicode_header(&cmap);
532 append_cmap_sections(glyphToUnicode, subset, &cmap); 532 append_cmap_sections(glyphToUnicode, subset, &cmap);
533 append_cmap_footer(&cmap); 533 append_cmap_footer(&cmap);
534 SkAutoTUnref<SkMemoryStream> cmapStream(new SkMemoryStream()); 534 SkAutoTUnref<SkMemoryStream> cmapStream(new SkMemoryStream());
535 cmapStream->setData(cmap.copyToData())->unref(); 535 cmapStream->setData(cmap.copyToData())->unref();
536 return new SkPDFStream(cmapStream.get()); 536 return new SkPDFStream(cmapStream.get());
537 } 537 }
538 538
539 #if defined (SK_SFNTLY_SUBSETTER) 539 #if defined (SK_SFNTLY_SUBSETTER)
540 static void sk_delete_array(const void* ptr, size_t, void*) { 540 static void sk_delete_array(const void* ptr, size_t) {
541 // Use C-style cast to cast away const and cast type simultaneously. 541 // Use C-style cast to cast away const and cast type simultaneously.
542 delete[] (unsigned char*)ptr; 542 delete[] (unsigned char*)ptr;
543 } 543 }
544 #endif 544 #endif
545 545
546 static int get_subset_font_stream(const char* fontName, 546 static int get_subset_font_stream(const char* fontName,
547 const SkTypeface* typeface, 547 const SkTypeface* typeface,
548 const SkTDArray<uint32_t>& subset, 548 const SkTDArray<uint32_t>& subset,
549 SkPDFStream** fontStream) { 549 SkPDFStream** fontStream) {
550 int ttcIndex; 550 int ttcIndex;
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 1408
1409 insert("FontBBox", makeFontBBox(bbox, 1000))->unref(); 1409 insert("FontBBox", makeFontBBox(bbox, 1000))->unref();
1410 insertInt("FirstChar", firstGlyphID()); 1410 insertInt("FirstChar", firstGlyphID());
1411 insertInt("LastChar", lastGlyphID()); 1411 insertInt("LastChar", lastGlyphID());
1412 insert("Widths", widthArray.get()); 1412 insert("Widths", widthArray.get());
1413 insertName("CIDToGIDMap", "Identity"); 1413 insertName("CIDToGIDMap", "Identity");
1414 1414
1415 populateToUnicodeTable(NULL); 1415 populateToUnicodeTable(NULL);
1416 return true; 1416 return true;
1417 } 1417 }
OLDNEW
« include/core/SkWeakRefCnt.h ('K') | « src/core/SkStream.cpp ('k') | tests/DataRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698