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

Side by Side Diff: ppapi/thunk/ppb_browser_font_trusted_thunk.cc

Issue 238923007: PPAPI: Format ppapi/thunk using clang-format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use Popen instead, force carriage returns in thunks Created 6 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 | 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 #include "ppapi/thunk/thunk.h" 5 #include "ppapi/thunk/thunk.h"
6 #include "ppapi/thunk/enter.h" 6 #include "ppapi/thunk/enter.h"
7 #include "ppapi/thunk/ppb_browser_font_singleton_api.h" 7 #include "ppapi/thunk/ppb_browser_font_singleton_api.h"
8 #include "ppapi/thunk/ppb_browser_font_trusted_api.h" 8 #include "ppapi/thunk/ppb_browser_font_trusted_api.h"
9 #include "ppapi/thunk/resource_creation_api.h" 9 #include "ppapi/thunk/resource_creation_api.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 PP_Bool DrawTextAt(PP_Resource font_id, 47 PP_Bool DrawTextAt(PP_Resource font_id,
48 PP_Resource image_data, 48 PP_Resource image_data,
49 const PP_BrowserFont_Trusted_TextRun* text, 49 const PP_BrowserFont_Trusted_TextRun* text,
50 const PP_Point* position, 50 const PP_Point* position,
51 uint32_t color, 51 uint32_t color,
52 const PP_Rect* clip, 52 const PP_Rect* clip,
53 PP_Bool image_data_is_opaque) { 53 PP_Bool image_data_is_opaque) {
54 EnterBrowserFont enter(font_id, true); 54 EnterBrowserFont enter(font_id, true);
55 if (enter.failed()) 55 if (enter.failed())
56 return PP_FALSE; 56 return PP_FALSE;
57 return enter.object()->DrawTextAt(image_data, text, position, color, clip, 57 return enter.object()->DrawTextAt(
58 image_data_is_opaque); 58 image_data, text, position, color, clip, image_data_is_opaque);
59 } 59 }
60 60
61 int32_t MeasureText(PP_Resource font_id, 61 int32_t MeasureText(PP_Resource font_id,
62 const PP_BrowserFont_Trusted_TextRun* text) { 62 const PP_BrowserFont_Trusted_TextRun* text) {
63 EnterBrowserFont enter(font_id, true); 63 EnterBrowserFont enter(font_id, true);
64 if (enter.failed()) 64 if (enter.failed())
65 return -1; 65 return -1;
66 return enter.object()->MeasureText(text); 66 return enter.object()->MeasureText(text);
67 } 67 }
68 68
69 uint32_t CharacterOffsetForPixel(PP_Resource font_id, 69 uint32_t CharacterOffsetForPixel(PP_Resource font_id,
70 const PP_BrowserFont_Trusted_TextRun* text, 70 const PP_BrowserFont_Trusted_TextRun* text,
71 int32_t pixel_position) { 71 int32_t pixel_position) {
72 EnterBrowserFont enter(font_id, true); 72 EnterBrowserFont enter(font_id, true);
73 if (enter.failed()) 73 if (enter.failed())
74 return -1; 74 return -1;
75 return enter.object()->CharacterOffsetForPixel(text, pixel_position); 75 return enter.object()->CharacterOffsetForPixel(text, pixel_position);
76 } 76 }
77 77
78 int32_t PixelOffsetForCharacter(PP_Resource font_id, 78 int32_t PixelOffsetForCharacter(PP_Resource font_id,
79 const PP_BrowserFont_Trusted_TextRun* text, 79 const PP_BrowserFont_Trusted_TextRun* text,
80 uint32_t char_offset) { 80 uint32_t char_offset) {
81 EnterBrowserFont enter(font_id, true); 81 EnterBrowserFont enter(font_id, true);
82 if (enter.failed()) 82 if (enter.failed())
83 return -1; 83 return -1;
84 return enter.object()->PixelOffsetForCharacter(text, char_offset); 84 return enter.object()->PixelOffsetForCharacter(text, char_offset);
85 } 85 }
86 86
87 const PPB_BrowserFont_Trusted_1_0 g_ppb_browser_font_trusted_thunk = { 87 const PPB_BrowserFont_Trusted_1_0 g_ppb_browser_font_trusted_thunk = {
88 &GetFontFamilies, 88 &GetFontFamilies, &Create, &IsBrowserFont,
89 &Create, 89 &Describe, &DrawTextAt, &MeasureText,
90 &IsBrowserFont, 90 &CharacterOffsetForPixel, &PixelOffsetForCharacter};
91 &Describe,
92 &DrawTextAt,
93 &MeasureText,
94 &CharacterOffsetForPixel,
95 &PixelOffsetForCharacter
96 };
97 91
98 } // namespace 92 } // namespace
99 93
100 const PPB_BrowserFont_Trusted_1_0* GetPPB_BrowserFont_Trusted_1_0_Thunk() { 94 const PPB_BrowserFont_Trusted_1_0* GetPPB_BrowserFont_Trusted_1_0_Thunk() {
101 return &g_ppb_browser_font_trusted_thunk; 95 return &g_ppb_browser_font_trusted_thunk;
102 } 96 }
103 97
104 } // namespace thunk 98 } // namespace thunk
105 } // namespace ppapi 99 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698