OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #if USE(SKIA) | 27 #if USE(SKIA) |
28 #include "FEGaussianBlur.h" | 28 #include "FEGaussianBlur.h" |
29 | 29 |
30 #include "BitmapImageSingleFrameSkia.h" | 30 #include "BitmapImageSingleFrameSkia.h" |
31 #include "SkBlurImageFilter.h" | 31 #include "SkBlurImageFilter.h" |
32 | 32 |
33 namespace WebCore { | 33 namespace WebCore { |
34 | 34 |
35 bool FEGaussianBlur::platformApplySkia() | 35 void FEGaussianBlur::platformApplySkia() |
36 { | 36 { |
37 ImageBuffer* resultImage = createImageBufferResult(); | 37 ImageBuffer* resultImage = createImageBufferResult(); |
38 if (!resultImage) | 38 if (!resultImage) |
39 return false; | 39 return; |
40 | 40 |
41 FilterEffect* in = inputEffect(0); | 41 FilterEffect* in = inputEffect(0); |
42 | 42 |
43 IntRect drawingRegion = drawingRegionOfInputImage(in->absolutePaintRect()); | 43 IntRect drawingRegion = drawingRegionOfInputImage(in->absolutePaintRect()); |
44 | 44 |
45 setIsAlphaImage(in->isAlphaImage()); | 45 setIsAlphaImage(in->isAlphaImage()); |
46 | 46 |
47 float stdX = filter()->applyHorizontalScale(m_stdX); | 47 float stdX = filter()->applyHorizontalScale(m_stdX); |
48 float stdY = filter()->applyVerticalScale(m_stdY); | 48 float stdY = filter()->applyVerticalScale(m_stdY); |
49 | 49 |
50 RefPtr<Image> image = in->asImageBuffer()->copyImage(DontCopyBackingStore); | 50 RefPtr<Image> image = in->asImageBuffer()->copyImage(DontCopyBackingStore); |
51 | 51 |
52 SkPaint paint; | 52 SkPaint paint; |
53 GraphicsContext* dstContext = resultImage->context(); | 53 GraphicsContext* dstContext = resultImage->context(); |
54 SkCanvas* canvas = dstContext->platformContext()->canvas(); | 54 SkCanvas* canvas = dstContext->platformContext()->canvas(); |
55 paint.setImageFilter(new SkBlurImageFilter(stdX, stdY))->unref(); | 55 paint.setImageFilter(new SkBlurImageFilter(stdX, stdY))->unref(); |
56 canvas->saveLayer(0, &paint); | 56 canvas->saveLayer(0, &paint); |
57 paint.setColor(0xFFFFFFFF); | 57 paint.setColor(0xFFFFFFFF); |
58 dstContext->drawImage(image.get(), ColorSpaceDeviceRGB, drawingRegion.locati
on(), CompositeCopy); | 58 dstContext->drawImage(image.get(), ColorSpaceDeviceRGB, drawingRegion.locati
on(), CompositeCopy); |
59 canvas->restore(); | 59 canvas->restore(); |
60 return true; | 60 return; |
61 } | 61 } |
62 | 62 |
63 }; | 63 }; |
64 #endif | 64 #endif |
OLD | NEW |