OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/pdf/pdf_browsertest_base.h" | 5 #include "chrome/browser/ui/pdf/pdf_browsertest_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 scoped_ptr<char[]> data(new char[size]); | 126 scoped_ptr<char[]> data(new char[size]); |
127 ASSERT_EQ(size, base::ReadFile(reference, data.get(), size)); | 127 ASSERT_EQ(size, base::ReadFile(reference, data.get(), size)); |
128 | 128 |
129 int w, h; | 129 int w, h; |
130 std::vector<unsigned char> decoded; | 130 std::vector<unsigned char> decoded; |
131 ASSERT_TRUE(gfx::PNGCodec::Decode( | 131 ASSERT_TRUE(gfx::PNGCodec::Decode( |
132 reinterpret_cast<unsigned char*>(data.get()), size, | 132 reinterpret_cast<unsigned char*>(data.get()), size, |
133 gfx::PNGCodec::FORMAT_BGRA, &decoded, &w, &h)); | 133 gfx::PNGCodec::FORMAT_BGRA, &decoded, &w, &h)); |
134 int32* ref_pixels = reinterpret_cast<int32*>(&decoded[0]); | 134 int32* ref_pixels = reinterpret_cast<int32*>(&decoded[0]); |
135 | 135 |
| 136 SkAutoLockPixels lock_image(bitmap); |
136 int32* pixels = static_cast<int32*>(bitmap.getPixels()); | 137 int32* pixels = static_cast<int32*>(bitmap.getPixels()); |
137 | 138 |
138 // Get the background color, and use it to figure out the x-offsets in | 139 // Get the background color, and use it to figure out the x-offsets in |
139 // each image. The reason is that depending on the theme in the OS, the | 140 // each image. The reason is that depending on the theme in the OS, the |
140 // same browser width can lead to slightly different plugin sizes, so the | 141 // same browser width can lead to slightly different plugin sizes, so the |
141 // pdf content will start at different x offsets. | 142 // pdf content will start at different x offsets. |
142 // Also note that the images we saved are cut off before the scrollbar, as | 143 // Also note that the images we saved are cut off before the scrollbar, as |
143 // that'll change depending on the theme, and also cut off vertically so | 144 // that'll change depending on the theme, and also cut off vertically so |
144 // that the ui controls don't show up, as those fade-in and so the timing | 145 // that the ui controls don't show up, as those fade-in and so the timing |
145 // will affect their transparency. | 146 // will affect their transparency. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // Calling RenderWidgetHost::CopyFromBackingStore() with the GPU enabled | 195 // Calling RenderWidgetHost::CopyFromBackingStore() with the GPU enabled |
195 // fails on Linux. | 196 // fails on Linux. |
196 command_line->AppendSwitch(switches::kDisableGpu); | 197 command_line->AppendSwitch(switches::kDisableGpu); |
197 #endif | 198 #endif |
198 | 199 |
199 #if defined(OS_CHROMEOS) | 200 #if defined(OS_CHROMEOS) |
200 // Also need on CrOS in addition to disabling the GPU above. | 201 // Also need on CrOS in addition to disabling the GPU above. |
201 command_line->AppendSwitch(switches::kUIDisableThreadedCompositing); | 202 command_line->AppendSwitch(switches::kUIDisableThreadedCompositing); |
202 #endif | 203 #endif |
203 } | 204 } |
OLD | NEW |