2 * Copyright 2012 The Android Open Source Project
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkBitmapSource_DEFINED
9 #define SkBitmapSource_DEFINED
11 #include "SkImageFilter.h"
14 class SK_API SkBitmapSource : public SkImageFilter {
16 static SkBitmapSource* Create(const SkBitmap& bitmap) {
17 return SkNEW_ARGS(SkBitmapSource, (bitmap));
19 static SkBitmapSource* Create(const SkBitmap& bitmap, const SkRect& srcRect,
20 const SkRect& dstRect) {
21 return SkNEW_ARGS(SkBitmapSource, (bitmap, srcRect, dstRect));
23 void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
25 SK_TO_STRING_OVERRIDE()
26 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource)
29 explicit SkBitmapSource(const SkBitmap& bitmap);
30 SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect& dstRect);
31 void flatten(SkWriteBuffer&) const SK_OVERRIDE;
33 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
34 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
38 SkRect fSrcRect, fDstRect;
39 typedef SkImageFilter INHERITED;