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

Side by Side Diff: content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc

Issue 374633002: SkBitmap::Config is deprecated, use SkColorType instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments from #4 Created 6 years, 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/renderer_host/compositing_iosurface_transformer_mac.h" 5 #include "content/browser/renderer_host/compositing_iosurface_transformer_mac.h"
6 6
7 #include <OpenGL/CGLCurrent.h> 7 #include <OpenGL/CGLCurrent.h>
8 #include <OpenGL/CGLRenderers.h> 8 #include <OpenGL/CGLRenderers.h>
9 #include <OpenGL/CGLTypes.h> 9 #include <OpenGL/CGLTypes.h>
10 #include <OpenGL/OpenGL.h> 10 #include <OpenGL/OpenGL.h>
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 // Returns the number of pixels significantly different between |expected| and 206 // Returns the number of pixels significantly different between |expected| and
207 // |actual|. 207 // |actual|.
208 int ImageDifference(const SkBitmap& expected, const SkBitmap& actual) { 208 int ImageDifference(const SkBitmap& expected, const SkBitmap& actual) {
209 SkAutoLockPixels lock_expected(expected); 209 SkAutoLockPixels lock_expected(expected);
210 SkAutoLockPixels lock_actual(actual); 210 SkAutoLockPixels lock_actual(actual);
211 211
212 // Sanity-check assumed image properties. 212 // Sanity-check assumed image properties.
213 DCHECK_EQ(expected.width(), actual.width()); 213 DCHECK_EQ(expected.width(), actual.width());
214 DCHECK_EQ(expected.height(), actual.height()); 214 DCHECK_EQ(expected.height(), actual.height());
215 DCHECK_EQ(SkBitmap::kARGB_8888_Config, expected.config()); 215 DCHECK_EQ(kN32_SkColorType, expected.colorType());
216 DCHECK_EQ(SkBitmap::kARGB_8888_Config, actual.config()); 216 DCHECK_EQ(kN32_SkColorType, actual.colorType());
217 217
218 // Compare both images. 218 // Compare both images.
219 int num_pixels_different = 0; 219 int num_pixels_different = 0;
220 for (int y = 0; y < expected.height(); ++y) { 220 for (int y = 0; y < expected.height(); ++y) {
221 const uint32_t* p = expected.getAddr32(0, y); 221 const uint32_t* p = expected.getAddr32(0, y);
222 const uint32_t* q = actual.getAddr32(0, y); 222 const uint32_t* q = actual.getAddr32(0, y);
223 for (int x = 0; x < expected.width(); ++x, ++p, ++q) { 223 for (int x = 0; x < expected.width(); ++x, ++p, ++q) {
224 if (abs(static_cast<int>(SkColorGetR(*p)) - 224 if (abs(static_cast<int>(SkColorGetR(*p)) -
225 static_cast<int>(SkColorGetR(*q))) > kDifferenceThreshold || 225 static_cast<int>(SkColorGetR(*q))) > kDifferenceThreshold ||
226 abs(static_cast<int>(SkColorGetG(*p)) - 226 abs(static_cast<int>(SkColorGetG(*p)) -
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // Subrect resize test: missing top row, and left+right columns in source. 521 // Subrect resize test: missing top row, and left+right columns in source.
522 RunTransformRGBToYV12Test( 522 RunTransformRGBToYV12Test(
523 src_bitmap, 523 src_bitmap,
524 gfx::Rect(1, 1, params.src_width - 2, params.src_height - 1), 524 gfx::Rect(1, 1, params.src_width - 2, params.src_height - 1),
525 dst_size); 525 dst_size);
526 } 526 }
527 } 527 }
528 } 528 }
529 529
530 } // namespace content 530 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698