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

Side by Side Diff: Source/WebCore/svg/graphics/SVGImageForContainer.h

Issue 12314169: Merge 143541 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 20 matching lines...) Expand all
31 #include "AffineTransform.h" 31 #include "AffineTransform.h"
32 #include "FloatRect.h" 32 #include "FloatRect.h"
33 #include "FloatSize.h" 33 #include "FloatSize.h"
34 #include "Image.h" 34 #include "Image.h"
35 #include "SVGImage.h" 35 #include "SVGImage.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 class SVGImageForContainer : public Image { 39 class SVGImageForContainer : public Image {
40 public: 40 public:
41 static PassRefPtr<SVGImageForContainer> create(SVGImage* image, const FloatS ize& containerSize, float pageScale, float zoom) 41 static PassRefPtr<SVGImageForContainer> create(SVGImage* image, const FloatS ize& containerSize, float zoom)
42 { 42 {
43 return adoptRef(new SVGImageForContainer(image, containerSize, pageScale , zoom)); 43 return adoptRef(new SVGImageForContainer(image, containerSize, zoom));
44 } 44 }
45 45
46 virtual bool isSVGImage() const OVERRIDE { return true; } 46 virtual bool isSVGImage() const OVERRIDE { return true; }
47 47
48 virtual IntSize size() const OVERRIDE; 48 virtual IntSize size() const OVERRIDE;
49 49
50 virtual bool usesContainerSize() const OVERRIDE { return m_image->usesContai nerSize(); } 50 virtual bool usesContainerSize() const OVERRIDE { return m_image->usesContai nerSize(); }
51 virtual bool hasRelativeWidth() const OVERRIDE { return m_image->hasRelative Width(); } 51 virtual bool hasRelativeWidth() const OVERRIDE { return m_image->hasRelative Width(); }
52 virtual bool hasRelativeHeight() const OVERRIDE { return m_image->hasRelativ eHeight(); } 52 virtual bool hasRelativeHeight() const OVERRIDE { return m_image->hasRelativ eHeight(); }
53 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr insicHeight, FloatSize& intrinsicRatio) OVERRIDE 53 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr insicHeight, FloatSize& intrinsicRatio) OVERRIDE
54 { 54 {
55 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int rinsicRatio); 55 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, int rinsicRatio);
56 } 56 }
57 57
58 virtual void draw(GraphicsContext*, const FloatRect&, const FloatRect&, Colo rSpace, CompositeOperator, BlendMode) OVERRIDE; 58 virtual void draw(GraphicsContext*, const FloatRect&, const FloatRect&, Colo rSpace, CompositeOperator, BlendMode) OVERRIDE;
59 59
60 virtual void drawPattern(GraphicsContext*, const FloatRect&, const AffineTra nsform&, const FloatPoint&, ColorSpace, CompositeOperator, const FloatRect&) OVE RRIDE; 60 virtual void drawPattern(GraphicsContext*, const FloatRect&, const AffineTra nsform&, const FloatPoint&, ColorSpace, CompositeOperator, const FloatRect&) OVE RRIDE;
61 61
62 // FIXME: Implement this to be less conservative. 62 // FIXME: Implement this to be less conservative.
63 virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; } 63 virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; }
64 64
65 FloatSize containerSize() { return m_containerSize; }
66 float pageScale() { return m_pageScale; }
67 float zoom() { return m_zoom; }
68
69 void setSize(FloatSize& size) { m_containerSize = size; }
70 void setZoom(float zoom) { m_zoom = zoom; }
71 void setPageScale(float pageScale) { m_pageScale = pageScale; }
72
73 private: 65 private:
74 SVGImageForContainer(SVGImage* image, const FloatSize& containerSize, float pageScale, float zoom) 66 SVGImageForContainer(SVGImage* image, const FloatSize& containerSize, float zoom)
75 : m_image(image), m_containerSize(containerSize), m_pageScale(pageScale) , m_zoom(zoom) { } 67 : m_image(image)
68 , m_containerSize(containerSize)
69 , m_zoom(zoom)
70 {
71 }
76 72
77 virtual void destroyDecodedData(bool /*destroyAll*/ = true) { } 73 virtual void destroyDecodedData(bool /*destroyAll*/ = true) { }
78 virtual unsigned decodedSize() const { return 0; } 74 virtual unsigned decodedSize() const { return 0; }
79 75
80 SVGImage* m_image; 76 SVGImage* m_image;
81 FloatSize m_containerSize; 77 const FloatSize m_containerSize;
82 float m_pageScale; 78 const float m_zoom;
83 float m_zoom;
84 }; 79 };
85 } 80 }
86 81
87 #endif // ENABLE(SVG) 82 #endif // ENABLE(SVG)
88 #endif // SVGImageForContainer_h 83 #endif // SVGImageForContainer_h
OLDNEW
« no previous file with comments | « Source/WebCore/svg/graphics/SVGImageCache.cpp ('k') | Source/WebCore/svg/graphics/SVGImageForContainer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698