Rename paint data structures
This patch typedefs a number of skia data structures used in painting in
Blink and ui.
SkCanvas -> PaintCanvas
SkSurface -> PaintSurface
SkPicture -> PaintRecord
SkPictureRecorder -> PaintRecorder
SkPaint -> PaintFlags
SkShader -> PaintShader
These are all typedef'd to Skia types in cc/paint headers. They are
forwarded to the Blink namespace via platform/graphics/paint headers.
This first step in this patch is to rename uses of these classes
everywhere and then further patches will replace their implementation.
This adds a cc:paint gn component that only depends on Skia that can
then be depended on by ui and Blink platform without depending on the
rest of cc. This allows ui and Blink platform to continue to
encapsulate its use of cc while still being able to use paint data
structures throughout the entire pipeline.
This patch will be followed up with another patch to change all of
the identifiers that refer to old names.
See: https://docs.google.com/document/d/135-2dYsilJCPucW7edvuh-eGOmmGvazX4QuF7vIboBY/edit?disco=AAAAA5r88Q0
BUG=671433
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel
Review-Url: https://codereview.chromium.org/2640983002
Cr-Commit-Position: refs/heads/master@{#447861}
diff --git a/cc/trees/layer_tree_host_pixeltest_masks.cc b/cc/trees/layer_tree_host_pixeltest_masks.cc
index fd24b5d..7d9c3cd 100644
--- a/cc/trees/layer_tree_host_pixeltest_masks.cc
+++ b/cc/trees/layer_tree_host_pixeltest_masks.cc
@@ -9,13 +9,14 @@
#include "cc/layers/picture_image_layer.h"
#include "cc/layers/picture_layer.h"
#include "cc/layers/solid_color_layer.h"
+#include "cc/paint/paint_flags.h"
+#include "cc/paint/paint_recorder.h"
+#include "cc/paint/paint_surface.h"
#include "cc/playback/drawing_display_item.h"
#include "cc/test/layer_tree_pixel_resource_test.h"
#include "cc/test/pixel_comparator.h"
#include "cc/test/solid_color_content_layer_client.h"
#include "third_party/skia/include/core/SkImage.h"
-#include "third_party/skia/include/core/SkPictureRecorder.h"
-#include "third_party/skia/include/core/SkSurface.h"
#if !defined(OS_ANDROID)
@@ -38,12 +39,12 @@
scoped_refptr<DisplayItemList> PaintContentsToDisplayList(
PaintingControlSetting picture_control) override {
- SkPictureRecorder recorder;
- SkCanvas* canvas =
+ PaintRecorder recorder;
+ PaintCanvas* canvas =
recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(bounds_)));
- SkPaint paint;
- paint.setStyle(SkPaint::kStroke_Style);
+ PaintFlags paint;
+ paint.setStyle(PaintFlags::kStroke_Style);
paint.setStrokeWidth(SkIntToScalar(2));
paint.setColor(SK_ColorWHITE);
@@ -102,7 +103,7 @@
mask->SetBounds(mask_bounds);
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(200, 200);
- SkCanvas* canvas = surface->getCanvas();
+ PaintCanvas* canvas = surface->getCanvas();
canvas->scale(SkIntToScalar(4), SkIntToScalar(4));
MaskContentLayerClient client(mask_bounds);
scoped_refptr<DisplayItemList> mask_display_list =
@@ -160,12 +161,12 @@
gfx::Rect PaintableRegion() override { return gfx::Rect(bounds_); }
scoped_refptr<DisplayItemList> PaintContentsToDisplayList(
PaintingControlSetting picture_control) override {
- SkPictureRecorder recorder;
- SkCanvas* canvas =
+ PaintRecorder recorder;
+ PaintCanvas* canvas =
recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(bounds_)));
- SkPaint paint;
- paint.setStyle(SkPaint::kStroke_Style);
+ PaintFlags paint;
+ paint.setStyle(PaintFlags::kStroke_Style);
paint.setStrokeWidth(SkIntToScalar(4));
paint.setColor(color_);
canvas->clear(SK_ColorTRANSPARENT);
@@ -203,12 +204,12 @@
gfx::Rect PaintableRegion() override { return gfx::Rect(bounds_); }
scoped_refptr<DisplayItemList> PaintContentsToDisplayList(
PaintingControlSetting picture_control) override {
- SkPictureRecorder recorder;
- SkCanvas* canvas =
+ PaintRecorder recorder;
+ PaintCanvas* canvas =
recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(bounds_)));
- SkPaint paint;
- paint.setStyle(SkPaint::kFill_Style);
+ PaintFlags paint;
+ paint.setStyle(PaintFlags::kFill_Style);
paint.setColor(SK_ColorWHITE);
canvas->clear(SK_ColorTRANSPARENT);
canvas->drawCircle(bounds_.width() / 2,
diff --git a/cc/trees/layer_tree_host_pixeltest_scrollbars.cc b/cc/trees/layer_tree_host_pixeltest_scrollbars.cc
index 491fb7c..69fec99 100644
--- a/cc/trees/layer_tree_host_pixeltest_scrollbars.cc
+++ b/cc/trees/layer_tree_host_pixeltest_scrollbars.cc
@@ -9,6 +9,8 @@
#include "cc/input/scrollbar.h"
#include "cc/layers/painted_scrollbar_layer.h"
#include "cc/layers/solid_color_layer.h"
+#include "cc/paint/paint_canvas.h"
+#include "cc/paint/paint_flags.h"
#include "cc/test/layer_tree_pixel_test.h"
#include "cc/test/test_in_process_context_provider.h"
#include "gpu/command_buffer/client/gles2_interface.h"
@@ -48,11 +50,11 @@
gfx::Rect TrackRect() const override { return rect_; }
float ThumbOpacity() const override { return 1.f; }
bool NeedsPaintPart(ScrollbarPart part) const override { return true; }
- void PaintPart(SkCanvas* canvas,
+ void PaintPart(PaintCanvas* canvas,
ScrollbarPart part,
const gfx::Rect& content_rect) override {
- SkPaint paint;
- paint.setStyle(SkPaint::kStroke_Style);
+ PaintFlags paint;
+ paint.setStyle(PaintFlags::kStroke_Style);
paint.setStrokeWidth(SkIntToScalar(paint_scale_));
paint.setColor(color_);
diff --git a/cc/trees/layer_tree_host_pixeltest_synchronous.cc b/cc/trees/layer_tree_host_pixeltest_synchronous.cc
index 5561906..6f73e08 100644
--- a/cc/trees/layer_tree_host_pixeltest_synchronous.cc
+++ b/cc/trees/layer_tree_host_pixeltest_synchronous.cc
@@ -35,7 +35,7 @@
FakeContentLayerClient client;
client.set_bounds(bounds);
- SkPaint green_paint;
+ PaintFlags green_paint;
green_paint.setColor(SkColorSetARGB(255, 0, 255, 0));
client.add_draw_rect(gfx::Rect(bounds), green_paint);
scoped_refptr<PictureLayer> root = PictureLayer::Create(&client);
@@ -66,7 +66,7 @@
FakeContentLayerClient client;
client.set_bounds(bounds);
- SkPaint green_paint;
+ PaintFlags green_paint;
green_paint.setColor(SkColorSetARGB(255, 0, 255, 0));
client.add_draw_rect(gfx::Rect(bounds), green_paint);
scoped_refptr<PictureLayer> root = PictureLayer::Create(&client);
diff --git a/cc/trees/layer_tree_host_pixeltest_tiles.cc b/cc/trees/layer_tree_host_pixeltest_tiles.cc
index f9e4bbd..0a279c0 100644
--- a/cc/trees/layer_tree_host_pixeltest_tiles.cc
+++ b/cc/trees/layer_tree_host_pixeltest_tiles.cc
@@ -7,13 +7,14 @@
#include "cc/layers/content_layer_client.h"
#include "cc/layers/picture_layer.h"
#include "cc/output/copy_output_request.h"
+#include "cc/paint/paint_canvas.h"
+#include "cc/paint/paint_flags.h"
+#include "cc/paint/paint_recorder.h"
#include "cc/playback/display_item_list.h"
#include "cc/playback/drawing_display_item.h"
#include "cc/test/layer_tree_pixel_test.h"
#include "cc/test/test_compositor_frame_sink.h"
#include "gpu/command_buffer/client/gles2_interface.h"
-#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkPictureRecorder.h"
#if !defined(OS_ANDROID)
@@ -112,8 +113,8 @@
PaintingControlSetting painting_status) override {
auto display_list = make_scoped_refptr(new DisplayItemList);
- SkPictureRecorder recorder;
- SkCanvas* canvas =
+ PaintRecorder recorder;
+ PaintCanvas* canvas =
recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(size_)));
gfx::Rect top(0, 0, size_.width(), size_.height() / 2);
gfx::Rect bottom(0, size_.height() / 2, size_.width(), size_.height() / 2);
@@ -121,8 +122,8 @@
gfx::Rect blue_rect = blue_top_ ? top : bottom;
gfx::Rect yellow_rect = blue_top_ ? bottom : top;
- SkPaint paint;
- paint.setStyle(SkPaint::kFill_Style);
+ PaintFlags paint;
+ paint.setStyle(PaintFlags::kFill_Style);
paint.setColor(SK_ColorBLUE);
canvas->drawRect(gfx::RectToSkRect(blue_rect), paint);
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index e73d79e2..a8b7086 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -15,6 +15,7 @@
#include "cc/layers/video_layer.h"
#include "cc/layers/video_layer_impl.h"
#include "cc/output/filter_operations.h"
+#include "cc/paint/paint_flags.h"
#include "cc/resources/single_release_callback.h"
#include "cc/resources/ui_resource_manager.h"
#include "cc/test/fake_content_layer_client.h"
@@ -609,7 +610,7 @@
root_->SetIsDrawable(true);
// Paint non-solid color.
- SkPaint paint;
+ PaintFlags paint;
paint.setColor(SkColorSetARGB(100, 80, 200, 200));
client_.add_draw_rect(gfx::Rect(5, 5), paint);
@@ -688,7 +689,7 @@
void SetupTree() override {
// Paint non-solid color.
- SkPaint paint;
+ PaintFlags paint;
paint.setColor(SkColorSetARGB(100, 80, 200, 200));
client_.add_draw_rect(gfx::Rect(5, 5), paint);
@@ -1602,7 +1603,7 @@
: public LayerTreeTest {
protected:
void SetupTree() override {
- SkPaint paint;
+ PaintFlags paint;
client_.set_fill_with_nonsolid_color(true);
client_.add_draw_rect(gfx::Rect(5, 5), paint);