Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: Source/core/svg/graphics/SVGImage.h

Issue 1093673002: Removing the dependency on GraphicsContext for drawing images in 2D canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 public: 44 public:
45 static PassRefPtr<SVGImage> create(ImageObserver* observer) 45 static PassRefPtr<SVGImage> create(ImageObserver* observer)
46 { 46 {
47 return adoptRef(new SVGImage(observer)); 47 return adoptRef(new SVGImage(observer));
48 } 48 }
49 49
50 static bool isInSVGImage(const Node*); 50 static bool isInSVGImage(const Node*);
51 51
52 LayoutBox* embeddedContentBox() const; 52 LayoutBox* embeddedContentBox() const;
53 53
54 virtual bool isSVGImage() const override { return true; } 54 bool isSVGImage() const override { return true; }
55 virtual IntSize size() const override { return m_intrinsicSize; } 55 IntSize size() const override { return m_intrinsicSize; }
56 void setURL(const KURL& url) { m_url = url; } 56 void setURL(const KURL& url) { m_url = url; }
57 57
58 virtual bool currentFrameHasSingleSecurityOrigin() const override; 58 bool currentFrameHasSingleSecurityOrigin() const override;
59 59
60 virtual void startAnimation(CatchUpAnimation = CatchUp) override; 60 void startAnimation(CatchUpAnimation = CatchUp) override;
61 virtual void stopAnimation() override; 61 void stopAnimation() override;
62 virtual void resetAnimation() override; 62 void resetAnimation() override;
63 63
64 virtual bool bitmapForCurrentFrame(SkBitmap*) override; 64 bool bitmapForCurrentFrame(SkBitmap*) override;
65 65
66 // Returns the SVG image document's frame. 66 // Returns the SVG image document's frame.
67 FrameView* frameView() const; 67 FrameView* frameView() const;
68 68
69 // Does the SVG image/document contain any animations? 69 // Does the SVG image/document contain any animations?
70 bool hasAnimations() const; 70 bool hasAnimations() const;
71 71
72 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); } 72 DisplayItemClient displayItemClient() const { return toDisplayItemClient(thi s); }
73 String debugName() const { return "SVGImage"; } 73 String debugName() const { return "SVGImage"; }
74 74
75 private: 75 private:
76 friend class AXLayoutObject; 76 friend class AXLayoutObject;
77 friend class SVGImageChromeClient; 77 friend class SVGImageChromeClient;
78 friend class SVGImageForContainer; 78 friend class SVGImageForContainer;
79 79
80 virtual ~SVGImage(); 80 virtual ~SVGImage();
81 81
82 82
83 virtual String filenameExtension() const override; 83 String filenameExtension() const override;
84 84
85 virtual void setContainerSize(const IntSize&) override; 85 void setContainerSize(const IntSize&) override;
86 IntSize containerSize() const; 86 IntSize containerSize() const;
87 virtual bool usesContainerSize() const override { return true; } 87 bool usesContainerSize() const override { return true; }
88 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr insicHeight, FloatSize& intrinsicRatio) override; 88 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio) override;
89 89
90 virtual bool dataChanged(bool allDataReceived) override; 90 bool dataChanged(bool allDataReceived) override;
91 91
92 // FIXME: SVGImages are underreporting decoded sizes and will be unable 92 // FIXME: SVGImages are underreporting decoded sizes and will be unable
93 // to prune because these functions are not implemented yet. 93 // to prune because these functions are not implemented yet.
94 virtual void destroyDecodedData(bool) override { } 94 void destroyDecodedData(bool) override { }
95 95
96 // FIXME: Implement this to be less conservative. 96 // FIXME: Implement this to be less conservative.
97 virtual bool currentFrameKnownToBeOpaque() override { return false; } 97 bool currentFrameKnownToBeOpaque() override { return false; }
98 98
99 SVGImage(ImageObserver*); 99 SVGImage(ImageObserver*);
100 void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRect& toRe ct, SkXfermode::Mode, RespectImageOrientationEnum) override; 100 void draw(SkCanvas*, const SkPaint&, const FloatRect& fromRect, const FloatR ect& toRect, RespectImageOrientationEnum) override;
101 void drawForContainer(GraphicsContext*, const FloatSize, float, const FloatR ect&, const FloatRect&, SkXfermode::Mode); 101 void drawForContainer(SkCanvas*, const SkPaint&, const FloatSize, float, con st FloatRect&, const FloatRect&);
102 void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatSize&, const FloatPoint&, 102 void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatSize&, const FloatPoint&,
103 SkXfermode::Mode, const FloatRect&, const IntSize& repeatSpacing); 103 SkXfermode::Mode, const FloatRect&, const IntSize& repeatSpacing);
104 104
105 OwnPtr<SVGImageChromeClient> m_chromeClient; 105 OwnPtr<SVGImageChromeClient> m_chromeClient;
106 OwnPtrWillBePersistent<Page> m_page; 106 OwnPtrWillBePersistent<Page> m_page;
107 IntSize m_intrinsicSize; 107 IntSize m_intrinsicSize;
108 KURL m_url; 108 KURL m_url;
109 }; 109 };
110 110
111 DEFINE_IMAGE_TYPE_CASTS(SVGImage); 111 DEFINE_IMAGE_TYPE_CASTS(SVGImage);
(...skipping 13 matching lines...) Expand all
125 m_image->setImageObserver(m_observer); 125 m_image->setImageObserver(m_observer);
126 } 126 }
127 private: 127 private:
128 Image* m_image; 128 Image* m_image;
129 ImageObserver* m_observer; 129 ImageObserver* m_observer;
130 }; 130 };
131 131
132 } 132 }
133 133
134 #endif // SVGImage_h 134 #endif // SVGImage_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698