Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright 2012 Google Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | * found in the LICENSE file. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef Gr1DKernelEffect_DEFINED |
michael@0 | 9 | #define Gr1DKernelEffect_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | #include "GrSingleTextureEffect.h" |
michael@0 | 12 | #include "SkMatrix.h" |
michael@0 | 13 | |
michael@0 | 14 | /** |
michael@0 | 15 | * Base class for 1D kernel effects. The kernel operates either in X or Y and |
michael@0 | 16 | * has a pixel radius. The kernel is specified in the src texture's space |
michael@0 | 17 | * and the kernel center is pinned to a texel's center. The radius specifies |
michael@0 | 18 | * the number of texels on either side of the center texel in X or Y that are |
michael@0 | 19 | * read. Since the center pixel is also read, the total width is one larger than |
michael@0 | 20 | * two times the radius. |
michael@0 | 21 | */ |
michael@0 | 22 | |
michael@0 | 23 | class Gr1DKernelEffect : public GrSingleTextureEffect { |
michael@0 | 24 | |
michael@0 | 25 | public: |
michael@0 | 26 | enum Direction { |
michael@0 | 27 | kX_Direction, |
michael@0 | 28 | kY_Direction, |
michael@0 | 29 | }; |
michael@0 | 30 | |
michael@0 | 31 | Gr1DKernelEffect(GrTexture* texture, |
michael@0 | 32 | Direction direction, |
michael@0 | 33 | int radius) |
michael@0 | 34 | : GrSingleTextureEffect(texture, MakeDivByTextureWHMatrix(texture)) |
michael@0 | 35 | , fDirection(direction) |
michael@0 | 36 | , fRadius(radius) {} |
michael@0 | 37 | |
michael@0 | 38 | virtual ~Gr1DKernelEffect() {}; |
michael@0 | 39 | |
michael@0 | 40 | static int WidthFromRadius(int radius) { return 2 * radius + 1; } |
michael@0 | 41 | |
michael@0 | 42 | int radius() const { return fRadius; } |
michael@0 | 43 | int width() const { return WidthFromRadius(fRadius); } |
michael@0 | 44 | Direction direction() const { return fDirection; } |
michael@0 | 45 | |
michael@0 | 46 | private: |
michael@0 | 47 | |
michael@0 | 48 | Direction fDirection; |
michael@0 | 49 | int fRadius; |
michael@0 | 50 | |
michael@0 | 51 | typedef GrSingleTextureEffect INHERITED; |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | #endif |