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

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

Issue 1438043012: Avoid int coercion of box-shadow args (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac theme update, subpixel test Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 void DrawLooperBuilder::addUnmodifiedContent() 61 void DrawLooperBuilder::addUnmodifiedContent()
62 { 62 {
63 SkLayerDrawLooper::LayerInfo info; 63 SkLayerDrawLooper::LayerInfo info;
64 m_skDrawLooperBuilder.addLayerOnTop(info); 64 m_skDrawLooperBuilder.addLayerOnTop(info);
65 } 65 }
66 66
67 void DrawLooperBuilder::addShadow(const FloatSize& offset, float blur, const Col or& color, 67 void DrawLooperBuilder::addShadow(const FloatSize& offset, float blur, const Col or& color,
68 ShadowTransformMode shadowTransformMode, ShadowAlphaMode shadowAlphaMode) 68 ShadowTransformMode shadowTransformMode, ShadowAlphaMode shadowAlphaMode)
69 { 69 {
70 // Negative blurs are not allowed, so just pin the value to 0 70 ASSERT(blur >= 0);
71 if (blur < 0)
72 blur = 0;
73 71
74 // Detect when there's no effective shadow. 72 // Detect when there's no effective shadow.
75 if (!color.alpha()) 73 if (!color.alpha())
76 return; 74 return;
77 75
78 SkColor skColor = color.rgb(); 76 SkColor skColor = color.rgb();
79 77
80 SkLayerDrawLooper::LayerInfo info; 78 SkLayerDrawLooper::LayerInfo info;
81 79
82 switch (shadowAlphaMode) { 80 switch (shadowAlphaMode) {
(...skipping 22 matching lines...) Expand all
105 mfFlags |= SkBlurMaskFilter::kIgnoreTransform_BlurFlag; 103 mfFlags |= SkBlurMaskFilter::kIgnoreTransform_BlurFlag;
106 RefPtr<SkMaskFilter> mf = adoptRef(SkBlurMaskFilter::Create(kNormal_SkBl urStyle, sigma, mfFlags)); 104 RefPtr<SkMaskFilter> mf = adoptRef(SkBlurMaskFilter::Create(kNormal_SkBl urStyle, sigma, mfFlags));
107 paint->setMaskFilter(mf.get()); 105 paint->setMaskFilter(mf.get());
108 } 106 }
109 107
110 RefPtr<SkColorFilter> cf = adoptRef(SkColorFilter::CreateModeFilter(skColor, SkXfermode::kSrcIn_Mode)); 108 RefPtr<SkColorFilter> cf = adoptRef(SkColorFilter::CreateModeFilter(skColor, SkXfermode::kSrcIn_Mode));
111 paint->setColorFilter(cf.get()); 109 paint->setColorFilter(cf.get());
112 } 110 }
113 111
114 } // namespace blink 112 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/ThemePainterMac.mm ('k') | third_party/WebKit/Source/platform/graphics/GraphicsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698