1f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org/*
2f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org * Copyright 2013 Google Inc.
3f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org *
4f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org * Use of this source code is governed by a BSD-style license that can be
5f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org * found in the LICENSE file.
6f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org */
7f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org
8f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org#include "SkColor.h"
9f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org#include "SkImageFilter.h"
10f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org#include "SkScalar.h"
11f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org
12f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.orgclass SK_API SkDropShadowImageFilter : public SkImageFilter {
13f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.orgpublic:
14cac5fd597f6e2495f50aaa6bcbe3dadc56f0b977commit-bot@chromium.org    static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy,
15cac5fd597f6e2495f50aaa6bcbe3dadc56f0b977commit-bot@chromium.org                                           SkScalar sigmaX, SkScalar sigmaY, SkColor color,
16cac5fd597f6e2495f50aaa6bcbe3dadc56f0b977commit-bot@chromium.org                                           SkImageFilter* input = NULL,
175e5f948b6b363dbfc8c076d8ff0c6b8e9ea99958senorblanco                                           const CropRect* cropRect = NULL,
185e5f948b6b363dbfc8c076d8ff0c6b8e9ea99958senorblanco                                           uint32_t uniqueID = 0) {
19cac5fd597f6e2495f50aaa6bcbe3dadc56f0b977commit-bot@chromium.org        return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY,
205e5f948b6b363dbfc8c076d8ff0c6b8e9ea99958senorblanco                                                    color, input, cropRect, uniqueID));
21cac5fd597f6e2495f50aaa6bcbe3dadc56f0b977commit-bot@chromium.org    }
22336d1d759590d9bedcbc5a96d0fff79861cf8f7asenorblanco@chromium.org    virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
23f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter)
24f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org
25f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.orgprotected:
26bd0be25074e53a6d1abc284562568c9745191984commit-bot@chromium.org    SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor,
275e5f948b6b363dbfc8c076d8ff0c6b8e9ea99958senorblanco                            SkImageFilter* input, const CropRect* cropRect, uint32_t uniqueID);
289fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
298b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org    explicit SkDropShadowImageFilter(SkReadBuffer&);
309fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#endif
318b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org    virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
324cb543d6057b692e1099e9f115155f0bf323a0c8senorblanco@chromium.org    virtual bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
33c4b12f19a46946e1c02f3525e0ea4902b09feac5senorblanco@chromium.org    virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
34c4b12f19a46946e1c02f3525e0ea4902b09feac5senorblanco@chromium.org                                SkIRect* dst) const SK_OVERRIDE;
35c4b12f19a46946e1c02f3525e0ea4902b09feac5senorblanco@chromium.org
36f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.orgprivate:
37d6bab0238655dbab24dfe92bd0b16b464310a8c7rmistry@google.com    SkScalar fDx, fDy, fSigmaX, fSigmaY;
38f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org    SkColor fColor;
39f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org    typedef SkImageFilter INHERITED;
40f44fcdca01722959c3be335f44e88b59dbb33a10junov@chromium.org};
41