Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
external_skia
Commits
7249c95f
Commit
7249c95f
authored
13 years ago
by
Romain Guy
Browse files
Options
Download
Email Patches
Plain Diff
Add new utfToGlyphs API for GL renderer
Bug #6408362 Change-Id: I69c21d9aeeb663aa6244132ce8d598be888886e2
parent
7c6d54cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
include/core/SkPaint.h
include/core/SkPaint.h
+3
-0
src/core/SkPaint.cpp
src/core/SkPaint.cpp
+31
-0
No files found.
include/core/SkPaint.h
View file @
7249c95f
...
...
@@ -870,6 +870,9 @@ public:
/** Returns the base glyph count for the strike associated with this paint
*/
unsigned
getBaseGlyphCount
(
SkUnichar
text
)
const
;
int
utfToGlyphs
(
const
void
*
text
,
TextEncoding
encoding
,
size_t
byteLength
,
uint16_t
glyphs
[])
const
;
#endif
// returns true if the paint's settings (e.g. xfermode + alpha) resolve to
...
...
This diff is collapsed.
Click to expand it.
src/core/SkPaint.cpp
View file @
7249c95f
...
...
@@ -440,6 +440,37 @@ const void* SkPaint::findImage(const SkGlyph& glyph) {
SkGlyphCache
::
AttachCache
(
cache
);
return
image
;
}
int
SkPaint
::
utfToGlyphs
(
const
void
*
textData
,
TextEncoding
encoding
,
size_t
byteLength
,
uint16_t
glyphs
[])
const
{
SkAutoGlyphCache
autoCache
(
*
this
,
NULL
);
SkGlyphCache
*
cache
=
autoCache
.
getCache
();
const
char
*
text
=
(
const
char
*
)
textData
;
const
char
*
stop
=
text
+
byteLength
;
uint16_t
*
gptr
=
glyphs
;
switch
(
encoding
)
{
case
SkPaint
::
kUTF8_TextEncoding
:
while
(
text
<
stop
)
{
*
gptr
++
=
cache
->
unicharToGlyph
(
SkUTF8_NextUnichar
(
&
text
));
}
break
;
case
SkPaint
::
kUTF16_TextEncoding
:
{
const
uint16_t
*
text16
=
(
const
uint16_t
*
)
text
;
const
uint16_t
*
stop16
=
(
const
uint16_t
*
)
stop
;
while
(
text16
<
stop16
)
{
*
gptr
++
=
cache
->
unicharToGlyph
(
SkUTF16_NextUnichar
(
&
text16
));
}
break
;
}
default:
SkDEBUGFAIL
(
"unknown text encoding"
);
}
return
gptr
-
glyphs
;
}
#endif
int
SkPaint
::
textToGlyphs
(
const
void
*
textData
,
size_t
byteLength
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment