OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include <gtest/gtest.h> | 35 #include <gtest/gtest.h> |
36 | 36 |
37 using testing::Test; | 37 using testing::Test; |
38 using namespace blink; | 38 using namespace blink; |
39 | 39 |
40 class ImageFilterBuilderTest : public Test { | 40 class ImageFilterBuilderTest : public Test { |
41 protected: | 41 protected: |
42 void colorSpaceTest() | 42 void colorSpaceTest() |
43 { | 43 { |
44 // Build filter tree | 44 // Build filter tree |
45 RefPtr<ReferenceFilter> referenceFilter = ReferenceFilter::create(1.0f); | 45 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilter::c
reate(1.0f); |
46 | 46 |
47 // Add a dummy source graphic input | 47 // Add a dummy source graphic input |
48 RefPtr<FilterEffect> sourceEffect = referenceFilter->sourceGraphic(); | 48 RefPtrWillBeRawPtr<FilterEffect> sourceEffect = referenceFilter->sourceG
raphic(); |
49 sourceEffect->setOperatingColorSpace(ColorSpaceDeviceRGB); | 49 sourceEffect->setOperatingColorSpace(ColorSpaceDeviceRGB); |
50 | 50 |
51 // Add a blur effect (with input : source) | 51 // Add a blur effect (with input : source) |
52 RefPtr<FilterEffect> blurEffect = | 52 RefPtrWillBeRawPtr<FilterEffect> blurEffect = |
53 FEGaussianBlur::create(referenceFilter.get(), 3.0f, 3.0f); | 53 FEGaussianBlur::create(referenceFilter.get(), 3.0f, 3.0f); |
54 blurEffect->setOperatingColorSpace(ColorSpaceLinearRGB); | 54 blurEffect->setOperatingColorSpace(ColorSpaceLinearRGB); |
55 blurEffect->inputEffects().append(sourceEffect); | 55 blurEffect->inputEffects().append(sourceEffect); |
56 | 56 |
57 // Add a blend effect (with inputs : blur, source) | 57 // Add a blend effect (with inputs : blur, source) |
58 RefPtr<FilterEffect> blendEffect = | 58 RefPtrWillBeRawPtr<FilterEffect> blendEffect = |
59 FEBlend::create(referenceFilter.get(), WebBlendModeNormal); | 59 FEBlend::create(referenceFilter.get(), WebBlendModeNormal); |
60 blendEffect->setOperatingColorSpace(ColorSpaceDeviceRGB); | 60 blendEffect->setOperatingColorSpace(ColorSpaceDeviceRGB); |
61 FilterEffectVector& blendInputs = blendEffect->inputEffects(); | 61 FilterEffectVector& blendInputs = blendEffect->inputEffects(); |
62 blendInputs.reserveCapacity(2); | 62 blendInputs.reserveCapacity(2); |
63 blendInputs.append(sourceEffect); | 63 blendInputs.append(sourceEffect); |
64 blendInputs.append(blurEffect); | 64 blendInputs.append(blurEffect); |
65 | 65 |
66 // Add a merge effect (with inputs : blur, blend) | 66 // Add a merge effect (with inputs : blur, blend) |
67 RefPtr<FilterEffect> mergeEffect = FEMerge::create(referenceFilter.get()
); | 67 RefPtrWillBeRawPtr<FilterEffect> mergeEffect = FEMerge::create(reference
Filter.get()); |
68 mergeEffect->setOperatingColorSpace(ColorSpaceLinearRGB); | 68 mergeEffect->setOperatingColorSpace(ColorSpaceLinearRGB); |
69 FilterEffectVector& mergeInputs = mergeEffect->inputEffects(); | 69 FilterEffectVector& mergeInputs = mergeEffect->inputEffects(); |
70 mergeInputs.reserveCapacity(2); | 70 mergeInputs.reserveCapacity(2); |
71 mergeInputs.append(blurEffect); | 71 mergeInputs.append(blurEffect); |
72 mergeInputs.append(blendEffect); | 72 mergeInputs.append(blendEffect); |
73 referenceFilter->setLastEffect(mergeEffect); | 73 referenceFilter->setLastEffect(mergeEffect); |
74 | 74 |
75 // Get SkImageFilter resulting tree | 75 // Get SkImageFilter resulting tree |
76 SkiaImageFilterBuilder builder; | 76 SkiaImageFilterBuilder builder; |
77 RefPtr<SkImageFilter> filter = builder.build(referenceFilter->lastEffect
(), ColorSpaceDeviceRGB); | 77 RefPtr<SkImageFilter> filter = builder.build(referenceFilter->lastEffect
(), ColorSpaceDeviceRGB); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 }; | 116 }; |
117 | 117 |
118 namespace { | 118 namespace { |
119 | 119 |
120 TEST_F(ImageFilterBuilderTest, testColorSpace) | 120 TEST_F(ImageFilterBuilderTest, testColorSpace) |
121 { | 121 { |
122 colorSpaceTest(); | 122 colorSpaceTest(); |
123 } | 123 } |
124 | 124 |
125 } // namespace | 125 } // namespace |
OLD | NEW |