summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kevin Lubick <kjlubick@google.com> 2023-01-05 18:42:26 +0000
committer Kevin Lubick <kjlubick@google.com> 2023-01-09 13:05:21 +0000
commit980469807d0838ff924843a9efb80a2907dcde87 (patch)
tree9950f61a46e44cb7f8eba4d4a6a494e57368305f
parentb9d91dde26eb37ba704423ee512494cc0760fc29 (diff)
Remove use of SkMalloc from Skia Interpolator
Change-Id: I91364a0b64c953221e013cd360c797ef0faa6a03
-rw-r--r--libs/hwui/SkiaInterpolator.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/hwui/SkiaInterpolator.cpp b/libs/hwui/SkiaInterpolator.cpp
index b28b15aa6cf4..47bd0b96ebd3 100644
--- a/libs/hwui/SkiaInterpolator.cpp
+++ b/libs/hwui/SkiaInterpolator.cpp
@@ -20,9 +20,10 @@
#include "include/core/SkScalar.h"
#include "include/core/SkTypes.h"
#include "include/private/SkFixed.h"
-#include "include/private/SkMalloc.h"
#include "src/core/SkTSearch.h"
+#include <log/log.h>
+
typedef int Dot14;
#define Dot14_ONE (1 << 14)
#define Dot14_HALF (1 << 13)
@@ -96,7 +97,7 @@ SkiaInterpolatorBase::SkiaInterpolatorBase() {
SkiaInterpolatorBase::~SkiaInterpolatorBase() {
if (fStorage) {
- sk_free(fStorage);
+ free(fStorage);
}
}
@@ -106,7 +107,7 @@ void SkiaInterpolatorBase::reset(int elemCount, int frameCount) {
fFrameCount = static_cast<int16_t>(frameCount);
fRepeat = SK_Scalar1;
if (fStorage) {
- sk_free(fStorage);
+ free(fStorage);
fStorage = nullptr;
fTimes = nullptr;
}
@@ -213,7 +214,10 @@ SkiaInterpolator::SkiaInterpolator(int elemCount, int frameCount) {
void SkiaInterpolator::reset(int elemCount, int frameCount) {
INHERITED::reset(elemCount, frameCount);
- fStorage = sk_malloc_throw((sizeof(float) * elemCount + sizeof(SkTimeCode)) * frameCount);
+ size_t numBytes = (sizeof(float) * elemCount + sizeof(SkTimeCode)) * frameCount;
+ fStorage = malloc(numBytes);
+ LOG_ALWAYS_FATAL_IF(!fStorage, "Failed to allocate %zu bytes in %s",
+ numBytes, __func__);
fTimes = (SkTimeCode*)fStorage;
fValues = (float*)((char*)fStorage + sizeof(SkTimeCode) * frameCount);
}