[canvaskit] Slice out SkPicture
Removes about 120k uncompressed, 40k gzipped Bug: skia: Change-Id: I7e0b404f18fc3c6d4ff6b01d2c9bcd657b7d5e07 Reviewed-on: https://skia-review.googlesource.com/c/163246 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
dd9bfe9a32
commit
32dfdbe1af
11
BUILD.gn
11
BUILD.gn
@ -47,6 +47,7 @@ declare_args() {
|
||||
skia_enable_gpu = true
|
||||
skia_enable_pdf = true
|
||||
skia_enable_spirv_validation = is_skia_dev_build && is_debug
|
||||
skia_enable_skpicture = true
|
||||
skia_enable_tools = is_skia_dev_build
|
||||
skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
|
||||
skia_vulkan_header = "" # temporary as we remove the use from clients
|
||||
@ -383,6 +384,9 @@ optional("effects") {
|
||||
skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
|
||||
if (skia_enable_effects_imagefilters) {
|
||||
sources += skia_effects_imagefilter_sources
|
||||
if (!skia_enable_skpicture) {
|
||||
sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
|
||||
}
|
||||
} else {
|
||||
sources += [ "src/ports/SkGlobalInitialization_none_imagefilters.cpp" ]
|
||||
}
|
||||
@ -903,6 +907,13 @@ component("skia") {
|
||||
"third_party/gif/SkGifImageReader.cpp",
|
||||
]
|
||||
|
||||
defines = []
|
||||
if (!skia_enable_skpicture) {
|
||||
defines = [ "SK_DISABLE_SKPICTURE" ]
|
||||
sources -= skia_skpicture_sources
|
||||
sources += [ "src/core/SkPicture_none.cpp" ]
|
||||
}
|
||||
|
||||
libs = []
|
||||
|
||||
if (is_win) {
|
||||
|
@ -112,6 +112,7 @@ echo "Compiling bitcode"
|
||||
\
|
||||
skia_enable_ccpr=false \
|
||||
skia_enable_nvpr=false \
|
||||
skia_enable_skpicture=false \
|
||||
${GN_GPU} \
|
||||
skia_enable_fontmgr_empty=false \
|
||||
skia_enable_pdf=false"
|
||||
|
46
gn/core.gni
46
gn/core.gni
@ -25,7 +25,6 @@ skia_core_sources = [
|
||||
"$_src/core/SkAutoPixmapStorage.cpp",
|
||||
"$_src/core/SkBBHFactory.cpp",
|
||||
"$_src/core/SkBBoxHierarchy.h",
|
||||
"$_src/core/SkBigPicture.cpp",
|
||||
"$_src/core/SkBitmap.cpp",
|
||||
"$_src/core/SkBitmapCache.cpp",
|
||||
"$_src/core/SkBitmapController.cpp",
|
||||
@ -190,7 +189,6 @@ skia_core_sources = [
|
||||
"$_src/core/SkMiniRecorder.cpp",
|
||||
"$_src/core/SkMiniRecorder.h",
|
||||
"$_src/core/SkModeColorFilter.cpp",
|
||||
"$_src/core/SkMultiPictureDraw.cpp",
|
||||
"$_src/core/SkNextID.h",
|
||||
"$_src/core/SkLatticeIter.cpp",
|
||||
"$_src/core/SkLatticeIter.h",
|
||||
@ -217,18 +215,6 @@ skia_core_sources = [
|
||||
"$_src/core/SkPathMeasure.cpp",
|
||||
"$_src/core/SkPathPriv.h",
|
||||
"$_src/core/SkPathRef.cpp",
|
||||
"$_src/core/SkPicture.cpp",
|
||||
"$_src/core/SkPictureCommon.h",
|
||||
"$_src/core/SkPictureData.cpp",
|
||||
"$_src/core/SkPictureData.h",
|
||||
"$_src/core/SkPictureFlat.cpp",
|
||||
"$_src/core/SkPictureFlat.h",
|
||||
"$_src/core/SkPictureImageGenerator.cpp",
|
||||
"$_src/core/SkPicturePlayback.cpp",
|
||||
"$_src/core/SkPicturePlayback.h",
|
||||
"$_src/core/SkPictureRecord.cpp",
|
||||
"$_src/core/SkPictureRecord.h",
|
||||
"$_src/core/SkPictureRecorder.cpp",
|
||||
"$_src/core/SkPixelRef.cpp",
|
||||
"$_src/core/SkPixmap.cpp",
|
||||
"$_src/core/SkPoint.cpp",
|
||||
@ -249,8 +235,6 @@ skia_core_sources = [
|
||||
"$_src/core/SkRecordOpts.cpp",
|
||||
"$_src/core/SkRecordOpts.h",
|
||||
"$_src/core/SkRecordPattern.h",
|
||||
"$_src/core/SkRecordedDrawable.cpp",
|
||||
"$_src/core/SkRecorder.cpp",
|
||||
"$_src/core/SkRect.cpp",
|
||||
"$_src/core/SkRegion.cpp",
|
||||
"$_src/core/SkRegionPriv.h",
|
||||
@ -371,8 +355,6 @@ skia_core_sources = [
|
||||
"$_src/shaders/SkLightingShader.h",
|
||||
"$_src/shaders/SkLocalMatrixShader.cpp",
|
||||
"$_src/shaders/SkLocalMatrixShader.h",
|
||||
"$_src/shaders/SkPictureShader.cpp",
|
||||
"$_src/shaders/SkPictureShader.h",
|
||||
"$_src/shaders/SkShader.cpp",
|
||||
"$_src/shaders/SkShaderBase.h",
|
||||
|
||||
@ -407,14 +389,11 @@ skia_core_sources = [
|
||||
"$_include/core/SkMatrix.h",
|
||||
"$_include/core/SkMatrix44.h",
|
||||
"$_include/core/SkMetaData.h",
|
||||
"$_include/core/SkMultiPictureDraw.h",
|
||||
"$_include/core/SkOverdrawCanvas.h",
|
||||
"$_include/core/SkPaint.h",
|
||||
"$_include/core/SkPath.h",
|
||||
"$_include/core/SkPathEffect.h",
|
||||
"$_include/core/SkPathMeasure.h",
|
||||
"$_include/core/SkPicture.h",
|
||||
"$_include/core/SkPictureRecorder.h",
|
||||
"$_include/core/SkPixelRef.h",
|
||||
"$_include/core/SkPoint.h",
|
||||
"$_include/core/SkPoint3.h",
|
||||
@ -546,6 +525,31 @@ skia_pathops_sources = [
|
||||
"$_src/pathops/SkReduceOrder.h",
|
||||
]
|
||||
|
||||
skia_skpicture_sources = [
|
||||
"$_include/core/SkMultiPictureDraw.h",
|
||||
"$_include/core/SkPicture.h",
|
||||
"$_include/core/SkPictureRecorder.h",
|
||||
"$_src/core/SkBigPicture.cpp",
|
||||
"$_src/core/SkMultiPictureDraw.cpp",
|
||||
"$_src/core/SkPicture.cpp",
|
||||
"$_src/core/SkPictureCommon.h",
|
||||
"$_src/core/SkPictureData.cpp",
|
||||
"$_src/core/SkPictureData.h",
|
||||
"$_src/core/SkPictureFlat.cpp",
|
||||
"$_src/core/SkPictureFlat.h",
|
||||
"$_src/core/SkPictureImageGenerator.cpp",
|
||||
"$_src/core/SkPicturePlayback.cpp",
|
||||
"$_src/core/SkPicturePlayback.h",
|
||||
"$_src/core/SkPictureRecord.cpp",
|
||||
"$_src/core/SkPictureRecord.h",
|
||||
"$_src/core/SkPictureRecorder.cpp",
|
||||
"$_src/core/SkRecordedDrawable.cpp",
|
||||
"$_src/core/SkRecorder.cpp",
|
||||
"$_src/shaders/SkPictureShader.cpp",
|
||||
"$_src/shaders/SkPictureShader.h",
|
||||
]
|
||||
|
||||
skia_core_sources += skia_pathops_sources
|
||||
skia_core_sources += skia_skpicture_sources
|
||||
|
||||
skia_core_defines = [] # Used to be used by Chromium, but no longer.
|
||||
|
@ -240,7 +240,7 @@ BASE_SRCS_ALL = struct(
|
||||
"src/utils/win/**/*",
|
||||
|
||||
# Exclude multiple definitions.
|
||||
# TODO(mtklein): Move to opts?
|
||||
"src/core/SkPicture_none.cpp"
|
||||
"src/gpu/GrPathRendering_none.cpp",
|
||||
"src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp",
|
||||
"src/gpu/gl/GrGLMakeNativeInterface_none.cpp",
|
||||
|
@ -2732,7 +2732,13 @@ void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle,
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef SK_DISABLE_SKPICTURE
|
||||
void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint) {}
|
||||
|
||||
|
||||
void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
|
||||
const SkPaint* paint) {}
|
||||
#else
|
||||
/**
|
||||
* This constant is trying to balance the speed of ref'ing a subpicture into a parent picture,
|
||||
* against the playback cost of recursing into the subpicture to get at its actual ops.
|
||||
@ -2775,6 +2781,7 @@ void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
|
||||
SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
|
||||
picture->playback(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -15,8 +15,6 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SkTypefacePlayback::~SkTypefacePlayback() {}
|
||||
|
||||
void SkTypefacePlayback::setCount(size_t count) {
|
||||
fCount = count;
|
||||
fArray.reset(new sk_sp<SkTypeface>[count]);
|
||||
|
@ -157,7 +157,7 @@ static inline bool ClipParams_unpackDoAA(uint32_t packed) {
|
||||
class SkTypefacePlayback {
|
||||
public:
|
||||
SkTypefacePlayback() : fCount(0), fArray(nullptr) {}
|
||||
~SkTypefacePlayback();
|
||||
~SkTypefacePlayback() = default;
|
||||
|
||||
void setCount(size_t count);
|
||||
|
||||
|
103
src/core/SkPicture_none.cpp
Normal file
103
src/core/SkPicture_none.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright 2018 Google LLC
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkCanvas.h"
|
||||
#include "SkData.h"
|
||||
#include "SkDrawable.h"
|
||||
#include "SkImageGenerator.h"
|
||||
#include "SkPicture.h"
|
||||
#include "SkPictureData.h"
|
||||
#include "SkPictureImageFilter.h"
|
||||
#include "SkPicturePlayback.h"
|
||||
#include "SkPicturePriv.h"
|
||||
#include "SkPictureRecorder.h"
|
||||
#include "SkPictureShader.h"
|
||||
#include "SkRecordedDrawable.h"
|
||||
#include "SkTypes.h"
|
||||
|
||||
SkPicture::SkPicture() : fUniqueID(0) {}
|
||||
|
||||
|
||||
sk_sp<SkPicture> SkPicturePriv::MakeFromBuffer(SkReadBuffer& buffer) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SkPicturePriv::Flatten(const sk_sp<const SkPicture> picture, SkWriteBuffer& buffer) {}
|
||||
|
||||
|
||||
SkPictureRecorder::SkPictureRecorder() {}
|
||||
|
||||
SkPictureRecorder::~SkPictureRecorder() {}
|
||||
|
||||
SkCanvas* SkPictureRecorder::beginRecording(const SkRect& userCullRect,
|
||||
SkBBHFactory* bbhFactory /* = nullptr */,
|
||||
uint32_t recordFlags /* = 0 */) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SkCanvas* SkPictureRecorder::getRecordingCanvas() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkPicture> SkPictureRecorder::finishRecordingAsPicture(uint32_t finishFlags) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkPicture> SkPictureRecorder::finishRecordingAsPictureWithCull(const SkRect& cullRect,
|
||||
uint32_t finishFlags) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {}
|
||||
|
||||
sk_sp<SkDrawable> SkPictureRecorder::finishRecordingAsDrawable(uint32_t finishFlags) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
SkPictureData* SkPictureData::CreateFromStream(SkStream* stream,
|
||||
const SkPictInfo& info,
|
||||
const SkDeserialProcs& procs,
|
||||
SkTypefacePlayback* topLevelTFPlayback) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SkPictureData* SkPictureData::CreateFromBuffer(SkReadBuffer& buffer,
|
||||
const SkPictInfo& info) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
sk_sp<SkFlattenable> SkPictureShader::CreateProc(SkReadBuffer& buffer) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SkPictureShader::flatten(SkWriteBuffer& buffer) const {}
|
||||
|
||||
|
||||
void SkPicturePlayback::draw(SkCanvas* canvas,
|
||||
SkPicture::AbortCallback* callback,
|
||||
SkReadBuffer* buffer) {}
|
||||
|
||||
|
||||
std::unique_ptr<SkImageGenerator>
|
||||
SkImageGenerator::MakeFromPicture(const SkISize& size, sk_sp<SkPicture> picture,
|
||||
const SkMatrix* matrix, const SkPaint* paint,
|
||||
SkImage::BitDepth bitDepth, sk_sp<SkColorSpace> colorSpace) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SkRecordedDrawable::flatten(SkWriteBuffer& buffer) const {}
|
||||
|
||||
sk_sp<SkFlattenable> SkRecordedDrawable::CreateProc(SkReadBuffer& buffer) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
sk_sp<SkFlattenable> SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) {
|
||||
return nullptr;
|
||||
}
|
Loading…
Reference in New Issue
Block a user