| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PaintGeneratedImage_h | 5 #ifndef PaintGeneratedImage_h |
| 6 #define PaintGeneratedImage_h | 6 #define PaintGeneratedImage_h |
| 7 | 7 |
| 8 #include "platform/geometry/IntSize.h" | 8 #include "platform/geometry/IntSize.h" |
| 9 #include "platform/graphics/GeneratedImage.h" | 9 #include "platform/graphics/GeneratedImage.h" |
| 10 #include "third_party/skia/include/core/SkRefCnt.h" | 10 #include "third_party/skia/include/core/SkRefCnt.h" |
| 11 | 11 |
| 12 class SkPicture; | 12 class SkPicture; |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class PLATFORM_EXPORT PaintGeneratedImage : public GeneratedImage { | 16 class PLATFORM_EXPORT PaintGeneratedImage : public GeneratedImage { |
| 17 public: | 17 public: |
| 18 static PassRefPtr<PaintGeneratedImage> create(sk_sp<SkPicture> picture, | 18 static PassRefPtr<PaintGeneratedImage> create(sk_sp<SkPicture> picture, |
| 19 const IntSize& size) { | 19 const IntSize& size) { |
| 20 return adoptRef(new PaintGeneratedImage(std::move(picture), size)); | 20 return adoptRef(new PaintGeneratedImage(std::move(picture), size)); |
| 21 } | 21 } |
| 22 ~PaintGeneratedImage() override {} | 22 ~PaintGeneratedImage() override {} |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 void draw(SkCanvas*, | 25 void draw(SkCanvas*, |
| 26 const SkPaint&, | 26 const SkPaint&, |
| 27 const FloatRect&, | 27 const FloatRect&, |
| 28 const FloatRect&, | 28 const FloatRect&, |
| 29 RespectImageOrientationEnum, | 29 RespectImageOrientationEnum, |
| 30 ImageClampingMode) override; | 30 ImageClampingMode, |
| 31 const ColorBehavior&) override; |
| 31 void drawTile(GraphicsContext&, const FloatRect&) final; | 32 void drawTile(GraphicsContext&, const FloatRect&) final; |
| 32 | 33 |
| 33 PaintGeneratedImage(sk_sp<SkPicture> picture, const IntSize& size) | 34 PaintGeneratedImage(sk_sp<SkPicture> picture, const IntSize& size) |
| 34 : GeneratedImage(size), m_picture(std::move(picture)) {} | 35 : GeneratedImage(size), m_picture(std::move(picture)) {} |
| 35 | 36 |
| 36 sk_sp<SkPicture> m_picture; | 37 sk_sp<SkPicture> m_picture; |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 } // namespace blink | 40 } // namespace blink |
| 40 | 41 |
| 41 #endif // PaintGeneratedImage_h | 42 #endif // PaintGeneratedImage_h |
| OLD | NEW |