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

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

Issue 88233003: Code cleanup following recapture of skps (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: More cleanup Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkBlurMaskFilter.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 /* 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 "SkEmbossMaskFilter.h" 10 #include "SkEmbossMaskFilter.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 memcpy(dst->fImage, src.fImage, src.computeImageSize()); 127 memcpy(dst->fImage, src.fImage, src.computeImageSize());
128 128
129 return true; 129 return true;
130 } 130 }
131 131
132 SkEmbossMaskFilter::SkEmbossMaskFilter(SkFlattenableReadBuffer& buffer) 132 SkEmbossMaskFilter::SkEmbossMaskFilter(SkFlattenableReadBuffer& buffer)
133 : SkMaskFilter(buffer) { 133 : SkMaskFilter(buffer) {
134 SkASSERT(buffer.getArrayCount() == sizeof(Light)); 134 SkASSERT(buffer.getArrayCount() == sizeof(Light));
135 buffer.readByteArray(&fLight, sizeof(Light)); 135 buffer.readByteArray(&fLight, sizeof(Light));
136 SkASSERT(fLight.fPad == 0); // for the font-cache lookup to be clean 136 SkASSERT(fLight.fPad == 0); // for the font-cache lookup to be clean
137 fBlurSigma = buffer.readScalar(); 137 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO O
138 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V13_AND_ALL_OTHER_INSTANCES_TO O 138 // TODO: Once skps are recaptured in > v15 this SkScalarAbs can be removed
139 // Fixing this must be done in two stages. When the skps are recaptured in V 13,
140 // remove the ConvertRadiusToSigma but retain the absolute value.
141 // At the same time, switch the code in flatten to write a positive value.
142 // When the skps are captured in V14 the absolute value can be removed.
143 if (fBlurSigma > 0) {
144 fBlurSigma = SkBlurMask::ConvertRadiusToSigma(fBlurSigma);
145 } else {
146 fBlurSigma = -fBlurSigma;
147 }
148 #endif 139 #endif
140 fBlurSigma = SkScalarAbs(buffer.readScalar());
149 } 141 }
150 142
151 void SkEmbossMaskFilter::flatten(SkFlattenableWriteBuffer& buffer) const { 143 void SkEmbossMaskFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
152 this->INHERITED::flatten(buffer); 144 this->INHERITED::flatten(buffer);
153 145
154 Light tmpLight = fLight; 146 Light tmpLight = fLight;
155 tmpLight.fPad = 0; // for the font-cache lookup to be clean 147 tmpLight.fPad = 0; // for the font-cache lookup to be clean
156 buffer.writeByteArray(&tmpLight, sizeof(tmpLight)); 148 buffer.writeByteArray(&tmpLight, sizeof(tmpLight));
157 buffer.writeScalar(-fBlurSigma); 149 buffer.writeScalar(fBlurSigma);
158 } 150 }
159 151
160 #ifdef SK_DEVELOPER 152 #ifdef SK_DEVELOPER
161 void SkEmbossMaskFilter::toString(SkString* str) const { 153 void SkEmbossMaskFilter::toString(SkString* str) const {
162 str->append("SkEmbossMaskFilter: ("); 154 str->append("SkEmbossMaskFilter: (");
163 155
164 str->append("direction: ("); 156 str->append("direction: (");
165 str->appendScalar(fLight.fDirection[0]); 157 str->appendScalar(fLight.fDirection[0]);
166 str->append(", "); 158 str->append(", ");
167 str->appendScalar(fLight.fDirection[1]); 159 str->appendScalar(fLight.fDirection[1]);
168 str->append(", "); 160 str->append(", ");
169 str->appendScalar(fLight.fDirection[2]); 161 str->appendScalar(fLight.fDirection[2]);
170 str->append(") "); 162 str->append(") ");
171 163
172 str->appendf("ambient: %d specular: %d ", 164 str->appendf("ambient: %d specular: %d ",
173 fLight.fAmbient, fLight.fSpecular); 165 fLight.fAmbient, fLight.fSpecular);
174 166
175 str->append("blurSigma: "); 167 str->append("blurSigma: ");
176 str->appendScalar(fBlurSigma); 168 str->appendScalar(fBlurSigma);
177 str->append(")"); 169 str->append(")");
178 } 170 }
179 #endif 171 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698