| OLD | NEW |
| 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 "content/shell/renderer/webkit_test_runner.h" | 5 #include "content/shell/renderer/webkit_test_runner.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <clocale> | 8 #include <clocale> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 DCHECK_EQ(bitmap->config(), SkBitmap::kARGB_8888_Config); | 103 DCHECK_EQ(bitmap->config(), SkBitmap::kARGB_8888_Config); |
| 104 for (int y = 0; y < bitmap->height(); ++y) { | 104 for (int y = 0; y < bitmap->height(); ++y) { |
| 105 uint32_t* row = bitmap->getAddr32(0, y); | 105 uint32_t* row = bitmap->getAddr32(0, y); |
| 106 for (int x = 0; x < bitmap->width(); ++x) | 106 for (int x = 0; x < bitmap->width(); ++x) |
| 107 row[x] |= 0xFF000000; // Set alpha bits to 1. | 107 row[x] |= 0xFF000000; // Set alpha bits to 1. |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 #endif | 110 #endif |
| 111 | 111 |
| 112 void CopyCanvasToBitmap(SkCanvas* canvas, SkBitmap* snapshot) { | 112 void CopyCanvasToBitmap(SkCanvas* canvas, SkBitmap* snapshot) { |
| 113 SkDevice* device = skia::GetTopDevice(*canvas); | 113 SkBaseDevice* device = skia::GetTopDevice(*canvas); |
| 114 const SkBitmap& bitmap = device->accessBitmap(false); | 114 const SkBitmap& bitmap = device->accessBitmap(false); |
| 115 const bool success = bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config); | 115 const bool success = bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config); |
| 116 DCHECK(success); | 116 DCHECK(success); |
| 117 | 117 |
| 118 #if !defined(OS_MACOSX) | 118 #if !defined(OS_MACOSX) |
| 119 // Only the expected PNGs for Mac have a valid alpha channel. | 119 // Only the expected PNGs for Mac have a valid alpha channel. |
| 120 MakeBitmapOpaque(snapshot); | 120 MakeBitmapOpaque(snapshot); |
| 121 #endif | 121 #endif |
| 122 } | 122 } |
| 123 | 123 |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 WebURLRequest(GURL(kAboutBlankURL))); | 681 WebURLRequest(GURL(kAboutBlankURL))); |
| 682 Send(new ShellViewHostMsg_ResetDone(routing_id())); | 682 Send(new ShellViewHostMsg_ResetDone(routing_id())); |
| 683 } | 683 } |
| 684 | 684 |
| 685 void WebKitTestRunner::OnNotifyDone() { | 685 void WebKitTestRunner::OnNotifyDone() { |
| 686 render_view()->GetWebView()->mainFrame()->executeScript( | 686 render_view()->GetWebView()->mainFrame()->executeScript( |
| 687 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); | 687 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); |
| 688 } | 688 } |
| 689 | 689 |
| 690 } // namespace content | 690 } // namespace content |
| OLD | NEW |