Index: Source/core/svg/graphics/SVGImage.cpp |
diff --git a/Source/core/svg/graphics/SVGImage.cpp b/Source/core/svg/graphics/SVGImage.cpp |
index 4b751100e3ed6f6e9ef5760e57ecf64872a60641..ca2cc3f6bb3804707b77e8066bb8aa936231ba70 100644 |
--- a/Source/core/svg/graphics/SVGImage.cpp |
+++ b/Source/core/svg/graphics/SVGImage.cpp |
@@ -58,7 +58,6 @@ |
#include "platform/graphics/paint/DrawingRecorder.h" |
#include "platform/graphics/paint/SkPictureBuilder.h" |
#include "third_party/skia/include/core/SkPicture.h" |
-#include "third_party/skia/include/core/SkSurface.h" |
#include "wtf/PassRefPtr.h" |
namespace blink { |
@@ -218,21 +217,16 @@ void SVGImage::drawForContainer(SkCanvas* canvas, const SkPaint& paint, const Fl |
PassRefPtr<SkImage> SVGImage::imageForCurrentFrame() |
{ |
- // TODO(fmalita): instead of rasterizing, investigate returning a SkPicture-backed image. |
- |
if (!m_page) |
return nullptr; |
- IntSize size = this->size(); |
- SkImageInfo imageInfo = SkImageInfo::MakeN32(size.width(), size.height(), kPremul_SkAlphaType); |
- SkSurfaceProps disableLCDProps(0, kUnknown_SkPixelGeometry); |
- RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRaster(imageInfo, &disableLCDProps)); |
- if (!surface) |
- return nullptr; |
- |
- drawForContainer(surface->getCanvas(), SkPaint(), size, 1, rect(), rect()); |
+ SkPictureRecorder recorder; |
+ SkCanvas* canvas = recorder.beginRecording(width(), height()); |
+ drawForContainer(canvas, SkPaint(), size(), 1, rect(), rect()); |
+ RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); |
- return adoptRef(surface->newImageSnapshot()); |
+ return adoptRef( |
+ SkImage::NewFromPicture(picture.get(), SkISize::Make(width(), height()), nullptr, nullptr)); |
} |
void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize containerSize, |