OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
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 Gr1DKernelEffect_DEFINED | 8 #ifndef Gr1DKernelEffect_DEFINED |
9 #define Gr1DKernelEffect_DEFINED | 9 #define Gr1DKernelEffect_DEFINED |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 */ | 21 */ |
22 | 22 |
23 class Gr1DKernelEffect : public GrSingleTextureEffect { | 23 class Gr1DKernelEffect : public GrSingleTextureEffect { |
24 | 24 |
25 public: | 25 public: |
26 enum Direction { | 26 enum Direction { |
27 kX_Direction, | 27 kX_Direction, |
28 kY_Direction, | 28 kY_Direction, |
29 }; | 29 }; |
30 | 30 |
31 // Constructor using default nearest-neighbor sampling for the input texture | |
32 // filter mode. | |
33 Gr1DKernelEffect(GrProcessorDataManager* procDataManager, | 31 Gr1DKernelEffect(GrProcessorDataManager* procDataManager, |
34 GrTexture* texture, | 32 GrTexture* texture, |
35 Direction direction, | 33 Direction direction, |
36 int radius) | 34 int radius) |
37 : INHERITED(procDataManager, texture, GrCoordTransform::MakeDivByTexture
WHMatrix(texture)) | 35 : INHERITED(procDataManager, texture, GrCoordTransform::MakeDivByTexture
WHMatrix(texture)) |
38 , fDirection(direction) | 36 , fDirection(direction) |
39 , fRadius(radius) {} | 37 , fRadius(radius) {} |
40 | 38 |
41 Gr1DKernelEffect(GrProcessorDataManager* procDataManager, | |
42 GrTexture* texture, | |
43 Direction direction, | |
44 int radius, | |
45 GrTextureParams::FilterMode filterMode) | |
46 : INHERITED(procDataManager, | |
47 texture, | |
48 GrCoordTransform::MakeDivByTextureWHMatrix(texture), | |
49 filterMode) | |
50 , fDirection(direction) | |
51 , fRadius(radius) {} | |
52 | |
53 virtual ~Gr1DKernelEffect() {}; | 39 virtual ~Gr1DKernelEffect() {}; |
54 | 40 |
55 static int WidthFromRadius(int radius) { return 2 * radius + 1; } | 41 static int WidthFromRadius(int radius) { return 2 * radius + 1; } |
56 | 42 |
57 int radius() const { return fRadius; } | 43 int radius() const { return fRadius; } |
58 int width() const { return WidthFromRadius(fRadius); } | 44 int width() const { return WidthFromRadius(fRadius); } |
59 Direction direction() const { return fDirection; } | 45 Direction direction() const { return fDirection; } |
60 | 46 |
61 private: | 47 private: |
62 | 48 |
63 Direction fDirection; | 49 Direction fDirection; |
64 int fRadius; | 50 int fRadius; |
65 | 51 |
66 typedef GrSingleTextureEffect INHERITED; | 52 typedef GrSingleTextureEffect INHERITED; |
67 }; | 53 }; |
68 | 54 |
69 #endif | 55 #endif |
OLD | NEW |