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

Side by Side Diff: cc/trees/layer_tree_host_pixeltest_tiles.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "cc/layers/content_layer_client.h" 7 #include "cc/layers/content_layer_client.h"
8 #include "cc/layers/picture_layer.h" 8 #include "cc/layers/picture_layer.h"
9 #include "cc/output/copy_output_request.h" 9 #include "cc/output/copy_output_request.h"
10 #include "cc/paint/paint_canvas.h"
11 #include "cc/paint/paint_flags.h"
12 #include "cc/paint/paint_recorder.h"
10 #include "cc/playback/display_item_list.h" 13 #include "cc/playback/display_item_list.h"
11 #include "cc/playback/drawing_display_item.h" 14 #include "cc/playback/drawing_display_item.h"
12 #include "cc/test/layer_tree_pixel_test.h" 15 #include "cc/test/layer_tree_pixel_test.h"
13 #include "cc/test/test_compositor_frame_sink.h" 16 #include "cc/test/test_compositor_frame_sink.h"
14 #include "gpu/command_buffer/client/gles2_interface.h" 17 #include "gpu/command_buffer/client/gles2_interface.h"
15 #include "third_party/skia/include/core/SkCanvas.h"
16 #include "third_party/skia/include/core/SkPictureRecorder.h"
17 18
18 #if !defined(OS_ANDROID) 19 #if !defined(OS_ANDROID)
19 20
20 namespace cc { 21 namespace cc {
21 namespace { 22 namespace {
22 23
23 enum RasterMode { 24 enum RasterMode {
24 PARTIAL_ONE_COPY, 25 PARTIAL_ONE_COPY,
25 FULL_ONE_COPY, 26 FULL_ONE_COPY,
26 PARTIAL_GPU, 27 PARTIAL_GPU,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 class BlueYellowClient : public ContentLayerClient { 106 class BlueYellowClient : public ContentLayerClient {
106 public: 107 public:
107 explicit BlueYellowClient(const gfx::Size& size) 108 explicit BlueYellowClient(const gfx::Size& size)
108 : size_(size), blue_top_(true) {} 109 : size_(size), blue_top_(true) {}
109 110
110 gfx::Rect PaintableRegion() override { return gfx::Rect(size_); } 111 gfx::Rect PaintableRegion() override { return gfx::Rect(size_); }
111 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( 112 scoped_refptr<DisplayItemList> PaintContentsToDisplayList(
112 PaintingControlSetting painting_status) override { 113 PaintingControlSetting painting_status) override {
113 auto display_list = make_scoped_refptr(new DisplayItemList); 114 auto display_list = make_scoped_refptr(new DisplayItemList);
114 115
115 SkPictureRecorder recorder; 116 PaintRecorder recorder;
116 SkCanvas* canvas = 117 PaintCanvas* canvas =
117 recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(size_))); 118 recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(size_)));
118 gfx::Rect top(0, 0, size_.width(), size_.height() / 2); 119 gfx::Rect top(0, 0, size_.width(), size_.height() / 2);
119 gfx::Rect bottom(0, size_.height() / 2, size_.width(), size_.height() / 2); 120 gfx::Rect bottom(0, size_.height() / 2, size_.width(), size_.height() / 2);
120 121
121 gfx::Rect blue_rect = blue_top_ ? top : bottom; 122 gfx::Rect blue_rect = blue_top_ ? top : bottom;
122 gfx::Rect yellow_rect = blue_top_ ? bottom : top; 123 gfx::Rect yellow_rect = blue_top_ ? bottom : top;
123 124
124 SkPaint paint; 125 PaintFlags paint;
125 paint.setStyle(SkPaint::kFill_Style); 126 paint.setStyle(PaintFlags::kFill_Style);
126 127
127 paint.setColor(SK_ColorBLUE); 128 paint.setColor(SK_ColorBLUE);
128 canvas->drawRect(gfx::RectToSkRect(blue_rect), paint); 129 canvas->drawRect(gfx::RectToSkRect(blue_rect), paint);
129 paint.setColor(SK_ColorYELLOW); 130 paint.setColor(SK_ColorYELLOW);
130 canvas->drawRect(gfx::RectToSkRect(yellow_rect), paint); 131 canvas->drawRect(gfx::RectToSkRect(yellow_rect), paint);
131 132
132 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>( 133 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
133 PaintableRegion(), recorder.finishRecordingAsPicture()); 134 PaintableRegion(), recorder.finishRecordingAsPicture());
134 display_list->Finalize(); 135 display_list->Finalize();
135 return display_list; 136 return display_list;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 FullRaster_SingleThread_GpuRaster) { 244 FullRaster_SingleThread_GpuRaster) {
244 RunRasterPixelTest( 245 RunRasterPixelTest(
245 false, FULL_GPU, picture_layer_, 246 false, FULL_GPU, picture_layer_,
246 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png"))); 247 base::FilePath(FILE_PATH_LITERAL("blue_yellow_flipped.png")));
247 } 248 }
248 249
249 } // namespace 250 } // namespace
250 } // namespace cc 251 } // namespace cc
251 252
252 #endif // !defined(OS_ANDROID) 253 #endif // !defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_synchronous.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698