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

Unified Diff: Source/core/svg/graphics/filters/SVGFEImage.cpp

Issue 1334173004: Switch SVGFEImage from SkBitmapSource to SkImageSource (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed-size <svg> Created 5 years, 3 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
« no previous file with comments | « Source/core/svg/SVGFEImageElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/graphics/filters/SVGFEImage.cpp
diff --git a/Source/core/svg/graphics/filters/SVGFEImage.cpp b/Source/core/svg/graphics/filters/SVGFEImage.cpp
index 476b4055cc377367cd4142d3b83baea20057804e..a41bdd15a8eaf97a7b4ac2303a304edb854f50f5 100644
--- a/Source/core/svg/graphics/filters/SVGFEImage.cpp
+++ b/Source/core/svg/graphics/filters/SVGFEImage.cpp
@@ -38,7 +38,7 @@
#include "platform/text/TextStream.h"
#include "platform/transforms/AffineTransform.h"
#include "third_party/skia/include/core/SkPicture.h"
-#include "third_party/skia/include/effects/SkBitmapSource.h"
+#include "third_party/skia/include/effects/SkImageSource.h"
#include "third_party/skia/include/effects/SkPictureImageFilter.h"
namespace blink {
@@ -187,23 +187,25 @@ PassRefPtr<SkImageFilter> FEImage::createImageFilterForLayoutObject(LayoutObject
PassRefPtr<SkImageFilter> FEImage::createImageFilter(SkiaImageFilterBuilder* builder)
{
- LayoutObject* layoutObject = referencedLayoutObject();
- if (!m_image && !layoutObject)
- return adoptRef(SkBitmapSource::Create(SkBitmap()));
-
- if (layoutObject)
+ if (auto* layoutObject = referencedLayoutObject())
return createImageFilterForLayoutObject(*layoutObject, builder);
- FloatRect srcRect = FloatRect(FloatPoint(), m_image->size());
FloatRect dstRect = filterPrimitiveSubregion();
- m_preserveAspectRatio->transformRect(dstRect, srcRect);
+ RefPtr<SkImage> image = m_image ? m_image->imageForCurrentFrame() : nullptr;
+ if (!image) {
+ // "A href reference that is an empty image (zero width or zero height), that fails
+ // to download, is non-existent, or that cannot be displayed (e.g. because it is
+ // not in a supported image format) fills the filter primitive subregion with
+ // transparent black."
+ return adoptRef(SkPictureImageFilter::Create(nullptr, dstRect));
+ }
+
+ FloatRect srcRect = FloatRect(FloatPoint(), m_image->size());
- SkBitmap bitmap;
- if (!m_image->deprecatedBitmapForCurrentFrame(&bitmap))
- return adoptRef(SkBitmapSource::Create(SkBitmap()));
+ m_preserveAspectRatio->transformRect(dstRect, srcRect);
- return adoptRef(SkBitmapSource::Create(bitmap, srcRect, dstRect));
+ return adoptRef(SkImageSource::Create(image.get(), srcRect, dstRect, kHigh_SkFilterQuality));
}
} // namespace blink
« no previous file with comments | « Source/core/svg/SVGFEImageElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698