Remove unnamed namespace usage from 'gm'.
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 20 Nov 2013 21:32:10 +0000 (21:32 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 20 Nov 2013 21:32:10 +0000 (21:32 +0000)
Skia prefers static over unnamed namespaces.

BUG=None
TEST=None
R=bsalomon@google.com, robertphillips@google.com

Author: tfarina@chromium.org

Review URL: https://codereview.chromium.org/79173002

git-svn-id: http://skia.googlecode.com/svn/trunk@12326 2bbb7eff-a529-9590-31e7-b0007b416f81

gm/imagefiltersgraph.cpp
gm/optimizations.cpp

index 9b9e0551ed842de4b32c70514818d2365256a6ba..4e46869a4ec48fe654cd1f1bab8f2ce13e35c5cd 100644 (file)
 #include "SkBitmapSource.h"
 #include "SkBlurImageFilter.h"
 #include "SkColorFilter.h"
-#include "SkColorMatrixFilter.h"
 #include "SkColorFilterImageFilter.h"
+#include "SkColorMatrixFilter.h"
 #include "SkFlattenableBuffers.h"
 #include "SkMergeImageFilter.h"
 #include "SkMorphologyImageFilter.h"
 #include "SkOnce.h"
-#include "SkXfermodeImageFilter.h"
-
 #include "SkTestImageFilters.h"
+#include "SkXfermodeImageFilter.h"
 
-///////////////////////////////////////////////////////////////////////////////
-
-namespace {
 // More closely models how Blink's OffsetFilter works as of 10/23/13. SkOffsetImageFilter doesn't
 // perform a draw and this one does.
 class SimpleOffsetFilter : public SkImageFilter {
@@ -76,7 +72,6 @@ protected:
 private:
     SkScalar fDX, fDY;
 };
-}
 
 static void init_flattenable(int*) {
     SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SimpleOffsetFilter)
index a6b61705d8a6ee16ee5e7951bc626e23faa52371..6b7d2843fc688d78fd03855eade2c4276e0ba28f 100644 (file)
 #define WARN(msg)                                           \
     SkDebugf("%s:%d: %s\n", __FILE__, __LINE__, msg);
 
-namespace {
-
 // Do the commands in 'input' match the supplied pattern? Note: this is a pretty
 // heavy-weight operation since we are drawing the picture into a debug canvas
 // to extract the commands.
-bool check_pattern(SkPicture& input, const SkTDArray<DrawType> &pattern) {
+static bool check_pattern(SkPicture& input, const SkTDArray<DrawType> &pattern) {
     SkDebugCanvas debugCanvas(input.width(), input.height());
     debugCanvas.setBounds(input.width(), input.height());
     input.draw(&debugCanvas);
@@ -47,12 +45,12 @@ bool check_pattern(SkPicture& input, const SkTDArray<DrawType> &pattern) {
 //                     takes a different path if this is false)
 // colorsMatch       - control if the saveLayer and dbmr2r paint colors
 //                     match (the optimization will fail if they do not)
-SkPicture* create_save_layer_opt_1(SkTDArray<DrawType> *preOptPattern,
-                                   SkTDArray<DrawType> *postOptPattern,
-                                   const SkBitmap& checkerBoard,
-                                   bool saveLayerHasPaint,
-                                   bool dbmr2rHasPaint,
-                                   bool colorsMatch)  {
+static SkPicture* create_save_layer_opt_1(SkTDArray<DrawType>* preOptPattern,
+                                          SkTDArray<DrawType>* postOptPattern,
+                                          const SkBitmap& checkerBoard,
+                                          bool saveLayerHasPaint,
+                                          bool dbmr2rHasPaint,
+                                          bool colorsMatch)  {
     // Create the pattern that should trigger the optimization
     preOptPattern->setCount(5);
     (*preOptPattern)[0] = SAVE;
@@ -120,9 +118,9 @@ SkPicture* create_save_layer_opt_1(SkTDArray<DrawType> *preOptPattern,
 }
 
 // straight-ahead version that is seen in the skps
-SkPicture* create_save_layer_opt_1_v1(SkTDArray<DrawType> *preOptPattern,
-                                      SkTDArray<DrawType> *postOptPattern,
-                                      const SkBitmap& checkerBoard) {
+static SkPicture* create_save_layer_opt_1_v1(SkTDArray<DrawType>* preOptPattern,
+                                             SkTDArray<DrawType>* postOptPattern,
+                                             const SkBitmap& checkerBoard) {
     return create_save_layer_opt_1(preOptPattern, postOptPattern, checkerBoard,
                                    true,   // saveLayer has a paint
                                    true,   // dbmr2r has a paint
@@ -130,9 +128,9 @@ SkPicture* create_save_layer_opt_1_v1(SkTDArray<DrawType> *preOptPattern,
 }
 
 // alternate version that should still succeed
-SkPicture* create_save_layer_opt_1_v2(SkTDArray<DrawType> *preOptPattern,
-                                      SkTDArray<DrawType> *postOptPattern,
-                                      const SkBitmap& checkerBoard) {
+static SkPicture* create_save_layer_opt_1_v2(SkTDArray<DrawType>* preOptPattern,
+                                             SkTDArray<DrawType>* postOptPattern,
+                                             const SkBitmap& checkerBoard) {
     return create_save_layer_opt_1(preOptPattern, postOptPattern, checkerBoard,
                                    false,  // saveLayer doesn't have a paint!
                                    true,   // dbmr2r has a paint
@@ -140,9 +138,9 @@ SkPicture* create_save_layer_opt_1_v2(SkTDArray<DrawType> *preOptPattern,
 }
 
 // alternate version that should still succeed
-SkPicture* create_save_layer_opt_1_v3(SkTDArray<DrawType> *preOptPattern,
-                                      SkTDArray<DrawType> *postOptPattern,
-                                      const SkBitmap& checkerBoard) {
+static SkPicture* create_save_layer_opt_1_v3(SkTDArray<DrawType>* preOptPattern,
+                                             SkTDArray<DrawType>* postOptPattern,
+                                             const SkBitmap& checkerBoard) {
     return create_save_layer_opt_1(preOptPattern, postOptPattern, checkerBoard,
                                    true,   // saveLayer has a paint
                                    false,  // dbmr2r doesn't have a paint!
@@ -150,9 +148,9 @@ SkPicture* create_save_layer_opt_1_v3(SkTDArray<DrawType> *preOptPattern,
 }
 
 // version in which the optimization fails b.c. the colors don't match
-SkPicture* create_save_layer_opt_1_v4(SkTDArray<DrawType> *preOptPattern,
-                                      SkTDArray<DrawType> *postOptPattern,
-                                      const SkBitmap& checkerBoard) {
+static SkPicture* create_save_layer_opt_1_v4(SkTDArray<DrawType>* preOptPattern,
+                                             SkTDArray<DrawType>* postOptPattern,
+                                             const SkBitmap& checkerBoard) {
     return create_save_layer_opt_1(preOptPattern, postOptPattern, checkerBoard,
                                    true,   // saveLayer has a paint
                                    true,   // dbmr2r has a paint
@@ -174,12 +172,12 @@ SkPicture* create_save_layer_opt_1_v4(SkTDArray<DrawType> *preOptPattern,
 //                     takes a different path if this is false)
 // colorsMatch       - control if the saveLayer and dbmr2r paint colors
 //                     match (the optimization will fail if they do not)
-SkPicture* create_save_layer_opt_2(SkTDArray<DrawType> *preOptPattern,
-                                   SkTDArray<DrawType> *postOptPattern,
-                                   const SkBitmap& checkerBoard,
-                                   bool saveLayerHasPaint,
-                                   bool dbmr2rHasPaint,
-                                   bool colorsMatch)  {
+static SkPicture* create_save_layer_opt_2(SkTDArray<DrawType>* preOptPattern,
+                                          SkTDArray<DrawType>* postOptPattern,
+                                          const SkBitmap& checkerBoard,
+                                          bool saveLayerHasPaint,
+                                          bool dbmr2rHasPaint,
+                                          bool colorsMatch)  {
     // Create the pattern that should trigger the optimization
     preOptPattern->setCount(8);
     (*preOptPattern)[0] = SAVE;
@@ -260,9 +258,9 @@ SkPicture* create_save_layer_opt_2(SkTDArray<DrawType> *preOptPattern,
 }
 
 // straight-ahead version that is seen in the skps
-SkPicture* create_save_layer_opt_2_v1(SkTDArray<DrawType> *preOptPattern,
-                                      SkTDArray<DrawType> *postOptPattern,
-                                      const SkBitmap& checkerBoard) {
+static SkPicture* create_save_layer_opt_2_v1(SkTDArray<DrawType>* preOptPattern,
+                                             SkTDArray<DrawType>* postOptPattern,
+                                             const SkBitmap& checkerBoard) {
     return create_save_layer_opt_2(preOptPattern, postOptPattern, checkerBoard,
                                    true,   // saveLayer has a paint
                                    true,   // dbmr2r has a paint
@@ -270,9 +268,9 @@ SkPicture* create_save_layer_opt_2_v1(SkTDArray<DrawType> *preOptPattern,
 }
 
 // alternate version that should still succeed
-SkPicture* create_save_layer_opt_2_v2(SkTDArray<DrawType> *preOptPattern,
-                                      SkTDArray<DrawType> *postOptPattern,
-                                      const SkBitmap& checkerBoard) {
+static SkPicture* create_save_layer_opt_2_v2(SkTDArray<DrawType>* preOptPattern,
+                                             SkTDArray<DrawType>* postOptPattern,
+                                             const SkBitmap& checkerBoard) {
     return create_save_layer_opt_2(preOptPattern, postOptPattern, checkerBoard,
                                    false,  // saveLayer doesn't have a paint!
                                    true,   // dbmr2r has a paint
@@ -280,9 +278,9 @@ SkPicture* create_save_layer_opt_2_v2(SkTDArray<DrawType> *preOptPattern,
 }
 
 // alternate version that should still succeed
-SkPicture* create_save_layer_opt_2_v3(SkTDArray<DrawType> *preOptPattern,
-                                      SkTDArray<DrawType> *postOptPattern,
-                                      const SkBitmap& checkerBoard) {
+static SkPicture* create_save_layer_opt_2_v3(SkTDArray<DrawType>* preOptPattern,
+                                             SkTDArray<DrawType>* postOptPattern,
+                                             const SkBitmap& checkerBoard) {
     return create_save_layer_opt_2(preOptPattern, postOptPattern, checkerBoard,
                                    true,   // saveLayer has a paint
                                    false,  // dbmr2r doesn't have a paint!
@@ -290,18 +288,15 @@ SkPicture* create_save_layer_opt_2_v3(SkTDArray<DrawType> *preOptPattern,
 }
 
 // version in which the optimization fails b.c. the colors don't match
-SkPicture* create_save_layer_opt_2_v4(SkTDArray<DrawType> *preOptPattern,
-                                      SkTDArray<DrawType> *postOptPattern,
-                                      const SkBitmap& checkerBoard) {
+static SkPicture* create_save_layer_opt_2_v4(SkTDArray<DrawType>* preOptPattern,
+                                             SkTDArray<DrawType>* postOptPattern,
+                                             const SkBitmap& checkerBoard) {
     return create_save_layer_opt_2(preOptPattern, postOptPattern, checkerBoard,
                                    true,   // saveLayer has a paint
                                    true,   // dbmr2r has a paint
                                    false); // and the colors don't match!
 }
 
-};
-
-
 // As our .skp optimizations get folded into the captured skps our code will
 // no longer be locally exercised. This GM manually constructs the patterns
 // our optimizations will remove to test them. It acts as both a GM and a unit