Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: tools/vulkan/viewer/SKPSlide.cpp

Issue 1873543003: Add slides to VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reverse GM array; add name to Slide Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/vulkan/viewer/SKPSlide.h ('k') | tools/vulkan/viewer/Slide.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..72f68b5cb5e3f5930fc30182b6a1d840d4662505
--- /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();
+ }
+}
« no previous file with comments | « tools/vulkan/viewer/SKPSlide.h ('k') | tools/vulkan/viewer/Slide.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698