| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 void DrawLooperBuilder::addUnmodifiedContent() | 61 void DrawLooperBuilder::addUnmodifiedContent() |
| 62 { | 62 { |
| 63 SkLayerDrawLooper::LayerInfo info; | 63 SkLayerDrawLooper::LayerInfo info; |
| 64 m_skDrawLooperBuilder.addLayerOnTop(info); | 64 m_skDrawLooperBuilder.addLayerOnTop(info); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void DrawLooperBuilder::addShadow(const FloatSize& offset, float blur, const Col
or& color, | 67 void DrawLooperBuilder::addShadow(const FloatSize& offset, float blur, const Col
or& color, |
| 68 ShadowTransformMode shadowTransformMode, ShadowAlphaMode shadowAlphaMode) | 68 ShadowTransformMode shadowTransformMode, ShadowAlphaMode shadowAlphaMode) |
| 69 { | 69 { |
| 70 // Negative blurs are not allowed, so just pin the value to 0 | 70 ASSERT(blur >= 0); |
| 71 if (blur < 0) | |
| 72 blur = 0; | |
| 73 | 71 |
| 74 // Detect when there's no effective shadow. | 72 // Detect when there's no effective shadow. |
| 75 if (!color.alpha()) | 73 if (!color.alpha()) |
| 76 return; | 74 return; |
| 77 | 75 |
| 78 SkColor skColor = color.rgb(); | 76 SkColor skColor = color.rgb(); |
| 79 | 77 |
| 80 SkLayerDrawLooper::LayerInfo info; | 78 SkLayerDrawLooper::LayerInfo info; |
| 81 | 79 |
| 82 switch (shadowAlphaMode) { | 80 switch (shadowAlphaMode) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 105 mfFlags |= SkBlurMaskFilter::kIgnoreTransform_BlurFlag; | 103 mfFlags |= SkBlurMaskFilter::kIgnoreTransform_BlurFlag; |
| 106 RefPtr<SkMaskFilter> mf = adoptRef(SkBlurMaskFilter::Create(kNormal_SkBl
urStyle, sigma, mfFlags)); | 104 RefPtr<SkMaskFilter> mf = adoptRef(SkBlurMaskFilter::Create(kNormal_SkBl
urStyle, sigma, mfFlags)); |
| 107 paint->setMaskFilter(mf.get()); | 105 paint->setMaskFilter(mf.get()); |
| 108 } | 106 } |
| 109 | 107 |
| 110 RefPtr<SkColorFilter> cf = adoptRef(SkColorFilter::CreateModeFilter(skColor,
SkXfermode::kSrcIn_Mode)); | 108 RefPtr<SkColorFilter> cf = adoptRef(SkColorFilter::CreateModeFilter(skColor,
SkXfermode::kSrcIn_Mode)); |
| 111 paint->setColorFilter(cf.get()); | 109 paint->setColorFilter(cf.get()); |
| 112 } | 110 } |
| 113 | 111 |
| 114 } // namespace blink | 112 } // namespace blink |
| OLD | NEW |