1 /* 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 13 namespace sksg { 14 15 Image::Image(sk_sp<SkImage> image) : fImage(std::move(image)) {} 16 17 void 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 25 SkRect Image::onRevalidate(InvalidationController*, const SkMatrix& ctm) { 26 return SkRect::Make(fImage->bounds()); 27 } 28 29 } // namespace sksg 30