OLD | NEW |
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 Loading... |
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 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO
O | 137 fBlurSigma = buffer.readScalar(); |
138 // TODO: Once skps are recaptured in > v15 this SkScalarAbs can be removed | |
139 #endif | |
140 fBlurSigma = SkScalarAbs(buffer.readScalar()); | |
141 } | 138 } |
142 | 139 |
143 void SkEmbossMaskFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 140 void SkEmbossMaskFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
144 this->INHERITED::flatten(buffer); | 141 this->INHERITED::flatten(buffer); |
145 | 142 |
146 Light tmpLight = fLight; | 143 Light tmpLight = fLight; |
147 tmpLight.fPad = 0; // for the font-cache lookup to be clean | 144 tmpLight.fPad = 0; // for the font-cache lookup to be clean |
148 buffer.writeByteArray(&tmpLight, sizeof(tmpLight)); | 145 buffer.writeByteArray(&tmpLight, sizeof(tmpLight)); |
149 buffer.writeScalar(fBlurSigma); | 146 buffer.writeScalar(fBlurSigma); |
150 } | 147 } |
(...skipping 11 matching lines...) Expand all Loading... |
162 str->append(") "); | 159 str->append(") "); |
163 | 160 |
164 str->appendf("ambient: %d specular: %d ", | 161 str->appendf("ambient: %d specular: %d ", |
165 fLight.fAmbient, fLight.fSpecular); | 162 fLight.fAmbient, fLight.fSpecular); |
166 | 163 |
167 str->append("blurSigma: "); | 164 str->append("blurSigma: "); |
168 str->appendScalar(fBlurSigma); | 165 str->appendScalar(fBlurSigma); |
169 str->append(")"); | 166 str->append(")"); |
170 } | 167 } |
171 #endif | 168 #endif |
OLD | NEW |