| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2011 Google Inc. | 2  * Copyright 2011 Google Inc. | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 #include "SkBlurMask.h" | 8 #include "SkBlurMask.h" | 
| 9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" | 
| 10 #include "SkLayerDrawLooper.h" | 10 #include "SkLayerDrawLooper.h" | 
| 11 #include "SkPaint.h" | 11 #include "SkPaint.h" | 
| 12 #include "SkPath.h" | 12 #include "SkPath.h" | 
| 13 #include "SkRandom.h" | 13 #include "SkRandom.h" | 
| 14 #include "SkReadBuffer.h" | 14 #include "SkReadBuffer.h" | 
| 15 #include "SkTypeface.h" | 15 #include "SkTypeface.h" | 
| 16 #include "SkUtils.h" | 16 #include "SkUtils.h" | 
| 17 #include "SkWriteBuffer.h" | 17 #include "SkWriteBuffer.h" | 
| 18 #include "SkXfermode.h" | 18 #include "SkXfermode.h" | 
| 19 #include "Test.h" | 19 #include "Test.h" | 
| 20 | 20 | 
| 21 static size_t uni_to_utf8(const SkUnichar src[], void* dst, int count) { | 21 static size_t uni_to_utf8(const SkUnichar src[], void* dst, int count) { | 
| 22     char* u8 = (char*)dst; | 22     char* u8 = (char*)dst; | 
| 23     for (int i = 0; i < count; ++i) { | 23     for (int i = 0; i < count; ++i) { | 
| 24         int n = SkUTF8_FromUnichar(src[i], u8); | 24         int n = SkToInt(SkUTF8_FromUnichar(src[i], u8)); | 
| 25         u8 += n; | 25         u8 += n; | 
| 26     } | 26     } | 
| 27     return u8 - (char*)dst; | 27     return u8 - (char*)dst; | 
| 28 } | 28 } | 
| 29 | 29 | 
| 30 static size_t uni_to_utf16(const SkUnichar src[], void* dst, int count) { | 30 static size_t uni_to_utf16(const SkUnichar src[], void* dst, int count) { | 
| 31     uint16_t* u16 = (uint16_t*)dst; | 31     uint16_t* u16 = (uint16_t*)dst; | 
| 32     for (int i = 0; i < count; ++i) { | 32     for (int i = 0; i < count; ++i) { | 
| 33         int n = SkUTF16_FromUnichar(src[i], u16); | 33         int n = SkToInt(SkUTF16_FromUnichar(src[i], u16)); | 
| 34         u16 += n; | 34         u16 += n; | 
| 35     } | 35     } | 
| 36     return (char*)u16 - (char*)dst; | 36     return (char*)u16 - (char*)dst; | 
| 37 } | 37 } | 
| 38 | 38 | 
| 39 static size_t uni_to_utf32(const SkUnichar src[], void* dst, int count) { | 39 static size_t uni_to_utf32(const SkUnichar src[], void* dst, int count) { | 
| 40     SkUnichar* u32 = (SkUnichar*)dst; | 40     SkUnichar* u32 = (SkUnichar*)dst; | 
| 41     if (src != u32) { | 41     if (src != u32) { | 
| 42         memcpy(u32, src, count * sizeof(SkUnichar)); | 42         memcpy(u32, src, count * sizeof(SkUnichar)); | 
| 43     } | 43     } | 
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 364     SkColorMatrix cm; | 364     SkColorMatrix cm; | 
| 365     cm.setIdentity();   // does not change alpha | 365     cm.setIdentity();   // does not change alpha | 
| 366     paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); | 366     paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); | 
| 367     REPORTER_ASSERT(r, paint.nothingToDraw()); | 367     REPORTER_ASSERT(r, paint.nothingToDraw()); | 
| 368 | 368 | 
| 369     cm.postTranslate(0, 0, 0, 1);    // wacks alpha | 369     cm.postTranslate(0, 0, 0, 1);    // wacks alpha | 
| 370     paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); | 370     paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); | 
| 371     REPORTER_ASSERT(r, !paint.nothingToDraw()); | 371     REPORTER_ASSERT(r, !paint.nothingToDraw()); | 
| 372 } | 372 } | 
| 373 | 373 | 
| OLD | NEW | 
|---|