summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 05:48:19 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 05:48:19 +0000
commitc524541f5a8ba5bb6a114685978a8fcc6cd9a8db (patch)
treef4aae0c982d02a415ca58ff0b9c31ab5aef085a9 /printing
parente10887cb33dccc20cb881d0ab031fc2493ca1e5f (diff)
downloadchromium_src-c524541f5a8ba5bb6a114685978a8fcc6cd9a8db.zip
chromium_src-c524541f5a8ba5bb6a114685978a8fcc6cd9a8db.tar.gz
chromium_src-c524541f5a8ba5bb6a114685978a8fcc6cd9a8db.tar.bz2
Revert "Roll Skia to 3470, which changes most of the pdf includes to be private."
This reverts r128408 tbr=thakis@chromium.org BUG=NONE TEST=NONE Review URL: https://chromiumcodereview.appspot.com/9835042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128410 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/pdf_metafile_skia.cc31
1 files changed, 18 insertions, 13 deletions
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index ac06695..e2409b9 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,6 +17,8 @@
#include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/pdf/SkPDFDevice.h"
#include "third_party/skia/include/pdf/SkPDFDocument.h"
+#include "third_party/skia/include/pdf/SkPDFFont.h"
+#include "third_party/skia/include/pdf/SkPDFPage.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
@@ -93,18 +95,21 @@ bool PdfMetafileSkia::FinishDocument() {
FinishPage();
data_->current_page_ = NULL;
-
- int font_counts[SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1];
- // Work around bug in skia for the moment.
- memset(font_counts, 0, sizeof(font_counts));
- data_->pdf_doc_.getCountOfFontTypes(font_counts);
- for (int type = 0;
- type <= SkAdvancedTypefaceMetrics::kNotEmbeddable_Font;
- type++) {
- for (int count = 0; count < font_counts[type]; count++) {
- UMA_HISTOGRAM_ENUMERATION(
- "PrintPreview.FontType", type,
- SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1);
+ base::hash_set<SkFontID> font_set;
+
+ const SkTDArray<SkPDFPage*>& pages = data_->pdf_doc_.getPages();
+ for (int page_number = 0; page_number < pages.count(); page_number++) {
+ const SkTDArray<SkPDFFont*>& font_resources =
+ pages[page_number]->getFontResources();
+ for (int font = 0; font < font_resources.count(); font++) {
+ SkFontID font_id = font_resources[font]->typeface()->uniqueID();
+ if (font_set.find(font_id) == font_set.end()) {
+ font_set.insert(font_id);
+ UMA_HISTOGRAM_ENUMERATION(
+ "PrintPreview.FontType",
+ font_resources[font]->getType(),
+ SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1);
+ }
}
}