| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
| 3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include "Image.h" | 32 #include "Image.h" |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 class FrameView; | 36 class FrameView; |
| 37 class ImageBuffer; | 37 class ImageBuffer; |
| 38 class Page; | 38 class Page; |
| 39 class RenderBox; | 39 class RenderBox; |
| 40 class SVGImageChromeClient; | 40 class SVGImageChromeClient; |
| 41 class SVGImageForContainer; |
| 41 | 42 |
| 42 class SVGImage : public Image { | 43 class SVGImage : public Image { |
| 43 public: | 44 public: |
| 44 static PassRefPtr<SVGImage> create(ImageObserver* observer) | 45 static PassRefPtr<SVGImage> create(ImageObserver* observer) |
| 45 { | 46 { |
| 46 return adoptRef(new SVGImage(observer)); | 47 return adoptRef(new SVGImage(observer)); |
| 47 } | 48 } |
| 48 | 49 |
| 49 enum ShouldClearBuffer { | |
| 50 ClearImageBuffer, | |
| 51 DontClearImageBuffer | |
| 52 }; | |
| 53 | |
| 54 void drawSVGToImageBuffer(ImageBuffer*, const FloatSize&, float, ShouldClear
Buffer); | |
| 55 RenderBox* embeddedContentBox() const; | 50 RenderBox* embeddedContentBox() const; |
| 56 FrameView* frameView() const; | 51 FrameView* frameView() const; |
| 57 | 52 |
| 58 virtual bool isSVGImage() const { return true; } | 53 virtual bool isSVGImage() const { return true; } |
| 59 virtual IntSize size() const; | 54 virtual IntSize size() const; |
| 60 | 55 |
| 61 virtual bool hasRelativeWidth() const; | 56 virtual bool hasRelativeWidth() const; |
| 62 virtual bool hasRelativeHeight() const; | 57 virtual bool hasRelativeHeight() const; |
| 63 | 58 |
| 59 virtual void startAnimation(bool /*catchUpIfNecessary*/ = true) OVERRIDE; |
| 60 virtual void stopAnimation() OVERRIDE; |
| 61 virtual void resetAnimation() OVERRIDE; |
| 62 |
| 64 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 63 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; |
| 65 | 64 |
| 66 private: | 65 private: |
| 67 friend class SVGImageChromeClient; | 66 friend class SVGImageChromeClient; |
| 67 friend class SVGImageForContainer; |
| 68 |
| 68 virtual ~SVGImage(); | 69 virtual ~SVGImage(); |
| 69 | 70 |
| 70 virtual String filenameExtension() const; | 71 virtual String filenameExtension() const; |
| 71 | 72 |
| 72 virtual void setContainerSize(const IntSize&); | 73 virtual void setContainerSize(const IntSize&); |
| 73 virtual bool usesContainerSize() const { return true; } | 74 virtual bool usesContainerSize() const { return true; } |
| 74 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr
insicHeight, FloatSize& intrinsicRatio); | 75 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr
insicHeight, FloatSize& intrinsicRatio); |
| 75 | 76 |
| 76 virtual bool dataChanged(bool allDataReceived); | 77 virtual bool dataChanged(bool allDataReceived); |
| 77 | 78 |
| 78 // FIXME: SVGImages are underreporting decoded sizes and will be unable | 79 // FIXME: SVGImages are underreporting decoded sizes and will be unable |
| 79 // to prune because these functions are not implemented yet. | 80 // to prune because these functions are not implemented yet. |
| 80 virtual void destroyDecodedData(bool) { } | 81 virtual void destroyDecodedData(bool) { } |
| 81 virtual unsigned decodedSize() const { return 0; } | 82 virtual unsigned decodedSize() const { return 0; } |
| 82 | 83 |
| 83 virtual NativeImagePtr frameAtIndex(size_t) { return 0; } | 84 virtual NativeImagePtr frameAtIndex(size_t) { return 0; } |
| 84 | 85 |
| 85 // FIXME: Implement this to be less conservative. | 86 // FIXME: Implement this to be less conservative. |
| 86 virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; } | 87 virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; } |
| 87 | 88 |
| 88 SVGImage(ImageObserver*); | 89 SVGImage(ImageObserver*); |
| 89 virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRe
ct& toRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode); | 90 virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRe
ct& toRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode); |
| 90 | 91 void drawForContainer(GraphicsContext*, const FloatSize, float, const FloatR
ect&, const FloatRect&, ColorSpace, CompositeOperator, BlendMode); |
| 91 virtual NativeImagePtr nativeImageForCurrentFrame(); | 92 void drawPatternForContainer(GraphicsContext*, const FloatSize, float, float
, const FloatRect&, const AffineTransform&, |
| 93 const FloatPoint&, ColorSpace, CompositeOperator, const FloatRect&); |
| 92 | 94 |
| 93 OwnPtr<SVGImageChromeClient> m_chromeClient; | 95 OwnPtr<SVGImageChromeClient> m_chromeClient; |
| 94 OwnPtr<Page> m_page; | 96 OwnPtr<Page> m_page; |
| 95 RefPtr<Image> m_frameCache; | |
| 96 }; | 97 }; |
| 97 } | 98 } |
| 98 | 99 |
| 99 #endif // ENABLE(SVG) | 100 #endif // ENABLE(SVG) |
| 100 #endif // SVGImage_h | 101 #endif // SVGImage_h |
| OLD | NEW |