Chromium Code Reviews| 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" | 88 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" |
| 89 #include "chrome/renderer/webplugin_delegate_pepper.h" | 89 #include "chrome/renderer/webplugin_delegate_pepper.h" |
| 90 #include "chrome/renderer/webplugin_delegate_proxy.h" | 90 #include "chrome/renderer/webplugin_delegate_proxy.h" |
| 91 #include "chrome/renderer/websharedworker_proxy.h" | 91 #include "chrome/renderer/websharedworker_proxy.h" |
| 92 #include "chrome/renderer/webworker_proxy.h" | 92 #include "chrome/renderer/webworker_proxy.h" |
| 93 #include "gfx/color_utils.h" | 93 #include "gfx/color_utils.h" |
| 94 #include "gfx/favicon_size.h" | 94 #include "gfx/favicon_size.h" |
| 95 #include "gfx/native_widget_types.h" | 95 #include "gfx/native_widget_types.h" |
| 96 #include "gfx/point.h" | 96 #include "gfx/point.h" |
| 97 #include "gfx/rect.h" | 97 #include "gfx/rect.h" |
| 98 #include "gfx/skbitmap_operations.h" | |
| 98 #include "grit/generated_resources.h" | 99 #include "grit/generated_resources.h" |
| 99 #include "grit/renderer_resources.h" | 100 #include "grit/renderer_resources.h" |
| 100 #include "media/base/media_switches.h" | 101 #include "media/base/media_switches.h" |
| 101 #include "net/base/data_url.h" | 102 #include "net/base/data_url.h" |
| 102 #include "net/base/escape.h" | 103 #include "net/base/escape.h" |
| 103 #include "net/base/net_errors.h" | 104 #include "net/base/net_errors.h" |
| 104 #include "skia/ext/bitmap_platform_device.h" | 105 #include "skia/ext/bitmap_platform_device.h" |
| 105 #include "skia/ext/image_operations.h" | 106 #include "skia/ext/image_operations.h" |
| 106 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h" | 107 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h" |
| 107 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" | 108 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1098 static_cast<S16CPU>(src_bmp.width() / dest_aspect)); | 1099 static_cast<S16CPU>(src_bmp.width() / dest_aspect)); |
| 1099 score->good_clipping = true; | 1100 score->good_clipping = true; |
| 1100 } | 1101 } |
| 1101 } | 1102 } |
| 1102 | 1103 |
| 1103 score->at_top = (view->mainFrame()->scrollOffset().height == 0); | 1104 score->at_top = (view->mainFrame()->scrollOffset().height == 0); |
| 1104 | 1105 |
| 1105 SkBitmap subset; | 1106 SkBitmap subset; |
| 1106 device.accessBitmap(false).extractSubset(&subset, src_rect); | 1107 device.accessBitmap(false).extractSubset(&subset, src_rect); |
| 1107 | 1108 |
| 1108 // Resample the subset that we want to get it the right size. | 1109 // First do a fast downsample by powers of two to get close to the final size. |
| 1110 SkBitmap downsampledSubset = | |
|
brettw
2010/11/12 07:05:57
Le style Goog: downsampled_subset
| |
| 1111 SkBitmapOperations::DownsampleByTwoUntilSize(subset, w, h); | |
| 1112 | |
| 1113 // Do a high-quality resize from the downscaled size to the final size. | |
| 1109 *thumbnail = skia::ImageOperations::Resize( | 1114 *thumbnail = skia::ImageOperations::Resize( |
| 1110 subset, skia::ImageOperations::RESIZE_LANCZOS3, w, h); | 1115 downsampledSubset, skia::ImageOperations::RESIZE_LANCZOS3, w, h); |
| 1111 | 1116 |
| 1112 score->boring_score = CalculateBoringScore(thumbnail); | 1117 score->boring_score = CalculateBoringScore(thumbnail); |
| 1113 | 1118 |
| 1114 HISTOGRAM_TIMES("Renderer4.Thumbnail", | 1119 HISTOGRAM_TIMES("Renderer4.Thumbnail", |
| 1115 base::TimeTicks::Now() - beginning_time); | 1120 base::TimeTicks::Now() - beginning_time); |
| 1121 | |
| 1116 return true; | 1122 return true; |
| 1117 } | 1123 } |
| 1118 | 1124 |
| 1119 bool RenderView::CaptureSnapshot(WebView* view, SkBitmap* snapshot) { | 1125 bool RenderView::CaptureSnapshot(WebView* view, SkBitmap* snapshot) { |
| 1120 base::TimeTicks beginning_time = base::TimeTicks::Now(); | 1126 base::TimeTicks beginning_time = base::TimeTicks::Now(); |
| 1121 | 1127 |
| 1122 skia::PlatformCanvas canvas; | 1128 skia::PlatformCanvas canvas; |
| 1123 if (!PaintViewIntoCanvas(view, canvas)) | 1129 if (!PaintViewIntoCanvas(view, canvas)) |
| 1124 return false; | 1130 return false; |
| 1125 | 1131 |
| (...skipping 4354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5480 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), | 5486 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), |
| 5481 message_id); | 5487 message_id); |
| 5482 } | 5488 } |
| 5483 | 5489 |
| 5484 #if defined(OS_MACOSX) | 5490 #if defined(OS_MACOSX) |
| 5485 void RenderView::OnSelectPopupMenuItem(int selected_index) { | 5491 void RenderView::OnSelectPopupMenuItem(int selected_index) { |
| 5486 external_popup_menu_->DidSelectItem(selected_index); | 5492 external_popup_menu_->DidSelectItem(selected_index); |
| 5487 external_popup_menu_.reset(); | 5493 external_popup_menu_.reset(); |
| 5488 } | 5494 } |
| 5489 #endif | 5495 #endif |
| OLD | NEW |