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

Side by Side Diff: ui/gfx/canvas_mac.mm

Issue 11299262: ui: Use skia::RefPtr<T> for implicit safe reference counting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: winbuild Created 8 years 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/platform_font_pango.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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 void Canvas::DrawStringWithShadows(const string16& text, 54 void Canvas::DrawStringWithShadows(const string16& text,
55 const gfx::Font& font, 55 const gfx::Font& font,
56 SkColor color, 56 SkColor color,
57 const gfx::Rect& text_bounds, 57 const gfx::Rect& text_bounds,
58 int flags, 58 int flags,
59 const ShadowValues& shadows) { 59 const ShadowValues& shadows) {
60 DLOG_IF(WARNING, !shadows.empty()) << "Text shadow not implemented."; 60 DLOG_IF(WARNING, !shadows.empty()) << "Text shadow not implemented.";
61 61
62 SkTypeface* typeface = SkTypeface::CreateFromName(font.GetFontName().c_str(), 62 skia::RefPtr<SkTypeface> typeface = skia::AdoptRef(
63 FontTypefaceStyle(font)); 63 SkTypeface::CreateFromName(
64 font.GetFontName().c_str(), FontTypefaceStyle(font)));
64 SkPaint paint; 65 SkPaint paint;
65 paint.setTypeface(typeface); 66 paint.setTypeface(typeface.get());
66 typeface->unref();
67 paint.setColor(color); 67 paint.setColor(color);
68 canvas_->drawText(text.c_str(), 68 canvas_->drawText(text.c_str(),
69 text.size() * sizeof(string16::value_type), 69 text.size() * sizeof(string16::value_type),
70 text_bounds.x(), 70 text_bounds.x(),
71 text_bounds.bottom(), 71 text_bounds.bottom(),
72 paint); 72 paint);
73 } 73 }
74 74
75 void Canvas::DrawStringWithHalo(const string16& text, 75 void Canvas::DrawStringWithHalo(const string16& text,
76 const gfx::Font& font, 76 const gfx::Font& font,
77 SkColor text_color, 77 SkColor text_color,
78 SkColor halo_color, 78 SkColor halo_color,
79 int x, int y, int w, int h, 79 int x, int y, int w, int h,
80 int flags) { 80 int flags) {
81 } 81 }
82 82
83 } // namespace gfx 83 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas.cc ('k') | ui/gfx/platform_font_pango.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698