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

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

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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 | « ui/gfx/geometry/cubic_bezier_unittest.cc ('k') | ui/gfx/icon_util.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/harfbuzz_font_skia.h" 5 #include "ui/gfx/harfbuzz_font_skia.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 base::LazyInstance<FontFuncs>::Leaky g_font_funcs = LAZY_INSTANCE_INITIALIZER; 209 base::LazyInstance<FontFuncs>::Leaky g_font_funcs = LAZY_INSTANCE_INITIALIZER;
210 210
211 // Returns the raw data of the font table |tag|. 211 // Returns the raw data of the font table |tag|.
212 hb_blob_t* GetFontTable(hb_face_t* face, hb_tag_t tag, void* user_data) { 212 hb_blob_t* GetFontTable(hb_face_t* face, hb_tag_t tag, void* user_data) {
213 SkTypeface* typeface = reinterpret_cast<SkTypeface*>(user_data); 213 SkTypeface* typeface = reinterpret_cast<SkTypeface*>(user_data);
214 214
215 const size_t table_size = typeface->getTableSize(tag); 215 const size_t table_size = typeface->getTableSize(tag);
216 if (!table_size) 216 if (!table_size)
217 return 0; 217 return 0;
218 218
219 scoped_ptr<char[]> buffer(new char[table_size]); 219 std::unique_ptr<char[]> buffer(new char[table_size]);
220 if (!buffer) 220 if (!buffer)
221 return 0; 221 return 0;
222 size_t actual_size = typeface->getTableData(tag, 0, table_size, buffer.get()); 222 size_t actual_size = typeface->getTableData(tag, 0, table_size, buffer.get());
223 if (table_size != actual_size) 223 if (table_size != actual_size)
224 return 0; 224 return 0;
225 225
226 char* buffer_raw = buffer.release(); 226 char* buffer_raw = buffer.release();
227 return hb_blob_create(buffer_raw, table_size, HB_MEMORY_MODE_WRITABLE, 227 return hb_blob_create(buffer_raw, table_size, HB_MEMORY_MODE_WRITABLE,
228 buffer_raw, DeleteArrayByType<char>); 228 buffer_raw, DeleteArrayByType<char>);
229 } 229 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // TODO(ckocagil): Do we need to update these params later? 280 // TODO(ckocagil): Do we need to update these params later?
281 internal::ApplyRenderParams(params, subpixel_rendering_suppressed, 281 internal::ApplyRenderParams(params, subpixel_rendering_suppressed,
282 &hb_font_data->paint_); 282 &hb_font_data->paint_);
283 hb_font_set_funcs(harfbuzz_font, g_font_funcs.Get().get(), hb_font_data, 283 hb_font_set_funcs(harfbuzz_font, g_font_funcs.Get().get(), hb_font_data,
284 DeleteByType<FontData>); 284 DeleteByType<FontData>);
285 hb_font_make_immutable(harfbuzz_font); 285 hb_font_make_immutable(harfbuzz_font);
286 return harfbuzz_font; 286 return harfbuzz_font;
287 } 287 }
288 288
289 } // namespace gfx 289 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/geometry/cubic_bezier_unittest.cc ('k') | ui/gfx/icon_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698