Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion display_list/effects/dl_path_effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "flutter/display_list/dl_attributes.h"
#include "flutter/fml/logging.h"
#include "include/core/SkRect.h"
#include "third_party/skia/include/core/SkRect.h"

namespace flutter {

Expand Down
2 changes: 1 addition & 1 deletion display_list/effects/dl_path_effect_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "flutter/display_list/testing/dl_test_equality.h"
#include "flutter/display_list/utils/dl_comparable.h"
#include "gtest/gtest.h"
#include "include/core/SkScalar.h"
#include "third_party/skia/include/core/SkScalar.h"

namespace flutter {
namespace testing {
Expand Down
2 changes: 1 addition & 1 deletion display_list/image/dl_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <string>

#include "flutter/fml/macros.h"
#include "include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkRefCnt.h"

namespace impeller {
class Texture;
Expand Down
2 changes: 1 addition & 1 deletion display_list/skia/dl_sk_conversions_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "flutter/display_list/dl_tile_mode.h"
#include "flutter/display_list/dl_vertices.h"
#include "gtest/gtest.h"
#include "include/core/SkSamplingOptions.h"
#include "third_party/skia/include/core/SkSamplingOptions.h"

namespace flutter {
namespace testing {
Expand Down
17 changes: 0 additions & 17 deletions display_list/testing/dl_test_snippets.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,6 @@ struct DisplayListInvocation {
DlInvoker invoker;
bool supports_group_opacity_ = false;

bool sk_version_matches() {
return (static_cast<int>(op_count_) == sk_op_count_ &&
byte_count_ == sk_byte_count_);
}

// A negative sk_op_count means "do not test this op".
// Used mainly for these cases:
// - we cannot encode a DrawShadowRec (Skia private header)
// - SkCanvas cannot receive a DisplayList
// - SkCanvas may or may not inline an SkPicture
bool sk_testing_invalid() { return sk_op_count_ < 0; }

bool is_empty() { return byte_count_ == 0; }

bool supports_group_opacity() { return supports_group_opacity_; }
Expand All @@ -267,11 +255,6 @@ struct DisplayListInvocation {
// to |DisplayList.byte_count().
size_t byte_count() { return sizeof(DisplayList) + byte_count_; }

int sk_op_count() { return sk_op_count_; }
// byte count for the ops with DisplayList overhead as translated
// through an SkCanvas interface, comparable to |DisplayList.byte_count().
size_t sk_byte_count() { return sizeof(DisplayList) + sk_byte_count_; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 2 fields can be deleted now, but it would cascade into a huge edit of the long list of test cases that are expressed using this structure, so I'm leaving that for a future pass.


void Invoke(DlOpReceiver& builder) { invoker(builder); }

// sk_sp<DisplayList> Build() {
Expand Down
8 changes: 2 additions & 6 deletions flow/layers/display_list_raster_cache_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
#include "flutter/display_list/display_list.h"
#include "flutter/flow/embedded_views.h"
#include "flutter/flow/raster_cache_item.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPicture.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "third_party/skia/include/core/SkMatrix.h"
#include "third_party/skia/include/core/SkPoint.h"

namespace flutter {

Expand Down
2 changes: 0 additions & 2 deletions flow/layers/layer_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include "flutter/flow/raster_cache.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/time/time_delta.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkSize.h"

class GrDirectContext;

Expand Down
1 change: 0 additions & 1 deletion flow/raster_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
Expand Down
14 changes: 5 additions & 9 deletions flow/raster_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/fml/trace_event.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkRect.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkSize.h"
#include "third_party/skia/include/core/SkMatrix.h"
#include "third_party/skia/include/core/SkRect.h"

class GrDirectContext;
class SkColorSpace;
Expand Down Expand Up @@ -182,16 +180,14 @@ class RasterCache {
size_t GetLayerCachedEntriesCount() const;

/**
* Return the number of map entries in the picture caches (SkPicture and
* DisplayList) regardless of whether the entries have been populated with
* an image.
* Return the number of map entries in the picture (DisplayList) cache
* regardless of whether the entries have been populated with an image.
*/
size_t GetPictureCachedEntriesCount() const;

/**
* @brief Estimate how much memory is used by picture raster cache entries in
* bytes, including cache entries in the SkPicture cache and the DisplayList
* cache.
* bytes.
*
* Only SkImage's memory usage is counted as other objects are often much
* smaller compared to SkImage. SkImageInfo::computeMinByteSize is used to
Expand Down
73 changes: 0 additions & 73 deletions flow/raster_cache_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,39 +182,6 @@ TEST(RasterCache, SetCheckboardCacheImages) {
ASSERT_TRUE(did_draw_checkerboard);
}

TEST(RasterCache, AccessThresholdOfZeroDisablesCachingForSkPicture) {
size_t threshold = 0;
flutter::RasterCache cache(threshold);

SkMatrix matrix = SkMatrix::I();

auto display_list = GetSampleDisplayList();

MockCanvas dummy_canvas(1000, 1000);
DlPaint paint;

LayerStateStack preroll_state_stack;
preroll_state_stack.set_preroll_delegate(kGiantRect, matrix);
LayerStateStack paint_state_stack;
preroll_state_stack.set_delegate(&dummy_canvas);

FixedRefreshRateStopwatch raster_time;
FixedRefreshRateStopwatch ui_time;
PrerollContextHolder preroll_context_holder = GetSamplePrerollContextHolder(
preroll_state_stack, &cache, &raster_time, &ui_time);
PaintContextHolder paint_context_holder = GetSamplePaintContextHolder(
paint_state_stack, &cache, &raster_time, &ui_time);
auto& preroll_context = preroll_context_holder.preroll_context;
auto& paint_context = paint_context_holder.paint_context;

cache.BeginFrame();
DisplayListRasterCacheItem display_list_item(display_list, SkPoint(), true,
false);
ASSERT_FALSE(RasterCacheItemPrerollAndTryToRasterCache(
display_list_item, preroll_context, paint_context, matrix));
ASSERT_FALSE(display_list_item.Draw(paint_context, &dummy_canvas, &paint));
}

TEST(RasterCache, AccessThresholdOfZeroDisablesCachingForDisplayList) {
size_t threshold = 0;
flutter::RasterCache cache(threshold);
Expand Down Expand Up @@ -249,46 +216,6 @@ TEST(RasterCache, AccessThresholdOfZeroDisablesCachingForDisplayList) {
ASSERT_FALSE(display_list_item.Draw(paint_context, &dummy_canvas, &paint));
}

TEST(RasterCache, PictureCacheLimitPerFrameIsRespectedWhenZeroForSkPicture) {
size_t picture_cache_limit_per_frame = 0;
flutter::RasterCache cache(3, picture_cache_limit_per_frame);

SkMatrix matrix = SkMatrix::I();

auto display_list = GetSampleDisplayList();

MockCanvas dummy_canvas(1000, 1000);
DlPaint paint;

LayerStateStack preroll_state_stack;
preroll_state_stack.set_preroll_delegate(kGiantRect, matrix);
LayerStateStack paint_state_stack;
preroll_state_stack.set_delegate(&dummy_canvas);

FixedRefreshRateStopwatch raster_time;
FixedRefreshRateStopwatch ui_time;
PrerollContextHolder preroll_context_holder = GetSamplePrerollContextHolder(
preroll_state_stack, &cache, &raster_time, &ui_time);
PaintContextHolder paint_context_holder = GetSamplePaintContextHolder(
paint_state_stack, &cache, &raster_time, &ui_time);
auto& preroll_context = preroll_context_holder.preroll_context;
auto& paint_context = paint_context_holder.paint_context;

cache.BeginFrame();

DisplayListRasterCacheItem display_list_item(display_list, SkPoint(), true,
false);
ASSERT_FALSE(RasterCacheItemPrerollAndTryToRasterCache(
display_list_item, preroll_context, paint_context, matrix));
ASSERT_FALSE(display_list_item.Draw(paint_context, &dummy_canvas, &paint));
ASSERT_FALSE(RasterCacheItemPrerollAndTryToRasterCache(
display_list_item, preroll_context, paint_context, matrix));
ASSERT_FALSE(display_list_item.Draw(paint_context, &dummy_canvas, &paint));
ASSERT_FALSE(RasterCacheItemPrerollAndTryToRasterCache(
display_list_item, preroll_context, paint_context, matrix));
ASSERT_FALSE(display_list_item.Draw(paint_context, &dummy_canvas, &paint));
}

TEST(RasterCache, PictureCacheLimitPerFrameIsRespectedWhenZeroForDisplayList) {
size_t picture_cache_limit_per_frame = 0;
flutter::RasterCache cache(3, picture_cache_limit_per_frame);
Expand Down
4 changes: 2 additions & 2 deletions flow/testing/mock_raster_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace testing {

/**
* @brief A RasterCacheResult implementation that represents a cached Layer or
* SkPicture without the overhead of storage.
* DisplayList without the overhead of storage.
*
* This implementation is used by MockRasterCache only for testing proper usage
* of the RasterCache in layer unit tests.
Expand Down Expand Up @@ -50,7 +50,7 @@ static std::vector<RasterCacheItem*> raster_cache_items_;

/**
* @brief A RasterCache implementation that simulates the act of rendering a
* Layer or SkPicture without the overhead of rasterization or pixel storage.
* Layer or DisplayList without the overhead of rasterization or pixel storage.
* This implementation is used only for testing proper usage of the RasterCache
* in layer unit tests.
*/
Expand Down
1 change: 0 additions & 1 deletion lib/ui/compositing/scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include "flutter/flow/layers/layer_tree.h"
#include "flutter/lib/ui/dart_wrapper.h"
#include "third_party/skia/include/core/SkPicture.h"

namespace flutter {

Expand Down
1 change: 0 additions & 1 deletion lib/ui/painting/picture.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "flutter/lib/ui/dart_wrapper.h"
#include "flutter/lib/ui/painting/image.h"
#include "flutter/lib/ui/ui_dart_state.h"
#include "third_party/skia/include/core/SkPicture.h"

namespace flutter {
class Canvas;
Expand Down
1 change: 0 additions & 1 deletion lib/ui/snapshot_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "flutter/common/graphics/texture.h"
#include "flutter/display_list/display_list.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/gpu/GrBackendSurface.h"
#include "third_party/skia/include/gpu/GrContextThreadSafeProxy.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
Expand Down
3 changes: 1 addition & 2 deletions shell/common/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "flutter/shell/common/rasterizer.h"
#include "flutter/shell/common/run_configuration.h"
#include "flutter/shell/common/shell_io_manager.h"
#include "third_party/skia/include/core/SkPicture.h"

namespace flutter {

Expand Down Expand Up @@ -345,7 +344,7 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
/// snapshot a specified scene. The engine
/// cannot snapshot a scene on the UI thread
/// directly because the scene (described via
/// an `SkPicture`) may reference resources on
/// a `DisplayList`) may reference resources on
/// the GPU and there is no GPU context current
/// on the UI thread. The delegate is a
/// component that has access to all the
Expand Down
1 change: 0 additions & 1 deletion shell/common/persistent_cache_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "flutter/shell/common/switches.h"
#include "flutter/shell/version/version.h"
#include "flutter/testing/testing.h"
#include "include/core/SkPicture.h"

namespace flutter {
namespace testing {
Expand Down
12 changes: 5 additions & 7 deletions shell/common/serialization_callbacks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
// found in the LICENSE file.

#include "flutter/fml/logging.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPicture.h"
#include "include/core/SkSerialProcs.h"
#include "include/core/SkStream.h"
#include "include/core/SkTypeface.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h"

namespace flutter {

Expand Down
5 changes: 2 additions & 3 deletions shell/common/serialization_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
#define FLUTTER_SHELL_COMMON_SERIALIZATION_CALLBACKS_H_

#include "flutter/fml/logging.h"
#include "include/core/SkImage.h"
#include "include/core/SkPicture.h"
#include "include/core/SkTypeface.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkTypeface.h"

namespace flutter {

Expand Down
1 change: 0 additions & 1 deletion testing/mock_canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "flutter/fml/logging.h"
#include "flutter/testing/display_list_testing.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkSerialProcs.h"
#include "third_party/skia/include/core/SkSize.h"
#include "third_party/skia/include/core/SkTextBlob.h"
Expand Down