| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "embedders/openglui/common/canvas_state.h" | 5 #include "embedders/openglui/common/canvas_state.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "embedders/openglui/common/support.h" | 10 #include "embedders/openglui/common/support.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 int len = strlen(name); | 91 int len = strlen(name); |
| 92 while (pos < len && isspace(name[pos])) { | 92 while (pos < len && isspace(name[pos])) { |
| 93 ++pos; | 93 ++pos; |
| 94 } | 94 } |
| 95 name = name + pos; | 95 name = name + pos; |
| 96 } | 96 } |
| 97 SkTypeface *pTypeface = SkTypeface::CreateFromName(name, SkTypeface::kNormal); | 97 SkTypeface *pTypeface = SkTypeface::CreateFromName(name, SkTypeface::kNormal); |
| 98 paint_.setTypeface(pTypeface); | 98 paint_.setTypeface(pTypeface); |
| 99 paint_.setTextSize(size); | 99 paint_.setTextSize(size); |
| 100 pTypeface->unref(); | |
| 101 // TODO(gram): Must return a normalized font name incorporating size, so | 100 // TODO(gram): Must return a normalized font name incorporating size, so |
| 102 // callers can set the Dart canvas font name to an appropriate value. | 101 // callers can set the Dart canvas font name to an appropriate value. |
| 103 // Actually this may not be necessary in which case we can change this | 102 // Actually this may not be necessary in which case we can change this |
| 104 // method to return void. | 103 // method to return void. |
| 105 return rtn; | 104 return rtn; |
| 106 } | 105 } |
| 107 | 106 |
| 108 const char* CanvasState::setTextAlign(const char* align) { | 107 const char* CanvasState::setTextAlign(const char* align) { |
| 109 // TODO(gram): What about "start" and "end"? | 108 // TODO(gram): What about "start" and "end"? |
| 110 // I don't see any an analogs in Skia. | 109 // I don't see any an analogs in Skia. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 if (sw < 0) sw = bm.width(); | 289 if (sw < 0) sw = bm.width(); |
| 291 if (dw < 0) dw = bm.width(); | 290 if (dw < 0) dw = bm.width(); |
| 292 if (sh < 0) sh = bm.height(); | 291 if (sh < 0) sh = bm.height(); |
| 293 if (dh < 0) dh = bm.height(); | 292 if (dh < 0) dh = bm.height(); |
| 294 SkIRect src = SkIRect::MakeXYWH(sx, sy, sw, sh); | 293 SkIRect src = SkIRect::MakeXYWH(sx, sy, sw, sh); |
| 295 SkRect dst = SkRect::MakeXYWH(dx, dy, dw, dh); | 294 SkRect dst = SkRect::MakeXYWH(dx, dy, dw, dh); |
| 296 LOGI("DrawImage(_,%d,%d,%d,%d,%d,%d,%d,%d)", sx, sy, sw, sh, dx, dy, dw, dh); | 295 LOGI("DrawImage(_,%d,%d,%d,%d,%d,%d,%d,%d)", sx, sy, sw, sh, dx, dy, dw, dh); |
| 297 canvas_->drawBitmapRect(bm, &src, dst); | 296 canvas_->drawBitmapRect(bm, &src, dst); |
| 298 } | 297 } |
| 299 | 298 |
| OLD | NEW |