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

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

Issue 331283002: stop calling deprecated setConfig (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + android typo Created 6 years, 6 months 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/bitmap_platform_device_skia.cc ('k') | skia/ext/image_operations.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 7 #include <algorithm>
8 #include <numeric> 8 #include <numeric>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 for (unsigned int p = 0; p < dest_height; ++p) { 230 for (unsigned int p = 0; p < dest_height; ++p) {
231 unsigned int offset = source_height * p / dest_height; 231 unsigned int offset = source_height * p / dest_height;
232 y_filter.AddFilter(offset, filter, 232 y_filter.AddFilter(offset, filter,
233 std::min<int>(arraysize(filter), 233 std::min<int>(arraysize(filter),
234 source_height - offset)); 234 source_height - offset));
235 } 235 }
236 y_filter.PaddingForSIMD(); 236 y_filter.PaddingForSIMD();
237 237
238 // Allocate input and output skia bitmap. 238 // Allocate input and output skia bitmap.
239 SkBitmap source, result_c, result_sse; 239 SkBitmap source, result_c, result_sse;
240 source.setConfig(SkBitmap::kARGB_8888_Config, 240 source.allocN32Pixels(source_width, source_height);
241 source_width, source_height); 241 result_c.allocN32Pixels(dest_width, dest_height);
242 source.allocPixels(); 242 result_sse.allocN32Pixels(dest_width, dest_height);
243 result_c.setConfig(SkBitmap::kARGB_8888_Config,
244 dest_width, dest_height);
245 result_c.allocPixels();
246 result_sse.setConfig(SkBitmap::kARGB_8888_Config,
247 dest_width, dest_height);
248 result_sse.allocPixels();
249 243
250 // Randomize source bitmap for testing. 244 // Randomize source bitmap for testing.
251 unsigned char* src_ptr = static_cast<unsigned char*>(source.getPixels()); 245 unsigned char* src_ptr = static_cast<unsigned char*>(source.getPixels());
252 for (int y = 0; y < source.height(); y++) { 246 for (int y = 0; y < source.height(); y++) {
253 for (unsigned int x = 0; x < source.rowBytes(); x++) 247 for (unsigned int x = 0; x < source.rowBytes(); x++)
254 src_ptr[x] = rand() % 255; 248 src_ptr[x] = rand() % 255;
255 src_ptr += source.rowBytes(); 249 src_ptr += source.rowBytes();
256 } 250 }
257 251
258 // Test both cases with different has_alpha. 252 // Test both cases with different has_alpha.
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 fp_gradient_kernel.end()), -1.5f); 523 fp_gradient_kernel.end()), -1.5f);
530 EXPECT_LT(*std::min_element(fp_gradient_kernel.begin(), 524 EXPECT_LT(*std::min_element(fp_gradient_kernel.begin(),
531 fp_gradient_kernel.end()), 0.0f); 525 fp_gradient_kernel.end()), 0.0f);
532 EXPECT_LT(*std::max_element(fp_gradient_kernel.begin(), 526 EXPECT_LT(*std::max_element(fp_gradient_kernel.begin(),
533 fp_gradient_kernel.end()), 1.5f); 527 fp_gradient_kernel.end()), 1.5f);
534 EXPECT_GT(*std::max_element(fp_gradient_kernel.begin(), 528 EXPECT_GT(*std::max_element(fp_gradient_kernel.begin(),
535 fp_gradient_kernel.end()), 0.0f); 529 fp_gradient_kernel.end()), 0.0f);
536 } 530 }
537 531
538 } // namespace skia 532 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_skia.cc ('k') | skia/ext/image_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698