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

Unified Diff: src/pdf/SkPDFShader.cpp

Issue 941023005: PDF : New factory function for SkPDFDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase on 07d5947 Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | tests/AnnotationTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFShader.cpp
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp
index e9283bc2756f98d333c9d0de2344206e91f29f7b..979ef3faea80576950a6a128a5368d4ee9389c77 100644
--- a/src/pdf/SkPDFShader.cpp
+++ b/src/pdf/SkPDFShader.cpp
@@ -942,15 +942,11 @@ SkPDFImageShader* SkPDFImageShader::Create(
deviceBounds.join(bitmapBounds);
}
- SkMatrix unflip;
- unflip.setTranslate(0, SkScalarRoundToScalar(deviceBounds.height()));
- unflip.preScale(SK_Scalar1, -SK_Scalar1);
SkISize size = SkISize::Make(SkScalarRoundToInt(deviceBounds.width()),
SkScalarRoundToInt(deviceBounds.height()));
- // TODO(edisonn): should we pass here the DCT encoder of the destination device?
- // TODO(edisonn): NYI Perspective, use SkPDFDeviceFlattener.
- SkPDFDevice pattern(size, size, unflip);
- SkCanvas canvas(&pattern);
+ SkAutoTUnref<SkPDFDevice> patternDevice(
+ SkPDFDevice::CreateUnflipped(size, 72.0f, NULL));
+ SkCanvas canvas(patternDevice.get());
SkRect patternBBox;
image->getBounds(&patternBBox);
@@ -1108,14 +1104,16 @@ SkPDFImageShader* SkPDFImageShader::Create(
}
// Put the canvas into the pattern stream (fContent).
- SkAutoTDelete<SkStream> content(pattern.content());
+ SkAutoTDelete<SkStream> content(patternDevice->content());
SkPDFImageShader* imageShader =
SkNEW_ARGS(SkPDFImageShader, (autoState->detach()));
imageShader->setData(content.get());
- populate_tiling_pattern_dict(imageShader, patternBBox,
- pattern.getResourceDict(), finalMatrix);
+ populate_tiling_pattern_dict(imageShader,
+ patternBBox,
+ patternDevice->getResourceDict(),
+ finalMatrix);
imageShader->fShaderState->fImage.unlockPixels();
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | tests/AnnotationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698