| Index: tools/vulkan/viewer/SKPSlide.cpp
|
| diff --git a/tools/vulkan/viewer/SKPSlide.cpp b/tools/vulkan/viewer/SKPSlide.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6a525ada12fb7e3ddb64fcb26d8f2d1396564cfa
|
| --- /dev/null
|
| +++ b/tools/vulkan/viewer/SKPSlide.cpp
|
| @@ -0,0 +1,32 @@
|
| +/*
|
| +* 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 "SKPSlide.h"
|
| +
|
| +#include "SkCanvas.h"
|
| +
|
| +SKPSlide::SKPSlide(const char* name, sk_sp<const SkPicture> pic)
|
| + : fPic(pic)
|
| + , fCullRect(fPic->cullRect().roundOut())
|
| + , fName(name) {
|
| +}
|
| +
|
| +SKPSlide::~SKPSlide() {}
|
| +
|
| +void SKPSlide::draw(SkCanvas* canvas) {
|
| + bool isOffset = SkToBool(fCullRect.left() | fCullRect.top());
|
| + if (isOffset) {
|
| + canvas->save();
|
| + canvas->translate(SkIntToScalar(-fCullRect.left()), SkIntToScalar(-fCullRect.top()));
|
| + }
|
| +
|
| + canvas->drawPicture(fPic.get());
|
| +
|
| + if (isOffset) {
|
| + canvas->restore();
|
| + }
|
| +}
|
|
|