OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkPdfRenderer.h" | 8 #include "SkPdfRenderer.h" |
9 | 9 |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 #else | 3055 #else |
3056 SkPoint skiaSpace[4] = {SkPoint::Make(z, h), | 3056 SkPoint skiaSpace[4] = {SkPoint::Make(z, h), |
3057 SkPoint::Make(w, h), | 3057 SkPoint::Make(w, h), |
3058 SkPoint::Make(w, z), | 3058 SkPoint::Make(w, z), |
3059 SkPoint::Make(z, z)}; | 3059 SkPoint::Make(z, z)}; |
3060 #endif | 3060 #endif |
3061 | 3061 |
3062 SkAssertResult(pdfContext.fOriginalMatrix.setPolyToPoly(pdfSpace, skiaSpace,
4)); | 3062 SkAssertResult(pdfContext.fOriginalMatrix.setPolyToPoly(pdfSpace, skiaSpace,
4)); |
3063 SkTraceMatrix(pdfContext.fOriginalMatrix, "Original matrix"); | 3063 SkTraceMatrix(pdfContext.fOriginalMatrix, "Original matrix"); |
3064 | 3064 |
| 3065 pdfContext.fOriginalMatrix.postConcat(canvas->getTotalMatrix()); |
| 3066 |
3065 pdfContext.fGraphicsState.fCTM = pdfContext.fOriginalMatrix; | 3067 pdfContext.fGraphicsState.fCTM = pdfContext.fOriginalMatrix; |
3066 pdfContext.fGraphicsState.fContentStreamMatrix = pdfContext.fOriginalMatrix; | 3068 pdfContext.fGraphicsState.fContentStreamMatrix = pdfContext.fOriginalMatrix; |
3067 pdfContext.fGraphicsState.fMatrixTm = pdfContext.fGraphicsState.fCTM; | 3069 pdfContext.fGraphicsState.fMatrixTm = pdfContext.fGraphicsState.fCTM; |
3068 pdfContext.fGraphicsState.fMatrixTlm = pdfContext.fGraphicsState.fCTM; | 3070 pdfContext.fGraphicsState.fMatrixTlm = pdfContext.fGraphicsState.fCTM; |
3069 | 3071 |
3070 #ifndef PDF_DEBUG_NO_PAGE_CLIPING | 3072 #ifndef PDF_DEBUG_NO_PAGE_CLIPING |
3071 canvas->clipRect(dst, SkRegion::kIntersect_Op, true); | 3073 canvas->clipRect(dst, SkRegion::kIntersect_Op, true); |
3072 #endif | 3074 #endif |
3073 | 3075 |
3074 canvas->setMatrix(pdfContext.fOriginalMatrix); | 3076 canvas->concat(pdfContext.fOriginalMatrix); |
3075 | 3077 |
3076 doPage(&pdfContext, canvas, fPdfDoc->page(page)); | 3078 doPage(&pdfContext, canvas, fPdfDoc->page(page)); |
3077 | 3079 |
3078 // TODO(edisonn:) erase with white before draw? Right now the caller i
s responsible. | 3080 // TODO(edisonn:) erase with white before draw? Right now the caller i
s responsible. |
3079 // SkPaint paint; | 3081 // SkPaint paint; |
3080 // paint.setColor(SK_ColorWHITE); | 3082 // paint.setColor(SK_ColorWHITE); |
3081 // canvas->drawRect(rect, paint); | 3083 // canvas->drawRect(rect, paint); |
3082 | 3084 |
3083 | 3085 |
3084 canvas->flush(); | 3086 canvas->flush(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3148 | 3150 |
3149 rect = SkRect::MakeWH(width, height); | 3151 rect = SkRect::MakeWH(width, height); |
3150 | 3152 |
3151 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei
ght)); | 3153 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei
ght)); |
3152 | 3154 |
3153 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); | 3155 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); |
3154 SkCanvas canvas(device); | 3156 SkCanvas canvas(device); |
3155 | 3157 |
3156 return renderer.renderPage(page, &canvas, rect); | 3158 return renderer.renderPage(page, &canvas, rect); |
3157 } | 3159 } |
OLD | NEW |