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

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

Issue 21398002: Collapse ImageSkia.cpp and ImageChromium.cpp into Image.cpp (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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/platform/graphics/Image.h ('k') | Source/core/platform/graphics/chromium/ImageChromium.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/graphics/Image.cpp
diff --git a/Source/core/platform/graphics/Image.cpp b/Source/core/platform/graphics/Image.cpp
index a47afaf7177a9ed29a5d9cc6c07417450a087cde..36a219c0f9a819bb68c9b03790f5feced100fdb8 100644
--- a/Source/core/platform/graphics/Image.cpp
+++ b/Source/core/platform/graphics/Image.cpp
@@ -27,18 +27,25 @@
#include "config.h"
#include "core/platform/graphics/Image.h"
-#include <math.h>
#include "core/platform/Length.h"
#include "core/platform/MIMETypeRegistry.h"
#include "core/platform/SharedBuffer.h"
+#include "core/platform/chromium/TraceEvent.h"
#include "core/platform/graphics/BitmapImage.h"
+#include "core/platform/graphics/FloatPoint.h"
+#include "core/platform/graphics/FloatRect.h"
+#include "core/platform/graphics/FloatSize.h"
#include "core/platform/graphics/GraphicsContext.h"
#include "core/platform/graphics/GraphicsContextStateSaver.h"
#include "core/platform/graphics/GraphicsTypes.h"
#include "core/platform/graphics/IntRect.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebData.h"
#include "wtf/MainThread.h"
#include "wtf/StdLibExtras.h"
+#include <math.h>
+
namespace WebCore {
Image::Image(ImageObserver* observer)
@@ -57,6 +64,17 @@ Image* Image::nullImage()
return nullImage.get();
}
+PassRefPtr<Image> Image::loadPlatformResource(const char *name)
+{
+ const WebKit::WebData& resource = WebKit::Platform::current()->loadResource(name);
+ if (resource.isEmpty())
+ return Image::nullImage();
+
+ RefPtr<Image> image = BitmapImage::create();
+ image->setData(resource, true);
+ return image.release();
+}
+
bool Image::supportsType(const String& type)
{
return MIMETypeRegistry::isSupportedImageResourceMIMEType(type);
@@ -205,6 +223,14 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo
startAnimation();
}
+void Image::drawPattern(GraphicsContext* context, const FloatRect& floatSrcRect, const FloatSize& scale,
+ const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode blendMode)
+{
+ TRACE_EVENT0("skia", "Image::drawPattern");
+ if (RefPtr<NativeImageSkia> bitmap = nativeImageForCurrentFrame())
+ bitmap->drawPattern(context, adjustForNegativeSize(floatSrcRect), scale, phase, compositeOp, destRect, blendMode);
+}
+
void Image::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
{
intrinsicRatio = size();
« no previous file with comments | « Source/core/platform/graphics/Image.h ('k') | Source/core/platform/graphics/chromium/ImageChromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698