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 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef TransformBuilder_h | 31 #ifndef DrawLooper_h |
32 #define TransformBuilder_h | 32 #define DrawLooper_h |
33 | 33 |
34 #include "core/platform/graphics/transforms/TransformOperations.h" | 34 #include "third_party/skia/include/core/SkDrawLooper.h" |
| 35 |
| 36 // SkPaint and SkPoint are needed before SkLayerDrawLooper.h; they should be #in
cluded there. |
| 37 // Can be removed once https://codereview.chromium.org/14607015/ is submitted. |
| 38 #include "third_party/skia/include/core/SkPaint.h" |
| 39 #include "third_party/skia/include/core/SkPoint.h" |
| 40 |
| 41 #include "third_party/skia/include/core/SkRefCnt.h" |
| 42 #include "third_party/skia/include/effects/SkLayerDrawLooper.h" |
35 #include "wtf/Noncopyable.h" | 43 #include "wtf/Noncopyable.h" |
36 | 44 |
37 namespace WebCore { | 45 namespace WebCore { |
38 | 46 |
39 class RenderStyle; | 47 class Color; |
40 class CSSValue; | 48 class FloatSize; |
41 | 49 |
42 class TransformBuilder { | 50 class DrawLooper { |
43 WTF_MAKE_NONCOPYABLE(TransformBuilder); WTF_MAKE_FAST_ALLOCATED; | 51 // Implementing the copy constructor properly would require writing code to |
| 52 // copy the underlying SkDrawLooper. |
| 53 WTF_MAKE_NONCOPYABLE(DrawLooper); |
| 54 |
44 public: | 55 public: |
45 TransformBuilder(); | 56 enum ShadowTransformMode { |
46 ~TransformBuilder(); | 57 ShadowRespectsTransforms, |
| 58 ShadowIgnoresTransforms |
| 59 }; |
| 60 enum ShadowAlphaMode { |
| 61 ShadowRespectsAlpha, |
| 62 ShadowIgnoresAlpha |
| 63 }; |
47 | 64 |
48 static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyl
e, RenderStyle* rootStyle, TransformOperations& outOperations); | 65 DrawLooper(); |
| 66 ~DrawLooper() { } |
| 67 SkLayerDrawLooper* skDrawLooper() { return m_skDrawLooper.get(); } |
| 68 |
| 69 void addUnmodifiedContent(); |
| 70 void addShadow(const FloatSize& offset, float blur, const Color&, |
| 71 ShadowTransformMode = ShadowRespectsTransforms, |
| 72 ShadowAlphaMode = ShadowRespectsAlpha); |
| 73 |
| 74 private: |
| 75 SkAutoTUnref<SkLayerDrawLooper> m_skDrawLooper; |
49 }; | 76 }; |
50 | 77 |
51 } // namespace WebCore | 78 } // namespace WebCore |
52 | 79 |
53 #endif // TransformBuilder_h | 80 #endif // DrawLooper_h |
OLD | NEW |