| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |