Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 601286b

Browse files
committed
Remove root_surface_transformation from PaintContext
It should be sufficient to provide the matrix to preroll.
1 parent e27a2e9 commit 601286b

File tree

6 files changed

+6
-16
lines changed

6 files changed

+6
-16
lines changed

flow/layers/layer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class Layer {
5757

5858
struct PaintContext {
5959
SkCanvas& canvas;
60-
const SkMatrix& root_surface_transformation;
6160
const Stopwatch& frame_time;
6261
const Stopwatch& engine_time;
6362
TextureRegistry& texture_registry;

flow/layers/layer_tree.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void LayerTree::Preroll(CompositorContext::ScopedFrame& frame,
3232
SkRect::MakeEmpty(),
3333
};
3434

35-
root_layer_->Preroll(&context, SkMatrix::I());
35+
root_layer_->Preroll(&context, frame.root_surface_transformation());
3636
}
3737

3838
#if defined(OS_FUCHSIA)
@@ -64,7 +64,6 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame) const {
6464
TRACE_EVENT0("flutter", "LayerTree::Paint");
6565
Layer::PaintContext context = {
6666
*frame.canvas(), //
67-
frame.root_surface_transformation(), //
6867
frame.context().frame_time(), //
6968
frame.context().engine_time(), //
7069
frame.context().texture_registry(), //
@@ -100,7 +99,6 @@ sk_sp<SkPicture> LayerTree::Flatten(const SkRect& bounds) {
10099

101100
Layer::PaintContext paint_context = {
102101
*canvas, // canvas
103-
root_surface_transformation, // root surface transformation
104102
unused_stopwatch, // frame time (dont care)
105103
unused_stopwatch, // engine time (dont care)
106104
unused_texture_registry, // texture registry (not supported)
@@ -110,7 +108,7 @@ sk_sp<SkPicture> LayerTree::Flatten(const SkRect& bounds) {
110108
// Even if we don't have a root layer, we still need to create an empty
111109
// picture.
112110
if (root_layer_) {
113-
root_layer_->Preroll(&preroll_context, SkMatrix::I());
111+
root_layer_->Preroll(&preroll_context, root_surface_transformation);
114112
// The needs painting flag may be set after the preroll. So check it after.
115113
if (root_layer_->needs_painting()) {
116114
root_layer_->Paint(paint_context);

flow/layers/picture_layer.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ void PictureLayer::Paint(PaintContext& context) const {
4545
#endif
4646

4747
if (raster_cache_result_.is_valid()) {
48-
raster_cache_result_.draw(context.canvas,
49-
context.root_surface_transformation);
48+
raster_cache_result_.draw(context.canvas);
5049
} else {
5150
context.canvas.drawPicture(picture());
5251
}

flow/raster_cache.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@
1717

1818
namespace flow {
1919

20-
void RasterCacheResult::draw(
21-
SkCanvas& canvas,
22-
const SkMatrix& root_surface_transformation) const {
20+
void RasterCacheResult::draw(SkCanvas& canvas) const {
2321
SkAutoCanvasRestore auto_restore(&canvas, true);
2422
SkIRect bounds =
2523
RasterCache::GetDeviceBounds(logical_rect_, canvas.getTotalMatrix());
2624
FML_DCHECK(bounds.size() == image_->dimensions());
27-
// Clear all transformations on the canvas except the root surface
28-
// transormation.
29-
canvas.setMatrix(root_surface_transformation);
25+
canvas.resetMatrix();
3026
canvas.drawImage(image_, bounds.fLeft, bounds.fTop);
3127
}
3228

flow/raster_cache.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ class RasterCacheResult {
2828

2929
bool is_valid() const { return static_cast<bool>(image_); };
3030

31-
void draw(SkCanvas& canvas,
32-
const SkMatrix& root_surface_transformation) const;
31+
void draw(SkCanvas& canvas) const;
3332

3433
private:
3534
sk_sp<SkImage> image_;

flow/scene_update_context.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ SceneUpdateContext::ExecutePaintTasks(CompositorContext::ScopedFrame& frame) {
188188
FML_DCHECK(task.surface);
189189
SkCanvas* canvas = task.surface->GetSkiaSurface()->getCanvas();
190190
Layer::PaintContext context = {*canvas,
191-
frame.root_surface_transformation(),
192191
frame.context().frame_time(),
193192
frame.context().engine_time(),
194193
frame.context().texture_registry(),

0 commit comments

Comments
 (0)