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

Unified Diff: Source/core/platform/graphics/ImageCache.cpp

Issue 25627006: Generalize ImageForContainer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/graphics/ImageCache.cpp
diff --git a/Source/core/svg/graphics/SVGImageCache.cpp b/Source/core/platform/graphics/ImageCache.cpp
similarity index 71%
rename from Source/core/svg/graphics/SVGImageCache.cpp
rename to Source/core/platform/graphics/ImageCache.cpp
index 81153b3739e78e05d6f9dc35fd7a606d6ce03f2f..375cf862e7a3b0ab10ddddc5e3aa3051b59dc81b 100644
--- a/Source/core/svg/graphics/SVGImageCache.cpp
+++ b/Source/core/platform/graphics/ImageCache.cpp
@@ -19,31 +19,31 @@
*/
#include "config.h"
-#include "core/svg/graphics/SVGImageCache.h"
+#include "core/platform/graphics/ImageCache.h"
#include "core/fetch/ImageResource.h"
#include "core/page/FrameView.h"
#include "core/page/Page.h"
#include "core/platform/graphics/GraphicsContext.h"
+#include "core/platform/graphics/Image.h"
#include "core/platform/graphics/ImageBuffer.h"
+#include "core/platform/graphics/ImageForContainer.h"
#include "core/rendering/svg/RenderSVGRoot.h"
-#include "core/svg/graphics/SVGImage.h"
-#include "core/svg/graphics/SVGImageForContainer.h"
namespace WebCore {
-SVGImageCache::SVGImageCache(SVGImage* svgImage)
- : m_svgImage(svgImage)
+ImageCache::ImageCache(Image* image)
+ : m_image(image)
{
- ASSERT(m_svgImage);
+ ASSERT(m_image);
}
-SVGImageCache::~SVGImageCache()
+ImageCache::~ImageCache()
{
m_imageForContainerMap.clear();
}
-void SVGImageCache::removeClientFromCache(const ImageResourceClient* client)
+void ImageCache::removeClientFromCache(const ImageResourceClient* client)
{
ASSERT(client);
@@ -51,7 +51,7 @@ void SVGImageCache::removeClientFromCache(const ImageResourceClient* client)
m_imageForContainerMap.remove(client);
}
-void SVGImageCache::setContainerSizeForRenderer(const ImageResourceClient* client, const IntSize& containerSize, float containerZoom)
+void ImageCache::setContainerSizeForRenderer(const ImageResourceClient* client, const IntSize& containerSize, float containerZoom)
{
ASSERT(client);
ASSERT(!containerSize.isEmpty());
@@ -60,12 +60,12 @@ void SVGImageCache::setContainerSizeForRenderer(const ImageResourceClient* clien
FloatSize containerSizeWithoutZoom(containerSize);
containerSizeWithoutZoom.scale(1 / containerZoom);
- m_imageForContainerMap.set(client, SVGImageForContainer::create(m_svgImage, containerSizeWithoutZoom, containerZoom));
+ m_imageForContainerMap.set(client, ImageForContainer::create(m_image, containerSizeWithoutZoom, containerZoom));
}
-IntSize SVGImageCache::imageSizeForRenderer(const RenderObject* renderer) const
+IntSize ImageCache::imageSizeForRenderer(const RenderObject* renderer) const
{
- IntSize imageSize = m_svgImage->size();
+ IntSize imageSize = m_image->size();
if (!renderer)
return imageSize;
@@ -73,14 +73,14 @@ IntSize SVGImageCache::imageSizeForRenderer(const RenderObject* renderer) const
if (it == m_imageForContainerMap.end())
return imageSize;
- RefPtr<SVGImageForContainer> imageForContainer = it->value;
+ RefPtr<ImageForContainer> imageForContainer = it->value;
ASSERT(!imageForContainer->size().isEmpty());
return imageForContainer->size();
}
// FIXME: This doesn't take into account the animation timeline so animations will not
// restart on page load, nor will two animations in different pages have different timelines.
-Image* SVGImageCache::imageForRenderer(const RenderObject* renderer)
+Image* ImageCache::imageForRenderer(const RenderObject* renderer)
{
if (!renderer)
return Image::nullImage();
@@ -89,9 +89,10 @@ Image* SVGImageCache::imageForRenderer(const RenderObject* renderer)
if (it == m_imageForContainerMap.end())
return Image::nullImage();
- RefPtr<SVGImageForContainer> imageForContainer = it->value;
+ RefPtr<ImageForContainer> imageForContainer = it->value;
ASSERT(!imageForContainer->size().isEmpty());
return imageForContainer.get();
}
} // namespace WebCore
+

Powered by Google App Engine
This is Rietveld 408576698