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/output/render_surface_filters.h" | 5 #include "cc/output/render_surface_filters.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "cc/output/filter_operation.h" | 10 #include "cc/output/filter_operation.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 skia::RefPtr<SkColorFilter> color_filter = | 153 skia::RefPtr<SkColorFilter> color_filter = |
154 skia::AdoptRef(new SkColorMatrixFilter(matrix)); | 154 skia::AdoptRef(new SkColorMatrixFilter(matrix)); |
155 return skia::AdoptRef( | 155 return skia::AdoptRef( |
156 SkColorFilterImageFilter::Create(color_filter.get(), input.get())); | 156 SkColorFilterImageFilter::Create(color_filter.get(), input.get())); |
157 } | 157 } |
158 | 158 |
159 } // namespace | 159 } // namespace |
160 | 160 |
161 skia::RefPtr<SkImageFilter> RenderSurfaceFilters::BuildImageFilter( | 161 skia::RefPtr<SkImageFilter> RenderSurfaceFilters::BuildImageFilter( |
162 const FilterOperations& filters, | 162 const FilterOperations& filters, |
163 gfx::SizeF size) { | 163 const gfx::SizeF& size) { |
164 skia::RefPtr<SkImageFilter> image_filter; | 164 skia::RefPtr<SkImageFilter> image_filter; |
165 SkScalar matrix[20]; | 165 SkScalar matrix[20]; |
166 for (size_t i = 0; i < filters.size(); ++i) { | 166 for (size_t i = 0; i < filters.size(); ++i) { |
167 const FilterOperation& op = filters.at(i); | 167 const FilterOperation& op = filters.at(i); |
168 switch (op.type()) { | 168 switch (op.type()) { |
169 case FilterOperation::GRAYSCALE: | 169 case FilterOperation::GRAYSCALE: |
170 GetGrayscaleMatrix(1.f - op.amount(), matrix); | 170 GetGrayscaleMatrix(1.f - op.amount(), matrix); |
171 image_filter = CreateMatrixImageFilter(matrix, image_filter); | 171 image_filter = CreateMatrixImageFilter(matrix, image_filter); |
172 break; | 172 break; |
173 case FilterOperation::SEPIA: | 173 case FilterOperation::SEPIA: |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 image_filter = op.image_filter(); | 259 image_filter = op.image_filter(); |
260 } | 260 } |
261 break; | 261 break; |
262 } | 262 } |
263 } | 263 } |
264 } | 264 } |
265 return image_filter; | 265 return image_filter; |
266 } | 266 } |
267 | 267 |
268 } // namespace cc | 268 } // namespace cc |
OLD | NEW |