| 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 |
| 127 SkFlattenable* SkEmbossMaskFilter::CreateProc(SkReadBuffer& buffer) { | 136 SkFlattenable* SkEmbossMaskFilter::CreateProc(SkReadBuffer& buffer) { |
| 128 Light light; | 137 Light light; |
| 129 if (buffer.readByteArray(&light, sizeof(Light))) { | 138 if (buffer.readByteArray(&light, sizeof(Light))) { |
| 130 light.fPad = 0; // for the font-cache lookup to be clean | 139 light.fPad = 0; // for the font-cache lookup to be clean |
| 131 const SkScalar sigma = buffer.readScalar(); | 140 const SkScalar sigma = buffer.readScalar(); |
| 132 return Create(sigma, light); | 141 return Create(sigma, light); |
| 133 } | 142 } |
| 134 return NULL; | 143 return NULL; |
| 135 } | 144 } |
| 136 | 145 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 154 str->append(") "); | 163 str->append(") "); |
| 155 | 164 |
| 156 str->appendf("ambient: %d specular: %d ", | 165 str->appendf("ambient: %d specular: %d ", |
| 157 fLight.fAmbient, fLight.fSpecular); | 166 fLight.fAmbient, fLight.fSpecular); |
| 158 | 167 |
| 159 str->append("blurSigma: "); | 168 str->append("blurSigma: "); |
| 160 str->appendScalar(fBlurSigma); | 169 str->appendScalar(fBlurSigma); |
| 161 str->append(")"); | 170 str->append(")"); |
| 162 } | 171 } |
| 163 #endif | 172 #endif |
| OLD | NEW |