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

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

Issue 1980613003: cc: correctly fix edge-AA for filtered render surfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 4 years, 7 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
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 "cc/output/filter_operations.h" 5 #include "cc/output/filter_operations.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <numeric> 10 #include <numeric>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 static int SpreadForStdDeviation(float std_deviation) { 53 static int SpreadForStdDeviation(float std_deviation) {
54 // https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#feGaussianBlurE lement 54 // https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#feGaussianBlurE lement
55 // provides this approximation for evaluating a gaussian blur by a triple box 55 // provides this approximation for evaluating a gaussian blur by a triple box
56 // filter. 56 // filter.
57 float d = floorf(std_deviation * 3.f * sqrt(8.f * atan(1.f)) / 4.f + 0.5f); 57 float d = floorf(std_deviation * 3.f * sqrt(8.f * atan(1.f)) / 4.f + 0.5f);
58 return static_cast<int>(ceilf(d * 3.f / 2.f)); 58 return static_cast<int>(ceilf(d * 3.f / 2.f));
59 } 59 }
60 60
61 gfx::Rect FilterOperations::MapRect(const gfx::Rect& rect) const { 61 gfx::Rect FilterOperations::MapRect(const gfx::Rect& rect,
62 auto accumulate_rect = [](const gfx::Rect& rect, const FilterOperation& op) { 62 const SkMatrix& matrix) const {
63 return op.MapRect(rect); 63 auto accumulate_rect = [matrix](const gfx::Rect& rect,
64 const FilterOperation& op) {
65 return op.MapRect(rect, matrix);
64 }; 66 };
65 return std::accumulate(operations_.begin(), operations_.end(), rect, 67 return std::accumulate(operations_.begin(), operations_.end(), rect,
66 accumulate_rect); 68 accumulate_rect);
67 } 69 }
68 70
69 void FilterOperations::GetOutsets(int* top, 71 void FilterOperations::GetOutsets(int* top,
70 int* right, 72 int* right,
71 int* bottom, 73 int* bottom,
72 int* left) const { 74 int* left) const {
73 *top = *right = *bottom = *left = 0; 75 *top = *right = *bottom = *left = 0;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 void FilterOperations::AsValueInto( 224 void FilterOperations::AsValueInto(
223 base::trace_event::TracedValue* value) const { 225 base::trace_event::TracedValue* value) const {
224 for (size_t i = 0; i < operations_.size(); ++i) { 226 for (size_t i = 0; i < operations_.size(); ++i) {
225 value->BeginDictionary(); 227 value->BeginDictionary();
226 operations_[i].AsValueInto(value); 228 operations_[i].AsValueInto(value);
227 value->EndDictionary(); 229 value->EndDictionary();
228 } 230 }
229 } 231 }
230 232
231 } // namespace cc 233 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698