Changeset 83936 in webkit


Ignore:
Timestamp:
Apr 14, 2011 8:18:36 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-14 Mike Reed <reed@google.com>

Reviewed by Kenneth Russell.

fix shadows with gradients
https://bugs.webkit.org/show_bug.cgi?id=58376

No new tests. Existing tests exercise this
LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html

  • platform/graphics/skia/GraphicsContextSkia.cpp: (WebCore::GraphicsContext::setPlatformShadow):
Location:
trunk/Source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83933 r83936  
     12011-04-14  Mike Reed  <reed@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        fix shadows with gradients
     6        https://bugs.webkit.org/show_bug.cgi?id=58376
     7
     8        No new tests. Existing tests exercise this
     9        LayoutTests/fast/canvas/canvas-fillPath-gradient-shadow.html
     10
     11        * platform/graphics/skia/GraphicsContextSkia.cpp:
     12        (WebCore::GraphicsContext::setPlatformShadow):
     13
    1142011-04-14  Vsevolod Vlasov  <vsevik@chromium.org>
    215
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r83216 r83936  
    4545
    4646#include "SkBitmap.h"
    47 #include "SkBlurDrawLooper.h"
     47#include "SkBlurMaskFilter.h"
     48#include "SkColorFilter.h"
    4849#include "SkCornerPathEffect.h"
     50#include "SkLayerDrawLooper.h"
    4951#include "SkShader.h"
    5052#include "SkiaUtils.h"
     
    10451047    double blur = blurFloat;
    10461048
    1047     uint32_t blurFlags = SkBlurDrawLooper::kHighQuality_BlurFlag |
    1048         SkBlurDrawLooper::kOverrideColor_BlurFlag;
     1049    uint32_t mfFlags = SkBlurMaskFilter::kHighQuality_BlurFlag;
    10491050
    10501051    if (m_state.shadowsIgnoreTransforms)  {
     
    10531054        // Transforms. So with this flag set, we know this state is associated
    10541055        // with a CanvasRenderingContext.
    1055         blurFlags |= SkBlurDrawLooper::kIgnoreTransform_BlurFlag;
    1056        
     1056        mfFlags |= SkBlurMaskFilter::kIgnoreTransform_BlurFlag;
     1057
    10571058        // CG uses natural orientation for Y axis, but the HTML5 canvas spec
    10581059        // does not.
     
    10701071    // TODO(tc): Should we have a max value for the blur?  CG clamps at 1000.0
    10711072    // for perf reasons.
    1072     SkDrawLooper* dl = new SkBlurDrawLooper(blur / 2, width, height, c, blurFlags);
     1073
     1074    SkLayerDrawLooper* dl = new SkLayerDrawLooper;
     1075    SkAutoUnref aur(dl);
     1076
     1077    // top layer, we just draw unchanged
     1078    dl->addLayer();
     1079
     1080    // lower layer contains our offset, blur, and colorfilter
     1081    SkLayerDrawLooper::LayerInfo info;
     1082
     1083    info.fPaintBits |= SkLayerDrawLooper::kMaskFilter_Bit; // our blur
     1084    info.fPaintBits |= SkLayerDrawLooper::kColorFilter_Bit;
     1085    info.fColorMode = SkXfermode::kDst_Mode;
     1086    info.fOffset.set(width, height);
     1087    info.fPostTranslate = m_state.shadowsIgnoreTransforms;
     1088
     1089    SkMaskFilter* mf = SkBlurMaskFilter::Create(blur / 2, SkBlurMaskFilter::kNormal_BlurStyle, mfFlags);
     1090
     1091    SkColorFilter* cf = SkColorFilter::CreateModeFilter(c, SkXfermode::kSrcIn_Mode);
     1092
     1093    SkPaint* paint = dl->addLayer(info);
     1094    SkSafeUnref(paint->setMaskFilter(mf));
     1095    SkSafeUnref(paint->setColorFilter(cf));
     1096
     1097    // dl is now built, just install it
    10731098    platformContext()->setDrawLooper(dl);
    1074     dl->unref();
    10751099}
    10761100
  • trunk/Source/WebKit/chromium/DEPS

    r83782 r83936  
    3333vars = {
    3434  'chromium_svn': 'http://src.chromium.org/svn/trunk/src',
    35   'chromium_rev': '81341'
     35  'chromium_rev': '81564'
    3636}
    3737
Note: See TracChangeset for help on using the changeset viewer.