OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "printing/pdf_metafile_skia.h" | 5 #include "printing/pdf_metafile_skia.h" |
6 | 6 |
7 #include "base/eintr_wrapper.h" | 7 #include "base/eintr_wrapper.h" |
8 #include "base/file_descriptor_posix.h" | 8 #include "base/file_descriptor_posix.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Don't do anything if we've already set the data in InitFromData. | 88 // Don't do anything if we've already set the data in InitFromData. |
89 if (data_->pdf_stream_.getOffset()) | 89 if (data_->pdf_stream_.getOffset()) |
90 return true; | 90 return true; |
91 | 91 |
92 if (page_outstanding_) | 92 if (page_outstanding_) |
93 FinishPage(); | 93 FinishPage(); |
94 | 94 |
95 data_->current_page_ = NULL; | 95 data_->current_page_ = NULL; |
96 | 96 |
97 int font_counts[SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1]; | 97 int font_counts[SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1]; |
98 // Work around bug in skia for the moment. | |
99 memset(font_counts, 0, sizeof(font_counts)); | |
100 data_->pdf_doc_.getCountOfFontTypes(font_counts); | 98 data_->pdf_doc_.getCountOfFontTypes(font_counts); |
101 for (int type = 0; | 99 for (int type = 0; |
102 type <= SkAdvancedTypefaceMetrics::kNotEmbeddable_Font; | 100 type <= SkAdvancedTypefaceMetrics::kNotEmbeddable_Font; |
103 type++) { | 101 type++) { |
104 for (int count = 0; count < font_counts[type]; count++) { | 102 for (int count = 0; count < font_counts[type]; count++) { |
105 UMA_HISTOGRAM_ENUMERATION( | 103 UMA_HISTOGRAM_ENUMERATION( |
106 "PrintPreview.FontType", type, | 104 "PrintPreview.FontType", type, |
107 SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1); | 105 SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1); |
108 } | 106 } |
109 } | 107 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 SkAutoDataUnref data(pdf_stream.copyToData()); | 241 SkAutoDataUnref data(pdf_stream.copyToData()); |
244 if (data.size() == 0) | 242 if (data.size() == 0) |
245 return NULL; | 243 return NULL; |
246 | 244 |
247 PdfMetafileSkia* metafile = new PdfMetafileSkia; | 245 PdfMetafileSkia* metafile = new PdfMetafileSkia; |
248 metafile->InitFromData(data.bytes(), data.size()); | 246 metafile->InitFromData(data.bytes(), data.size()); |
249 return metafile; | 247 return metafile; |
250 } | 248 } |
251 | 249 |
252 } // namespace printing | 250 } // namespace printing |
OLD | NEW |