| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/render_surface_filters.h" | 5 #include "cc/render_surface_filters.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "skia/ext/refptr.h" | 8 #include "skia/ext/refptr.h" |
| 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation.
h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation.
h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 WebKit::WebFilterOperations RenderSurfaceFilters::Optimize( | 312 WebKit::WebFilterOperations RenderSurfaceFilters::Optimize( |
| 313 const WebKit::WebFilterOperations& filters) { | 313 const WebKit::WebFilterOperations& filters) { |
| 314 WebKit::WebFilterOperations new_list; | 314 WebKit::WebFilterOperations new_list; |
| 315 | 315 |
| 316 SkScalar accumulated_color_matrix[20]; | 316 SkScalar accumulated_color_matrix[20]; |
| 317 bool have_accumulated_color_matrix = false; | 317 bool have_accumulated_color_matrix = false; |
| 318 for (unsigned i = 0; i < filters.size(); ++i) { | 318 for (unsigned i = 0; i < filters.size(); ++i) { |
| 319 const WebKit::WebFilterOperation& op = filters.at(i); | 319 const WebKit::WebFilterOperation& op = filters.at(i); |
| 320 | 320 |
| 321 // If the filter is a color matrix, we may be able to combine it with | 321 // If the filter is a color matrix, we may be able to combine it with |
| 322 // following filter(s) that also are color matrices. | 322 // following Filter(s) that also are color matrices. |
| 323 SkScalar matrix[20]; | 323 SkScalar matrix[20]; |
| 324 if (GetColorMatrix(op, matrix)) { | 324 if (GetColorMatrix(op, matrix)) { |
| 325 if (have_accumulated_color_matrix) { | 325 if (have_accumulated_color_matrix) { |
| 326 SkScalar newMatrix[20]; | 326 SkScalar newMatrix[20]; |
| 327 MultColorMatrix(matrix, accumulated_color_matrix, newMatrix); | 327 MultColorMatrix(matrix, accumulated_color_matrix, newMatrix); |
| 328 memcpy(accumulated_color_matrix, | 328 memcpy(accumulated_color_matrix, |
| 329 newMatrix, | 329 newMatrix, |
| 330 sizeof(accumulated_color_matrix)); | 330 sizeof(accumulated_color_matrix)); |
| 331 } else { | 331 } else { |
| 332 memcpy(accumulated_color_matrix, | 332 memcpy(accumulated_color_matrix, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 case WebKit::WebFilterOperation::FilterTypeOpacity: | 449 case WebKit::WebFilterOperation::FilterTypeOpacity: |
| 450 NOTREACHED(); | 450 NOTREACHED(); |
| 451 break; | 451 break; |
| 452 } | 452 } |
| 453 state.Swap(); | 453 state.Swap(); |
| 454 } | 454 } |
| 455 return state.Source(); | 455 return state.Source(); |
| 456 } | 456 } |
| 457 | 457 |
| 458 } // namespace cc | 458 } // namespace cc |
| OLD | NEW |