skia2/modules/sksg/include/SkSGImage.h

52 lines
1.2 KiB
C
Raw Normal View History

/*
* Copyright 2018 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSGImage_DEFINED
#define SkSGImage_DEFINED
#include "modules/sksg/include/SkSGRenderNode.h"
Reland "[skottie] Add image sampling and transform options" This reverts commit b81842aa283e4c5d6155b94453b81b58f5888a96. Reason for revert: reland with fixes Original change's description: > Revert "[skottie] Add image sampling and transform options" > > This reverts commit 2f24405250708f7d81b52ab88013ccae32607deb. > > Reason for revert: broke Win/shared > > Original change's description: > > [skottie] Add image sampling and transform options > > > > Expand the SkImageAsset API to support controlling sampling options and > > pass an additional transform. > > > > Bug: skia:10944, skia:10942 > > Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097 > > Commit-Queue: Florin Malita <fmalita@chromium.org> > > Commit-Queue: Florin Malita <fmalita@google.com> > > Reviewed-by: Mike Reed <reed@google.com> > > TBR=fmalita@chromium.org,fmalita@google.com,reed@google.com,aparchur@google.com > > Change-Id: I59d4161356ffdc20588f1bd3beb33c54e44807a2 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10944 > Bug: skia:10942 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340619 > Reviewed-by: Florin Malita <fmalita@google.com> > Commit-Queue: Florin Malita <fmalita@google.com> TBR=fmalita@chromium.org,fmalita@google.com,reed@google.com,aparchur@google.com # Not skipping CQ checks because this is a reland. Bug: skia:10944 Bug: skia:10942 Change-Id: I91892f4db6366ceb07d1a49a7bc54da17cea5399 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340657 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@google.com>
2020-12-03 17:51:28 +00:00
#include "include/core/SkSamplingOptions.h"
class SkImage;
namespace sksg {
/**
* Concrete rendering node, wrapping an SkImage.
*
*/
class Image final : public RenderNode {
public:
static sk_sp<Image> Make(sk_sp<SkImage> image) {
return sk_sp<Image>(new Image(std::move(image)));
}
Reland "[skottie] Add image sampling and transform options" This reverts commit b81842aa283e4c5d6155b94453b81b58f5888a96. Reason for revert: reland with fixes Original change's description: > Revert "[skottie] Add image sampling and transform options" > > This reverts commit 2f24405250708f7d81b52ab88013ccae32607deb. > > Reason for revert: broke Win/shared > > Original change's description: > > [skottie] Add image sampling and transform options > > > > Expand the SkImageAsset API to support controlling sampling options and > > pass an additional transform. > > > > Bug: skia:10944, skia:10942 > > Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097 > > Commit-Queue: Florin Malita <fmalita@chromium.org> > > Commit-Queue: Florin Malita <fmalita@google.com> > > Reviewed-by: Mike Reed <reed@google.com> > > TBR=fmalita@chromium.org,fmalita@google.com,reed@google.com,aparchur@google.com > > Change-Id: I59d4161356ffdc20588f1bd3beb33c54e44807a2 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10944 > Bug: skia:10942 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340619 > Reviewed-by: Florin Malita <fmalita@google.com> > Commit-Queue: Florin Malita <fmalita@google.com> TBR=fmalita@chromium.org,fmalita@google.com,reed@google.com,aparchur@google.com # Not skipping CQ checks because this is a reland. Bug: skia:10944 Bug: skia:10942 Change-Id: I91892f4db6366ceb07d1a49a7bc54da17cea5399 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340657 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@google.com>
2020-12-03 17:51:28 +00:00
SG_ATTRIBUTE(Image , sk_sp<SkImage> , fImage )
SG_ATTRIBUTE(SamplingOptions, SkSamplingOptions, fSamplingOptions)
SG_ATTRIBUTE(AntiAlias , bool , fAntiAlias )
protected:
explicit Image(sk_sp<SkImage>);
void onRender(SkCanvas*, const RenderContext*) const override;
const RenderNode* onNodeAt(const SkPoint&) const override;
SkRect onRevalidate(InvalidationController*, const SkMatrix&) override;
private:
Reland "[skottie] Add image sampling and transform options" This reverts commit b81842aa283e4c5d6155b94453b81b58f5888a96. Reason for revert: reland with fixes Original change's description: > Revert "[skottie] Add image sampling and transform options" > > This reverts commit 2f24405250708f7d81b52ab88013ccae32607deb. > > Reason for revert: broke Win/shared > > Original change's description: > > [skottie] Add image sampling and transform options > > > > Expand the SkImageAsset API to support controlling sampling options and > > pass an additional transform. > > > > Bug: skia:10944, skia:10942 > > Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097 > > Commit-Queue: Florin Malita <fmalita@chromium.org> > > Commit-Queue: Florin Malita <fmalita@google.com> > > Reviewed-by: Mike Reed <reed@google.com> > > TBR=fmalita@chromium.org,fmalita@google.com,reed@google.com,aparchur@google.com > > Change-Id: I59d4161356ffdc20588f1bd3beb33c54e44807a2 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10944 > Bug: skia:10942 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340619 > Reviewed-by: Florin Malita <fmalita@google.com> > Commit-Queue: Florin Malita <fmalita@google.com> TBR=fmalita@chromium.org,fmalita@google.com,reed@google.com,aparchur@google.com # Not skipping CQ checks because this is a reland. Bug: skia:10944 Bug: skia:10942 Change-Id: I91892f4db6366ceb07d1a49a7bc54da17cea5399 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340657 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@google.com>
2020-12-03 17:51:28 +00:00
SkSamplingOptions fSamplingOptions;
sk_sp<SkImage> fImage;
bool fAntiAlias = true;
using INHERITED = RenderNode;
};
} // namespace sksg
#endif // SkSGImage_DEFINED