| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cpp/dev/font_dev.h" | 5 #include "ppapi/cpp/dev/font_dev.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ppapi/cpp/common.h" | 9 #include "ppapi/cpp/common.h" |
| 10 #include "ppapi/cpp/image_data.h" | 10 #include "ppapi/cpp/image_data.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 Font_Dev::Font_Dev(const Font_Dev& other) : Resource(other) { | 113 Font_Dev::Font_Dev(const Font_Dev& other) : Resource(other) { |
| 114 } | 114 } |
| 115 | 115 |
| 116 Font_Dev& Font_Dev::operator=(const Font_Dev& other) { | 116 Font_Dev& Font_Dev::operator=(const Font_Dev& other) { |
| 117 Resource::operator=(other); | 117 Resource::operator=(other); |
| 118 return *this; | 118 return *this; |
| 119 } | 119 } |
| 120 | 120 |
| 121 // static |
| 122 Var Font_Dev::GetFontFamilies(Instance* instance) { |
| 123 if (!has_interface<PPB_Font_Dev>()) |
| 124 return Var(); |
| 125 return Var(Var::PassRef(), |
| 126 get_interface<PPB_Font_Dev>()->GetFontFamilies( |
| 127 instance->pp_instance())); |
| 128 } |
| 129 |
| 121 bool Font_Dev::Describe(FontDescription_Dev* description, | 130 bool Font_Dev::Describe(FontDescription_Dev* description, |
| 122 PP_FontMetrics_Dev* metrics) const { | 131 PP_FontMetrics_Dev* metrics) const { |
| 123 if (!has_interface<PPB_Font_Dev>()) | 132 if (!has_interface<PPB_Font_Dev>()) |
| 124 return false; | 133 return false; |
| 125 | 134 |
| 126 // Be careful with ownership of the |face| string. It will come back with | 135 // Be careful with ownership of the |face| string. It will come back with |
| 127 // a ref of 1, which we want to assign to the |face_| member of the C++ class. | 136 // a ref of 1, which we want to assign to the |face_| member of the C++ class. |
| 128 if (!get_interface<PPB_Font_Dev>()->Describe( | 137 if (!get_interface<PPB_Font_Dev>()->Describe( |
| 129 pp_resource(), &description->pp_font_description_, metrics)) | 138 pp_resource(), &description->pp_font_description_, metrics)) |
| 130 return false; | 139 return false; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 bool image_data_is_opaque) const { | 192 bool image_data_is_opaque) const { |
| 184 return DrawTextAt(dest, TextRun_Dev(text), position, color, | 193 return DrawTextAt(dest, TextRun_Dev(text), position, color, |
| 185 Rect(dest->size()), image_data_is_opaque); | 194 Rect(dest->size()), image_data_is_opaque); |
| 186 } | 195 } |
| 187 | 196 |
| 188 int32_t Font_Dev::MeasureSimpleText(const std::string& text) const { | 197 int32_t Font_Dev::MeasureSimpleText(const std::string& text) const { |
| 189 return MeasureText(TextRun_Dev(text)); | 198 return MeasureText(TextRun_Dev(text)); |
| 190 } | 199 } |
| 191 | 200 |
| 192 } // namespace pp | 201 } // namespace pp |
| OLD | NEW |