OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/surface/transport_dib.h" | 5 #include "app/surface/transport_dib.h" |
6 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/ref_counted_memory.h" | 9 #include "base/ref_counted_memory.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 if (argb_color == *bitmap.getAddr32(x, y)) { | 121 if (argb_color == *bitmap.getAddr32(x, y)) { |
122 return true; | 122 return true; |
123 } | 123 } |
124 } | 124 } |
125 } | 125 } |
126 return false; | 126 return false; |
127 } | 127 } |
128 | 128 |
129 void RenderWidgetTest::OutputBitmapToFile(const SkBitmap& bitmap, | 129 void RenderWidgetTest::OutputBitmapToFile(const SkBitmap& bitmap, |
130 const FilePath& file_path) { | 130 const FilePath& file_path) { |
131 scoped_refptr<RefCountedBytes> bitmap_data = new RefCountedBytes(); | 131 scoped_refptr<RefCountedBytes> bitmap_data(new RefCountedBytes()); |
132 SkAutoLockPixels lock(bitmap); | 132 SkAutoLockPixels lock(bitmap); |
133 ASSERT_TRUE(gfx::JPEGCodec::Encode( | 133 ASSERT_TRUE(gfx::JPEGCodec::Encode( |
134 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), | 134 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), |
135 gfx::JPEGCodec::FORMAT_BGRA, | 135 gfx::JPEGCodec::FORMAT_BGRA, |
136 bitmap.width(), | 136 bitmap.width(), |
137 bitmap.height(), | 137 bitmap.height(), |
138 static_cast<int>(bitmap.rowBytes()), | 138 static_cast<int>(bitmap.rowBytes()), |
139 90 /* quality */, | 139 90 /* quality */, |
140 &bitmap_data->data)); | 140 &bitmap_data->data)); |
141 ASSERT_LT(0, file_util::WriteFile( | 141 ASSERT_LT(0, file_util::WriteFile( |
142 file_path, | 142 file_path, |
143 reinterpret_cast<const char*>(bitmap_data->front()), | 143 reinterpret_cast<const char*>(bitmap_data->front()), |
144 bitmap_data->size())); | 144 bitmap_data->size())); |
145 } | 145 } |
146 | 146 |
147 TEST_F(RenderWidgetTest, OnMsgPaintAtSize) { | 147 TEST_F(RenderWidgetTest, OnMsgPaintAtSize) { |
148 TestResizeAndPaint(); | 148 TestResizeAndPaint(); |
149 } | 149 } |
OLD | NEW |