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

Unified Diff: src/pdf/SkPDFDevice.cpp

Issue 1812063002: SkPDF: Add SkPDFCanvas to intercept some draw calls (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-03-21 (Monday) 15:44:28 EDT Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFCanvas.cpp ('k') | src/pdf/SkPDFDocument.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFDevice.cpp
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index f5e341b0439d194e8fd56947f2c7c95c31f44005..9cc2563caf44532123e3d6e3fe2f39ba5a65fdb8 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1039,12 +1039,7 @@ void SkPDFDevice::drawBitmapRect(const SkDraw& draw,
const SkRect& dst,
const SkPaint& srcPaint,
SkCanvas::SrcRectConstraint constraint) {
- const SkImage* image = fCanon->bitmapToImage(bitmap);
- if (!image) {
- return;
- }
- // ownership of this image is retained by the canon.
- this->drawImageRect(draw, image, src, dst, srcPaint, constraint);
+ SkASSERT(false);
}
void SkPDFDevice::drawBitmap(const SkDraw& d,
@@ -1121,66 +1116,7 @@ void SkPDFDevice::drawImageRect(const SkDraw& draw,
const SkRect& dst,
const SkPaint& srcPaint,
SkCanvas::SrcRectConstraint constraint) {
- if (!image) {
- return;
- }
- if (draw.fClip->isEmpty()) {
- return;
- }
- SkPaint paint = srcPaint;
- if (image->isOpaque()) {
- replace_srcmode_on_opaque_paint(&paint);
- }
- // TODO: this code path must be updated to respect the flags parameter
- SkMatrix matrix;
- SkRect tmpSrc, tmpDst;
- SkRect imageBounds = SkRect::Make(image->bounds());
-
- // Compute matrix from the two rectangles
- if (src) {
- tmpSrc = *src;
- } else {
- tmpSrc = imageBounds;
- }
- matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit);
-
- // clip the tmpSrc to the bounds of the bitmap, and recompute dstRect if
- // needed (if the src was clipped). No check needed if src==null.
- sk_sp<const SkImage> autoImageUnref;
- if (src) {
- if (!imageBounds.contains(*src)) {
- if (!tmpSrc.intersect(imageBounds)) {
- return; // nothing to draw
- }
- // recompute dst, based on the smaller tmpSrc
- matrix.mapRect(&tmpDst, tmpSrc);
- }
-
- // since we may need to clamp to the borders of the src rect within
- // the bitmap, we extract a subset.
- SkIRect srcIR;
- tmpSrc.roundOut(&srcIR);
-
- autoImageUnref = image->makeSubset(srcIR);
- if (!autoImageUnref) {
- return;
- }
- image = autoImageUnref.get();
- // Since we did an extract, we need to adjust the matrix accordingly
- SkScalar dx = 0, dy = 0;
- if (srcIR.fLeft > 0) {
- dx = SkIntToScalar(srcIR.fLeft);
- }
- if (srcIR.fTop > 0) {
- dy = SkIntToScalar(srcIR.fTop);
- }
- if (dx || dy) {
- matrix.preTranslate(dx, dy);
- }
- }
- matrix.postConcat(*draw.fMatrix);
- this->internalDrawImage(matrix, draw.fClipStack, *draw.fClip, image,
- nullptr, paint);
+ SkASSERT(false);
}
// Create a PDF string. Maximum length (in bytes) is 65,535.
« no previous file with comments | « src/pdf/SkPDFCanvas.cpp ('k') | src/pdf/SkPDFDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698