1 /* 2 * Copyright 2012 The Android Open Source Project 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkBitmapSource_DEFINED 9 #define SkBitmapSource_DEFINED 10 11 #include "SkImageFilter.h" 12 #include "SkBitmap.h" 13 14 class SK_API SkBitmapSource : public SkImageFilter { 15 public: 16 explicit SkBitmapSource(const SkBitmap& bitmap); 17 SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect& dstRect); 18 19 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource) 20 21 protected: 22 explicit SkBitmapSource(SkFlattenableReadBuffer& buffer); 23 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 24 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, 25 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; 26 27 private: 28 SkBitmap fBitmap; 29 SkRect fSrcRect, fDstRect; 30 typedef SkImageFilter INHERITED; 31 }; 32 33 #endif 34