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

Side by Side Diff: third_party/WebKit/Source/core/style/ShadowData.h

Issue 2356213004: Adjust paint invalidation rects to match the actual radius of rastered blur. (Closed)
Patch Set: none 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
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
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 10 matching lines...) Expand all
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 * 22 *
23 */ 23 */
24 24
25 #ifndef ShadowData_h 25 #ifndef ShadowData_h
26 #define ShadowData_h 26 #define ShadowData_h
27 27
28 #include "core/css/StyleColor.h" 28 #include "core/css/StyleColor.h"
29 #include "platform/geometry/FloatPoint.h" 29 #include "platform/geometry/FloatPoint.h"
30 #include "platform/geometry/FloatRectOutsets.h" 30 #include "platform/geometry/FloatRectOutsets.h"
31 #include "platform/graphics/skia/SkiaUtils.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 enum ShadowStyle { Normal, Inset }; 35 enum ShadowStyle { Normal, Inset };
35 36
36 // This class holds information about shadows for the text-shadow and box-shadow properties. 37 // This class holds information about shadows for the text-shadow and box-shadow properties.
37 class ShadowData { 38 class ShadowData {
38 USING_FAST_MALLOC(ShadowData); 39 USING_FAST_MALLOC(ShadowData);
39 public: 40 public:
40 ShadowData(const FloatPoint& location, float blur, float spread, ShadowStyle style, StyleColor color) 41 ShadowData(const FloatPoint& location, float blur, float spread, ShadowStyle style, StyleColor color)
(...skipping 15 matching lines...) Expand all
56 FloatPoint location() const { return m_location; } 57 FloatPoint location() const { return m_location; }
57 float blur() const { return m_blur; } 58 float blur() const { return m_blur; }
58 float spread() const { return m_spread; } 59 float spread() const { return m_spread; }
59 ShadowStyle style() const { return m_style; } 60 ShadowStyle style() const { return m_style; }
60 StyleColor color() const { return m_color; } 61 StyleColor color() const { return m_color; }
61 62
62 // Outsets needed to adjust a source rectangle to the one cast by this 63 // Outsets needed to adjust a source rectangle to the one cast by this
63 // shadow. 64 // shadow.
64 FloatRectOutsets rectOutsets() const 65 FloatRectOutsets rectOutsets() const
65 { 66 {
66 float blurAndSpread = blur() + spread(); 67 // 3 * skBlurRadiusToSigma(blur()) is how Skia implements the radius of a blur. See also
68 // https://crbug.com/624175.
69 float blurAndSpread = ceil(3 * skBlurRadiusToSigma(blur())) + spread();
67 return FloatRectOutsets( 70 return FloatRectOutsets(
68 blurAndSpread - y() /* top */, 71 blurAndSpread - y() /* top */,
69 blurAndSpread + x() /* right */, 72 blurAndSpread + x() /* right */,
70 blurAndSpread + y() /* bottom */, 73 blurAndSpread + y() /* bottom */,
71 blurAndSpread - x() /* left */); 74 blurAndSpread - x() /* left */);
72 } 75 }
73 76
74 private: 77 private:
75 FloatPoint m_location; 78 FloatPoint m_location;
76 float m_blur; 79 float m_blur;
77 float m_spread; 80 float m_spread;
78 StyleColor m_color; 81 StyleColor m_color;
79 ShadowStyle m_style; 82 ShadowStyle m_style;
80 }; 83 };
81 84
82 } // namespace blink 85 } // namespace blink
83 86
84 #endif // ShadowData_h 87 #endif // ShadowData_h
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698