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

Side by Side Diff: cc/test/pixel_test_utils.cc

Issue 11420079: Allow using a larger-than-necessary texture as cached render pass backing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: seems to work Created 8 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
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 "cc/test/pixel_test_utils.h" 5 #include "cc/test/pixel_test_utils.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "ui/gfx/codec/png_codec.h" 10 #include "ui/gfx/codec/png_codec.h"
(...skipping 21 matching lines...) Expand all
32 return file_util::ReadFileToString(file_path, &png_data) && 32 return file_util::ReadFileToString(file_path, &png_data) &&
33 gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&png_data[0]), 33 gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&png_data[0]),
34 png_data.length(), 34 png_data.length(),
35 bitmap); 35 bitmap);
36 } 36 }
37 37
38 bool IsSameAsPNGFile(const SkBitmap& gen_bmp, FilePath ref_img_path) { 38 bool IsSameAsPNGFile(const SkBitmap& gen_bmp, FilePath ref_img_path) {
39 SkBitmap ref_bmp; 39 SkBitmap ref_bmp;
40 if (!ReadPNGFile(ref_img_path, &ref_bmp)) { 40 if (!ReadPNGFile(ref_img_path, &ref_bmp)) {
41 LOG(ERROR) << "Cannot read reference image: " << ref_img_path.value(); 41 LOG(ERROR) << "Cannot read reference image: " << ref_img_path.value();
42 WritePNGFile(gen_bmp, ref_img_path);
enne (OOO) 2012/12/12 23:41:54 Is this intentional? (Also, the other change in th
jamesr 2012/12/13 01:15:06 no (although it's useful when debugging). removed
42 return false; 43 return false;
43 } 44 }
44 45
45 if (ref_bmp.width() != gen_bmp.width() || 46 if (ref_bmp.width() != gen_bmp.width() ||
46 ref_bmp.height() != gen_bmp.height()) { 47 ref_bmp.height() != gen_bmp.height()) {
47 LOG(ERROR) 48 LOG(ERROR)
48 << "Dimensions do not match (Expected) vs (Actual):" 49 << "Dimensions do not match (Expected) vs (Actual):"
49 << "(" << ref_bmp.width() << "x" << ref_bmp.height() 50 << "(" << ref_bmp.width() << "x" << ref_bmp.height()
50 << ") vs. " 51 << ") vs. "
51 << "(" << gen_bmp.width() << "x" << gen_bmp.height() << ")"; 52 << "(" << gen_bmp.width() << "x" << gen_bmp.height() << ")";
(...skipping 11 matching lines...) Expand all
63 for (int y = 0; y < gen_bmp.height(); ++y) { 64 for (int y = 0; y < gen_bmp.height(); ++y) {
64 if ((*gen_bmp.getAddr32(x, y) & kAlphaMask) != 65 if ((*gen_bmp.getAddr32(x, y) & kAlphaMask) !=
65 (*ref_bmp.getAddr32(x, y) & kAlphaMask)) { 66 (*ref_bmp.getAddr32(x, y) & kAlphaMask)) {
66 ++diff_pixels_count; 67 ++diff_pixels_count;
67 } 68 }
68 } 69 }
69 } 70 }
70 71
71 if (diff_pixels_count != 0) { 72 if (diff_pixels_count != 0) {
72 LOG(ERROR) << "Images differ by pixel count: " << diff_pixels_count; 73 LOG(ERROR) << "Images differ by pixel count: " << diff_pixels_count;
74 //WritePNGFile(gen_bmp, FilePath("/tmp/actual.png"));
73 return false; 75 return false;
74 } 76 }
75 77
76 return true; 78 return true;
77 } 79 }
78 80
79 } // namespace test 81 } // namespace test
80 } // namespace cc 82 } // namespace cc
81 83
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698