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

Side by Side Diff: src/core/SkFlattenable.cpp

Issue 1361323002: Eliminate some clutter in SkFlattenable (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Remove unused SkLayerDrawLooper::fTopRec Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « include/effects/SkLayerDrawLooper.h ('k') | src/effects/SkLayerDrawLooper.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkFlattenable.h" 8 #include "SkFlattenable.h"
9 #include "SkPtrRecorder.h" 9 #include "SkPtrRecorder.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 /////////////////////////////////////////////////////////////////////////////// 49 ///////////////////////////////////////////////////////////////////////////////
50 50
51 #define MAX_ENTRY_COUNT 1024 51 #define MAX_ENTRY_COUNT 1024
52 52
53 struct Entry { 53 struct Entry {
54 const char* fName; 54 const char* fName;
55 SkFlattenable::Factory fFactory; 55 SkFlattenable::Factory fFactory;
56 SkFlattenable::Type fType; 56 SkFlattenable::Type fType;
57 }; 57 };
58 58
59 static int gCount; 59 static int gCount = 0;
60 static Entry gEntries[MAX_ENTRY_COUNT]; 60 static Entry gEntries[MAX_ENTRY_COUNT];
61 61
62 void SkFlattenable::Register(const char name[], Factory factory, SkFlattenable:: Type type) { 62 void SkFlattenable::Register(const char name[], Factory factory, SkFlattenable:: Type type) {
63 SkASSERT(name); 63 SkASSERT(name);
64 SkASSERT(factory); 64 SkASSERT(factory);
65
66 static bool gOnce = false;
67 if (!gOnce) {
68 gCount = 0;
69 gOnce = true;
70 }
71
72 SkASSERT(gCount < MAX_ENTRY_COUNT); 65 SkASSERT(gCount < MAX_ENTRY_COUNT);
73 66
74 gEntries[gCount].fName = name; 67 gEntries[gCount].fName = name;
75 gEntries[gCount].fFactory = factory; 68 gEntries[gCount].fFactory = factory;
76 gEntries[gCount].fType = type; 69 gEntries[gCount].fType = type;
77 gCount += 1; 70 gCount += 1;
78 } 71 }
79 72
80 #ifdef SK_DEBUG 73 #ifdef SK_DEBUG
81 static void report_no_entries(const char* functionName) { 74 static void report_no_entries(const char* functionName) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 report_no_entries(__FUNCTION__); 116 report_no_entries(__FUNCTION__);
124 #endif 117 #endif
125 const Entry* entries = gEntries; 118 const Entry* entries = gEntries;
126 for (int i = gCount - 1; i >= 0; --i) { 119 for (int i = gCount - 1; i >= 0; --i) {
127 if (entries[i].fFactory == fact) { 120 if (entries[i].fFactory == fact) {
128 return entries[i].fName; 121 return entries[i].fName;
129 } 122 }
130 } 123 }
131 return nullptr; 124 return nullptr;
132 } 125 }
OLDNEW
« no previous file with comments | « include/effects/SkLayerDrawLooper.h ('k') | src/effects/SkLayerDrawLooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698