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

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

Issue 278903002: Revert of hide get/setLocalMatrix (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkRectShaderImageFilter.cpp ('k') | no next file » | 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 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 "SkPDFDeviceFlattener.h" 8 #include "SkPDFDeviceFlattener.h"
9
9 #include "SkDraw.h" 10 #include "SkDraw.h"
10 11
11 static SkISize SkSizeToISize(const SkSize& size) { 12 static SkISize SkSizeToISize(const SkSize& size) {
12 return SkISize::Make(SkScalarRoundToInt(size.width()), SkScalarRoundToInt(si ze.height())); 13 return SkISize::Make(SkScalarRoundToInt(size.width()), SkScalarRoundToInt(si ze.height()));
13 } 14 }
14 15
15 SkPDFDeviceFlattener::SkPDFDeviceFlattener(const SkSize& pageSize, const SkRect* trimBox) 16 SkPDFDeviceFlattener::SkPDFDeviceFlattener(const SkSize& pageSize, const SkRect* trimBox)
16 : SkPDFDevice(SkSizeToISize(pageSize), 17 : SkPDFDevice(SkSizeToISize(pageSize),
17 SkSizeToISize(pageSize), 18 SkSizeToISize(pageSize),
18 SkMatrix::I()) { 19 SkMatrix::I()) {
19 // TODO(edisonn): store the trimbox on emit. 20 // TODO(edisonn): store the trimbox on emit.
20 } 21 }
21 22
22 SkPDFDeviceFlattener::~SkPDFDeviceFlattener() { 23 SkPDFDeviceFlattener::~SkPDFDeviceFlattener() {
23 } 24 }
24 25
25 static void flattenPaint(const SkDraw& d, SkPaint* paint) { 26 static void flattenPaint(const SkDraw& d, SkPaint* paint) {
26 if (paint->getShader()) { 27 if (paint->getShader()) {
27 SkAutoTUnref<SkShader> lms(SkShader::CreateLocalMatrixShader(paint->getS hader(), 28 SkMatrix local = paint->getShader()->getLocalMatrix();
28 *d.fMatrix) ); 29 local.preConcat(*d.fMatrix);
29 paint->setShader(lms); 30 paint->getShader()->setLocalMatrix(local);
30 } 31 }
31 } 32 }
32 33
33 void SkPDFDeviceFlattener::drawPoints(const SkDraw& d, SkCanvas::PointMode mode, 34 void SkPDFDeviceFlattener::drawPoints(const SkDraw& d, SkCanvas::PointMode mode,
34 size_t count, const SkPoint points[], 35 size_t count, const SkPoint points[],
35 const SkPaint& paint) { 36 const SkPaint& paint) {
36 if (!mustFlatten(d)) { 37 if (!mustFlatten(d)) {
37 INHERITED::drawPoints(d, mode, count, points, paint); 38 INHERITED::drawPoints(d, mode, count, points, paint);
38 return; 39 return;
39 } 40 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 bool SkPDFDeviceFlattener::mustFlatten(const SkDraw& d) const { 146 bool SkPDFDeviceFlattener::mustFlatten(const SkDraw& d) const {
146 // TODO(edisonn): testability, add flag to force return true. 147 // TODO(edisonn): testability, add flag to force return true.
147 return d.fMatrix->hasPerspective(); 148 return d.fMatrix->hasPerspective();
148 } 149 }
149 150
150 bool SkPDFDeviceFlattener::mustPathText(const SkDraw& d, const SkPaint&) { 151 bool SkPDFDeviceFlattener::mustPathText(const SkDraw& d, const SkPaint&) {
151 // TODO(edisonn): testability, add flag to force return true. 152 // TODO(edisonn): testability, add flag to force return true.
152 // TODO(edisonn): TBD: How to flatten MaskFilter. 153 // TODO(edisonn): TBD: How to flatten MaskFilter.
153 return d.fMatrix->hasPerspective(); 154 return d.fMatrix->hasPerspective();
154 } 155 }
OLDNEW
« no previous file with comments | « src/effects/SkRectShaderImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698