| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 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 "SkDropShadowImageFilter.h" | 8 #include "SkDropShadowImageFilter.h" |
| 9 | 9 |
| 10 #include "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 SkScalar sigmaY = buffer.readScalar(); | 46 SkScalar sigmaY = buffer.readScalar(); |
| 47 SkColor color = buffer.readColor(); | 47 SkColor color = buffer.readColor(); |
| 48 ShadowMode shadowMode = buffer.isVersionLT(SkReadBuffer::kDropShadowMode_Ver
sion) ? | 48 ShadowMode shadowMode = buffer.isVersionLT(SkReadBuffer::kDropShadowMode_Ver
sion) ? |
| 49 kDrawShadowAndForeground_ShadowMode : | 49 kDrawShadowAndForeground_ShadowMode : |
| 50 static_cast<ShadowMode>(buffer.readInt()); | 50 static_cast<ShadowMode>(buffer.readInt()); |
| 51 return Make(dx, dy, sigmaX, sigmaY, color, shadowMode, common.getInput(0), &
common.cropRect()); | 51 return Make(dx, dy, sigmaX, sigmaY, color, shadowMode, common.getInput(0), &
common.cropRect()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void SkDropShadowImageFilter::flatten(SkWriteBuffer& buffer) const { | 54 void SkDropShadowImageFilter::flatten(SkWriteBuffer& buffer) const { |
| 55 this->INHERITED::flatten(buffer); | 55 this->INHERITED::flatten(buffer); |
| 56 buffer.writeScalar(fDx); | 56 buffer.writeScalar("fDx", fDx); |
| 57 buffer.writeScalar(fDy); | 57 buffer.writeScalar("fDy", fDy); |
| 58 buffer.writeScalar(fSigmaX); | 58 buffer.writeScalar("fSigmaX", fSigmaX); |
| 59 buffer.writeScalar(fSigmaY); | 59 buffer.writeScalar("fSigmaY", fSigmaY); |
| 60 buffer.writeColor(fColor); | 60 buffer.writeColor("fColor", fColor); |
| 61 buffer.writeInt(static_cast<int>(fShadowMode)); | 61 buffer.writeInt("fShadowMode", static_cast<int>(fShadowMode)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 sk_sp<SkSpecialImage> SkDropShadowImageFilter::onFilterImage(SkSpecialImage* sou
rce, | 64 sk_sp<SkSpecialImage> SkDropShadowImageFilter::onFilterImage(SkSpecialImage* sou
rce, |
| 65 const Context& ctx, | 65 const Context& ctx, |
| 66 SkIPoint* offset) c
onst { | 66 SkIPoint* offset) c
onst { |
| 67 SkIPoint inputOffset = SkIPoint::Make(0, 0); | 67 SkIPoint inputOffset = SkIPoint::Make(0, 0); |
| 68 sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &inputOffset))
; | 68 sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &inputOffset))
; |
| 69 if (!input) { | 69 if (!input) { |
| 70 return nullptr; | 70 return nullptr; |
| 71 } | 71 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 "kDrawShadowAndForeground", "kDrawShadowOnly" | 163 "kDrawShadowAndForeground", "kDrawShadowOnly" |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 static_assert(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), "enum_mismat
ch"); | 166 static_assert(kShadowModeCount == SK_ARRAY_COUNT(gModeStrings), "enum_mismat
ch"); |
| 167 | 167 |
| 168 str->appendf(" mode: %s", gModeStrings[fShadowMode]); | 168 str->appendf(" mode: %s", gModeStrings[fShadowMode]); |
| 169 | 169 |
| 170 str->append(")"); | 170 str->append(")"); |
| 171 } | 171 } |
| 172 #endif | 172 #endif |
| OLD | NEW |