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

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

Issue 2341923002: Harmonize FilterEffect::mapRect and mapPaintRect (Closed)
Patch Set: Rebase Created 4 years, 2 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 /* 1 /*
2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 23 matching lines...) Expand all
34 return new SourceAlpha(sourceEffect); 34 return new SourceAlpha(sourceEffect);
35 } 35 }
36 36
37 SourceAlpha::SourceAlpha(FilterEffect* sourceEffect) 37 SourceAlpha::SourceAlpha(FilterEffect* sourceEffect)
38 : FilterEffect(sourceEffect->getFilter()) 38 : FilterEffect(sourceEffect->getFilter())
39 { 39 {
40 setOperatingColorSpace(sourceEffect->operatingColorSpace()); 40 setOperatingColorSpace(sourceEffect->operatingColorSpace());
41 inputEffects().append(sourceEffect); 41 inputEffects().append(sourceEffect);
42 } 42 }
43 43
44 FloatRect SourceAlpha::determineAbsolutePaintRect(const FloatRect& requestedRect ) const
45 {
46 return inputEffect(0)->determineAbsolutePaintRect(requestedRect);
47 }
48
49 sk_sp<SkImageFilter> SourceAlpha::createImageFilter() 44 sk_sp<SkImageFilter> SourceAlpha::createImageFilter()
50 { 45 {
51 sk_sp<SkImageFilter> sourceGraphic(SkiaImageFilterBuilder::build(inputEffect (0), operatingColorSpace())); 46 sk_sp<SkImageFilter> sourceGraphic(SkiaImageFilterBuilder::build(inputEffect (0), operatingColorSpace()));
52 SkScalar matrix[20] = { 47 SkScalar matrix[20] = {
53 0, 0, 0, 0, 0, 48 0, 0, 0, 0, 0,
54 0, 0, 0, 0, 0, 49 0, 0, 0, 0, 0,
55 0, 0, 0, 0, 0, 50 0, 0, 0, 0, 0,
56 0, 0, 0, SK_Scalar1, 0 51 0, 0, 0, SK_Scalar1, 0
57 }; 52 };
58 sk_sp<SkColorFilter> colorFilter = SkColorFilter::MakeMatrixFilterRowMajor25 5(matrix); 53 sk_sp<SkColorFilter> colorFilter = SkColorFilter::MakeMatrixFilterRowMajor25 5(matrix);
59 return SkColorFilterImageFilter::Make(std::move(colorFilter), std::move(sour ceGraphic)); 54 return SkColorFilterImageFilter::Make(std::move(colorFilter), std::move(sour ceGraphic));
60 } 55 }
61 56
62 TextStream& SourceAlpha::externalRepresentation(TextStream& ts, int indent) cons t 57 TextStream& SourceAlpha::externalRepresentation(TextStream& ts, int indent) cons t
63 { 58 {
64 writeIndent(ts, indent); 59 writeIndent(ts, indent);
65 ts << "[SourceAlpha]\n"; 60 ts << "[SourceAlpha]\n";
66 return ts; 61 return ts;
67 } 62 }
68 63
69 } // namespace blink 64 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698