| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 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 16 matching lines...) Expand all Loading... |
| 27 #define DragImage_h | 27 #define DragImage_h |
| 28 | 28 |
| 29 #include "platform/geometry/FloatSize.h" | 29 #include "platform/geometry/FloatSize.h" |
| 30 #include "platform/geometry/IntSize.h" | 30 #include "platform/geometry/IntSize.h" |
| 31 #include "platform/graphics/GraphicsTypes.h" | 31 #include "platform/graphics/GraphicsTypes.h" |
| 32 #include "platform/graphics/ImageOrientation.h" | 32 #include "platform/graphics/ImageOrientation.h" |
| 33 #include "platform/graphics/paint/DisplayItemClient.h" | 33 #include "platform/graphics/paint/DisplayItemClient.h" |
| 34 #include "third_party/skia/include/core/SkBitmap.h" | 34 #include "third_party/skia/include/core/SkBitmap.h" |
| 35 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
| 36 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
| 37 #include <memory> |
| 37 | 38 |
| 38 class SkImage; | 39 class SkImage; |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 class FontDescription; | 43 class FontDescription; |
| 43 class Image; | 44 class Image; |
| 44 class KURL; | 45 class KURL; |
| 45 | 46 |
| 46 class PLATFORM_EXPORT DragImage { | 47 class PLATFORM_EXPORT DragImage { |
| 47 USING_FAST_MALLOC(DragImage); | 48 USING_FAST_MALLOC(DragImage); |
| 48 WTF_MAKE_NONCOPYABLE(DragImage); | 49 WTF_MAKE_NONCOPYABLE(DragImage); |
| 49 public: | 50 public: |
| 50 static PassOwnPtr<DragImage> create(Image*, | 51 static std::unique_ptr<DragImage> create(Image*, |
| 51 RespectImageOrientationEnum = DoNotRespectImageOrientation, float device
ScaleFactor = 1, | 52 RespectImageOrientationEnum = DoNotRespectImageOrientation, float device
ScaleFactor = 1, |
| 52 InterpolationQuality = InterpolationHigh, float opacity = 1, | 53 InterpolationQuality = InterpolationHigh, float opacity = 1, |
| 53 FloatSize imageScale = FloatSize(1, 1)); | 54 FloatSize imageScale = FloatSize(1, 1)); |
| 54 | 55 |
| 55 static PassOwnPtr<DragImage> create(const KURL&, const String& label, const
FontDescription& systemFont, float deviceScaleFactor); | 56 static std::unique_ptr<DragImage> create(const KURL&, const String& label, c
onst FontDescription& systemFont, float deviceScaleFactor); |
| 56 ~DragImage(); | 57 ~DragImage(); |
| 57 | 58 |
| 58 static FloatSize clampedImageScale(const IntSize&, const IntSize&, const Int
Size& maxSize); | 59 static FloatSize clampedImageScale(const IntSize&, const IntSize&, const Int
Size& maxSize); |
| 59 | 60 |
| 60 const SkBitmap& bitmap() { return m_bitmap; } | 61 const SkBitmap& bitmap() { return m_bitmap; } |
| 61 float resolutionScale() const { return m_resolutionScale; } | 62 float resolutionScale() const { return m_resolutionScale; } |
| 62 IntSize size() const { return IntSize(m_bitmap.width(), m_bitmap.height());
} | 63 IntSize size() const { return IntSize(m_bitmap.width(), m_bitmap.height());
} |
| 63 | 64 |
| 64 void scale(float scaleX, float scaleY); | 65 void scale(float scaleX, float scaleY); |
| 65 | 66 |
| 66 static PassRefPtr<SkImage> resizeAndOrientImage(PassRefPtr<SkImage>, ImageOr
ientation, FloatSize imageScale = FloatSize(1, 1), float opacity = 1.0, Interpol
ationQuality = InterpolationNone); | 67 static PassRefPtr<SkImage> resizeAndOrientImage(PassRefPtr<SkImage>, ImageOr
ientation, FloatSize imageScale = FloatSize(1, 1), float opacity = 1.0, Interpol
ationQuality = InterpolationNone); |
| 67 | 68 |
| 68 private: | 69 private: |
| 69 DragImage(const SkBitmap&, float resolutionScale, InterpolationQuality); | 70 DragImage(const SkBitmap&, float resolutionScale, InterpolationQuality); |
| 70 | 71 |
| 71 SkBitmap m_bitmap; | 72 SkBitmap m_bitmap; |
| 72 float m_resolutionScale; | 73 float m_resolutionScale; |
| 73 InterpolationQuality m_interpolationQuality; | 74 InterpolationQuality m_interpolationQuality; |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 } // namespace blink | 77 } // namespace blink |
| 77 | 78 |
| 78 #endif // DragImage_h | 79 #endif // DragImage_h |
| OLD | NEW |