Make Slide::getDimensions pure virtual.
The default behavior is to not let the user move the slide to the top or left. Implement for SampleSlide and stub out for NIMASlide (which isn't so easy to implement). Change-Id: I16074e704f4086199932d83e28c28d1ee39fbd9d Reviewed-on: https://skia-review.googlesource.com/151600 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
7af2bc8802
commit
211511237f
@ -341,6 +341,10 @@ NIMASlide::NIMASlide(const SkString& name, const SkString& path)
|
||||
|
||||
NIMASlide::~NIMASlide() {}
|
||||
|
||||
SkISize NIMASlide::getDimensions() const {
|
||||
return SkISize::MakeEmpty(); // TODO
|
||||
}
|
||||
|
||||
void NIMASlide::draw(SkCanvas* canvas) {
|
||||
canvas->save();
|
||||
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
NIMASlide(const SkString& name, const SkString& path);
|
||||
~NIMASlide() override;
|
||||
|
||||
SkISize getDimensions() const override;
|
||||
|
||||
void draw(SkCanvas* canvas) override;
|
||||
void load(SkScalar winWidth, SkScalar winHeight) override;
|
||||
void unload() override;
|
||||
|
@ -23,6 +23,10 @@ SampleSlide::SampleSlide(const SampleFactory factory)
|
||||
|
||||
SampleSlide::~SampleSlide() { delete fClick; }
|
||||
|
||||
SkISize SampleSlide::getDimensions() const {
|
||||
return SkISize::Make(SkScalarCeilToInt(fSample->width()), SkScalarCeilToInt(fSample->height()));
|
||||
}
|
||||
|
||||
void SampleSlide::draw(SkCanvas* canvas) {
|
||||
SkASSERT(fSample);
|
||||
fSample->draw(canvas);
|
||||
|
@ -16,6 +16,8 @@ public:
|
||||
SampleSlide(const SampleFactory factory);
|
||||
~SampleSlide() override;
|
||||
|
||||
SkISize getDimensions() const override;
|
||||
|
||||
void draw(SkCanvas* canvas) override;
|
||||
void load(SkScalar winWidth, SkScalar winHeight) override;
|
||||
void resize(SkScalar winWidth, SkScalar winHeight) override {
|
||||
|
@ -21,9 +21,7 @@ class Slide : public SkRefCnt {
|
||||
public:
|
||||
virtual ~Slide() {}
|
||||
|
||||
virtual SkISize getDimensions() const {
|
||||
return SkISize::Make(0, 0);
|
||||
}
|
||||
virtual SkISize getDimensions() const = 0;
|
||||
|
||||
virtual void draw(SkCanvas* canvas) = 0;
|
||||
virtual bool animate(const SkAnimTimer&) { return false; }
|
||||
|
Loading…
Reference in New Issue
Block a user