Index: experimental/SkiaExamples/Presentation.cpp |
diff --git a/experimental/SkiaExamples/Presentation.cpp b/experimental/SkiaExamples/Presentation.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7a38077636bdedef5831955665418a4c47cc1c2a |
--- /dev/null |
+++ b/experimental/SkiaExamples/Presentation.cpp |
@@ -0,0 +1,61 @@ |
+/* |
+ * Copyright 2013 Google Inc. |
+ * |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ * |
+ */ |
+ |
+#include "Presentation.h" |
+ |
+#include "SkApplication.h" |
+#include "SkCanvas.h" |
+#include "SkGraphics.h" |
+ |
+// Define a type for presentation functions. |
+typedef void (*DrawSlide)(SkView* parent, SkCanvas* canvas); |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+// Slides |
+ |
+static void sample_slide(SkView* parent, SkCanvas* canvas) { |
+ canvas->drawColor(SK_ColorGREEN); |
+ const char text[] = "Skia Presentation Slide"; |
+ SkPaint paint; |
+ paint.setFlags(SkPaint::kAntiAlias_Flag | SkPaint::kUnderlineText_Flag); |
+ canvas->drawText(text, strlen(text), |
+ 100, parent->height() / SkIntToScalar(2), paint); |
+} |
+ |
+// Register the slides here: |
+const uint32_t kNumSlides = 1; |
+DrawSlide gSlides[kNumSlides] = { |
+ &sample_slide |
+}; |
+//////////////////////////////////////////////////////////////////////////////// |
+ |
+SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { |
+ return new SkPresentation(hwnd, argc, argv); |
+// return new SampleWindow(hwnd, argc, argv, NULL); |
+} |
+ |
+SkPresentation::SkPresentation(void* hWnd, int argc, char** argv) |
+ : INHERITED(hWnd, argc, argv) |
+ , slideIndex(0) |
+{ |
+// setupBackend(kRaster_DeviceType); |
+ setupBackend(kGPU_DeviceType); |
+} |
+ |
+void SkPresentation::draw(SkCanvas* canvas) { |
+ gSlides[slideIndex](this, canvas); |
+ canvas->flush(); |
+ |
+ INHERITED::draw(canvas); |
+} |
+ |
+bool SkPresentation::onEvent(const SkEvent& evt) { |
+ return INHERITED::onEvent(evt); |
+} |
+ |