OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 { | 60 { |
61 } | 61 } |
62 | 62 |
63 SkiaImageFilterBuilder::~SkiaImageFilterBuilder() | 63 SkiaImageFilterBuilder::~SkiaImageFilterBuilder() |
64 { | 64 { |
65 } | 65 } |
66 | 66 |
67 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::build(FilterEffect* effect, Co
lorSpace colorSpace) | 67 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::build(FilterEffect* effect, Co
lorSpace colorSpace) |
68 { | 68 { |
69 if (!effect) | 69 if (!effect) |
70 return 0; | 70 return nullptr; |
71 | 71 |
72 FilterColorSpacePair key(effect, colorSpace); | 72 FilterColorSpacePair key(effect, colorSpace); |
73 FilterBuilderHashMap::iterator it = m_map.find(key); | 73 FilterBuilderHashMap::iterator it = m_map.find(key); |
74 if (it != m_map.end()) { | 74 if (it != m_map.end()) { |
75 return it->value; | 75 return it->value; |
76 } else { | 76 } else { |
77 // Note that we may still need the color transform even if the filter is
null | 77 // Note that we may still need the color transform even if the filter is
null |
78 RefPtr<SkImageFilter> origFilter = effect->createImageFilter(this); | 78 RefPtr<SkImageFilter> origFilter = effect->createImageFilter(this); |
79 RefPtr<SkImageFilter> filter = transformColorSpace(origFilter.get(), eff
ect->operatingColorSpace(), colorSpace); | 79 RefPtr<SkImageFilter> filter = transformColorSpace(origFilter.get(), eff
ect->operatingColorSpace(), colorSpace); |
80 m_map.set(key, filter); | 80 m_map.set(key, filter); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 204 } |
205 return true; | 205 return true; |
206 } | 206 } |
207 | 207 |
208 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::buildResize(float scaleX, floa
t scaleY, SkImageFilter* input) | 208 PassRefPtr<SkImageFilter> SkiaImageFilterBuilder::buildResize(float scaleX, floa
t scaleY, SkImageFilter* input) |
209 { | 209 { |
210 return adoptRef(new SkResizeImageFilter(scaleX, scaleY, SkPaint::kHigh_Filte
rLevel, input)); | 210 return adoptRef(new SkResizeImageFilter(scaleX, scaleY, SkPaint::kHigh_Filte
rLevel, input)); |
211 } | 211 } |
212 | 212 |
213 }; | 213 }; |
OLD | NEW |