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

Side by Side Diff: cc/output/filter_operations.cc

Issue 22875045: cc: Remove unnecessary "default" cases from switch statements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 6
7 #include "cc/output/filter_operations.h" 7 #include "cc/output/filter_operations.h"
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/output/filter_operation.h" 10 #include "cc/output/filter_operation.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 bool FilterOperations::HasFilterThatMovesPixels() const { 81 bool FilterOperations::HasFilterThatMovesPixels() const {
82 for (size_t i = 0; i < operations_.size(); ++i) { 82 for (size_t i = 0; i < operations_.size(); ++i) {
83 const FilterOperation op = operations_[i]; 83 const FilterOperation op = operations_[i];
84 switch (op.type()) { 84 switch (op.type()) {
85 case FilterOperation::BLUR: 85 case FilterOperation::BLUR:
86 case FilterOperation::DROP_SHADOW: 86 case FilterOperation::DROP_SHADOW:
87 case FilterOperation::ZOOM: 87 case FilterOperation::ZOOM:
88 return true; 88 return true;
89 default: 89 case FilterOperation::OPACITY:
90 break; 90 case FilterOperation::COLOR_MATRIX:
91 case FilterOperation::GRAYSCALE:
92 case FilterOperation::SEPIA:
93 case FilterOperation::SATURATE:
94 case FilterOperation::HUE_ROTATE:
95 case FilterOperation::INVERT:
96 case FilterOperation::BRIGHTNESS:
97 case FilterOperation::CONTRAST:
98 case FilterOperation::SATURATING_BRIGHTNESS:
99 return false;
91 } 100 }
92 } 101 }
102 NOTREACHED();
93 return false; 103 return false;
94 } 104 }
95 105
96 bool FilterOperations::HasFilterThatAffectsOpacity() const { 106 bool FilterOperations::HasFilterThatAffectsOpacity() const {
97 for (size_t i = 0; i < operations_.size(); ++i) { 107 for (size_t i = 0; i < operations_.size(); ++i) {
98 const FilterOperation op = operations_[i]; 108 const FilterOperation op = operations_[i];
99 switch (op.type()) { 109 switch (op.type()) {
100 case FilterOperation::OPACITY: 110 case FilterOperation::OPACITY:
101 case FilterOperation::BLUR: 111 case FilterOperation::BLUR:
102 case FilterOperation::DROP_SHADOW: 112 case FilterOperation::DROP_SHADOW:
103 case FilterOperation::ZOOM: 113 case FilterOperation::ZOOM:
104 return true; 114 return true;
105 case FilterOperation::COLOR_MATRIX: { 115 case FilterOperation::COLOR_MATRIX: {
106 const SkScalar* matrix = op.matrix(); 116 const SkScalar* matrix = op.matrix();
107 return matrix[15] || matrix[16] || matrix[17] || matrix[18] != 1 || 117 if (matrix[15] ||
108 matrix[19]; 118 matrix[16] ||
119 matrix[17] ||
120 matrix[18] != 1 ||
121 matrix[19])
122 return true;
123 break;
109 } 124 }
110 default: 125 case FilterOperation::GRAYSCALE:
111 break; 126 case FilterOperation::SEPIA:
127 case FilterOperation::SATURATE:
128 case FilterOperation::HUE_ROTATE:
129 case FilterOperation::INVERT:
130 case FilterOperation::BRIGHTNESS:
131 case FilterOperation::CONTRAST:
132 case FilterOperation::SATURATING_BRIGHTNESS:
133 return false;
112 } 134 }
113 } 135 }
136 NOTREACHED();
114 return false; 137 return false;
115 } 138 }
116 139
117 FilterOperations FilterOperations::Blend(const FilterOperations& from, 140 FilterOperations FilterOperations::Blend(const FilterOperations& from,
118 double progress) const { 141 double progress) const {
119 FilterOperations blended_filters; 142 FilterOperations blended_filters;
120 if (from.size() == 0) { 143 if (from.size() == 0) {
121 for (size_t i = 0; i < size(); i++) 144 for (size_t i = 0; i < size(); i++)
122 blended_filters.Append(FilterOperation::Blend(NULL, &at(i), progress)); 145 blended_filters.Append(FilterOperation::Blend(NULL, &at(i), progress));
123 return blended_filters; 146 return blended_filters;
(...skipping 24 matching lines...) Expand all
148 } 171 }
149 172
150 scoped_ptr<base::Value> FilterOperations::AsValue() const { 173 scoped_ptr<base::Value> FilterOperations::AsValue() const {
151 scoped_ptr<base::ListValue> value(new ListValue); 174 scoped_ptr<base::ListValue> value(new ListValue);
152 for (size_t i = 0; i < operations_.size(); ++i) 175 for (size_t i = 0; i < operations_.size(); ++i)
153 value->Append(operations_[i].AsValue().release()); 176 value->Append(operations_[i].AsValue().release());
154 return value.PassAs<base::Value>(); 177 return value.PassAs<base::Value>();
155 } 178 }
156 179
157 } // namespace cc 180 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698