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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp

Issue 2846593008: Proactively dispose image filters for SVG filter chains (Closed)
Patch Set: Created 3 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/filters/FilterEffect.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> 2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * Copyright (C) 2012 University of Szeged 5 * Copyright (C) 2012 University of Szeged
6 * Copyright (C) 2013 Google Inc. All rights reserved. 6 * Copyright (C) 2013 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 FloatRect result = MapInputs(rect); 81 FloatRect result = MapInputs(rect);
82 result = MapEffect(result); 82 result = MapEffect(result);
83 return ApplyBounds(result); 83 return ApplyBounds(result);
84 } 84 }
85 85
86 FilterEffect* FilterEffect::InputEffect(unsigned number) const { 86 FilterEffect* FilterEffect::InputEffect(unsigned number) const {
87 SECURITY_DCHECK(number < input_effects_.size()); 87 SECURITY_DCHECK(number < input_effects_.size());
88 return input_effects_.at(number).Get(); 88 return input_effects_.at(number).Get();
89 } 89 }
90 90
91 void FilterEffect::ClearResult() { 91 void FilterEffect::DisposeImageFilters() {
92 for (int i = 0; i < 4; i++) 92 for (int i = 0; i < 4; i++)
93 image_filters_[i] = nullptr; 93 image_filters_[i] = nullptr;
94 } 94 }
95 95
96 void FilterEffect::DisposeImageFiltersRecursive() {
97 if (!HasImageFilter())
98 return;
99 DisposeImageFilters();
100 for (auto& effect : input_effects_)
101 effect->DisposeImageFiltersRecursive();
102 }
103
96 Color FilterEffect::AdaptColorToOperatingColorSpace(const Color& device_color) { 104 Color FilterEffect::AdaptColorToOperatingColorSpace(const Color& device_color) {
97 // |deviceColor| is assumed to be DeviceRGB. 105 // |deviceColor| is assumed to be DeviceRGB.
98 return ColorSpaceUtilities::ConvertColor(device_color, OperatingColorSpace()); 106 return ColorSpaceUtilities::ConvertColor(device_color, OperatingColorSpace());
99 } 107 }
100 108
101 TextStream& FilterEffect::ExternalRepresentation(TextStream& ts, int) const { 109 TextStream& FilterEffect::ExternalRepresentation(TextStream& ts, int) const {
102 // FIXME: We should dump the subRegions of the filter primitives here later. 110 // FIXME: We should dump the subRegions of the filter primitives here later.
103 // This isn't possible at the moment, because we need more detailed 111 // This isn't possible at the moment, because we need more detailed
104 // information from the target object. 112 // information from the target object.
105 return ts; 113 return ts;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 166 }
159 167
160 void FilterEffect::SetImageFilter(ColorSpace color_space, 168 void FilterEffect::SetImageFilter(ColorSpace color_space,
161 bool requires_pm_color_validation, 169 bool requires_pm_color_validation,
162 sk_sp<SkImageFilter> image_filter) { 170 sk_sp<SkImageFilter> image_filter) {
163 int index = GetImageFilterIndex(color_space, requires_pm_color_validation); 171 int index = GetImageFilterIndex(color_space, requires_pm_color_validation);
164 image_filters_[index] = std::move(image_filter); 172 image_filters_[index] = std::move(image_filter);
165 } 173 }
166 174
167 } // namespace blink 175 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/filters/FilterEffect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698