| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef CrossfadeGeneratedImage_h | 26 #ifndef CrossfadeGeneratedImage_h |
| 27 #define CrossfadeGeneratedImage_h | 27 #define CrossfadeGeneratedImage_h |
| 28 | 28 |
| 29 #include "platform/geometry/IntSize.h" | 29 #include "platform/geometry/IntSize.h" |
| 30 #include "platform/graphics/GeneratedImage.h" | 30 #include "platform/graphics/GeneratedImage.h" |
| 31 #include "platform/graphics/Image.h" | 31 #include "platform/graphics/Image.h" |
| 32 #include "platform/graphics/ImageObserver.h" | 32 #include "platform/graphics/ImageObserver.h" |
| 33 #include "skia/ext/cdl_common.h" |
| 33 #include "wtf/RefPtr.h" | 34 #include "wtf/RefPtr.h" |
| 34 | 35 |
| 35 namespace blink { | 36 namespace blink { |
| 36 | 37 |
| 37 class PLATFORM_EXPORT CrossfadeGeneratedImage final : public GeneratedImage { | 38 class PLATFORM_EXPORT CrossfadeGeneratedImage final : public GeneratedImage { |
| 38 public: | 39 public: |
| 39 static PassRefPtr<CrossfadeGeneratedImage> create(PassRefPtr<Image> fromImage, | 40 static PassRefPtr<CrossfadeGeneratedImage> create(PassRefPtr<Image> fromImage, |
| 40 PassRefPtr<Image> toImage, | 41 PassRefPtr<Image> toImage, |
| 41 float percentage, | 42 float percentage, |
| 42 IntSize crossfadeSize, | 43 IntSize crossfadeSize, |
| 43 const IntSize& size) { | 44 const IntSize& size) { |
| 44 return adoptRef(new CrossfadeGeneratedImage(std::move(fromImage), | 45 return adoptRef(new CrossfadeGeneratedImage(std::move(fromImage), |
| 45 std::move(toImage), percentage, | 46 std::move(toImage), percentage, |
| 46 crossfadeSize, size)); | 47 crossfadeSize, size)); |
| 47 } | 48 } |
| 48 | 49 |
| 49 bool usesContainerSize() const override { return false; } | 50 bool usesContainerSize() const override { return false; } |
| 50 bool hasRelativeSize() const override { return false; } | 51 bool hasRelativeSize() const override { return false; } |
| 51 | 52 |
| 52 IntSize size() const override { return m_crossfadeSize; } | 53 IntSize size() const override { return m_crossfadeSize; } |
| 53 | 54 |
| 54 protected: | 55 protected: |
| 55 void draw(SkCanvas*, | 56 void draw(CdlCanvas*, |
| 56 const SkPaint&, | 57 const CdlPaint&, |
| 57 const FloatRect&, | 58 const FloatRect&, |
| 58 const FloatRect&, | 59 const FloatRect&, |
| 59 RespectImageOrientationEnum, | 60 RespectImageOrientationEnum, |
| 60 ImageClampingMode) override; | 61 ImageClampingMode) override; |
| 61 void drawTile(GraphicsContext&, const FloatRect&) final; | 62 void drawTile(GraphicsContext&, const FloatRect&) final; |
| 62 | 63 |
| 63 CrossfadeGeneratedImage(PassRefPtr<Image> fromImage, | 64 CrossfadeGeneratedImage(PassRefPtr<Image> fromImage, |
| 64 PassRefPtr<Image> toImage, | 65 PassRefPtr<Image> toImage, |
| 65 float percentage, | 66 float percentage, |
| 66 IntSize crossfadeSize, | 67 IntSize crossfadeSize, |
| 67 const IntSize&); | 68 const IntSize&); |
| 68 | 69 |
| 69 private: | 70 private: |
| 70 void drawCrossfade(SkCanvas*, const SkPaint&, ImageClampingMode); | 71 void drawCrossfade(CdlCanvas*, const CdlPaint&, ImageClampingMode); |
| 71 | 72 |
| 72 RefPtr<Image> m_fromImage; | 73 RefPtr<Image> m_fromImage; |
| 73 RefPtr<Image> m_toImage; | 74 RefPtr<Image> m_toImage; |
| 74 | 75 |
| 75 float m_percentage; | 76 float m_percentage; |
| 76 IntSize m_crossfadeSize; | 77 IntSize m_crossfadeSize; |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 } // namespace blink | 80 } // namespace blink |
| 80 | 81 |
| 81 #endif | 82 #endif |
| OLD | NEW |