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

Side by Side Diff: ui/gfx/canvas_paint_gtk.cc

Issue 11138024: Simplify platform_canvas.h by recognizing that PlatformCanvas does not actually extend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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 | « ui/gfx/canvas.cc ('k') | ui/gfx/canvas_paint_win.h » ('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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/gfx/canvas_skia_paint.h" 8 #include "ui/gfx/canvas_skia_paint.h"
9 #include "ui/gfx/rect.h" 9 #include "ui/gfx/rect.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 gdk_cairo_region(cr, region_); 45 gdk_cairo_region(cr, region_);
46 cairo_fill(cr); 46 cairo_fill(cr);
47 cairo_destroy(cr); 47 cairo_destroy(cr);
48 } 48 }
49 49
50 gdk_region_destroy(region_); 50 gdk_region_destroy(region_);
51 } 51 }
52 52
53 void CanvasSkiaPaint::Init(bool opaque) { 53 void CanvasSkiaPaint::Init(bool opaque) {
54 GdkRectangle bounds = rectangle(); 54 GdkRectangle bounds = rectangle();
55 RecreateBackingCanvas(gfx::Size(bounds.width, bounds.height),
56 ui::SCALE_FACTOR_100P, opaque);
57
55 skia::PlatformCanvas* canvas = platform_canvas(); 58 skia::PlatformCanvas* canvas = platform_canvas();
56 if (!canvas->initialize(bounds.width, bounds.height, opaque, NULL)) {
57 // Cause a deliberate crash;
58 CHECK(false);
59 }
60 // No need to clear the canvas, because cairo automatically performs the
61 // clear.
62 59
63 // Need to translate so that the dirty region appears at the origin of the 60 // Need to translate so that the dirty region appears at the origin of the
64 // surface. 61 // surface.
65 canvas->translate(-SkIntToScalar(bounds.x), -SkIntToScalar(bounds.y)); 62 canvas->translate(-SkIntToScalar(bounds.x), -SkIntToScalar(bounds.y));
66 63
67 context_ = skia::BeginPlatformPaint(canvas); 64 context_ = skia::BeginPlatformPaint(canvas);
68 } 65 }
69 66
70 } // namespace gfx 67 } // namespace gfx
71 68
72 69
OLDNEW
« no previous file with comments | « ui/gfx/canvas.cc ('k') | ui/gfx/canvas_paint_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698