Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: skia/ext/convolver_unittest.cc

Issue 13726: Move Image operations and convolver to the skia namespace and clean up a few ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « skia/ext/convolver.cc ('k') | skia/ext/image_operations.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string.h> 5 #include <string.h>
6 #include <time.h> 6 #include <time.h>
7 #include <vector> 7 #include <vector>
8 8
9 #include "skia/ext/convolver.h" 9 #include "skia/ext/convolver.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace gfx { 12 namespace skia {
13 13
14 namespace { 14 namespace {
15 15
16 // Fills the given filter with impulse functions for the range 0->num_entries. 16 // Fills the given filter with impulse functions for the range 0->num_entries.
17 void FillImpulseFilter(int num_entries, ConvolusionFilter1D* filter) { 17 void FillImpulseFilter(int num_entries, ConvolusionFilter1D* filter) {
18 float one = 1.0f; 18 float one = 1.0f;
19 for (int i = 0; i < num_entries; i++) 19 for (int i = 0; i < num_entries; i++)
20 filter->AddFilter(i, &one, 1); 20 filter->AddFilter(i, &one, 1);
21 } 21 }
22 22
23 // Filters the given input with the impulse function, and verifies that it 23 // Filters the given input with the impulse function, and verifies that it
24 // does not change. 24 // does not change.
25 void TestImpulseConvolusion(const unsigned char* data, int width, int height) { 25 void TestImpulseConvolusion(const unsigned char* data, int width, int height) {
26 int byte_count = width * height * 4; 26 int byte_count = width * height * 4;
27 27
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 value /= 4; // Average. 118 value /= 4; // Average.
119 int difference = value - output[(y * dest_width + x) * 4 + channel]; 119 int difference = value - output[(y * dest_width + x) * 4 + channel];
120 EXPECT_TRUE(difference >= -1 || difference <= 1); 120 EXPECT_TRUE(difference >= -1 || difference <= 1);
121 } 121 }
122 } 122 }
123 } 123 }
124 } 124 }
125 125
126 } // namespace gfx 126 } // namespace gfx
127 127
OLDNEW
« no previous file with comments | « skia/ext/convolver.cc ('k') | skia/ext/image_operations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698