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

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

Issue 18511: Add back convolver_unittest.cc and image_operations_unittest.cc.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 11 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 | « no previous file | skia/ext/platform_canvas_unittest.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) 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "skia/ext/image_operations.h" 7 #include "skia/ext/image_operations.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // Resamples an iamge to the same image, it should give almost the same result. 126 // Resamples an iamge to the same image, it should give almost the same result.
127 TEST(ImageOperations, ResampleToSame) { 127 TEST(ImageOperations, ResampleToSame) {
128 // Make our source bitmap. 128 // Make our source bitmap.
129 int src_w = 16, src_h = 34; 129 int src_w = 16, src_h = 34;
130 SkBitmap src; 130 SkBitmap src;
131 FillDataToBitmap(src_w, src_h, &src); 131 FillDataToBitmap(src_w, src_h, &src);
132 132
133 // Do a resize of the full bitmap to the same size. The lanczos filter is good 133 // Do a resize of the full bitmap to the same size. The lanczos filter is good
134 // enough that we should get exactly the same image for output. 134 // enough that we should get exactly the same image for output.
135 SkBitmap results = gfx::ImageOperations::Resize( 135 SkBitmap results = skia::ImageOperations::Resize(
136 src, gfx::ImageOperations::RESIZE_LANCZOS3, gfx::Size(src_w, src_h)); 136 src, skia::ImageOperations::RESIZE_LANCZOS3, src_w, src_h);
137 ASSERT_EQ(src_w, results.width()); 137 ASSERT_EQ(src_w, results.width());
138 ASSERT_EQ(src_h, results.height()); 138 ASSERT_EQ(src_h, results.height());
139 139
140 SkAutoLockPixels src_lock(src); 140 SkAutoLockPixels src_lock(src);
141 SkAutoLockPixels results_lock(results); 141 SkAutoLockPixels results_lock(results);
142 for (int y = 0; y < src_h; y++) { 142 for (int y = 0; y < src_h; y++) {
143 for (int x = 0; x < src_w; x++) { 143 for (int x = 0; x < src_w; x++) {
144 EXPECT_EQ(*src.getAddr32(x, y), *results.getAddr32(x, y)); 144 EXPECT_EQ(*src.getAddr32(x, y), *results.getAddr32(x, y));
145 } 145 }
146 } 146 }
147 } 147 }
148
OLDNEW
« no previous file with comments | « no previous file | skia/ext/platform_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698