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

Side by Side Diff: src/effects/Sk2DPathEffect.cpp

Issue 769953002: Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « src/effects/Sk1DPathEffect.cpp ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "Sk2DPathEffect.h" 10 #include "Sk2DPathEffect.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void Sk2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) const { } 66 void Sk2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) const { }
67 void Sk2DPathEffect::end(SkPath* dst) const {} 67 void Sk2DPathEffect::end(SkPath* dst) const {}
68 68
69 /////////////////////////////////////////////////////////////////////////////// 69 ///////////////////////////////////////////////////////////////////////////////
70 70
71 void Sk2DPathEffect::flatten(SkWriteBuffer& buffer) const { 71 void Sk2DPathEffect::flatten(SkWriteBuffer& buffer) const {
72 this->INHERITED::flatten(buffer); 72 this->INHERITED::flatten(buffer);
73 buffer.writeMatrix(fMatrix); 73 buffer.writeMatrix(fMatrix);
74 } 74 }
75 75
76 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
77 Sk2DPathEffect::Sk2DPathEffect(SkReadBuffer& buffer) {
78 buffer.readMatrix(&fMatrix);
79 fMatrixIsInvertible = fMatrix.invert(&fInverse);
80 }
81 #endif
82
83 /////////////////////////////////////////////////////////////////////////////// 76 ///////////////////////////////////////////////////////////////////////////////
84 77
85 bool SkLine2DPathEffect::filterPath(SkPath* dst, const SkPath& src, 78 bool SkLine2DPathEffect::filterPath(SkPath* dst, const SkPath& src,
86 SkStrokeRec* rec, const SkRect* cullRect) const { 79 SkStrokeRec* rec, const SkRect* cullRect) const {
87 if (this->INHERITED::filterPath(dst, src, rec, cullRect)) { 80 if (this->INHERITED::filterPath(dst, src, rec, cullRect)) {
88 rec->setStrokeStyle(fWidth); 81 rec->setStrokeStyle(fWidth);
89 return true; 82 return true;
90 } 83 }
91 return false; 84 return false;
92 } 85 }
93 86
94 void SkLine2DPathEffect::nextSpan(int u, int v, int ucount, SkPath* dst) const { 87 void SkLine2DPathEffect::nextSpan(int u, int v, int ucount, SkPath* dst) const {
95 if (ucount > 1) { 88 if (ucount > 1) {
96 SkPoint src[2], dstP[2]; 89 SkPoint src[2], dstP[2];
97 90
98 src[0].set(SkIntToScalar(u) + SK_ScalarHalf, SkIntToScalar(v) + SK_Scala rHalf); 91 src[0].set(SkIntToScalar(u) + SK_ScalarHalf, SkIntToScalar(v) + SK_Scala rHalf);
99 src[1].set(SkIntToScalar(u+ucount) + SK_ScalarHalf, SkIntToScalar(v) + S K_ScalarHalf); 92 src[1].set(SkIntToScalar(u+ucount) + SK_ScalarHalf, SkIntToScalar(v) + S K_ScalarHalf);
100 this->getMatrix().mapPoints(dstP, src, 2); 93 this->getMatrix().mapPoints(dstP, src, 2);
101 94
102 dst->moveTo(dstP[0]); 95 dst->moveTo(dstP[0]);
103 dst->lineTo(dstP[1]); 96 dst->lineTo(dstP[1]);
104 } 97 }
105 } 98 }
106 99
107 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
108 SkLine2DPathEffect::SkLine2DPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {
109 fWidth = buffer.readScalar();
110 }
111 #endif
112
113 SkFlattenable* SkLine2DPathEffect::CreateProc(SkReadBuffer& buffer) { 100 SkFlattenable* SkLine2DPathEffect::CreateProc(SkReadBuffer& buffer) {
114 SkMatrix matrix; 101 SkMatrix matrix;
115 buffer.readMatrix(&matrix); 102 buffer.readMatrix(&matrix);
116 SkScalar width = buffer.readScalar(); 103 SkScalar width = buffer.readScalar();
117 return SkLine2DPathEffect::Create(width, matrix); 104 return SkLine2DPathEffect::Create(width, matrix);
118 } 105 }
119 106
120 void SkLine2DPathEffect::flatten(SkWriteBuffer &buffer) const { 107 void SkLine2DPathEffect::flatten(SkWriteBuffer &buffer) const {
121 buffer.writeMatrix(this->getMatrix()); 108 buffer.writeMatrix(this->getMatrix());
122 buffer.writeScalar(fWidth); 109 buffer.writeScalar(fWidth);
123 } 110 }
124 111
125 /////////////////////////////////////////////////////////////////////////////// 112 ///////////////////////////////////////////////////////////////////////////////
126 113
127 SkPath2DPathEffect::SkPath2DPathEffect(const SkMatrix& m, const SkPath& p) 114 SkPath2DPathEffect::SkPath2DPathEffect(const SkMatrix& m, const SkPath& p)
128 : INHERITED(m), fPath(p) { 115 : INHERITED(m), fPath(p) {
129 } 116 }
130 117
131 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
132 SkPath2DPathEffect::SkPath2DPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {
133 buffer.readPath(&fPath);
134 }
135 #endif
136
137 SkFlattenable* SkPath2DPathEffect::CreateProc(SkReadBuffer& buffer) { 118 SkFlattenable* SkPath2DPathEffect::CreateProc(SkReadBuffer& buffer) {
138 SkMatrix matrix; 119 SkMatrix matrix;
139 buffer.readMatrix(&matrix); 120 buffer.readMatrix(&matrix);
140 SkPath path; 121 SkPath path;
141 buffer.readPath(&path); 122 buffer.readPath(&path);
142 return SkPath2DPathEffect::Create(matrix, path); 123 return SkPath2DPathEffect::Create(matrix, path);
143 } 124 }
144 125
145 void SkPath2DPathEffect::flatten(SkWriteBuffer& buffer) const { 126 void SkPath2DPathEffect::flatten(SkWriteBuffer& buffer) const {
146 buffer.writeMatrix(this->getMatrix()); 127 buffer.writeMatrix(this->getMatrix());
147 buffer.writePath(fPath); 128 buffer.writePath(fPath);
148 } 129 }
149 130
150 void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v, 131 void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v,
151 SkPath* dst) const { 132 SkPath* dst) const {
152 dst->addPath(fPath, loc.fX, loc.fY); 133 dst->addPath(fPath, loc.fX, loc.fY);
153 } 134 }
OLDNEW
« no previous file with comments | « src/effects/Sk1DPathEffect.cpp ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698