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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHelperPlugin.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHelperPlugin.h" |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPagePopup.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPagePopup.h" |
46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" |
47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" |
48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" |
49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
50 #include "third_party/skia/include/core/SkShader.h" | 50 #include "third_party/skia/include/core/SkShader.h" |
51 #include "ui/base/ui_base_switches.h" | 51 #include "ui/base/ui_base_switches.h" |
52 #include "ui/gfx/point.h" | 52 #include "ui/gfx/point.h" |
| 53 #include "ui/gfx/point_conversions.h" |
53 #include "ui/gfx/rect_conversions.h" | 54 #include "ui/gfx/rect_conversions.h" |
54 #include "ui/gfx/size_conversions.h" | 55 #include "ui/gfx/size_conversions.h" |
55 #include "ui/gfx/skia_util.h" | 56 #include "ui/gfx/skia_util.h" |
56 #include "ui/gl/gl_switches.h" | 57 #include "ui/gl/gl_switches.h" |
57 #include "ui/surface/transport_dib.h" | 58 #include "ui/surface/transport_dib.h" |
58 #include "webkit/glue/cursor_utils.h" | 59 #include "webkit/glue/cursor_utils.h" |
59 #include "webkit/glue/webkit_glue.h" | 60 #include "webkit/glue/webkit_glue.h" |
60 #include "webkit/plugins/npapi/webplugin.h" | 61 #include "webkit/plugins/npapi/webplugin.h" |
61 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 62 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
62 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" | 63 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 } else if (!is_accelerated_compositing_active_) { | 1229 } else if (!is_accelerated_compositing_active_) { |
1229 // Compute a buffer for painting and cache it. | 1230 // Compute a buffer for painting and cache it. |
1230 | 1231 |
1231 bool fractional_scale = device_scale_factor_ - | 1232 bool fractional_scale = device_scale_factor_ - |
1232 static_cast<int>(device_scale_factor_) != 0; | 1233 static_cast<int>(device_scale_factor_) != 0; |
1233 if (fractional_scale) { | 1234 if (fractional_scale) { |
1234 // Damage might not be DIP aligned. Inflate damage to compensate. | 1235 // Damage might not be DIP aligned. Inflate damage to compensate. |
1235 bounds.Inset(-1, -1); | 1236 bounds.Inset(-1, -1); |
1236 bounds.Intersect(gfx::Rect(size_)); | 1237 bounds.Intersect(gfx::Rect(size_)); |
1237 } | 1238 } |
1238 | 1239 // TODO: Migrate this sizing logic into backing store win/aura. |
1239 gfx::Rect pixel_bounds = gfx::ToEnclosingRect( | 1240 gfx::Rect pixel_bounds = gfx::Rect( |
1240 gfx::ScaleRect(bounds, device_scale_factor_)); | 1241 gfx::ToFlooredPoint( |
| 1242 gfx::ScalePoint(bounds.origin(),device_scale_factor_)), |
| 1243 gfx::ToCeiledSize(gfx::ScaleSize(bounds.size(),device_scale_factor_))); |
1241 | 1244 |
1242 scoped_ptr<skia::PlatformCanvas> canvas( | 1245 scoped_ptr<skia::PlatformCanvas> canvas( |
1243 RenderProcess::current()->GetDrawingCanvas(¤t_paint_buf_, | 1246 RenderProcess::current()->GetDrawingCanvas(¤t_paint_buf_, |
1244 pixel_bounds)); | 1247 pixel_bounds)); |
1245 if (!canvas) { | 1248 if (!canvas) { |
1246 NOTREACHED(); | 1249 NOTREACHED(); |
1247 return; | 1250 return; |
1248 } | 1251 } |
1249 | 1252 |
1250 // We may get back a smaller canvas than we asked for. | 1253 // We may get back a smaller canvas than we asked for. |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 | 2392 |
2390 if (!context->Initialize( | 2393 if (!context->Initialize( |
2391 attributes, | 2394 attributes, |
2392 false /* bind generates resources */, | 2395 false /* bind generates resources */, |
2393 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2396 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
2394 return NULL; | 2397 return NULL; |
2395 return context.release(); | 2398 return context.release(); |
2396 } | 2399 } |
2397 | 2400 |
2398 } // namespace content | 2401 } // namespace content |
OLD | NEW |