diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-03-15 23:15:37 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-03-15 23:15:37 +0000 |
commit | a82d21e71932386add7510d22267d48c479cb1b9 (patch) | |
tree | 0763065352f010aaaa3acb30eab6e55a4a66267d | |
parent | ee672886634a6d8729aa1cf46421291e66ae920a (diff) | |
parent | 90248339847ad72c9c66837666949e5c1bc1f6ea (diff) | |
download | skia-nougat-mr0.5-release.tar.gz |
Merge cherrypicks of [6738238, 6739193, 6738335, 6738239, 6739470, 6739471, 6738201, 6738202, 6738203, 6738204, 6738205, 6738206, 6738207, 6738208, 6738209, 6739510, 6739511, 6739512, 6739513, 6739514, 6739515, 6739516, 6738336, 6739517, 6739518, 6738416, 6738417, 6739472, 6739473, 6739519, 6739520, 6739071, 6739072, 6738695, 6738696, 6738697, 6738698, 6738699, 6738243, 6739521, 6738244, 6738153, 6738154, 6738155, 6738156, 6738157, 6738158, 6738159, 6738160, 6739522, 6739523] into nyc-bugfix-releaseandroid-7.0.0_r36nougat-mr0.5-release
Change-Id: I1373bb6c12cb20299c418814aec1b766de431792
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | include/android/SkAndroidFrameworkUtils.h | 25 | ||||
-rw-r--r-- | src/android/SkAndroidFrameworkUtils.cpp | 19 | ||||
-rw-r--r-- | src/codec/SkSwizzler.cpp | 16 |
4 files changed, 61 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk index 4dbd17bb63..a501e2cb50 100644 --- a/Android.mk +++ b/Android.mk @@ -89,6 +89,7 @@ LOCAL_SRC_FILES := \ src/codec/SkWebpCodec.cpp \ src/codec/SkCodecImageGenerator.cpp \ src/ports/SkImageGenerator_skia.cpp \ + src/android/SkAndroidFrameworkUtils.cpp \ src/android/SkBitmapRegionCanvas.cpp \ src/android/SkBitmapRegionCodec.cpp \ src/android/SkBitmapRegionDecoder.cpp \ diff --git a/include/android/SkAndroidFrameworkUtils.h b/include/android/SkAndroidFrameworkUtils.h new file mode 100644 index 0000000000..abe959983b --- /dev/null +++ b/include/android/SkAndroidFrameworkUtils.h @@ -0,0 +1,25 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkAndroidFrameworkUtils_DEFINED +#define SkAndroidFrameworkUtils_DEFINED + +#include "SkTypes.h" + +#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK + +/** + * SkAndroidFrameworkUtils expose private APIs used only by Android framework. + */ +class SkAndroidFrameworkUtils { +public: + static void SafetyNetLog(const char*); +}; + +#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK + +#endif // SkAndroidFrameworkUtils_DEFINED diff --git a/src/android/SkAndroidFrameworkUtils.cpp b/src/android/SkAndroidFrameworkUtils.cpp new file mode 100644 index 0000000000..968b7b7d08 --- /dev/null +++ b/src/android/SkAndroidFrameworkUtils.cpp @@ -0,0 +1,19 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "SkAndroidFrameworkUtils.h" + +#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK + +#include <log/log.h> + +void SkAndroidFrameworkUtils::SafetyNetLog(const char* bugNumber) { + android_errorWriteLog(0x534e4554, bugNumber); +} + +#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK + diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp index 133736879f..f4be612c4d 100644 --- a/src/codec/SkSwizzler.cpp +++ b/src/codec/SkSwizzler.cpp @@ -11,6 +11,10 @@ #include "SkSwizzler.h" #include "SkTemplates.h" +#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK + #include "SkAndroidFrameworkUtils.h" +#endif + static void copy(void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { // This function must not be called if we are sampling. If we are not @@ -937,6 +941,18 @@ int SkSwizzler::onSetSampleX(int sampleX) { fSwizzleWidth = get_scaled_dimension(fSrcWidth, sampleX); fAllocatedWidth = get_scaled_dimension(fDstWidth, sampleX); + if (fDstOffsetBytes > 0) { + const size_t dstSwizzleBytes = fSwizzleWidth * fDstBPP; + const size_t dstAllocatedBytes = fAllocatedWidth * fDstBPP; + if (fDstOffsetBytes + dstSwizzleBytes > dstAllocatedBytes) { +#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK + SkAndroidFrameworkUtils::SafetyNetLog("118143775"); +#endif + SkASSERT(dstSwizzleBytes < dstAllocatedBytes); + fDstOffsetBytes = dstAllocatedBytes - dstSwizzleBytes; + } + } + // The optimized swizzler functions do not support sampling. Sampled swizzles // are already fast because they skip pixels. We haven't seen a situation // where speeding up sampling has a significant impact on total decode time. |