Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: ui/gfx/canvas_paint_win.h

Issue 17505003: Rounding error in HiDPI canvas. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef UI_GFX_CANVAS_PAINT_WIN_H_ 5 #ifndef UI_GFX_CANVAS_PAINT_WIN_H_
6 #define UI_GFX_CANVAS_PAINT_WIN_H_ 6 #define UI_GFX_CANVAS_PAINT_WIN_H_
7 7
8 #include "skia/ext/platform_canvas.h" 8 #include "skia/ext/platform_canvas.h"
9 #include "ui/base/win/dpi.h" 9 #include "ui/base/win/dpi.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 RecreateBackingCanvas(gfx::Size(width, height), 114 RecreateBackingCanvas(gfx::Size(width, height),
115 ui::GetScaleFactorFromScale(ui::win::GetDeviceScaleFactor()), 115 ui::GetScaleFactorFromScale(ui::win::GetDeviceScaleFactor()),
116 opaque); 116 opaque);
117 skia::PlatformCanvas* canvas = platform_canvas(); 117 skia::PlatformCanvas* canvas = platform_canvas();
118 118
119 canvas->clear(SkColorSetARGB(0, 0, 0, 0)); 119 canvas->clear(SkColorSetARGB(0, 0, 0, 0));
120 120
121 // This will bring the canvas into the screen coordinate system for the 121 // This will bring the canvas into the screen coordinate system for the
122 // dirty rect 122 // dirty rect
123 canvas->translate( 123 canvas->translate(
124 SkScalarRoundToInt(-ps_.rcPaint.left/ui::win::GetDeviceScaleFactor()), 124 -ps_.rcPaint.left/ui::win::GetDeviceScaleFactor(),
125 SkScalarRoundToInt(-ps_.rcPaint.top/ui::win::GetDeviceScaleFactor())); 125 -ps_.rcPaint.top/ui::win::GetDeviceScaleFactor());
126 } 126 }
127 127
128 // If true, this canvas was created for a BeginPaint. 128 // If true, this canvas was created for a BeginPaint.
129 const bool for_paint_; 129 const bool for_paint_;
130 130
131 // Disallow copy and assign. 131 // Disallow copy and assign.
132 CanvasSkiaPaint(const CanvasSkiaPaint&); 132 CanvasSkiaPaint(const CanvasSkiaPaint&);
133 CanvasSkiaPaint& operator=(const CanvasSkiaPaint&); 133 CanvasSkiaPaint& operator=(const CanvasSkiaPaint&);
134 }; 134 };
135 135
136 } // namespace gfx 136 } // namespace gfx
137 137
138 #endif // UI_GFX_CANVAS_PAINT_WIN_H_ 138 #endif // UI_GFX_CANVAS_PAINT_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698