| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "platform/graphics/BoxReflection.h" |
| 6 |
| 7 #include "platform/geometry/FloatRect.h" |
| 8 #include "platform/graphics/skia/SkiaUtils.h" |
| 9 #include "third_party/skia/include/core/SkImageFilter.h" |
| 10 #include "third_party/skia/include/core/SkMatrix.h" |
| 11 #include "third_party/skia/include/core/SkPicture.h" |
| 12 #include "third_party/skia/include/core/SkRefCnt.h" |
| 13 #include "third_party/skia/include/core/SkXfermode.h" |
| 14 #include "third_party/skia/include/effects/SkPictureImageFilter.h" |
| 15 #include "third_party/skia/include/effects/SkXfermodeImageFilter.h" |
| 16 |
| 17 #include <utility> |
| 18 |
| 19 namespace blink { |
| 20 |
| 21 SkMatrix BoxReflection::reflectionMatrix() const |
| 22 { |
| 23 SkMatrix flipMatrix; |
| 24 switch (m_direction) { |
| 25 case VerticalReflection: |
| 26 flipMatrix.setScale(1, -1); |
| 27 flipMatrix.postTranslate(0, m_offset); |
| 28 break; |
| 29 case HorizontalReflection: |
| 30 flipMatrix.setScale(-1, 1); |
| 31 flipMatrix.postTranslate(m_offset, 0); |
| 32 break; |
| 33 default: |
| 34 // MSVC requires that SkMatrix be initialized in this unreachable case. |
| 35 NOTREACHED(); |
| 36 flipMatrix.reset(); |
| 37 break; |
| 38 } |
| 39 return flipMatrix; |
| 40 } |
| 41 |
| 42 FloatRect BoxReflection::mapRect(const FloatRect& rect) const |
| 43 { |
| 44 SkRect reflection(rect); |
| 45 reflectionMatrix().mapRect(&reflection); |
| 46 FloatRect result = rect; |
| 47 result.unite(reflection); |
| 48 return result; |
| 49 } |
| 50 |
| 51 } // namespace blink |
| OLD | NEW |