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

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

Issue 12739006: move most of SkFontHost to private (preceeding making it all private) (Closed) Base URL: http://skia.googlecode.com/svn/
Patch Set: Created 7 years, 9 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
2 /* 1 /*
3 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9
10 #include "SkPDFDevice.h" 8 #include "SkPDFDevice.h"
11 9
12 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
13 #include "SkColor.h" 11 #include "SkColor.h"
14 #include "SkClipStack.h" 12 #include "SkClipStack.h"
15 #include "SkData.h" 13 #include "SkData.h"
16 #include "SkDraw.h" 14 #include "SkDraw.h"
17 #include "SkFontHost.h" 15 #include "SkFontHost.h"
18 #include "SkGlyphCache.h" 16 #include "SkGlyphCache.h"
19 #include "SkPaint.h" 17 #include "SkPaint.h"
20 #include "SkPath.h" 18 #include "SkPath.h"
21 #include "SkPDFFont.h" 19 #include "SkPDFFont.h"
22 #include "SkPDFFormXObject.h" 20 #include "SkPDFFormXObject.h"
23 #include "SkPDFGraphicState.h" 21 #include "SkPDFGraphicState.h"
24 #include "SkPDFImage.h" 22 #include "SkPDFImage.h"
25 #include "SkPDFShader.h" 23 #include "SkPDFShader.h"
26 #include "SkPDFStream.h" 24 #include "SkPDFStream.h"
27 #include "SkPDFTypes.h" 25 #include "SkPDFTypes.h"
28 #include "SkPDFUtils.h" 26 #include "SkPDFUtils.h"
29 #include "SkRect.h" 27 #include "SkRect.h"
30 #include "SkString.h" 28 #include "SkString.h"
31 #include "SkTextFormatParams.h" 29 #include "SkTextFormatParams.h"
32 #include "SkTemplates.h" 30 #include "SkTemplates.h"
33 #include "SkTypeface.h" 31 #include "SkTypefacePriv.h"
34 #include "SkTypes.h"
35 32
36 // Utility functions 33 // Utility functions
37 34
38 static void emit_pdf_color(SkColor color, SkWStream* result) { 35 static void emit_pdf_color(SkColor color, SkWStream* result) {
39 SkASSERT(SkColorGetA(color) == 0xFF); // We handle alpha elsewhere. 36 SkASSERT(SkColorGetA(color) == 0xFF); // We handle alpha elsewhere.
40 SkScalar colorMax = SkIntToScalar(0xFF); 37 SkScalar colorMax = SkIntToScalar(0xFF);
41 SkPDFScalar::Append( 38 SkPDFScalar::Append(
42 SkScalarDiv(SkIntToScalar(SkColorGetR(color)), colorMax), result); 39 SkScalarDiv(SkIntToScalar(SkColorGetR(color)), colorMax), result);
43 result->writeText(" "); 40 result->writeText(" ");
44 SkPDFScalar::Append( 41 SkPDFScalar::Append(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 SkScalar xAdj = SkFixedToScalar(xAdv); 94 SkScalar xAdj = SkFixedToScalar(xAdv);
98 SkScalar yAdj = SkFixedToScalar(yAdv); 95 SkScalar yAdj = SkFixedToScalar(yAdv);
99 if (paint.getTextAlign() == SkPaint::kCenter_Align) { 96 if (paint.getTextAlign() == SkPaint::kCenter_Align) {
100 xAdj = SkScalarHalf(xAdj); 97 xAdj = SkScalarHalf(xAdj);
101 yAdj = SkScalarHalf(yAdj); 98 yAdj = SkScalarHalf(yAdj);
102 } 99 }
103 *x = *x - xAdj; 100 *x = *x - xAdj;
104 *y = *y - yAdj; 101 *y = *y - yAdj;
105 } 102 }
106 103
107 static size_t max_glyphid_for_typeface(const SkTypeface* typeface) { 104 static size_t max_glyphid_for_typeface(SkTypeface* typeface) {
105 SkAutoResolveDefaultTypeface autoResolve(typeface);
106 typeface = autoResolve.get();
107
108 SkAdvancedTypefaceMetrics* metrics; 108 SkAdvancedTypefaceMetrics* metrics;
109 metrics = SkFontHost::GetAdvancedTypefaceMetrics( 109 metrics = typeface->getAdvancedTypefaceMetrics(
110 SkTypeface::UniqueID(typeface),
111 SkAdvancedTypefaceMetrics::kNo_PerGlyphInfo, 110 SkAdvancedTypefaceMetrics::kNo_PerGlyphInfo,
112 NULL, 0); 111 NULL, 0);
113 112
114 int lastGlyphID = 0; 113 int lastGlyphID = 0;
115 if (metrics) { 114 if (metrics) {
116 lastGlyphID = metrics->fLastGlyphID; 115 lastGlyphID = metrics->fLastGlyphID;
117 metrics->unref(); 116 metrics->unref();
118 } 117 }
119 return lastGlyphID; 118 return lastGlyphID;
120 } 119 }
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 } 1802 }
1804 1803
1805 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, 1804 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y,
1806 SkCanvas::Config8888) { 1805 SkCanvas::Config8888) {
1807 return false; 1806 return false;
1808 } 1807 }
1809 1808
1810 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { 1809 bool SkPDFDevice::allowImageFilter(SkImageFilter*) {
1811 return false; 1810 return false;
1812 } 1811 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698