diff options
Diffstat (limited to 'cc/test/fake_content_layer_client.cc')
-rw-r--r-- | cc/test/fake_content_layer_client.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/cc/test/fake_content_layer_client.cc b/cc/test/fake_content_layer_client.cc index 0cbb92a..77fa2d0 100644 --- a/cc/test/fake_content_layer_client.cc +++ b/cc/test/fake_content_layer_client.cc @@ -28,6 +28,18 @@ FakeContentLayerClient::BitmapData::BitmapData(const SkBitmap& bitmap, FakeContentLayerClient::BitmapData::~BitmapData() { } +FakeContentLayerClient::ImageData::ImageData(const SkImage* img, + const gfx::Point& point, + const SkPaint& paint) + : image(skia::SharePtr(img)), point(point), paint(paint) {} + +FakeContentLayerClient::ImageData::ImageData(const SkImage* img, + const gfx::Transform& transform, + const SkPaint& paint) + : image(skia::SharePtr(img)), transform(transform), paint(paint) {} + +FakeContentLayerClient::ImageData::~ImageData() {} + FakeContentLayerClient::FakeContentLayerClient() : fill_with_nonsolid_color_(false), last_canvas_(nullptr), @@ -57,6 +69,12 @@ void FakeContentLayerClient::PaintContents( canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint); } + for (ImageVector::const_iterator it = draw_images_.begin(); + it != draw_images_.end(); ++it) { + canvas->drawImage(it->image.get(), it->point.x(), it->point.y(), + &it->paint); + } + if (fill_with_nonsolid_color_) { gfx::Rect draw_rect = paint_rect; bool red = true; @@ -113,6 +131,24 @@ FakeContentLayerClient::PaintContentsToDisplayList( } } + for (ImageVector::const_iterator it = draw_images_.begin(); + it != draw_images_.end(); ++it) { + if (!it->transform.IsIdentity()) { + auto* item = display_list->CreateAndAppendItem<TransformDisplayItem>(); + item->SetNew(it->transform); + } + canvas = skia::SharePtr( + recorder.beginRecording(it->image->width(), it->image->height())); + canvas->drawImage(it->image.get(), it->point.x(), it->point.y(), + &it->paint); + picture = skia::AdoptRef(recorder.endRecordingAsPicture()); + auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>(); + item->SetNew(picture.Pass()); + if (!it->transform.IsIdentity()) { + display_list->CreateAndAppendItem<EndTransformDisplayItem>(); + } + } + if (fill_with_nonsolid_color_) { gfx::Rect draw_rect = clip; bool red = true; |