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

Side by Side Diff: ppapi/cpp/dev/font_dev.cc

Issue 7237039: Remove PPBoolToBool and BoolToPPBool and use PP_FromBool and PP_ToBool instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 pp_text_run_.text = text_.pp_var(); 68 pp_text_run_.text = text_.pp_var();
69 pp_text_run_.rtl = PP_FALSE; 69 pp_text_run_.rtl = PP_FALSE;
70 pp_text_run_.override_direction = PP_FALSE; 70 pp_text_run_.override_direction = PP_FALSE;
71 } 71 }
72 72
73 TextRun_Dev::TextRun_Dev(const std::string& text, 73 TextRun_Dev::TextRun_Dev(const std::string& text,
74 bool rtl, 74 bool rtl,
75 bool override_direction) 75 bool override_direction)
76 : text_(text) { 76 : text_(text) {
77 pp_text_run_.text = text_.pp_var(); 77 pp_text_run_.text = text_.pp_var();
78 pp_text_run_.rtl = BoolToPPBool(rtl); 78 pp_text_run_.rtl = PP_FromBool(rtl);
79 pp_text_run_.override_direction = BoolToPPBool(override_direction); 79 pp_text_run_.override_direction = PP_FromBool(override_direction);
80 } 80 }
81 81
82 TextRun_Dev::TextRun_Dev(const TextRun_Dev& other) : text_(other.text_) { 82 TextRun_Dev::TextRun_Dev(const TextRun_Dev& other) : text_(other.text_) {
83 pp_text_run_.text = text_.pp_var(); 83 pp_text_run_.text = text_.pp_var();
84 pp_text_run_.rtl = other.pp_text_run_.rtl; 84 pp_text_run_.rtl = other.pp_text_run_.rtl;
85 pp_text_run_.override_direction = other.pp_text_run_.override_direction; 85 pp_text_run_.override_direction = other.pp_text_run_.override_direction;
86 } 86 }
87 87
88 TextRun_Dev::~TextRun_Dev() { 88 TextRun_Dev::~TextRun_Dev() {
89 } 89 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 bool image_data_is_opaque) const { 151 bool image_data_is_opaque) const {
152 if (!has_interface<PPB_Font_Dev>()) 152 if (!has_interface<PPB_Font_Dev>())
153 return false; 153 return false;
154 return PPBoolToBool(get_interface<PPB_Font_Dev>()->DrawTextAt( 154 return PPBoolToBool(get_interface<PPB_Font_Dev>()->DrawTextAt(
155 pp_resource(), 155 pp_resource(),
156 dest->pp_resource(), 156 dest->pp_resource(),
157 &text.pp_text_run(), 157 &text.pp_text_run(),
158 &position.pp_point(), 158 &position.pp_point(),
159 color, 159 color,
160 &clip.pp_rect(), 160 &clip.pp_rect(),
161 BoolToPPBool(image_data_is_opaque))); 161 PP_FromBool(image_data_is_opaque)));
162 } 162 }
163 163
164 int32_t Font_Dev::MeasureText(const TextRun_Dev& text) const { 164 int32_t Font_Dev::MeasureText(const TextRun_Dev& text) const {
165 if (!has_interface<PPB_Font_Dev>()) 165 if (!has_interface<PPB_Font_Dev>())
166 return -1; 166 return -1;
167 return get_interface<PPB_Font_Dev>()->MeasureText(pp_resource(), 167 return get_interface<PPB_Font_Dev>()->MeasureText(pp_resource(),
168 &text.pp_text_run()); 168 &text.pp_text_run());
169 } 169 }
170 170
171 uint32_t Font_Dev::CharacterOffsetForPixel(const TextRun_Dev& text, 171 uint32_t Font_Dev::CharacterOffsetForPixel(const TextRun_Dev& text,
(...skipping 20 matching lines...) Expand all
192 bool image_data_is_opaque) const { 192 bool image_data_is_opaque) const {
193 return DrawTextAt(dest, TextRun_Dev(text), position, color, 193 return DrawTextAt(dest, TextRun_Dev(text), position, color,
194 Rect(dest->size()), image_data_is_opaque); 194 Rect(dest->size()), image_data_is_opaque);
195 } 195 }
196 196
197 int32_t Font_Dev::MeasureSimpleText(const std::string& text) const { 197 int32_t Font_Dev::MeasureSimpleText(const std::string& text) const {
198 return MeasureText(TextRun_Dev(text)); 198 return MeasureText(TextRun_Dev(text));
199 } 199 }
200 200
201 } // namespace pp 201 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698