443ec1b794
Also removes fWidth and fHeight from Window and instead calls into WindowContent to get these values. BUG=skia: Change-Id: I72ee506004b7da73db9abb607a3bc82edfcf7d43 Reviewed-on: https://skia-review.googlesource.com/8795 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com> Reviewed-by: Yuqian Li <liyuqian@google.com>
35 lines
769 B
C++
35 lines
769 B
C++
/*
|
|
* Copyright 2016 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "ImageSlide.h"
|
|
|
|
#include "SkCanvas.h"
|
|
#include "SkData.h"
|
|
#include "SkImage.h"
|
|
|
|
ImageSlide::ImageSlide(const SkString& name, const SkString& path) : fPath(path) {
|
|
fName = name;
|
|
}
|
|
|
|
SkISize ImageSlide::getDimensions() const {
|
|
return fImage ? fImage->dimensions() : SkISize::Make(0, 0);
|
|
}
|
|
|
|
void ImageSlide::draw(SkCanvas* canvas) {
|
|
SkASSERT(fImage);
|
|
canvas->drawImage(fImage, 0, 0);
|
|
}
|
|
|
|
void ImageSlide::load(SkScalar, SkScalar) {
|
|
sk_sp<SkData> encoded = SkData::MakeFromFileName(fPath.c_str());
|
|
fImage = SkImage::MakeFromEncoded(encoded);
|
|
}
|
|
|
|
void ImageSlide::unload() {
|
|
fImage.reset(nullptr);
|
|
}
|