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

Side by Side Diff: Source/core/rendering/FilterEffectRenderer.cpp

Issue 678163002: Oilpan: move SVG property hierarchy to the heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 70
71 FilterEffectRenderer::FilterEffectRenderer() 71 FilterEffectRenderer::FilterEffectRenderer()
72 { 72 {
73 } 73 }
74 74
75 FilterEffectRenderer::~FilterEffectRenderer() 75 FilterEffectRenderer::~FilterEffectRenderer()
76 { 76 {
77 } 77 }
78 78
79 void FilterEffectRenderer::trace(Visitor* visitor)
80 {
81 visitor->trace(m_lastEffect);
82 visitor->trace(m_referenceFilters);
83 }
84
79 bool FilterEffectRenderer::build(RenderObject* renderer, const FilterOperations& operations) 85 bool FilterEffectRenderer::build(RenderObject* renderer, const FilterOperations& operations)
80 { 86 {
81 const RenderStyle* style = renderer->style(); 87 const RenderStyle* style = renderer->style();
82 float zoom = style ? style->effectiveZoom() : 1.0f; 88 float zoom = style ? style->effectiveZoom() : 1.0f;
83 89
84 // Create a parent filter for shorthand filters. These have already been sca led by the CSS code for page zoom, so scale is 1.0 here. 90 // Create a parent filter for shorthand filters. These have already been sca led by the CSS code for page zoom, so scale is 1.0 here.
85 RefPtr<ReferenceFilter> parentFilter = ReferenceFilter::create(1.0f); 91 RefPtrWillBeRawPtr<ReferenceFilter> parentFilter = ReferenceFilter::create(1 .0f);
86 RefPtr<FilterEffect> previousEffect = SourceGraphic::create(parentFilter.get ()); 92 RefPtrWillBeRawPtr<FilterEffect> previousEffect = SourceGraphic::create(pare ntFilter.get());
87 for (size_t i = 0; i < operations.operations().size(); ++i) { 93 for (size_t i = 0; i < operations.operations().size(); ++i) {
88 RefPtr<FilterEffect> effect; 94 RefPtrWillBeRawPtr<FilterEffect> effect = nullptr;
89 FilterOperation* filterOperation = operations.operations().at(i).get(); 95 FilterOperation* filterOperation = operations.operations().at(i).get();
90 switch (filterOperation->type()) { 96 switch (filterOperation->type()) {
91 case FilterOperation::REFERENCE: { 97 case FilterOperation::REFERENCE: {
92 RefPtr<ReferenceFilter> referenceFilter = ReferenceFilter::create(zo om); 98 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte r::create(zoom);
93 effect = ReferenceFilterBuilder::build(referenceFilter.get(), render er, previousEffect.get(), toReferenceFilterOperation(filterOperation)); 99 effect = ReferenceFilterBuilder::build(referenceFilter.get(), render er, previousEffect.get(), toReferenceFilterOperation(filterOperation));
94 referenceFilter->setLastEffect(effect); 100 referenceFilter->setLastEffect(effect);
95 m_referenceFilters.append(referenceFilter); 101 m_referenceFilters.append(referenceFilter);
96 break; 102 break;
97 } 103 }
98 case FilterOperation::GRAYSCALE: { 104 case FilterOperation::GRAYSCALE: {
99 Vector<float> inputParameters; 105 Vector<float> inputParameters;
100 double oneMinusAmount = clampTo(1 - toBasicColorMatrixFilterOperatio n(filterOperation)->amount(), 0.0, 1.0); 106 double oneMinusAmount = clampTo(1 - toBasicColorMatrixFilterOperatio n(filterOperation)->amount(), 0.0, 1.0);
101 107
102 // See https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#g rayscaleEquivalent 108 // See https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#g rayscaleEquivalent
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 277 }
272 278
273 void FilterEffectRenderer::endFilterEffect(GraphicsContext* context) 279 void FilterEffectRenderer::endFilterEffect(GraphicsContext* context)
274 { 280 {
275 context->endLayer(); 281 context->endLayer();
276 context->restore(); 282 context->restore();
277 } 283 }
278 284
279 } // namespace blink 285 } // namespace blink
280 286
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698