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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1182 // Compute a buffer for painting and cache it. | 1182 // Compute a buffer for painting and cache it. |
1183 | 1183 |
1184 bool fractional_scale = device_scale_factor_ - | 1184 bool fractional_scale = device_scale_factor_ - |
1185 static_cast<int>(device_scale_factor_) != 0; | 1185 static_cast<int>(device_scale_factor_) != 0; |
1186 if (fractional_scale) { | 1186 if (fractional_scale) { |
1187 // Damage might not be DIP aligned. Inflate damage to compensate. | 1187 // Damage might not be DIP aligned. Inflate damage to compensate. |
1188 bounds.Inset(-1, -1); | 1188 bounds.Inset(-1, -1); |
1189 bounds.Intersect(gfx::Rect(size_)); | 1189 bounds.Intersect(gfx::Rect(size_)); |
1190 } | 1190 } |
1191 | 1191 |
1192 gfx::Rect pixel_bounds = gfx::ToEnclosingRect( | 1192 gfx::Rect pixel_bounds = gfx::ToSizedRect( |
1193 gfx::ScaleRect(bounds, device_scale_factor_)); | 1193 gfx::ScaleRect(bounds, device_scale_factor_)); |
kevers
2013/04/19 20:31:42
Will need to test in Win-Aura with non-integer sca
| |
1194 | 1194 |
1195 scoped_ptr<skia::PlatformCanvas> canvas( | 1195 scoped_ptr<skia::PlatformCanvas> canvas( |
1196 RenderProcess::current()->GetDrawingCanvas(¤t_paint_buf_, | 1196 RenderProcess::current()->GetDrawingCanvas(¤t_paint_buf_, |
1197 pixel_bounds)); | 1197 pixel_bounds)); |
1198 if (!canvas) { | 1198 if (!canvas) { |
1199 NOTREACHED(); | 1199 NOTREACHED(); |
1200 return; | 1200 return; |
1201 } | 1201 } |
1202 | 1202 |
1203 // We may get back a smaller canvas than we asked for. | 1203 // We may get back a smaller canvas than we asked for. |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2315 | 2315 |
2316 if (!context->Initialize( | 2316 if (!context->Initialize( |
2317 attributes, | 2317 attributes, |
2318 false /* bind generates resources */, | 2318 false /* bind generates resources */, |
2319 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) | 2319 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) |
2320 return NULL; | 2320 return NULL; |
2321 return context.release(); | 2321 return context.release(); |
2322 } | 2322 } |
2323 | 2323 |
2324 } // namespace content | 2324 } // namespace content |
OLD | NEW |