1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/include/effects/SkBitmapSource.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +/* 1.5 + * Copyright 2012 The Android Open Source Project 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef SkBitmapSource_DEFINED 1.12 +#define SkBitmapSource_DEFINED 1.13 + 1.14 +#include "SkImageFilter.h" 1.15 +#include "SkBitmap.h" 1.16 + 1.17 +class SK_API SkBitmapSource : public SkImageFilter { 1.18 +public: 1.19 + static SkBitmapSource* Create(const SkBitmap& bitmap) { 1.20 + return SkNEW_ARGS(SkBitmapSource, (bitmap)); 1.21 + } 1.22 + static SkBitmapSource* Create(const SkBitmap& bitmap, const SkRect& srcRect, 1.23 + const SkRect& dstRect) { 1.24 + return SkNEW_ARGS(SkBitmapSource, (bitmap, srcRect, dstRect)); 1.25 + } 1.26 + virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE; 1.27 + 1.28 + SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource) 1.29 + 1.30 +protected: 1.31 + explicit SkBitmapSource(SkReadBuffer& buffer); 1.32 + virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 1.33 + virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 1.34 + SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE; 1.35 + virtual bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const SK_OVERRIDE; 1.36 + 1.37 +#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS 1.38 +public: 1.39 +#endif 1.40 + explicit SkBitmapSource(const SkBitmap& bitmap); 1.41 + SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect& dstRect); 1.42 + 1.43 +private: 1.44 + SkBitmap fBitmap; 1.45 + SkRect fSrcRect, fDstRect; 1.46 + typedef SkImageFilter INHERITED; 1.47 +}; 1.48 + 1.49 +#endif