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

Side by Side Diff: cc/test/fake_display_list_raster_source.cc

Issue 1835843002: WIP: Fix foreignObject cullrect Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « cc/test/fake_content_layer_client.cc ('k') | cc/test/skia_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/test/fake_display_list_raster_source.h" 5 #include "cc/test/fake_display_list_raster_source.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "cc/test/fake_display_list_recording_source.h" 10 #include "cc/test/fake_display_list_recording_source.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 scoped_refptr<FakeDisplayListRasterSource> 16 scoped_refptr<FakeDisplayListRasterSource>
17 FakeDisplayListRasterSource::CreateInfiniteFilled() { 17 FakeDisplayListRasterSource::CreateInfiniteFilled() {
18 gfx::Size size(std::numeric_limits<int>::max() / 10, 18 gfx::Size size(std::numeric_limits<int>::max() / 10,
19 std::numeric_limits<int>::max() / 10); 19 std::numeric_limits<int>::max() / 10);
20 return CreateFilled(size); 20 return CreateFilled(size);
21 } 21 }
22 22
23 scoped_refptr<FakeDisplayListRasterSource> 23 scoped_refptr<FakeDisplayListRasterSource>
24 FakeDisplayListRasterSource::CreateFilled(const gfx::Size& size) { 24 FakeDisplayListRasterSource::CreateFilled(const gfx::Size& size) {
25 auto recording_source = 25 auto recording_source =
26 FakeDisplayListRecordingSource::CreateFilledRecordingSource(size); 26 FakeDisplayListRecordingSource::CreateFilledRecordingSource(size);
27 27
28 SkPaint red_paint; 28 SkPaint salmon_pink_paint;
29 red_paint.setColor(SK_ColorRED); 29 salmon_pink_paint.setColor(SK_ColorRED);
30 recording_source->add_draw_rect_with_paint(gfx::Rect(size), red_paint); 30 // Set an arbitrary non-opaque alpha in order to force the source non-solid.
31 31 // There are a number of ways to ensure the raster source is not solid. This
32 gfx::Size smaller_size(size.width() - 10, size.height() - 10); 32 // is just one of them.
33 SkPaint green_paint; 33 salmon_pink_paint.setAlpha(127);
34 green_paint.setColor(SK_ColorGREEN); 34 recording_source->add_draw_rect_with_paint(gfx::Rect(size),
35 recording_source->add_draw_rect_with_paint(gfx::Rect(smaller_size), 35 salmon_pink_paint);
36 green_paint);
37 36
38 recording_source->Rerecord(); 37 recording_source->Rerecord();
39 38
40 return make_scoped_refptr( 39 return make_scoped_refptr(
41 new FakeDisplayListRasterSource(recording_source.get(), false)); 40 new FakeDisplayListRasterSource(recording_source.get(), false));
42 } 41 }
43 42
44 scoped_refptr<FakeDisplayListRasterSource> 43 scoped_refptr<FakeDisplayListRasterSource>
45 FakeDisplayListRasterSource::CreateFilledLCD(const gfx::Size& size) { 44 FakeDisplayListRasterSource::CreateFilledLCD(const gfx::Size& size) {
46 auto recording_source = 45 auto recording_source =
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 float contents_scale, 150 float contents_scale,
152 bool include_images) const { 151 bool include_images) const {
153 if (playback_allowed_event_) 152 if (playback_allowed_event_)
154 playback_allowed_event_->Wait(); 153 playback_allowed_event_->Wait();
155 DisplayListRasterSource::PlaybackToCanvas(canvas, canvas_bitmap_rect, 154 DisplayListRasterSource::PlaybackToCanvas(canvas, canvas_bitmap_rect,
156 canvas_playback_rect, 155 canvas_playback_rect,
157 contents_scale, include_images); 156 contents_scale, include_images);
158 } 157 }
159 158
160 } // namespace cc 159 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_content_layer_client.cc ('k') | cc/test/skia_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698