1 // Copyright (c) 2014-2015 The Chromium Authors. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions 5 // are met: 6 // * Redistributions of source code must retain the above copyright 7 // notice, this list of conditions and the following disclaimer. 8 // * Redistributions in binary form must reproduce the above copyright 9 // notice, this list of conditions and the following disclaimer in 10 // the documentation and/or other materials provided with the 11 // distribution. 12 // * Neither the name of Google, Inc. nor the names of its contributors 13 // may be used to endorse or promote products derived from this 14 // software without specific prior written permission. 15 // 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 23 // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 // AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 26 // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 // SUCH DAMAGE. 28 29 #ifndef SKIA_EXT_CONVOLVER_LS3_H_ 30 #define SKIA_EXT_CONVOLVER_LS3_H_ 31 32 #include "convolver.h" 33 34 #include <algorithm> 35 36 #include "skia/include/core/SkTypes.h" 37 38 namespace skia { 39 40 // Convolves horizontally along a single row. The row data is given in 41 // |src_data| and continues for the [begin, end) of the filter. 42 void ConvolveHorizontally_LS3(const unsigned char* src_data, 43 const ConvolutionFilter1D& filter, 44 unsigned char* out_row); 45 46 // Convolves horizontally along a single row. The row data is given in 47 // |src_data| and continues for the [begin, end) of the filter. 48 // Process one pixel at a time. 49 void ConvolveHorizontally1_LS3(const unsigned char* src_data, 50 const ConvolutionFilter1D& filter, 51 unsigned char* out_row); 52 53 // Convolves horizontally along four rows. The row data is given in 54 // |src_data| and continues for the [begin, end) of the filter. 55 // The algorithm is almost same as |ConvolveHorizontally_LS3|. Please 56 // refer to that function for detailed comments. 57 void ConvolveHorizontally4_LS3(const unsigned char* src_data[4], 58 const ConvolutionFilter1D& filter, 59 unsigned char* out_row[4]); 60 61 // Does vertical convolution to produce one output row. The filter values and 62 // length are given in the first two parameters. These are applied to each 63 // of the rows pointed to in the |source_data_rows| array, with each row 64 // being |pixel_width| wide. 65 // 66 // The output must have room for |pixel_width * 4| bytes. 67 void ConvolveVertically_LS3(const ConvolutionFilter1D::Fixed* filter_values, 68 int filter_length, 69 unsigned char* const* source_data_rows, 70 int pixel_width, 71 unsigned char* out_row, bool has_alpha); 72 73 } // namespace skia 74 75 #endif // SKIA_EXT_CONVOLVER_LS3_H_ 76