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" |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkClipStack.h" | 12 #include "SkClipStack.h" |
13 #include "SkData.h" | 13 #include "SkData.h" |
14 #include "SkDraw.h" | 14 #include "SkDraw.h" |
15 #include "SkFontHost.h" | 15 #include "SkFontHost.h" |
16 #include "SkGlyphCache.h" | 16 #include "SkGlyphCache.h" |
17 #include "SkPaint.h" | 17 #include "SkPaint.h" |
18 #include "SkPath.h" | 18 #include "SkPath.h" |
19 #include "SkPathOps.h" | 19 #include "SkPathOps.h" |
20 #include "SkPDFFont.h" | 20 #include "SkPDFFont.h" |
21 #include "SkPDFFormXObject.h" | 21 #include "SkPDFFormXObject.h" |
22 #include "SkPDFGraphicState.h" | 22 #include "SkPDFGraphicState.h" |
23 #include "SkPDFImage.h" | 23 #include "SkPDFImage.h" |
24 #include "SkPDFResourceDict.h" | 24 #include "SkPDFResourceDict.h" |
25 #include "SkPDFShader.h" | 25 #include "SkPDFShader.h" |
26 #include "SkPDFStream.h" | 26 #include "SkPDFStream.h" |
27 #include "SkPDFTypes.h" | 27 #include "SkPDFTypes.h" |
28 #include "SkPDFUtils.h" | 28 #include "SkPDFUtils.h" |
29 #include "SkRect.h" | 29 #include "SkRect.h" |
30 #include "SkRRect.h" | |
30 #include "SkString.h" | 31 #include "SkString.h" |
31 #include "SkTextFormatParams.h" | 32 #include "SkTextFormatParams.h" |
32 #include "SkTemplates.h" | 33 #include "SkTemplates.h" |
33 #include "SkTypefacePriv.h" | 34 #include "SkTypefacePriv.h" |
34 #include "SkTSet.h" | 35 #include "SkTSet.h" |
35 | 36 |
36 #ifdef SK_BUILD_FOR_ANDROID | 37 #ifdef SK_BUILD_FOR_ANDROID |
37 #include "SkTypeface_android.h" | 38 #include "SkTypeface_android.h" |
38 | 39 |
39 struct TypefaceFallbackData { | 40 struct TypefaceFallbackData { |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
924 | 925 |
925 ScopedContentEntry content(this, d, paint); | 926 ScopedContentEntry content(this, d, paint); |
926 if (!content.entry()) { | 927 if (!content.entry()) { |
927 return; | 928 return; |
928 } | 929 } |
929 SkPDFUtils::AppendRectangle(r, &content.entry()->fContent); | 930 SkPDFUtils::AppendRectangle(r, &content.entry()->fContent); |
930 SkPDFUtils::PaintPath(paint.getStyle(), SkPath::kWinding_FillType, | 931 SkPDFUtils::PaintPath(paint.getStyle(), SkPath::kWinding_FillType, |
931 &content.entry()->fContent); | 932 &content.entry()->fContent); |
932 } | 933 } |
933 | 934 |
935 void SkPDFDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, | |
936 const SkPaint& paint) { | |
937 SkPath path; | |
938 path.addRRect(rrect); | |
939 this->drawPath(draw, path, paint, NULL, true); | |
scroggo
2013/11/04 19:52:54
PDF would not draw a blurred round rect. The mask
| |
940 } | |
941 | |
934 void SkPDFDevice::drawPath(const SkDraw& d, const SkPath& origPath, | 942 void SkPDFDevice::drawPath(const SkDraw& d, const SkPath& origPath, |
935 const SkPaint& paint, const SkMatrix* prePathMatrix, | 943 const SkPaint& paint, const SkMatrix* prePathMatrix, |
936 bool pathIsMutable) { | 944 bool pathIsMutable) { |
937 SkPath modifiedPath; | 945 SkPath modifiedPath; |
938 SkPath* pathPtr = const_cast<SkPath*>(&origPath); | 946 SkPath* pathPtr = const_cast<SkPath*>(&origPath); |
939 | 947 |
940 SkMatrix matrix = *d.fMatrix; | 948 SkMatrix matrix = *d.fMatrix; |
941 if (prePathMatrix) { | 949 if (prePathMatrix) { |
942 if (paint.getPathEffect() || paint.getStyle() != SkPaint::kFill_Style) { | 950 if (paint.getPathEffect() || paint.getStyle() != SkPaint::kFill_Style) { |
943 if (!pathIsMutable) { | 951 if (!pathIsMutable) { |
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2144 } | 2152 } |
2145 | 2153 |
2146 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, | 2154 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, |
2147 SkCanvas::Config8888) { | 2155 SkCanvas::Config8888) { |
2148 return false; | 2156 return false; |
2149 } | 2157 } |
2150 | 2158 |
2151 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { | 2159 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { |
2152 return false; | 2160 return false; |
2153 } | 2161 } |
OLD | NEW |