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