Removed the UTF16/Unicode functions
authorMatthew Leibowitz <mattleibow@live.com>
Thu, 12 May 2016 14:44:05 +0000 (16:44 +0200)
committerMatthew Leibowitz <mattleibow@live.com>
Thu, 12 May 2016 14:44:05 +0000 (16:44 +0200)
 - this is done in the managed code now
 - removes the need to change the paint instance

include/c/xamarin/sk_x_paint.h
src/c/xamarin/sk_x_paint.cpp

index 971e2a522d42a03ae69d76f5f02351003f0022bb..83948c531f126cafdc68fd0158b69182e03d6063 100644 (file)
@@ -98,34 +98,18 @@ SK_API void sk_paint_set_text_skew_x(sk_paint_t* cpaint, float skew);
  *  Return the number of bytes of text that were measured
  */
 SK_API size_t sk_paint_break_text(const sk_paint_t* cpaint, const void* text, size_t length, float maxWidth, float* measuredWidth);
-/**
- *  Return the number of bytes of text that were measured
- */
-SK_API size_t sk_paint_break_utf16_text(const sk_paint_t* cpaint, const void* text, size_t length, float maxWidth, float* measuredWidth);
 /**
  *  Return the width of the text
  */
 SK_API float sk_paint_measure_text(const sk_paint_t* cpaint, const void* text, size_t length, sk_rect_t* cbounds);
-/**
- *  Return the width of the UTF16 encoded text
- */
-SK_API float sk_paint_measure_utf16_text(sk_paint_t* cpaint, const void* text, size_t length, sk_rect_t* cbounds);
 /**
  *  Get the path outline of text.
  */
 SK_API sk_path_t* sk_paint_get_text_path(sk_paint_t* cpaint, const void* text, size_t length, float x, float y);
-/**
- *  Get the path outline of text.
- */
-SK_API sk_path_t* sk_paint_get_utf16_text_path(sk_paint_t* cpaint, const uint16_t *text, size_t lengthInChars, float x, float y);
 /**
  *  Get the path outline of text with each glyph positioned.
  */
 SK_API sk_path_t* sk_paint_get_pos_text_path(sk_paint_t* cpaint, const void* text, size_t length, const sk_point_t pos[]);
-/**
- *  Get the path outline of text with each glyph positioned.
- */
-SK_API sk_path_t* sk_paint_get_pos_utf16_text_path(sk_paint_t* cpaint, const uint16_t *text, size_t lengthInChars, const sk_point_t pos[]);
 /**
  * Return the recommend spacing between lines (which will be fDescent - fAscent + fLeading). 
  * Also get the font metrics for the current typeface and type size if cfontmetrics is not null.
index 6f699cf61545744568a8c3ce0ffa5f79606b9f0f..e1e96471bd73d08ed00c4e24e4f9073d2b24f4f3 100644 (file)
@@ -160,92 +160,22 @@ size_t sk_paint_break_text(const sk_paint_t* cpaint, const void* text, size_t le
     return AsPaint(cpaint)->breakText(text, length, maxWidth, measuredWidth);
 }
 
-size_t sk_paint_break_utf16_text(sk_paint_t* cpaint, const void* text, size_t length, float maxWidth, float* measuredWidth) {
-    SkPaint *paint = AsPaint(cpaint);
-    auto encoding = paint->getTextEncoding ();
-    int changed = 0;
-    if (encoding != SkPaint::kUTF16_TextEncoding){
-        changed = 1;
-        paint->setTextEncoding(SkPaint::kUTF16_TextEncoding);
-    }
-    auto ret = paint->breakText(text, length * sizeof(uint16_t), maxWidth, measuredWidth);
-    if (changed != 0){
-        paint->setTextEncoding(encoding);
-    }
-    return ret;
-}
-
 float sk_paint_measure_text(const sk_paint_t* cpaint, const void* text, size_t length, sk_rect_t* bounds) {
     return AsPaint(cpaint)->measureText(text, length, AsRect(bounds));
 }
 
-float sk_paint_measure_utf16_text(sk_paint_t* cpaint, const void* text, size_t length, sk_rect_t* bounds) {
-    SkPaint* paint = AsPaint(cpaint);
-    auto encoding = paint->getTextEncoding ();
-    int changed = 0;
-    if (encoding != SkPaint::kUTF16_TextEncoding){
-        changed = 1;
-        paint->setTextEncoding(SkPaint::kUTF16_TextEncoding);
-    }
-    auto ret = paint->measureText(text, length * sizeof(uint16_t), AsRect(bounds));
-    if (changed != 0){
-        paint->setTextEncoding(encoding);
-    }
-    return ret;
-}
-
 sk_path_t* sk_paint_get_text_path(sk_paint_t* cpaint, const void* text, size_t length, float x, float y) {
     SkPath* path = new SkPath();
     AsPaint(cpaint)->getTextPath(text, length, x, y, path);
     return ToPath(path);
 }
 
-sk_path_t* sk_paint_get_utf16_text_path(sk_paint_t* cpaint, const uint16_t *text, size_t lengthInChars, float x, float y) {
-    SkPaint* paint = AsPaint(cpaint);
-    SkPath* path = new SkPath();
-
-    auto encoding = paint->getTextEncoding();
-    int changed = 0;
-    if (encoding != SkPaint::kUTF16_TextEncoding) {
-        changed = 1;
-        paint->setTextEncoding(SkPaint::kUTF16_TextEncoding);
-    }
-
-    AsPaint(cpaint)->getTextPath(text, lengthInChars * sizeof(uint16_t), x, y, path);
-
-    if (changed != 0) {
-        paint->setTextEncoding(encoding);
-    }
-
-    return ToPath(path);
-}
-
 sk_path_t* sk_paint_get_pos_text_path(sk_paint_t* cpaint, const void* text, size_t length, const sk_point_t pos[]) {
     SkPath* path = new SkPath();
     AsPaint(cpaint)->getPosTextPath(text, length, reinterpret_cast<const SkPoint*>(pos), path);
     return ToPath(path);
 }
 
-sk_path_t* sk_paint_get_pos_utf16_text_path(sk_paint_t* cpaint, const uint16_t *text, size_t lengthInChars, const sk_point_t pos[]) {
-    SkPaint* paint = AsPaint(cpaint);
-    SkPath* path = new SkPath();
-
-    auto encoding = paint->getTextEncoding();
-    int changed = 0;
-    if (encoding != SkPaint::kUTF16_TextEncoding) {
-        changed = 1;
-        paint->setTextEncoding(SkPaint::kUTF16_TextEncoding);
-    }
-
-    AsPaint(cpaint)->getPosTextPath(text, lengthInChars * sizeof(uint16_t), reinterpret_cast<const SkPoint*>(pos), path);
-
-    if (changed != 0) {
-        paint->setTextEncoding(encoding);
-    }
-
-    return ToPath(path);
-}
-
 float sk_paint_get_fontmetrics(sk_paint_t* cpaint, sk_fontmetrics_t* cfontmetrics, float scale)
 {
     SkPaint *paint = AsPaint(cpaint);