| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "native_client/src/shared/ppapi_proxy/plugin_ppb_font.h" | 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_font.h" |
| 6 | 6 |
| 7 #include "native_client/src/include/nacl_scoped_ptr.h" | 7 #include "native_client/src/include/nacl_scoped_ptr.h" |
| 8 #include "native_client/src/include/portability.h" | 8 #include "native_client/src/include/portability.h" |
| 9 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" | 9 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" |
| 10 #include "native_client/src/shared/ppapi_proxy/plugin_callback.h" | 10 #include "native_client/src/shared/ppapi_proxy/plugin_callback.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 PpbFontRpcClient::PPB_Font_GetFontFamilies( | 46 PpbFontRpcClient::PPB_Font_GetFontFamilies( |
| 47 channel, | 47 channel, |
| 48 instance, | 48 instance, |
| 49 &var_size, | 49 &var_size, |
| 50 var_bytes.get()); | 50 var_bytes.get()); |
| 51 | 51 |
| 52 DebugPrintf("PPB_Font::GetFontFamilies: %s\n", | 52 DebugPrintf("PPB_Font::GetFontFamilies: %s\n", |
| 53 NaClSrpcErrorString(srpc_result)); | 53 NaClSrpcErrorString(srpc_result)); |
| 54 | 54 |
| 55 if (srpc_result == NACL_SRPC_RESULT_OK) | 55 if (srpc_result == NACL_SRPC_RESULT_OK) |
| 56 (void) DeserializeTo( | 56 (void) DeserializeTo(var_bytes.get(), var_size, 1, &font_families); |
| 57 channel, var_bytes.get(), var_size, 1, &font_families); | |
| 58 return font_families; | 57 return font_families; |
| 59 } | 58 } |
| 60 | 59 |
| 61 PP_Resource Create(PP_Instance instance, | 60 PP_Resource Create(PP_Instance instance, |
| 62 const struct PP_FontDescription_Dev* description) { | 61 const struct PP_FontDescription_Dev* description) { |
| 63 DebugPrintf("PPB_Font::Create: instance=%"NACL_PRIu32"\n", instance); | 62 DebugPrintf("PPB_Font::Create: instance=%"NACL_PRIu32"\n", instance); |
| 64 | 63 |
| 65 nacl_abi_size_t face_size = kMaxVarSize; | 64 nacl_abi_size_t face_size = kMaxVarSize; |
| 66 nacl::scoped_array<char> face_bytes( | 65 nacl::scoped_array<char> face_bytes( |
| 67 Serialize(&description->face, 1, &face_size)); | 66 Serialize(&description->face, 1, &face_size)); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 &face_size, | 122 &face_size, |
| 124 face_bytes.get(), | 123 face_bytes.get(), |
| 125 &metrics_size, | 124 &metrics_size, |
| 126 reinterpret_cast<char*>(metrics), | 125 reinterpret_cast<char*>(metrics), |
| 127 &success); | 126 &success); |
| 128 | 127 |
| 129 DebugPrintf("PPB_Font::Describe: %s\n", NaClSrpcErrorString(srpc_result)); | 128 DebugPrintf("PPB_Font::Describe: %s\n", NaClSrpcErrorString(srpc_result)); |
| 130 | 129 |
| 131 description->face = PP_MakeUndefined(); | 130 description->face = PP_MakeUndefined(); |
| 132 if (srpc_result == NACL_SRPC_RESULT_OK && success) { | 131 if (srpc_result == NACL_SRPC_RESULT_OK && success) { |
| 133 (void) DeserializeTo( | 132 (void) DeserializeTo(face_bytes.get(), face_size, 1, &description->face); |
| 134 channel, face_bytes.get(), face_size, 1, &description->face); | |
| 135 return PP_TRUE; | 133 return PP_TRUE; |
| 136 } | 134 } |
| 137 return PP_FALSE; | 135 return PP_FALSE; |
| 138 } | 136 } |
| 139 | 137 |
| 140 PP_Bool DrawTextAt(PP_Resource font, | 138 PP_Bool DrawTextAt(PP_Resource font, |
| 141 PP_Resource image_data, | 139 PP_Resource image_data, |
| 142 const struct PP_TextRun_Dev* text_run, | 140 const struct PP_TextRun_Dev* text_run, |
| 143 const struct PP_Point* position, | 141 const struct PP_Point* position, |
| 144 uint32_t color, | 142 uint32_t color, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 DrawTextAt, | 259 DrawTextAt, |
| 262 MeasureText, | 260 MeasureText, |
| 263 CharacterOffsetForPixel, | 261 CharacterOffsetForPixel, |
| 264 PixelOffsetForCharacter | 262 PixelOffsetForCharacter |
| 265 }; | 263 }; |
| 266 return &font_interface; | 264 return &font_interface; |
| 267 } | 265 } |
| 268 | 266 |
| 269 } // namespace ppapi_proxy | 267 } // namespace ppapi_proxy |
| 270 | 268 |
| OLD | NEW |