From b1b7f707907b8c63b955cd2aef1cc454623e3656 Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Tue, 18 Sep 2012 01:52:20 +0000 Subject: [PATCH] Add a header for OverView.cpp as well. This fixes another FIXMEs. Signed-off-by: Thiago Farina Review URL: https://codereview.appspot.com/6492125 git-svn-id: http://skia.googlecode.com/svn/trunk@5576 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gyp/SampleApp.gyp | 2 +- gyp/iOSSampleApp.gyp | 1 + samplecode/OverView.cpp | 6 ++---- samplecode/OverView.h | 18 ++++++++++++++++++ samplecode/SampleApp.cpp | 6 +----- samplecode/TransitionView.cpp | 8 ++++---- samplecode/TransitionView.h | 2 ++ 7 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 samplecode/OverView.h diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp index a2ee5c9..ac5c87f 100644 --- a/gyp/SampleApp.gyp +++ b/gyp/SampleApp.gyp @@ -1,4 +1,3 @@ - { 'targets': [ { @@ -21,6 +20,7 @@ '../samplecode/GMSampleView.h', '../samplecode/ClockFaceView.cpp', '../samplecode/OverView.cpp', + '../samplecode/OverView.h', '../samplecode/Sample2PtRadial.cpp', '../samplecode/SampleAAClip.cpp', '../samplecode/SampleAARects.cpp', diff --git a/gyp/iOSSampleApp.gyp b/gyp/iOSSampleApp.gyp index 5cd2c9c..dca28c4 100644 --- a/gyp/iOSSampleApp.gyp +++ b/gyp/iOSSampleApp.gyp @@ -30,6 +30,7 @@ '../samplecode/ClockFaceView.cpp', '../samplecode/OverView.cpp', + '../samplecode/OverView.h', '../samplecode/Sample2PtRadial.cpp', '../samplecode/SampleAll.cpp', '../samplecode/SampleAnimator.cpp', diff --git a/samplecode/OverView.cpp b/samplecode/OverView.cpp index 9858608..f170bdb 100644 --- a/samplecode/OverView.cpp +++ b/samplecode/OverView.cpp @@ -5,6 +5,8 @@ * found in the LICENSE file. */ +#include "OverView.h" + #include "SampleCode.h" #include "SkCanvas.h" @@ -69,14 +71,10 @@ private: typedef SkView INHERITED; }; -// FIXME: this should be in a header -SkView* create_overview(int count, const SkViewFactory* factories[]); SkView* create_overview(int count, const SkViewFactory* factories[]) { return SkNEW_ARGS(OverView, (count, factories)); } -// FIXME: this should be in a header -bool is_overview(SkView* view); bool is_overview(SkView* view) { SkEvent isOverview(gIsOverview); return view->doQuery(&isOverview); diff --git a/samplecode/OverView.h b/samplecode/OverView.h new file mode 100644 index 0000000..3412b19 --- /dev/null +++ b/samplecode/OverView.h @@ -0,0 +1,18 @@ +/* + * Copyright 2012 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SAMPLECODE_OVERVIEW_H_ +#define SAMPLECODE_OVERVIEW_H_ + +class SkView; +class SkViewFactory; + +SkView* create_overview(int, const SkViewFactory*[]); + +bool is_overview(SkView* view); + +#endif // SAMPLECODE_OVERVIEW_H_ diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index cfdd4ae..a98f2fc 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -37,6 +37,7 @@ class GrContext; #include "SkGPipe.h" #include "SamplePipeControllers.h" +#include "OverView.h" #include "TransitionView.h" SK_DEFINE_INST_COUNT(SampleWindow::DeviceManager) @@ -79,11 +80,6 @@ SkTDArray gTempDataStore; //#define DEFAULT_TO_GPU 1 #endif -extern SkView* create_overview(int, const SkViewFactory*[]); -extern bool is_overview(SkView* view); -extern bool is_transition(SkView* view); - - #define ANIMATING_EVENTTYPE "nextSample" #define ANIMATING_DELAY 750 diff --git a/samplecode/TransitionView.cpp b/samplecode/TransitionView.cpp index b2b1b9d..e755288 100644 --- a/samplecode/TransitionView.cpp +++ b/samplecode/TransitionView.cpp @@ -6,27 +6,27 @@ */ #include "TransitionView.h" +#include "OverView.h" #include "SampleCode.h" #include "SkView.h" #include "SkCanvas.h" #include "SkTime.h" #include "SkInterpolator.h" -extern bool is_overview(SkView* view); - static const char gIsTransitionQuery[] = "is-transition"; static const char gReplaceTransitionEvt[] = "replace-transition-view"; -static bool is_transition(SkView* view) { +bool is_transition(SkView* view) { SkEvent isTransition(gIsTransitionQuery); return view->doQuery(&isTransition); } class TransitionView : public SampleView { enum { -// kDurationMS = 500 + // kDurationMS = 500 kDurationMS = 1 }; + public: TransitionView(SkView* prev, SkView* next, int direction) : fInterp(4, 2){ fAnimationDirection = (Direction)(1 << (direction % 8)); diff --git a/samplecode/TransitionView.h b/samplecode/TransitionView.h index ac95221..92e136a 100644 --- a/samplecode/TransitionView.h +++ b/samplecode/TransitionView.h @@ -12,4 +12,6 @@ class SkView; SkView* create_transition(SkView* prev, SkView* next, int direction); +bool is_transition(SkView* view); + #endif // SAMPLECODE_TRANSITIONVIEW_H_ -- 2.7.4