aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/sksg/src/SkSGImage.cpp
blob: d06f6bec3598bf28a152b9510860f3bb7ccfee60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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, &paint);
}

SkRect Image::onRevalidate(InvalidationController*, const SkMatrix& ctm) {
    return SkRect::Make(fImage->bounds());
}

} // namespace sksg