Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Unified Diff: cc/paint/paint_op_buffer.cc

Issue 2899483002: cc: Audit and static_assert the types in PaintOpBuffer can be moved.
Patch Set: check-copy better-better-comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/paint/paint_op_buffer.cc
diff --git a/cc/paint/paint_op_buffer.cc b/cc/paint/paint_op_buffer.cc
index d6556ab50df49e5de58a7f60b50fb2cd6141b668..23c1726ea875a8c2aa8ec32502a3610bf686d0cd 100644
--- a/cc/paint/paint_op_buffer.cc
+++ b/cc/paint/paint_op_buffer.cc
@@ -194,7 +194,7 @@ void AnnotateOp::Raster(const PaintOp* base_op,
SkCanvas* canvas,
const SkMatrix& original_ctm) {
auto* op = static_cast<const AnnotateOp*>(base_op);
- switch (op->annotation_type) {
+ switch (static_cast<PaintCanvas::AnnotationType>(op->annotation_type)) {
case PaintCanvas::AnnotationType::URL:
SkAnnotateRectWithURL(canvas, op->rect, op->data.get());
break;
@@ -213,21 +213,21 @@ void ClipPathOp::Raster(const PaintOp* base_op,
SkCanvas* canvas,
const SkMatrix& original_ctm) {
auto* op = static_cast<const ClipPathOp*>(base_op);
- canvas->clipPath(op->path, op->op, op->antialias);
+ canvas->clipPath(op->path, static_cast<SkClipOp>(op->op), op->antialias);
}
void ClipRectOp::Raster(const PaintOp* base_op,
SkCanvas* canvas,
const SkMatrix& original_ctm) {
auto* op = static_cast<const ClipRectOp*>(base_op);
- canvas->clipRect(op->rect, op->op, op->antialias);
+ canvas->clipRect(op->rect, static_cast<SkClipOp>(op->op), op->antialias);
}
void ClipRRectOp::Raster(const PaintOp* base_op,
SkCanvas* canvas,
const SkMatrix& original_ctm) {
auto* op = static_cast<const ClipRRectOp*>(base_op);
- canvas->clipRRect(op->rrect, op->op, op->antialias);
+ canvas->clipRRect(op->rrect, static_cast<SkClipOp>(op->op), op->antialias);
}
void ConcatOp::Raster(const PaintOp* base_op,
@@ -258,7 +258,8 @@ void DrawColorOp::Raster(const PaintOp* base_op,
SkCanvas* canvas,
const SkMatrix& original_ctm) {
auto* op = static_cast<const DrawColorOp*>(base_op);
- canvas->drawColor(op->color, op->mode);
+ canvas->drawColor(static_cast<SkColor>(op->color),
+ static_cast<SkBlendMode>(op->mode));
}
void DrawDisplayItemListOp::Raster(const PaintOp* base_op,
@@ -496,7 +497,9 @@ int DrawRecordOp::CountSlowPaths() const {
AnnotateOp::AnnotateOp(PaintCanvas::AnnotationType annotation_type,
const SkRect& rect,
sk_sp<SkData> data)
- : annotation_type(annotation_type), rect(rect), data(std::move(data)) {}
+ : annotation_type(static_cast<uint8_t>(annotation_type)),
+ rect(rect),
+ data(std::move(data)) {}
AnnotateOp::~AnnotateOp() = default;

Powered by Google App Engine
This is Rietveld 408576698