aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFDevice.cpp
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-03-20 09:10:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-20 09:10:56 -0700
commit86ad8d643624a55b02e529100bbe4e2940115fa1 (patch)
treeb27f7f6eea0207145ac170d994b1a25f3c7ea957 /src/pdf/SkPDFDevice.cpp
parentd4bb991df84357ad77b7858ae6c5dd00347b7ba6 (diff)
PDF: remove last use of SkPDFImage
Add a GM. BUG=skia:255 Review URL: https://codereview.chromium.org/950633003
Diffstat (limited to 'src/pdf/SkPDFDevice.cpp')
-rw-r--r--src/pdf/SkPDFDevice.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 273b958a8c..a0ad1343af 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -17,10 +17,10 @@
#include "SkPaint.h"
#include "SkPath.h"
#include "SkPathOps.h"
+#include "SkPDFBitmap.h"
#include "SkPDFFont.h"
#include "SkPDFFormXObject.h"
#include "SkPDFGraphicState.h"
-#include "SkPDFImage.h"
#include "SkPDFResourceDict.h"
#include "SkPDFShader.h"
#include "SkPDFStream.h"
@@ -2126,7 +2126,7 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix,
if (content.needShape()) {
SkPath shape;
shape.addRect(SkRect::MakeWH(SkIntToScalar(subset.width()),
- SkIntToScalar( subset.height())));
+ SkIntToScalar(subset.height())));
shape.transform(matrix);
content.setShape(shape);
}
@@ -2134,8 +2134,12 @@ void SkPDFDevice::internalDrawBitmap(const SkMatrix& origMatrix,
return;
}
- SkAutoTUnref<SkPDFObject> image(
- SkPDFCreateImageObject(fCanon, *bitmap, subset));
+ SkBitmap subsetBitmap;
+ // Should extractSubset be done by the SkPDFDevice?
+ if (!bitmap->extractSubset(&subsetBitmap, subset)) {
+ return;
+ }
+ SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap));
if (!image) {
return;
}