blob: a0c3a759dc0c414cd90620c9097b6ddfac6566fc [file] [log] [blame]
Florin Malita49328072018-01-08 12:51:12 -05001/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "SkSGImage.h"
9
10#include "SkCanvas.h"
11#include "SkImage.h"
12
13namespace sksg {
14
15Image::Image(sk_sp<SkImage> image) : fImage(std::move(image)) {}
16
17void Image::onRender(SkCanvas* canvas) const {
18 SkPaint paint;
19 paint.setAntiAlias(fAntiAlias);
20 paint.setFilterQuality(fQuality);
21
22 canvas->drawImage(fImage, 0, 0);
23}
24
25SkRect Image::onRevalidate(InvalidationController*, const SkMatrix& ctm) {
26 return SkRect::Make(fImage->bounds());
27}
28
29} // namespace sksg