aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/sksg/SkSGImage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/sksg/SkSGImage.cpp')
-rw-r--r--experimental/sksg/SkSGImage.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/experimental/sksg/SkSGImage.cpp b/experimental/sksg/SkSGImage.cpp
new file mode 100644
index 0000000000..a0c3a759dc
--- /dev/null
+++ b/experimental/sksg/SkSGImage.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkSGImage.h"
+
+#include "SkCanvas.h"
+#include "SkImage.h"
+
+namespace sksg {
+
+Image::Image(sk_sp<SkImage> image) : fImage(std::move(image)) {}
+
+void Image::onRender(SkCanvas* canvas) const {
+ SkPaint paint;
+ paint.setAntiAlias(fAntiAlias);
+ paint.setFilterQuality(fQuality);
+
+ canvas->drawImage(fImage, 0, 0);
+}
+
+SkRect Image::onRevalidate(InvalidationController*, const SkMatrix& ctm) {
+ return SkRect::Make(fImage->bounds());
+}
+
+} // namespace sksg