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

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

Issue 11418217: Add skia::RefPtr class to wrap ref counted classes from Skia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop TNoRef 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
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 = SkTypeface::CreateFromName(
63 FontTypefaceStyle(font)); 63 font.GetFontName().c_str(), FontTypefaceStyle(font));
64 SkPaint paint; 64 SkPaint paint;
65 paint.setTypeface(typeface); 65 paint.setTypeface(typeface.get());
66 typeface->unref();
67 paint.setColor(color); 66 paint.setColor(color);
68 canvas_->drawText(text.c_str(), 67 canvas_->drawText(text.c_str(),
69 text.size() * sizeof(string16::value_type), 68 text.size() * sizeof(string16::value_type),
70 text_bounds.x(), 69 text_bounds.x(),
71 text_bounds.bottom(), 70 text_bounds.bottom(),
72 paint); 71 paint);
73 } 72 }
74 73
75 void Canvas::DrawStringWithHalo(const string16& text, 74 void Canvas::DrawStringWithHalo(const string16& text,
76 const gfx::Font& font, 75 const gfx::Font& font,
77 SkColor text_color, 76 SkColor text_color,
78 SkColor halo_color, 77 SkColor halo_color,
79 int x, int y, int w, int h, 78 int x, int y, int w, int h,
80 int flags) { 79 int flags) {
81 } 80 }
82 81
83 } // namespace gfx 82 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698