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

Unified Diff: third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp

Issue 1866623002: Hook up CSSPaintValue::image to CSS Paint API callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments + rebase. Created 4 years, 8 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 | « third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp b/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..395fe34f519f2d3f62b562e585b6a3c1fd6fb837
--- /dev/null
+++ b/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp
@@ -0,0 +1,29 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "platform/graphics/PaintGeneratedImage.h"
+
+#include "platform/geometry/FloatRect.h"
+#include "platform/graphics/GraphicsContext.h"
+#include "third_party/skia/include/core/SkPicture.h"
+
+namespace blink {
+
+void PaintGeneratedImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& destRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode)
+{
+ SkAutoCanvasRestore ar(canvas, true);
+ canvas->clipRect(destRect);
+ canvas->translate(destRect.x(), destRect.y());
+ if (destRect.size() != srcRect.size())
+ canvas->scale(destRect.width() / srcRect.width(), destRect.height() / srcRect.height());
+ canvas->translate(-srcRect.x(), -srcRect.y());
+ canvas->drawPicture(m_picture.get(), nullptr, &paint);
+}
+
+void PaintGeneratedImage::drawTile(GraphicsContext& context, const FloatRect& srcRect)
+{
+ context.drawPicture(m_picture.get());
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698