Merge "Remove use of private Skia SkTo.h file"

This commit is contained in:
Kevin Lubick
2023-01-06 13:30:02 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 16 deletions

View File

@@ -21,7 +21,6 @@
#include "include/core/SkTypes.h"
#include "include/private/SkFixed.h"
#include "include/private/SkMalloc.h"
#include "include/private/SkTo.h"
#include "src/core/SkTSearch.h"
typedef int Dot14;
@@ -93,7 +92,6 @@ static float SkUnitCubicInterp(float value, float bx, float by, float cx, float
SkiaInterpolatorBase::SkiaInterpolatorBase() {
fStorage = nullptr;
fTimes = nullptr;
SkDEBUGCODE(fTimesArray = nullptr;)
}
SkiaInterpolatorBase::~SkiaInterpolatorBase() {
@@ -104,14 +102,13 @@ SkiaInterpolatorBase::~SkiaInterpolatorBase() {
void SkiaInterpolatorBase::reset(int elemCount, int frameCount) {
fFlags = 0;
fElemCount = SkToU8(elemCount);
fFrameCount = SkToS16(frameCount);
fElemCount = static_cast<uint8_t>(elemCount);
fFrameCount = static_cast<int16_t>(frameCount);
fRepeat = SK_Scalar1;
if (fStorage) {
sk_free(fStorage);
fStorage = nullptr;
fTimes = nullptr;
SkDEBUGCODE(fTimesArray = nullptr);
}
}
@@ -207,7 +204,6 @@ SkiaInterpolatorBase::Result SkiaInterpolatorBase::timeToT(SkMSec time, float* T
SkiaInterpolator::SkiaInterpolator() {
INHERITED::reset(0, 0);
fValues = nullptr;
SkDEBUGCODE(fScalarsArray = nullptr;)
}
SkiaInterpolator::SkiaInterpolator(int elemCount, int frameCount) {
@@ -220,10 +216,6 @@ void SkiaInterpolator::reset(int elemCount, int frameCount) {
fStorage = sk_malloc_throw((sizeof(float) * elemCount + sizeof(SkTimeCode)) * frameCount);
fTimes = (SkTimeCode*)fStorage;
fValues = (float*)((char*)fStorage + sizeof(SkTimeCode) * frameCount);
#ifdef SK_DEBUG
fTimesArray = (SkTimeCode(*)[10])fTimes;
fScalarsArray = (float(*)[10])fValues;
#endif
}
#define SK_Fixed1Third (SK_Fixed1 / 3)

View File

@@ -17,7 +17,8 @@
#ifndef SkiaInterpolator_DEFINED
#define SkiaInterpolator_DEFINED
#include "include/private/SkTo.h"
#include <cstddef>
#include <cstdint>
class SkiaInterpolatorBase {
public:
@@ -46,7 +47,9 @@ public:
@param mirror If true, the odd repeats interpolate from the last key
frame and the first.
*/
void setMirror(bool mirror) { fFlags = SkToU8((fFlags & ~kMirror) | (int)mirror); }
void setMirror(bool mirror) {
fFlags = static_cast<uint8_t>((fFlags & ~kMirror) | (int)mirror);
}
/** Set the repeat count. The repeat count may be fractional.
@param repeatCount Multiplies the total time by this scalar.
@@ -57,7 +60,7 @@ public:
@param reset If true, the odd repeats interpolate from the last key
frame and the first.
*/
void setReset(bool reset) { fFlags = SkToU8((fFlags & ~kReset) | (int)reset); }
void setReset(bool reset) { fFlags = static_cast<uint8_t>((fFlags & ~kReset) | (int)reset); }
Result timeToT(uint32_t time, float* T, int* index, bool* exact) const;
@@ -75,9 +78,6 @@ protected:
};
SkTimeCode* fTimes; // pointer into fStorage
void* fStorage;
#ifdef SK_DEBUG
SkTimeCode (*fTimesArray)[10];
#endif
};
class SkiaInterpolator : public SkiaInterpolatorBase {