| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |