blob: d06f6bec3598bf28a152b9510860f3bb7ccfee60 [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
Florin Malitaf2dd96f2018-07-30 11:16:41 -040022 canvas->drawImage(fImage, 0, 0, &paint);
Florin Malita49328072018-01-08 12:51:12 -050023}
24
25SkRect Image::onRevalidate(InvalidationController*, const SkMatrix& ctm) {
26 return SkRect::Make(fImage->bounds());
27}
28
29} // namespace sksg