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

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

Issue 950633003: PDF: remove last use of SkPDFImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-03-20 (Friday) 15:22:20 EDT 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"
20 #include "SkPDFFont.h" 21 #include "SkPDFFont.h"
21 #include "SkPDFFormXObject.h" 22 #include "SkPDFFormXObject.h"
22 #include "SkPDFGraphicState.h" 23 #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 SkAutoTUnref<SkPDFObject> image( 2137 SkBitmap subsetBitmap;
2138 SkPDFCreateImageObject(fCanon, *bitmap, subset)); 2138 // Should extractSubset be done by the SkPDFDevice?
2139 if (!bitmap->extractSubset(&subsetBitmap, subset)) {
2140 return;
2141 }
2142 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap));
2139 if (!image) { 2143 if (!image) {
2140 return; 2144 return;
2141 } 2145 }
2142 2146
2143 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), 2147 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()),
2144 &content.entry()->fContent); 2148 &content.entry()->fContent);
2145 } 2149 }
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