OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkEmbossMaskFilter.h" | 8 #include "SkEmbossMaskFilter.h" |
9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 SkPoint::Length(fLight.fDirection[0], fLight.fDirection[1])); | 117 SkPoint::Length(fLight.fDirection[0], fLight.fDirection[1])); |
118 | 118 |
119 SkEmbossMask::Emboss(dst, light); | 119 SkEmbossMask::Emboss(dst, light); |
120 | 120 |
121 // restore original alpha | 121 // restore original alpha |
122 memcpy(dst->fImage, src.fImage, src.computeImageSize()); | 122 memcpy(dst->fImage, src.fImage, src.computeImageSize()); |
123 | 123 |
124 return true; | 124 return true; |
125 } | 125 } |
126 | 126 |
127 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
128 SkEmbossMaskFilter::SkEmbossMaskFilter(SkReadBuffer& buffer) : SkMaskFilter(buff
er) { | |
129 SkASSERT(buffer.getArrayCount() == sizeof(Light)); | |
130 buffer.readByteArray(&fLight, sizeof(Light)); | |
131 SkASSERT(fLight.fPad == 0); // for the font-cache lookup to be clean | |
132 fBlurSigma = buffer.readScalar(); | |
133 } | |
134 #endif | |
135 | |
136 SkFlattenable* SkEmbossMaskFilter::CreateProc(SkReadBuffer& buffer) { | 127 SkFlattenable* SkEmbossMaskFilter::CreateProc(SkReadBuffer& buffer) { |
137 Light light; | 128 Light light; |
138 if (buffer.readByteArray(&light, sizeof(Light))) { | 129 if (buffer.readByteArray(&light, sizeof(Light))) { |
139 light.fPad = 0; // for the font-cache lookup to be clean | 130 light.fPad = 0; // for the font-cache lookup to be clean |
140 const SkScalar sigma = buffer.readScalar(); | 131 const SkScalar sigma = buffer.readScalar(); |
141 return Create(sigma, light); | 132 return Create(sigma, light); |
142 } | 133 } |
143 return NULL; | 134 return NULL; |
144 } | 135 } |
145 | 136 |
(...skipping 17 matching lines...) Expand all Loading... |
163 str->append(") "); | 154 str->append(") "); |
164 | 155 |
165 str->appendf("ambient: %d specular: %d ", | 156 str->appendf("ambient: %d specular: %d ", |
166 fLight.fAmbient, fLight.fSpecular); | 157 fLight.fAmbient, fLight.fSpecular); |
167 | 158 |
168 str->append("blurSigma: "); | 159 str->append("blurSigma: "); |
169 str->appendScalar(fBlurSigma); | 160 str->appendScalar(fBlurSigma); |
170 str->append(")"); | 161 str->append(")"); |
171 } | 162 } |
172 #endif | 163 #endif |
OLD | NEW |