11a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org/*
21a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org * Copyright 2013 Google Inc.
31a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org *
41a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org * Use of this source code is governed by a BSD-style license that can be
51a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org * found in the LICENSE file.
61a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org */
71a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
81a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org#ifndef SkTileImageFilter_DEFINED
91a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org#define SkTileImageFilter_DEFINED
101a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
111a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org#include "SkImageFilter.h"
121a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
1355f5682523f66c7a0d9696ff9f7c50cc8a6d6b45sugoi@google.comclass SK_API SkTileImageFilter : public SkImageFilter {
141a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org    typedef SkImageFilter INHERITED;
151a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
161a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.orgpublic:
17cac5fd597f6e2495f50aaa6bcbe3dadc56f0b977commit-bot@chromium.org    /** Create a tile image filter
181a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org        @param srcRect  Defines the pixels to tile
191a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org        @param dstRect  Defines the pixels where tiles are drawn
201a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org        @param input    Input from which the subregion defined by srcRect will be tiled
211a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org    */
22cac5fd597f6e2495f50aaa6bcbe3dadc56f0b977commit-bot@chromium.org    static SkTileImageFilter* Create(const SkRect& srcRect, const SkRect& dstRect,
235e5f948b6b363dbfc8c076d8ff0c6b8e9ea99958senorblanco                                     SkImageFilter* input, uint32_t uniqueID = 0);
241a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
254cb543d6057b692e1099e9f115155f0bf323a0c8senorblanco@chromium.org    virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
26ae761f7545d8ebf181d220169afac2056b057b8ccommit-bot@chromium.org                               SkBitmap* dst, SkIPoint* offset) const SK_OVERRIDE;
270a5c233e3b911232c0d6f9a88ded99ecf88b8a97senorblanco@chromium.org    virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
280a5c233e3b911232c0d6f9a88ded99ecf88b8a97senorblanco@chromium.org                                SkIRect* dst) const SK_OVERRIDE;
291a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
301a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTileImageFilter)
311a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
321a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.orgprotected:
335e5f948b6b363dbfc8c076d8ff0c6b8e9ea99958senorblanco    SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, SkImageFilter* input, uint32_t uniqueID)
345e5f948b6b363dbfc8c076d8ff0c6b8e9ea99958senorblanco        : INHERITED(1, &input, NULL, uniqueID), fSrcRect(srcRect), fDstRect(dstRect) {}
359fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
368b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org    explicit SkTileImageFilter(SkReadBuffer& buffer);
379fa60daad4d5f54c0dbe3dbcc7608a8f6d721187reed#endif
381a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
398b0e8ac5f582de80356019406e2975079bf0829dcommit-bot@chromium.org    virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
401a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
411a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.orgprivate:
421a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org    SkRect fSrcRect;
431a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org    SkRect fDstRect;
441a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org};
451a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
461a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org#endif
47