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->createCompatibleDeviceForImageFilter(SkImageInfo::MakeN3
2Premul(w, h)); | 18 SkBaseDevice::CreateInfo cinfo(SkImageInfo::MakeN32Premul(w, h), |
| 19 SkBaseDevice::kImageFilter_Usage, |
| 20 kUnknown_SkPixelGeometry); |
| 21 return fDevice->onCreateCompatibleDevice(cinfo); |
19 } | 22 } |
20 virtual bool canHandleImageFilter(const SkImageFilter* filter) SK_OVERRIDE { | 23 virtual bool canHandleImageFilter(const SkImageFilter* filter) SK_OVERRIDE { |
21 return fDevice->canHandleImageFilter(filter); | 24 return fDevice->canHandleImageFilter(filter); |
22 } | 25 } |
23 virtual bool filterImage(const SkImageFilter* filter, const SkBitmap& src, | 26 virtual bool filterImage(const SkImageFilter* filter, const SkBitmap& src, |
24 const SkImageFilter::Context& ctx, | 27 const SkImageFilter::Context& ctx, |
25 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE { | 28 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE { |
26 return fDevice->filterImage(filter, src, ctx, result, offset); | 29 return fDevice->filterImage(filter, src, ctx, result, offset); |
27 } | 30 } |
28 | 31 |
29 private: | 32 private: |
30 SkBaseDevice* fDevice; | 33 SkBaseDevice* fDevice; |
31 }; | 34 }; |
32 | 35 |
33 #endif | 36 #endif |
OLD | NEW |