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

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

Issue 1024113002: Revert of PDF: remove last use of SkPDFImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | src/pdf/SkPDFImage.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkBitmapDevice.h" 11 #include "SkBitmapDevice.h"
12 #include "SkColor.h" 12 #include "SkColor.h"
13 #include "SkClipStack.h" 13 #include "SkClipStack.h"
14 #include "SkData.h" 14 #include "SkData.h"
15 #include "SkDraw.h" 15 #include "SkDraw.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 "SkPDFBitmap.h"
21 #include "SkPDFFont.h" 20 #include "SkPDFFont.h"
22 #include "SkPDFFormXObject.h" 21 #include "SkPDFFormXObject.h"
23 #include "SkPDFGraphicState.h" 22 #include "SkPDFGraphicState.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 "SkRRect.h"
31 #include "SkString.h" 31 #include "SkString.h"
32 #include "SkSurface.h" 32 #include "SkSurface.h"
33 #include "SkTextFormatParams.h" 33 #include "SkTextFormatParams.h"
(...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 scaled.postScale(SkIntToScalar(subset.width()), 2119 scaled.postScale(SkIntToScalar(subset.width()),
2120 SkIntToScalar(subset.height())); 2120 SkIntToScalar(subset.height()));
2121 scaled.postConcat(matrix); 2121 scaled.postConcat(matrix);
2122 ScopedContentEntry content(this, clipStack, *clipRegion, scaled, paint); 2122 ScopedContentEntry content(this, clipStack, *clipRegion, scaled, paint);
2123 if (!content.entry() || (srcRect && !subset.intersect(*srcRect))) { 2123 if (!content.entry() || (srcRect && !subset.intersect(*srcRect))) {
2124 return; 2124 return;
2125 } 2125 }
2126 if (content.needShape()) { 2126 if (content.needShape()) {
2127 SkPath shape; 2127 SkPath shape;
2128 shape.addRect(SkRect::MakeWH(SkIntToScalar(subset.width()), 2128 shape.addRect(SkRect::MakeWH(SkIntToScalar(subset.width()),
2129 SkIntToScalar(subset.height()))); 2129 SkIntToScalar( subset.height())));
2130 shape.transform(matrix); 2130 shape.transform(matrix);
2131 content.setShape(shape); 2131 content.setShape(shape);
2132 } 2132 }
2133 if (!content.needSource()) { 2133 if (!content.needSource()) {
2134 return; 2134 return;
2135 } 2135 }
2136 2136
2137 SkBitmap subsetBitmap; 2137 SkAutoTUnref<SkPDFObject> image(
2138 // Should extractSubset be done by the SkPDFDevice? 2138 SkPDFCreateImageObject(fCanon, *bitmap, subset));
2139 if (!bitmap->extractSubset(&subsetBitmap, subset)) {
2140 return;
2141 }
2142 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap));
2143 if (!image) { 2139 if (!image) {
2144 return; 2140 return;
2145 } 2141 }
2146 2142
2147 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), 2143 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()),
2148 &content.entry()->fContent); 2144 &content.entry()->fContent);
2149 } 2145 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFBitmap.cpp ('k') | src/pdf/SkPDFImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698