Skip to content

Commit

Permalink
Make paint_op_buffer_serializer use SkColor4f
Browse files Browse the repository at this point in the history
This CL is part of the effort of increasing color precision and
color gamut support in chrome.
https://docs.google.com/document/d/1y5qhBuK7sFkXt7c6vcrAJeIofj3h2UQ3btX3Hv1hrz8/edit#heading=h.69111d60ji6h
particularly
https://docs.google.com/document/d/1kvl_hwnIG3lAXcSxRndgcqbDGEvGoiD52-VwOuVfveE/edit?resourcekey=0-uvlZUrkCQ-o0H8ohYepsqA
To do so we are changing viz, cc, and other chrome parts to use
SkColor4f instead of SkColor.

This CL addresses the paint_op_buffer_serializer, removing SkColor from
there in benefit of using SkColor4f.

The only missing part of cc/paint with SkColor would be Skottie and we
can probably wait to do that part until later.

Bug: 1308932
Change-Id: I34594a57ebef9cd20977fc492ebda86bc514d6d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764895
Reviewed-by: Aaron Krajeski <aaronhk@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Auto-Submit: Juanmi Huertas <juanmihd@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: ccameron chromium <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1026409}
  • Loading branch information
Juanmihd authored and Chromium LUCI CQ committed Jul 20, 2022
1 parent 2cfcdad commit f1119b2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions cc/paint/paint_op_buffer_serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ void PaintOpBufferSerializer::ClearForOpaqueRaster(
SkClipOp::kDifference, false);
SerializeOp(canvas, &inner_clip_op, nullptr, params);
}
DrawColorOp clear_op(SkColor4f::FromColor(preamble.background_color),
SkBlendMode::kSrc);
DrawColorOp clear_op(preamble.background_color, SkBlendMode::kSrc);
SerializeOp(canvas, &clear_op, nullptr, params);
RestoreToCount(canvas, 1, params);
}
Expand Down
2 changes: 1 addition & 1 deletion cc/paint/paint_op_buffer_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CC_PAINT_EXPORT PaintOpBufferSerializer {
// potentially being partially transparent, if post scaled).
bool requires_clear = true;
// If clearing is needed, the color to clear to.
SkColor background_color = SK_ColorTRANSPARENT;
SkColor4f background_color = SkColors::kTransparent;
};
// Serialize the buffer with a preamble. This function wraps the buffer in a
// save/restore and includes any translations, scales, and clearing as
Expand Down
3 changes: 1 addition & 2 deletions gpu/command_buffer/client/raster_implementation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1347,8 +1347,7 @@ void RasterImplementation::RasterCHROMIUM(const cc::DisplayItemList* list,
preamble.post_translation = post_translate;
preamble.post_scale = post_scale;
preamble.requires_clear = requires_clear;
// TODO(aaronhk): change the preamble to float color
preamble.background_color = raster_properties_->background_color.toSkColor();
preamble.background_color = raster_properties_->background_color;

// Wrap the provided provider in a stashing provider so that we can delay
// unrefing images until we have serialized dependent commands.
Expand Down

0 comments on commit f1119b2

Please sign in to comment.