skia2/experimental/sksg/SkSGImage.cpp
Florin Malita 4932807824 [skotty,sksg] Initial image support
TBR=
Change-Id: Ib3c918b1d746e4f190ae05708681f2d5519afdb2
Reviewed-on: https://skia-review.googlesource.com/91980
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-08 18:11:31 +00:00

30 lines
619 B
C++

/*
* 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