| 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> | |
| 38 | 37 |
| 39 class SkImage; | 38 class SkImage; |
| 40 | 39 |
| 41 namespace blink { | 40 namespace blink { |
| 42 | 41 |
| 43 class FontDescription; | 42 class FontDescription; |
| 44 class Image; | 43 class Image; |
| 45 class KURL; | 44 class KURL; |
| 46 | 45 |
| 47 class PLATFORM_EXPORT DragImage { | 46 class PLATFORM_EXPORT DragImage { |
| 48 USING_FAST_MALLOC(DragImage); | 47 USING_FAST_MALLOC(DragImage); |
| 49 WTF_MAKE_NONCOPYABLE(DragImage); | 48 WTF_MAKE_NONCOPYABLE(DragImage); |
| 50 public: | 49 public: |
| 51 static std::unique_ptr<DragImage> create(Image*, | 50 static PassOwnPtr<DragImage> create(Image*, |
| 52 RespectImageOrientationEnum = DoNotRespectImageOrientation, float device
ScaleFactor = 1, | 51 RespectImageOrientationEnum = DoNotRespectImageOrientation, float device
ScaleFactor = 1, |
| 53 InterpolationQuality = InterpolationHigh, float opacity = 1, | 52 InterpolationQuality = InterpolationHigh, float opacity = 1, |
| 54 FloatSize imageScale = FloatSize(1, 1)); | 53 FloatSize imageScale = FloatSize(1, 1)); |
| 55 | 54 |
| 56 static std::unique_ptr<DragImage> create(const KURL&, const String& label, c
onst FontDescription& systemFont, float deviceScaleFactor); | 55 static PassOwnPtr<DragImage> create(const KURL&, const String& label, const
FontDescription& systemFont, float deviceScaleFactor); |
| 57 ~DragImage(); | 56 ~DragImage(); |
| 58 | 57 |
| 59 static FloatSize clampedImageScale(const IntSize&, const IntSize&, const Int
Size& maxSize); | 58 static FloatSize clampedImageScale(const IntSize&, const IntSize&, const Int
Size& maxSize); |
| 60 | 59 |
| 61 const SkBitmap& bitmap() { return m_bitmap; } | 60 const SkBitmap& bitmap() { return m_bitmap; } |
| 62 float resolutionScale() const { return m_resolutionScale; } | 61 float resolutionScale() const { return m_resolutionScale; } |
| 63 IntSize size() const { return IntSize(m_bitmap.width(), m_bitmap.height());
} | 62 IntSize size() const { return IntSize(m_bitmap.width(), m_bitmap.height());
} |
| 64 | 63 |
| 65 void scale(float scaleX, float scaleY); | 64 void scale(float scaleX, float scaleY); |
| 66 | 65 |
| 67 static PassRefPtr<SkImage> resizeAndOrientImage(PassRefPtr<SkImage>, ImageOr
ientation, FloatSize imageScale = FloatSize(1, 1), float opacity = 1.0, Interpol
ationQuality = InterpolationNone); | 66 static PassRefPtr<SkImage> resizeAndOrientImage(PassRefPtr<SkImage>, ImageOr
ientation, FloatSize imageScale = FloatSize(1, 1), float opacity = 1.0, Interpol
ationQuality = InterpolationNone); |
| 68 | 67 |
| 69 private: | 68 private: |
| 70 DragImage(const SkBitmap&, float resolutionScale, InterpolationQuality); | 69 DragImage(const SkBitmap&, float resolutionScale, InterpolationQuality); |
| 71 | 70 |
| 72 SkBitmap m_bitmap; | 71 SkBitmap m_bitmap; |
| 73 float m_resolutionScale; | 72 float m_resolutionScale; |
| 74 InterpolationQuality m_interpolationQuality; | 73 InterpolationQuality m_interpolationQuality; |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 } // namespace blink | 76 } // namespace blink |
| 78 | 77 |
| 79 #endif // DragImage_h | 78 #endif // DragImage_h |
| OLD | NEW |