@@ -236,6 +236,22 @@ TextLayoutCacheKey::TextLayoutCacheKey(const SkPaint* paint,
236236 hinting = paint->getHinting ();
237237}
238238
239+ TextLayoutCacheKey::TextLayoutCacheKey (const TextLayoutCacheKey& other) :
240+ text(NULL ),
241+ textCopy(other.textCopy),
242+ contextCount(other.contextCount),
243+ dirFlags(other.dirFlags),
244+ typeface(other.typeface),
245+ textSize(other.textSize),
246+ textSkewX(other.textSkewX),
247+ textScaleX(other.textScaleX),
248+ flags(other.flags),
249+ hinting(other.hinting) {
250+ if (other.text ) {
251+ textCopy.setTo (other.text );
252+ }
253+ }
254+
239255bool TextLayoutCacheKey::operator <(const TextLayoutCacheKey& rhs) const {
240256 LTE_INT (count) {
241257 LTE_INT (contextCount) {
@@ -247,7 +263,7 @@ bool TextLayoutCacheKey::operator<(const TextLayoutCacheKey& rhs) const {
247263 LTE_INT (flags) {
248264 LTE_INT (hinting) {
249265 LTE_INT (dirFlags) {
250- return strncmp16 (text , rhs.text , contextCount) < 0 ;
266+ return strncmp16 (getText () , rhs.getText () , contextCount) < 0 ;
251267 }
252268 }
253269 }
@@ -263,7 +279,7 @@ bool TextLayoutCacheKey::operator<(const TextLayoutCacheKey& rhs) const {
263279
264280void TextLayoutCacheKey::internalTextCopy () {
265281 textCopy.setTo (text, contextCount);
266- text = textCopy. string () ;
282+ text = NULL ;
267283}
268284
269285size_t TextLayoutCacheKey::getSize () {
0 commit comments