OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkDeviceImageFilterProxy_DEFINED | 8 #ifndef SkDeviceImageFilterProxy_DEFINED |
9 #define SkDeviceImageFilterProxy_DEFINED | 9 #define SkDeviceImageFilterProxy_DEFINED |
10 | 10 |
11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
12 | 12 |
13 class SkDeviceImageFilterProxy : public SkImageFilter::Proxy { | 13 class SkDeviceImageFilterProxy : public SkImageFilter::Proxy { |
14 public: | 14 public: |
15 SkDeviceImageFilterProxy(SkBaseDevice* device) : fDevice(device) {} | 15 SkDeviceImageFilterProxy(SkBaseDevice* device) : fDevice(device) {} |
16 | 16 |
17 virtual SkBaseDevice* createDevice(int w, int h) SK_OVERRIDE { | 17 virtual SkBaseDevice* createDevice(int w, int h) SK_OVERRIDE { |
18 return fDevice->createCompatibleDevice(SkBitmap::kARGB_8888_Config, | 18 return fDevice->createCompatibleDevice(SkImageInfo::MakeN32Premul(w, h))
; |
19 w, h, false); | |
20 } | 19 } |
21 virtual bool canHandleImageFilter(const SkImageFilter* filter) SK_OVERRIDE { | 20 virtual bool canHandleImageFilter(const SkImageFilter* filter) SK_OVERRIDE { |
22 return fDevice->canHandleImageFilter(filter); | 21 return fDevice->canHandleImageFilter(filter); |
23 } | 22 } |
24 virtual bool filterImage(const SkImageFilter* filter, const SkBitmap& src, | 23 virtual bool filterImage(const SkImageFilter* filter, const SkBitmap& src, |
25 const SkMatrix& ctm, | 24 const SkMatrix& ctm, |
26 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE { | 25 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE { |
27 return fDevice->filterImage(filter, src, ctm, result, offset); | 26 return fDevice->filterImage(filter, src, ctm, result, offset); |
28 } | 27 } |
29 | 28 |
30 private: | 29 private: |
31 SkBaseDevice* fDevice; | 30 SkBaseDevice* fDevice; |
32 }; | 31 }; |
33 | 32 |
34 #endif | 33 #endif |
OLD | NEW |