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

Side by Side Diff: Source/core/platform/graphics/DrawLooper.cpp

Issue 23581008: Revert r154797: "Move isValid/isCurrentColor from Color to StyleColor" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 void DrawLooper::addUnmodifiedContent() 55 void DrawLooper::addUnmodifiedContent()
56 { 56 {
57 SkLayerDrawLooper::LayerInfo info; 57 SkLayerDrawLooper::LayerInfo info;
58 m_skDrawLooper->addLayerOnTop(info); 58 m_skDrawLooper->addLayerOnTop(info);
59 } 59 }
60 60
61 void DrawLooper::addShadow(const FloatSize& offset, float blur, const Color& col or, 61 void DrawLooper::addShadow(const FloatSize& offset, float blur, const Color& col or,
62 ShadowTransformMode shadowTransformMode, ShadowAlphaMode shadowAlphaMode) 62 ShadowTransformMode shadowTransformMode, ShadowAlphaMode shadowAlphaMode)
63 { 63 {
64 // Detect when there's no effective shadow. 64 // Detect when there's no effective shadow.
65 if (!color.alpha()) 65 if (!color.isValid() || !color.alpha())
66 return; 66 return;
67 67
68 SkColor skColor = color.rgb(); 68 SkColor skColor;
69 if (color.isValid())
70 skColor = color.rgb();
71 else
72 skColor = SkColorSetARGB(0xFF / 3, 0, 0, 0); // "std" apple shadow color .
69 73
70 SkLayerDrawLooper::LayerInfo info; 74 SkLayerDrawLooper::LayerInfo info;
71 75
72 switch (shadowAlphaMode) { 76 switch (shadowAlphaMode) {
73 case ShadowRespectsAlpha: 77 case ShadowRespectsAlpha:
74 info.fColorMode = SkXfermode::kDst_Mode; 78 info.fColorMode = SkXfermode::kDst_Mode;
75 break; 79 break;
76 case ShadowIgnoresAlpha: 80 case ShadowIgnoresAlpha:
77 info.fColorMode = SkXfermode::kSrc_Mode; 81 info.fColorMode = SkXfermode::kSrc_Mode;
78 break; 82 break;
(...skipping 16 matching lines...) Expand all
95 RefPtr<SkMaskFilter> mf = adoptRef(SkBlurMaskFilter::Create( 99 RefPtr<SkMaskFilter> mf = adoptRef(SkBlurMaskFilter::Create(
96 (double)blur / 2.0, SkBlurMaskFilter::kNormal_BlurStyle, mfFlags)); 100 (double)blur / 2.0, SkBlurMaskFilter::kNormal_BlurStyle, mfFlags));
97 paint->setMaskFilter(mf.get()); 101 paint->setMaskFilter(mf.get());
98 } 102 }
99 103
100 RefPtr<SkColorFilter> cf = adoptRef(SkColorFilter::CreateModeFilter(skColor, SkXfermode::kSrcIn_Mode)); 104 RefPtr<SkColorFilter> cf = adoptRef(SkColorFilter::CreateModeFilter(skColor, SkXfermode::kSrcIn_Mode));
101 paint->setColorFilter(cf.get()); 105 paint->setColorFilter(cf.get());
102 } 106 }
103 107
104 } // namespace WebCore 108 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698