2012-08-20 14:53:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkBitmapSource_DEFINED
|
|
|
|
#define SkBitmapSource_DEFINED
|
|
|
|
|
|
|
|
#include "SkImageFilter.h"
|
|
|
|
#include "SkBitmap.h"
|
|
|
|
|
|
|
|
class SK_API SkBitmapSource : public SkImageFilter {
|
|
|
|
public:
|
2014-03-10 10:51:58 +00:00
|
|
|
static SkBitmapSource* Create(const SkBitmap& bitmap) {
|
|
|
|
return SkNEW_ARGS(SkBitmapSource, (bitmap));
|
|
|
|
}
|
|
|
|
static SkBitmapSource* Create(const SkBitmap& bitmap, const SkRect& srcRect,
|
|
|
|
const SkRect& dstRect) {
|
|
|
|
return SkNEW_ARGS(SkBitmapSource, (bitmap, srcRect, dstRect));
|
|
|
|
}
|
2014-01-27 21:03:17 +00:00
|
|
|
virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
|
2012-08-20 14:53:21 +00:00
|
|
|
|
|
|
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource)
|
|
|
|
|
|
|
|
protected:
|
2014-05-15 15:40:41 +00:00
|
|
|
explicit SkBitmapSource(const SkBitmap& bitmap);
|
|
|
|
SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect& dstRect);
|
2014-01-30 18:58:24 +00:00
|
|
|
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
|
2014-05-15 15:40:41 +00:00
|
|
|
|
2014-03-14 15:44:01 +00:00
|
|
|
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
|
2014-02-05 22:32:02 +00:00
|
|
|
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
|
2012-08-20 14:53:21 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SkBitmap fBitmap;
|
2013-12-09 18:31:42 +00:00
|
|
|
SkRect fSrcRect, fDstRect;
|
2012-08-20 14:53:21 +00:00
|
|
|
typedef SkImageFilter INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|