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,
2324e06d5244ae96e440410e1d76e039983b2efac9senorblanco                                     SkImageFilter* input);
241a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
254cb543d6057b692e1099e9f115155f0bf323a0c8senorblanco@chromium.org    virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
2636352bf5e38f45a70ee4f4fc132a38048d38206dmtklein                               SkBitmap* dst, SkIPoint* offset) const override;
270a5c233e3b911232c0d6f9a88ded99ecf88b8a97senorblanco@chromium.org    virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
2836352bf5e38f45a70ee4f4fc132a38048d38206dmtklein                                SkIRect* dst) const override;
291a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
30f3f5bad7ded35265c0b5d042cc4174386b197a33robertphillips    SK_TO_STRING_OVERRIDE()
311a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTileImageFilter)
321a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
331a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.orgprotected:
3424e06d5244ae96e440410e1d76e039983b2efac9senorblanco    SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, SkImageFilter* input)
3524e06d5244ae96e440410e1d76e039983b2efac9senorblanco        : INHERITED(1, &input, NULL), fSrcRect(srcRect), fDstRect(dstRect) {}
361a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
3736352bf5e38f45a70ee4f4fc132a38048d38206dmtklein    void flatten(SkWriteBuffer& buffer) const override;
381a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
391a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.orgprivate:
401a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org    SkRect fSrcRect;
411a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org    SkRect fDstRect;
421a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org};
431a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org
441a4fb70c8a04db2d92ec821555f91218a989031dcommit-bot@chromium.org#endif
45