ignore SK_DISABLE_READBUFFER
Its effect is small and we want to rely on SkReadBuffer being available. Size changes: - canvaskit uncompressed: 6,864,481 --> 6,864,481 ( no change ) - canvaskit compressed: 2,667,117 --> 2,667,117 ( no change ) - pathkit uncompressed: 329,187 --> 330,679 (+ 1.5K, +0.5%) - pathkit compressed: 134,158 --> 134,672 (+ 0.5K, +0.4%) - flutter : 1,302,108 --> 1,322,568 (+20.0K, +1.6%) The Flutter change is the biggest mystery, as bloaty only pegs SkReadBuffer as 3.9K. The rest must come from other files including SkReadBuffer.h not being able to see and inline away SkReadBuffer routines? Feels like SK_DISABLE_EFFECT_DESERIALIZATION isn't trimming enough? PS 4-6 have an idea to push SK_DISABLE_EFFECT_DESERIALIZATION further. Change-Id: Ifda3ccb82dd0636cfed6bb826fb185a7bca2cbe0 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295061 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
5c9d18170b
commit
45f36b5b55
1
BUILD.gn
1
BUILD.gn
@ -1152,6 +1152,7 @@ static_library("pathkit") {
|
||||
"src/core/SkPathRef.cpp",
|
||||
"src/core/SkPoint.cpp",
|
||||
"src/core/SkRRect.cpp",
|
||||
"src/core/SkReadBuffer.cpp",
|
||||
"src/core/SkRect.cpp",
|
||||
"src/core/SkSemaphore.cpp",
|
||||
"src/core/SkStream.cpp",
|
||||
|
@ -62,10 +62,6 @@ if [[ $@ == *cpu* ]]; then
|
||||
WASM_GPU="-DSK_SUPPORT_GPU=0 --pre-js $BASE_DIR/cpu.js -s USE_WEBGL2=0"
|
||||
fi
|
||||
|
||||
# Trim some skp-related code
|
||||
EXTRA_CFLAGS+=",\"-DSK_DISABLE_READBUFFER\""
|
||||
RELEASE_CONF+=" -DSK_DISABLE_READBUFFER"
|
||||
|
||||
SKOTTIE_LIB="$BUILD_DIR/libskottie.a \
|
||||
$BUILD_DIR/libsksg.a"
|
||||
|
||||
|
@ -11,8 +11,7 @@ flutter_defines = [
|
||||
# Remove software rasterizers to save some code size.
|
||||
"SK_DISABLE_AAA",
|
||||
|
||||
# Flutter doesn't deserialize anything.
|
||||
"SK_DISABLE_READBUFFER",
|
||||
# Flutter doesn't deserialize effects.
|
||||
"SK_DISABLE_EFFECT_DESERIALIZATION",
|
||||
|
||||
# Staging
|
||||
|
@ -72,8 +72,6 @@ SKP_JS="--pre-js $BASE_DIR/skp.js"
|
||||
GN_SKP_FLAGS=""
|
||||
WASM_SKP="-DSK_SERIALIZE_SKP"
|
||||
if [[ $@ == *no_skp* ]]; then
|
||||
GN_SKP_FLAGS="\"-DSK_DISABLE_READBUFFER\","
|
||||
WASM_SKP="-DSK_DISABLE_READBUFFER"
|
||||
SKP_JS=""
|
||||
fi
|
||||
|
||||
|
@ -93,7 +93,7 @@ echo "Compiling bitcode"
|
||||
--args="cc=\"${EMCC}\" \
|
||||
cxx=\"${EMCXX}\" \
|
||||
ar=\"${EMAR}\" \
|
||||
extra_cflags=[\"-DSK_DISABLE_READBUFFER=1\",\"-s\", \"WARN_UNALIGNED=1\",
|
||||
extra_cflags=[\"-s\", \"WARN_UNALIGNED=1\",
|
||||
\"-s\", \"MAIN_MODULE=1\",
|
||||
${EXTRA_CFLAGS}
|
||||
] \
|
||||
@ -113,7 +113,6 @@ ${EMCXX} $RELEASE_CONF -std=c++17 \
|
||||
--no-entry \
|
||||
--pre-js $BASE_DIR/helper.js \
|
||||
--pre-js $BASE_DIR/chaining.js \
|
||||
-DSK_DISABLE_READBUFFER=1 \
|
||||
-fno-rtti -fno-exceptions -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 \
|
||||
$WASM_CONF \
|
||||
-s ERROR_ON_UNDEFINED_SYMBOLS=1 \
|
||||
|
@ -17,8 +17,6 @@
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
#include "src/core/SkSafeMath.h"
|
||||
|
||||
#ifndef SK_DISABLE_READBUFFER
|
||||
|
||||
namespace {
|
||||
// This generator intentionally should always fail on all attempts to get its pixels,
|
||||
// simulating a bad or empty codec stream.
|
||||
@ -461,5 +459,3 @@ int32_t SkReadBuffer::checkInt(int32_t min, int32_t max) {
|
||||
SkFilterQuality SkReadBuffer::checkFilterQuality() {
|
||||
return this->checkRange<SkFilterQuality>(kNone_SkFilterQuality, kLast_SkFilterQuality);
|
||||
}
|
||||
|
||||
#endif // #ifndef SK_DISABLE_READBUFFER
|
||||
|
@ -27,8 +27,6 @@
|
||||
class SkData;
|
||||
class SkImage;
|
||||
|
||||
#ifndef SK_DISABLE_READBUFFER
|
||||
|
||||
class SkReadBuffer {
|
||||
public:
|
||||
SkReadBuffer();
|
||||
@ -220,102 +218,4 @@ private:
|
||||
bool fError = false;
|
||||
};
|
||||
|
||||
#else // #ifndef SK_DISABLE_READBUFFER
|
||||
|
||||
class SkReadBuffer {
|
||||
public:
|
||||
SkReadBuffer() {}
|
||||
SkReadBuffer(const void*, size_t) {}
|
||||
|
||||
bool isVersionLT(SkPicturePriv::Version) const { return false; }
|
||||
uint32_t getVersion() const { return 0xffffffff; }
|
||||
void setVersion(int) {}
|
||||
|
||||
size_t size() const { return 0; }
|
||||
size_t offset() const { return 0; }
|
||||
bool eof() { return true; }
|
||||
size_t available() const { return 0; }
|
||||
|
||||
const void* skip(size_t) { return nullptr; }
|
||||
const void* skip(size_t, size_t) { return nullptr; }
|
||||
template <typename T> const T* skipT() { return nullptr; }
|
||||
template <typename T> const T* skipT(size_t) { return nullptr; }
|
||||
|
||||
bool readBool() { return 0; }
|
||||
SkColor readColor() { return 0; }
|
||||
int32_t readInt() { return 0; }
|
||||
SkScalar readScalar() { return 0; }
|
||||
uint32_t readUInt() { return 0; }
|
||||
int32_t read32() { return 0; }
|
||||
|
||||
template <typename T> T read32LE(T max) { return max; }
|
||||
|
||||
uint8_t peekByte() { return 0; }
|
||||
|
||||
void readColor4f(SkColor4f* out) { *out = SkColor4f{0,0,0,0}; }
|
||||
void readPoint (SkPoint* out) { *out = SkPoint{0,0}; }
|
||||
void readPoint3 (SkPoint3* out) { *out = SkPoint3{0,0,0}; }
|
||||
void readMatrix (SkMatrix* out) { *out = SkMatrix::I(); }
|
||||
void readIRect (SkIRect* out) { *out = SkIRect{0,0,0,0}; }
|
||||
void readRect (SkRect* out) { *out = SkRect{0,0,0,0}; }
|
||||
void readRRect (SkRRect* out) { *out = SkRRect(); }
|
||||
void readRegion (SkRegion* out) { *out = SkRegion(); }
|
||||
void readString (SkString* out) { *out = SkString(); }
|
||||
void readPath (SkPath* out) { *out = SkPath(); }
|
||||
SkReadPaintResult readPaint (SkPaint* out, SkFont* font) {
|
||||
*out = SkPaint();
|
||||
if (font) {
|
||||
*font = SkFont();
|
||||
}
|
||||
return kFailed_ReadPaint;
|
||||
}
|
||||
|
||||
SkPoint readPoint() { return {0,0}; }
|
||||
|
||||
SkFlattenable* readFlattenable(SkFlattenable::Type) { return nullptr; }
|
||||
|
||||
template <typename T> sk_sp<T> readFlattenable() { return nullptr; }
|
||||
sk_sp<SkColorFilter> readColorFilter() { return nullptr; }
|
||||
sk_sp<SkDrawLooper> readDrawLooper() { return nullptr; }
|
||||
sk_sp<SkImageFilter> readImageFilter() { return nullptr; }
|
||||
sk_sp<SkMaskFilter> readMaskFilter() { return nullptr; }
|
||||
sk_sp<SkPathEffect> readPathEffect() { return nullptr; }
|
||||
sk_sp<SkShader> readShader() { return nullptr; }
|
||||
|
||||
bool readPad32 (void*, size_t) { return false; }
|
||||
bool readByteArray (void*, size_t) { return false; }
|
||||
bool readColorArray (SkColor*, size_t) { return false; }
|
||||
bool readColor4fArray(SkColor4f*, size_t) { return false; }
|
||||
bool readIntArray (int32_t*, size_t) { return false; }
|
||||
bool readPointArray (SkPoint*, size_t) { return false; }
|
||||
bool readScalarArray (SkScalar*, size_t) { return false; }
|
||||
|
||||
sk_sp<SkData> readByteArrayAsData() { return nullptr; }
|
||||
uint32_t getArrayCount() { return 0; }
|
||||
|
||||
sk_sp<SkImage> readImage() { return nullptr; }
|
||||
sk_sp<SkTypeface> readTypeface() { return nullptr; }
|
||||
|
||||
bool validate(bool) { return false; }
|
||||
template <typename T> bool validateCanReadN(size_t) { return false; }
|
||||
bool isValid() const { return false; }
|
||||
bool validateIndex(int, int) { return false; }
|
||||
|
||||
int32_t checkInt(int min, int) { return min; }
|
||||
template <typename T> T checkRange(T min, T) { return min; }
|
||||
|
||||
SkFilterQuality checkFilterQuality() { return SkFilterQuality::kNone_SkFilterQuality; }
|
||||
|
||||
void setTypefaceArray(sk_sp<SkTypeface>[], int) {}
|
||||
void setFactoryPlayback(SkFlattenable::Factory[], int) {}
|
||||
void setDeserialProcs(const SkDeserialProcs&) {}
|
||||
|
||||
const SkDeserialProcs& getDeserialProcs() const {
|
||||
static const SkDeserialProcs procs;
|
||||
return procs;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // #ifndef SK_DISABLE_READBUFFER
|
||||
|
||||
#endif // SkReadBuffer_DEFINED
|
||||
|
Loading…
Reference in New Issue
Block a user