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

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

Issue 19668002: [PDF] Use SkTypeface::countGlyphs instead of getAdvancedTypefaceMetrics (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | « 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 "SkPDFDevice.h" 8 #include "SkPDFDevice.h"
9 9
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 xAdj = SkScalarHalf(xAdj); 98 xAdj = SkScalarHalf(xAdj);
99 yAdj = SkScalarHalf(yAdj); 99 yAdj = SkScalarHalf(yAdj);
100 } 100 }
101 *x = *x - xAdj; 101 *x = *x - xAdj;
102 *y = *y - yAdj; 102 *y = *y - yAdj;
103 } 103 }
104 104
105 static size_t max_glyphid_for_typeface(SkTypeface* typeface) { 105 static size_t max_glyphid_for_typeface(SkTypeface* typeface) {
106 SkAutoResolveDefaultTypeface autoResolve(typeface); 106 SkAutoResolveDefaultTypeface autoResolve(typeface);
107 typeface = autoResolve.get(); 107 typeface = autoResolve.get();
108 108 return typeface->countGlyphs() - 1;
109 SkAdvancedTypefaceMetrics* metrics;
110 metrics = typeface->getAdvancedTypefaceMetrics(
111 SkAdvancedTypefaceMetrics::kNo_PerGlyphInfo,
112 NULL, 0);
113
114 int lastGlyphID = 0;
115 if (metrics) {
116 lastGlyphID = metrics->fLastGlyphID;
117 metrics->unref();
118 }
119 return lastGlyphID;
120 } 109 }
121 110
122 typedef SkAutoSTMalloc<128, uint16_t> SkGlyphStorage; 111 typedef SkAutoSTMalloc<128, uint16_t> SkGlyphStorage;
123 112
124 static size_t force_glyph_encoding(const SkPaint& paint, const void* text, 113 static size_t force_glyph_encoding(const SkPaint& paint, const void* text,
125 size_t len, SkGlyphStorage* storage, 114 size_t len, SkGlyphStorage* storage,
126 uint16_t** glyphIDs) { 115 uint16_t** glyphIDs) {
127 // Make sure we have a glyph id encoding. 116 // Make sure we have a glyph id encoding.
128 if (paint.getTextEncoding() != SkPaint::kGlyphID_TextEncoding) { 117 if (paint.getTextEncoding() != SkPaint::kGlyphID_TextEncoding) {
129 size_t numGlyphs = paint.textToGlyphs(text, len, NULL); 118 size_t numGlyphs = paint.textToGlyphs(text, len, NULL);
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 } 1826 }
1838 1827
1839 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, 1828 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y,
1840 SkCanvas::Config8888) { 1829 SkCanvas::Config8888) {
1841 return false; 1830 return false;
1842 } 1831 }
1843 1832
1844 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { 1833 bool SkPDFDevice::allowImageFilter(SkImageFilter*) {
1845 return false; 1834 return false;
1846 } 1835 }
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