Annotate overridden functions with SK_OVERRIDE in OverView class.

R=bsalomon@google.com

Signed-off-by: Thiago Farina <tfarina@chromium.org>


Committed on behalf of tfarina@chromium.org
Review URL: https://codereview.appspot.com/5752057/



git-svn-id: http://skia.googlecode.com/svn/trunk@3341 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/OverView.cpp b/samplecode/OverView.cpp
index fc4a9ef..d0c387b 100644
--- a/samplecode/OverView.cpp
+++ b/samplecode/OverView.cpp
@@ -1,39 +1,33 @@
-
 /*
  * Copyright 2011 Google Inc.
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
+
 #include "SampleCode.h"
+
 #include "SkCanvas.h"
 #include "SkView.h"
 
-static const int N = 8;
-const SkScalar W = SkIntToScalar(640);
-const SkScalar H = SkIntToScalar(480); 
+namespace {
 
-static const char gIsOverview[] = "is-overview";
-bool is_overview(SkView* view) {
-    SkEvent isOverview(gIsOverview);
-    return view->doQuery(&isOverview); 
-}
+const int N = 8;
+const SkScalar kWidth = SkIntToScalar(640);
+const SkScalar kHeight = SkIntToScalar(480);
+const char gIsOverview[] = "is-overview";
+
+}  // namespace
+
 class OverView : public SkView {
 public:
     OverView(int count, const SkViewFactory* factories[]);
     virtual ~OverView();
-    
+
 protected:
-    virtual bool onEvent(const SkEvent&);
-    virtual void onSizeChange();
-    
-    virtual void onDraw(SkCanvas* canvas) {
-        canvas->drawColor(SK_ColorLTGRAY);
-    }
-
-    virtual SkCanvas* beforeChildren(SkCanvas*);
-
-    virtual bool onQuery(SkEvent* evt) {
+    // Overridden from SkEventSink:
+    virtual bool onEvent(const SkEvent&) SK_OVERRIDE;
+    virtual bool onQuery(SkEvent* evt) SK_OVERRIDE {
         if (SampleCode::TitleQ(*evt)) {
             SampleCode::TitleR(evt, "Overview");
             return true;
@@ -44,13 +38,22 @@
         return this->INHERITED::onQuery(evt);
     }
 
-    virtual bool onSendClickToChildren(SkScalar x, SkScalar y) {
+
+    // Overridden from SkView:
+    virtual void onSizeChange() SK_OVERRIDE;
+    virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
+        canvas->drawColor(SK_ColorLTGRAY);
+    }
+
+    virtual SkCanvas* beforeChildren(SkCanvas*) SK_OVERRIDE;
+
+    virtual bool onSendClickToChildren(SkScalar x, SkScalar y) SK_OVERRIDE {
         return false;
     }
 
-    virtual Click* onFindClickHandler(SkScalar x, SkScalar y) {
-        int ix = (int)(SkScalarDiv(x * N, W));
-        int iy = (int)(SkScalarDiv(y * N, H));
+    virtual Click* onFindClickHandler(SkScalar x, SkScalar y) SK_OVERRIDE {
+        int ix = (int)(SkScalarDiv(x * N, kWidth));
+        int iy = (int)(SkScalarDiv(y * N, kHeight));
         if (ix >= 0 && iy >= 0) {
             SkEvent evt("set-curr-index");
             evt.setFast32(iy * N + ix);
@@ -60,15 +63,20 @@
     }
 
 private:
-    int             fCount;
-    const SkViewFactory**  fFactories;
+    int fCount;
+    const SkViewFactory** fFactories;
 
     typedef SkView INHERITED;
 };
 
 SkView* create_overview(int count, const SkViewFactory* factories[]) {
     return SkNEW_ARGS(OverView, (count, factories));
-};
+}
+
+bool is_overview(SkView* view) {
+    SkEvent isOverview(gIsOverview);
+    return view->doQuery(&isOverview);
+}
 
 OverView::OverView(int count, const SkViewFactory* factories[]) {
     fCount = count;
@@ -84,7 +92,7 @@
 
 void OverView::onSizeChange() {
     this->detachAllChildren();
-    
+
     SkScalar locX = 0;
     SkScalar locY = 0;
     for (int i = 0; i < fCount; i++) {
@@ -92,10 +100,10 @@
         view->setVisibleP(true);
         this->attachChildToBack(view)->unref();
         view->setLoc(locX, locY);
-        view->setSize(W, H);
-        locX += W;
+        view->setSize(kWidth, kHeight);
+        locX += kWidth;
         if ((i % N) == N - 1) {
-            locY += H;
+            locY += kHeight;
             locX = 0;
         }
     }
@@ -105,4 +113,3 @@
     canvas->scale(SK_Scalar1 / N, SK_Scalar1 / N);
     return canvas;
 }
-