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

Side by Side Diff: trunk/src/ui/gfx/canvas_paint_mac.mm

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/ui/gfx/canvas_paint_gtk.cc ('k') | trunk/src/ui/gfx/canvas_paint_win.cc » ('j') | 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) 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 "ui/gfx/canvas_paint_mac.h" 5 #include "ui/gfx/canvas_paint_mac.h"
6 #include "ui/gfx/size.h" 6 #include "ui/gfx/size.h"
7 7
8 namespace gfx { 8 namespace gfx {
9 9
10 CanvasSkiaPaint::CanvasSkiaPaint(NSRect dirtyRect) 10 CanvasSkiaPaint::CanvasSkiaPaint(NSRect dirtyRect)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 void CanvasSkiaPaint::Init(bool opaque) { 53 void CanvasSkiaPaint::Init(bool opaque) {
54 CGContextRef destination_context = 54 CGContextRef destination_context =
55 (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; 55 (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
56 CGRect scaled_unit_rect = CGContextConvertRectToDeviceSpace( 56 CGRect scaled_unit_rect = CGContextConvertRectToDeviceSpace(
57 destination_context, CGRectMake(0, 0, 1, 1)); 57 destination_context, CGRectMake(0, 0, 1, 1));
58 // Assume that the x scale and the y scale are the same. 58 // Assume that the x scale and the y scale are the same.
59 CGFloat scale = scaled_unit_rect.size.width; 59 CGFloat scale = scaled_unit_rect.size.width;
60 60
61 ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale(scale);
61 gfx::Size size(NSWidth(rectangle_), NSHeight(rectangle_)); 62 gfx::Size size(NSWidth(rectangle_), NSHeight(rectangle_));
62 RecreateBackingCanvas(size, scale, opaque); 63 RecreateBackingCanvas(size, scale_factor, opaque);
63 skia::PlatformCanvas* canvas = platform_canvas(); 64 skia::PlatformCanvas* canvas = platform_canvas();
64 canvas->clear(SkColorSetARGB(0, 0, 0, 0)); 65 canvas->clear(SkColorSetARGB(0, 0, 0, 0));
65 66
66 // Need to translate so that the dirty region appears at the origin of the 67 // Need to translate so that the dirty region appears at the origin of the
67 // surface. 68 // surface.
68 canvas->translate(-SkDoubleToScalar(NSMinX(rectangle_)), 69 canvas->translate(-SkDoubleToScalar(NSMinX(rectangle_)),
69 -SkDoubleToScalar(NSMinY(rectangle_))); 70 -SkDoubleToScalar(NSMinY(rectangle_)));
70 71
71 context_ = skia::GetBitmapContext(skia::GetTopDevice(*canvas)); 72 context_ = skia::GetBitmapContext(skia::GetTopDevice(*canvas));
72 } 73 }
73 74
74 } // namespace skia 75 } // namespace skia
75 76
76 77
OLDNEW
« no previous file with comments | « trunk/src/ui/gfx/canvas_paint_gtk.cc ('k') | trunk/src/ui/gfx/canvas_paint_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698