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

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

Issue 9360045: Rename PPB_Font to PPB_BrowserFont_Trusted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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
« no previous file with comments | « ppapi/thunk/ppb_font_api.h ('k') | ppapi/thunk/ppb_instance_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/thunk/thunk.h"
6 #include "ppapi/thunk/enter.h"
7 #include "ppapi/thunk/ppb_font_api.h"
8 #include "ppapi/thunk/resource_creation_api.h"
9
10 namespace ppapi {
11 namespace thunk {
12
13 namespace {
14
15 PP_Var GetFontFamilies(PP_Instance instance) {
16 EnterFunction<PPB_Font_FunctionAPI> enter(instance, true);
17 if (enter.failed())
18 return PP_MakeUndefined();
19 return enter.functions()->GetFontFamilies(instance);
20 }
21
22 PP_Resource Create(PP_Instance instance,
23 const PP_FontDescription_Dev* description) {
24 EnterFunction<ResourceCreationAPI> enter(instance, true);
25 if (enter.failed())
26 return 0;
27 return enter.functions()->CreateFontObject(instance, description);
28 }
29
30 PP_Bool IsFont(PP_Resource resource) {
31 EnterResource<PPB_Font_API> enter(resource, false);
32 return enter.succeeded() ? PP_TRUE : PP_FALSE;
33 }
34
35 PP_Bool Describe(PP_Resource font_id,
36 PP_FontDescription_Dev* description,
37 PP_FontMetrics_Dev* metrics) {
38 EnterResource<PPB_Font_API> enter(font_id, true);
39 if (enter.failed())
40 return PP_FALSE;
41 return enter.object()->Describe(description, metrics);
42 }
43
44 PP_Bool DrawTextAt(PP_Resource font_id,
45 PP_Resource image_data,
46 const PP_TextRun_Dev* text,
47 const PP_Point* position,
48 uint32_t color,
49 const PP_Rect* clip,
50 PP_Bool image_data_is_opaque) {
51 EnterResource<PPB_Font_API> enter(font_id, true);
52 if (enter.failed())
53 return PP_FALSE;
54 return enter.object()->DrawTextAt(image_data, text, position, color, clip,
55 image_data_is_opaque);
56 }
57
58 int32_t MeasureText(PP_Resource font_id, const PP_TextRun_Dev* text) {
59 EnterResource<PPB_Font_API> enter(font_id, true);
60 if (enter.failed())
61 return -1;
62 return enter.object()->MeasureText(text);
63 }
64
65 uint32_t CharacterOffsetForPixel(PP_Resource font_id,
66 const PP_TextRun_Dev* text,
67 int32_t pixel_position) {
68 EnterResource<PPB_Font_API> enter(font_id, true);
69 if (enter.failed())
70 return -1;
71 return enter.object()->CharacterOffsetForPixel(text, pixel_position);
72 }
73
74 int32_t PixelOffsetForCharacter(PP_Resource font_id,
75 const PP_TextRun_Dev* text,
76 uint32_t char_offset) {
77 EnterResource<PPB_Font_API> enter(font_id, true);
78 if (enter.failed())
79 return -1;
80 return enter.object()->PixelOffsetForCharacter(text, char_offset);
81 }
82
83 const PPB_Font_Dev g_ppb_font_thunk = {
84 &GetFontFamilies,
85 &Create,
86 &IsFont,
87 &Describe,
88 &DrawTextAt,
89 &MeasureText,
90 &CharacterOffsetForPixel,
91 &PixelOffsetForCharacter
92 };
93
94 } // namespace
95
96 const PPB_Font_Dev_0_6* GetPPB_Font_Dev_0_6_Thunk() {
97 return &g_ppb_font_thunk;
98 }
99
100 } // namespace thunk
101 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_font_api.h ('k') | ppapi/thunk/ppb_instance_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698