diff options
author | thestig <thestig@chromium.org> | 2015-04-08 11:49:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-08 18:49:38 +0000 |
commit | 3523bf887df5b18d4837012e2a40e9e509eec409 (patch) | |
tree | 2ea0241efb7ccab10c0f8d16fb006a480ca7d378 | |
parent | 9cd6e0dccc8918b56d2d38bf1cbc72bfa3e324fd (diff) | |
download | chromium_src-3523bf887df5b18d4837012e2a40e9e509eec409.zip chromium_src-3523bf887df5b18d4837012e2a40e9e509eec409.tar.gz chromium_src-3523bf887df5b18d4837012e2a40e9e509eec409.tar.bz2 |
Use SkPictureRecorder::endRecordingAsPicture() instead of endRecording()
endRecording() is deprecated.
Review URL: https://codereview.chromium.org/1066273002
Cr-Commit-Position: refs/heads/master@{#324260}
-rw-r--r-- | cc/layers/content_layer.cc | 3 | ||||
-rw-r--r-- | cc/layers/picture_image_layer.cc | 3 | ||||
-rw-r--r-- | cc/layers/picture_layer.cc | 3 | ||||
-rw-r--r-- | cc/resources/display_item_list.cc | 5 | ||||
-rw-r--r-- | cc/resources/display_item_list_unittest.cc | 10 | ||||
-rw-r--r-- | cc/resources/display_list_raster_source.cc | 3 | ||||
-rw-r--r-- | cc/resources/gpu_rasterizer.cc | 3 | ||||
-rw-r--r-- | cc/resources/picture.cc | 2 | ||||
-rw-r--r-- | cc/resources/picture_pile_impl.cc | 3 | ||||
-rw-r--r-- | cc/resources/skpicture_content_layer_updater.cc | 2 | ||||
-rw-r--r-- | cc/test/fake_content_layer_client.cc | 6 | ||||
-rw-r--r-- | printing/pdf_metafile_skia.cc | 2 | ||||
-rw-r--r-- | skia/ext/analysis_canvas_unittest.cc | 7 | ||||
-rw-r--r-- | skia/ext/pixel_ref_utils_unittest.cc | 36 |
14 files changed, 53 insertions, 35 deletions
diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc index d1ff842..7efa1c2 100644 --- a/cc/layers/content_layer.cc +++ b/cc/layers/content_layer.cc @@ -125,7 +125,8 @@ skia::RefPtr<SkPicture> ContentLayer::GetPicture() const { SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0); client_->PaintContents(canvas, gfx::Rect(width, height), ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(recorder.endRecordingAsPicture()); return picture; } diff --git a/cc/layers/picture_image_layer.cc b/cc/layers/picture_image_layer.cc index 6886612..b972ec1 100644 --- a/cc/layers/picture_image_layer.cc +++ b/cc/layers/picture_image_layer.cc @@ -72,7 +72,8 @@ scoped_refptr<DisplayItemList> PictureImageLayer::PaintContentsToDisplayList( SkCanvas* canvas = recorder.beginRecording(gfx::RectToSkRect(clip)); PaintContents(canvas, clip, painting_control); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(recorder.endRecordingAsPicture()); display_item_list->AppendItem(DrawingDisplayItem::Create(picture)); return display_item_list; } diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index d41b541..5c4cb06 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -205,7 +205,8 @@ skia::RefPtr<SkPicture> PictureLayer::GetPicture() const { SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0); client_->PaintContents(canvas, gfx::Rect(width, height), ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(recorder.endRecordingAsPicture()); return picture; } diff --git a/cc/resources/display_item_list.cc b/cc/resources/display_item_list.cc index 26ff003..33990d0 100644 --- a/cc/resources/display_item_list.cc +++ b/cc/resources/display_item_list.cc @@ -72,7 +72,7 @@ void DisplayItemList::CreateAndCacheSkPicture() { canvas->clipRect(gfx::RectToSkRect(layer_rect_)); for (size_t i = 0; i < items_.size(); ++i) items_[i]->Raster(canvas.get(), NULL); - picture_ = skia::AdoptRef(recorder.endRecording()); + picture_ = skia::AdoptRef(recorder.endRecordingAsPicture()); DCHECK(picture_); } @@ -127,7 +127,8 @@ DisplayItemList::AsValue() const { canvas->clipRect(gfx::RectToSkRect(layer_rect_)); for (size_t i = 0; i < items_.size(); ++i) items_[i]->RasterForTracing(canvas); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(recorder.endRecordingAsPicture()); std::string b64_picture; PictureDebugUtil::SerializeAsBase64(picture.get(), &b64_picture); diff --git a/cc/resources/display_item_list_unittest.cc b/cc/resources/display_item_list_unittest.cc index c9b9558..898b5fe 100644 --- a/cc/resources/display_item_list_unittest.cc +++ b/cc/resources/display_item_list_unittest.cc @@ -44,7 +44,7 @@ TEST(DisplayItemListTest, SingleDrawingItem) { canvas->translate(offset.x(), offset.y()); canvas->drawRectCoords(0.f, 0.f, 60.f, 60.f, red_paint); canvas->drawRectCoords(50.f, 50.f, 75.f, 75.f, blue_paint); - picture = skia::AdoptRef(recorder.endRecording()); + picture = skia::AdoptRef(recorder.endRecordingAsPicture()); list->AppendItem(DrawingDisplayItem::Create(picture)); DrawDisplayList(pixels, layer_rect, list); @@ -83,7 +83,7 @@ TEST(DisplayItemListTest, ClipItem) { recorder.beginRecording(gfx::RectFToSkRect(first_recording_rect))); canvas->translate(first_offset.x(), first_offset.y()); canvas->drawRectCoords(0.f, 0.f, 60.f, 60.f, red_paint); - picture = skia::AdoptRef(recorder.endRecording()); + picture = skia::AdoptRef(recorder.endRecordingAsPicture()); list->AppendItem(DrawingDisplayItem::Create(picture)); gfx::Rect clip_rect(60, 60, 10, 10); @@ -95,7 +95,7 @@ TEST(DisplayItemListTest, ClipItem) { recorder.beginRecording(gfx::RectFToSkRect(second_recording_rect))); canvas->translate(second_offset.x(), second_offset.y()); canvas->drawRectCoords(50.f, 50.f, 75.f, 75.f, blue_paint); - picture = skia::AdoptRef(recorder.endRecording()); + picture = skia::AdoptRef(recorder.endRecordingAsPicture()); list->AppendItem(DrawingDisplayItem::Create(picture)); list->AppendItem(EndClipDisplayItem::Create()); @@ -138,7 +138,7 @@ TEST(DisplayItemListTest, TransformItem) { recorder.beginRecording(gfx::RectFToSkRect(first_recording_rect))); canvas->translate(first_offset.x(), first_offset.y()); canvas->drawRectCoords(0.f, 0.f, 60.f, 60.f, red_paint); - picture = skia::AdoptRef(recorder.endRecording()); + picture = skia::AdoptRef(recorder.endRecordingAsPicture()); list->AppendItem(DrawingDisplayItem::Create(picture)); gfx::Transform transform; @@ -151,7 +151,7 @@ TEST(DisplayItemListTest, TransformItem) { recorder.beginRecording(gfx::RectFToSkRect(second_recording_rect))); canvas->translate(second_offset.x(), second_offset.y()); canvas->drawRectCoords(50.f, 50.f, 75.f, 75.f, blue_paint); - picture = skia::AdoptRef(recorder.endRecording()); + picture = skia::AdoptRef(recorder.endRecordingAsPicture()); list->AppendItem(DrawingDisplayItem::Create(picture)); list->AppendItem(EndTransformDisplayItem::Create()); diff --git a/cc/resources/display_list_raster_source.cc b/cc/resources/display_list_raster_source.cc index 9a0bc91..e3542b4 100644 --- a/cc/resources/display_list_raster_source.cc +++ b/cc/resources/display_list_raster_source.cc @@ -130,7 +130,8 @@ skia::RefPtr<SkPicture> DisplayListRasterSource::GetFlattenedPicture() { display_list_rect.height()); if (!display_list_rect.IsEmpty()) PlaybackToCanvas(canvas, display_list_rect, 1.0); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(recorder.endRecordingAsPicture()); return picture; } diff --git a/cc/resources/gpu_rasterizer.cc b/cc/resources/gpu_rasterizer.cc index 1620c2b..a1d33bc 100644 --- a/cc/resources/gpu_rasterizer.cc +++ b/cc/resources/gpu_rasterizer.cc @@ -52,7 +52,8 @@ void GpuRasterizer::RasterizeSource( canvas->save(); raster_source->PlaybackToCanvas(canvas.get(), rect, scale); canvas->restore(); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(recorder.endRecordingAsPicture()); // Turn on distance fields for layers that have ever animated. bool use_distance_field_text = diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc index e88ff21..9375d7e 100644 --- a/cc/resources/picture.cc +++ b/cc/resources/picture.cc @@ -218,7 +218,7 @@ void Picture::Record(ContentLayerClient* painter, painter->PaintContents(canvas.get(), layer_rect_, painting_control); canvas->restore(); - picture_ = skia::AdoptRef(recorder.endRecording()); + picture_ = skia::AdoptRef(recorder.endRecordingAsPicture()); DCHECK(picture_); EmitTraceSnapshot(); diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc index be05358..d1fba06 100644 --- a/cc/resources/picture_pile_impl.cc +++ b/cc/resources/picture_pile_impl.cc @@ -257,7 +257,8 @@ skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { recorder.beginRecording(tiling_rect.width(), tiling_rect.height()); if (!tiling_rect.IsEmpty()) PlaybackToCanvas(canvas, tiling_rect, 1.0); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(recorder.endRecordingAsPicture()); return picture; } diff --git a/cc/resources/skpicture_content_layer_updater.cc b/cc/resources/skpicture_content_layer_updater.cc index ace97a4..c54f5dc 100644 --- a/cc/resources/skpicture_content_layer_updater.cc +++ b/cc/resources/skpicture_content_layer_updater.cc @@ -38,7 +38,7 @@ void SkPictureContentLayerUpdater::PrepareToUpdate( paint_rect, contents_width_scale, contents_height_scale); - picture_ = skia::AdoptRef(recorder.endRecording()); + picture_ = skia::AdoptRef(recorder.endRecordingAsPicture()); } void SkPictureContentLayerUpdater::DrawPicture(SkCanvas* canvas) { diff --git a/cc/test/fake_content_layer_client.cc b/cc/test/fake_content_layer_client.cc index 09dd77b..296c891 100644 --- a/cc/test/fake_content_layer_client.cc +++ b/cc/test/fake_content_layer_client.cc @@ -89,7 +89,7 @@ FakeContentLayerClient::PaintContentsToDisplayList( skia::SharePtr(recorder.beginRecording(gfx::RectFToSkRect(draw_rect))); canvas->drawRectCoords(draw_rect.x(), draw_rect.y(), draw_rect.width(), draw_rect.height(), paint); - picture = skia::AdoptRef(recorder.endRecording()); + picture = skia::AdoptRef(recorder.endRecordingAsPicture()); list->AppendItem(DrawingDisplayItem::Create(picture)); } @@ -101,7 +101,7 @@ FakeContentLayerClient::PaintContentsToDisplayList( canvas = skia::SharePtr( recorder.beginRecording(it->bitmap.width(), it->bitmap.height())); canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint); - picture = skia::AdoptRef(recorder.endRecording()); + picture = skia::AdoptRef(recorder.endRecordingAsPicture()); list->AppendItem(DrawingDisplayItem::Create(picture)); if (!it->transform.IsIdentity()) { list->AppendItem(EndTransformDisplayItem::Create()); @@ -117,7 +117,7 @@ FakeContentLayerClient::PaintContentsToDisplayList( canvas = skia::SharePtr( recorder.beginRecording(gfx::RectFToSkRect(draw_rect))); canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint); - picture = skia::AdoptRef(recorder.endRecording()); + picture = skia::AdoptRef(recorder.endRecordingAsPicture()); list->AppendItem(DrawingDisplayItem::Create(picture)); draw_rect.Inset(1, 1); } diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc index cf8a5ee..f96d6c0 100644 --- a/printing/pdf_metafile_skia.cc +++ b/printing/pdf_metafile_skia.cc @@ -121,7 +121,7 @@ bool PdfMetafileSkia::FinishPage() { return false; DCHECK(!(data_->pages_.back().content_)); data_->pages_.back().content_ = - skia::AdoptRef(data_->recorder_.endRecording()); + skia::AdoptRef(data_->recorder_.endRecordingAsPicture()); return true; } diff --git a/skia/ext/analysis_canvas_unittest.cc b/skia/ext/analysis_canvas_unittest.cc index 8263075..db8e7a2 100644 --- a/skia/ext/analysis_canvas_unittest.cc +++ b/skia/ext/analysis_canvas_unittest.cc @@ -183,7 +183,8 @@ TEST(AnalysisCanvasTest, FilterPaint) { skia::AnalysisCanvas canvas(255, 255); SkPaint paint; - skia::RefPtr<SkImageFilter> filter = skia::AdoptRef(SkOffsetImageFilter::Create(10, 10)); + skia::RefPtr<SkImageFilter> filter = + skia::AdoptRef(SkOffsetImageFilter::Create(10, 10)); paint.setImageFilter(filter.get()); canvas.drawRect(SkRect::MakeWH(255, 255), paint); @@ -344,7 +345,8 @@ TEST(AnalysisCanvasTest, EarlyOutNotSolid) { record_canvas->drawText( text.c_str(), text.length(), point.fX, point.fY, paint); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(recorder.endRecordingAsPicture()); // Draw the picture into the analysis canvas, using the canvas as a callback // as well. @@ -357,7 +359,6 @@ TEST(AnalysisCanvasTest, EarlyOutNotSolid) { // Verify that we aborted drawing. EXPECT_TRUE(canvas.abortDrawing()); - } TEST(AnalysisCanvasTest, ClipComplexRegion) { diff --git a/skia/ext/pixel_ref_utils_unittest.cc b/skia/ext/pixel_ref_utils_unittest.cc index 50aa40d..1e8f6ee 100644 --- a/skia/ext/pixel_ref_utils_unittest.cc +++ b/skia/ext/pixel_ref_utils_unittest.cc @@ -85,7 +85,7 @@ SkCanvas* StartRecording(SkPictureRecorder* recorder, gfx::Rect layer_rect) { SkPicture* StopRecording(SkPictureRecorder* recorder, SkCanvas* canvas) { canvas->restore(); - return recorder->endRecording(); + return recorder->endRecordingAsPicture(); } } // namespace @@ -115,7 +115,8 @@ TEST(PixelRefUtilsTest, DrawPaint) { canvas->clipRect(SkRect::MakeWH(100, 100)); canvas->drawPaint(third_paint); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); @@ -168,7 +169,8 @@ TEST(PixelRefUtilsTest, DrawPoints) { // (50, 55, 150, 145). canvas->drawPoints(SkCanvas::kPolygon_PointMode, 3, points, third_paint); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); @@ -216,7 +218,8 @@ TEST(PixelRefUtilsTest, DrawRect) { // (50, 50, 50, 50) canvas->drawRect(SkRect::MakeXYWH(0, 0, 100, 100), third_paint); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); @@ -269,7 +272,8 @@ TEST(PixelRefUtilsTest, DrawRRect) { // (50, 50, 50, 50) canvas->drawRRect(rrect, third_paint); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); @@ -321,7 +325,8 @@ TEST(PixelRefUtilsTest, DrawOval) { // (50, 50, 50, 50) canvas->drawRect(SkRect::MakeXYWH(0, 0, 100, 100), third_paint); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); @@ -365,7 +370,8 @@ TEST(PixelRefUtilsTest, DrawPath) { canvas->restore(); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); @@ -419,7 +425,8 @@ TEST(PixelRefUtilsTest, DrawBitmap) { // At (0, 0), scaled by 5 and 6 canvas->drawBitmap(fifth, 0, 0); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); @@ -435,7 +442,6 @@ TEST(PixelRefUtilsTest, DrawBitmap) { gfx::SkRectToRectF(pixel_refs[3].pixel_ref_rect)); EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 50, 60), gfx::SkRectToRectF(pixel_refs[4].pixel_ref_rect)); - } TEST(PixelRefUtilsTest, DrawBitmapRect) { @@ -473,7 +479,8 @@ TEST(PixelRefUtilsTest, DrawBitmapRect) { canvas->restore(); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); @@ -536,7 +543,8 @@ TEST(PixelRefUtilsTest, DrawSprite) { // (100, 100, 50, 50). canvas->drawSprite(fifth, 100, 100, &first_paint); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); @@ -583,7 +591,8 @@ TEST(PixelRefUtilsTest, DrawText) { canvas->drawPosText("text", 4, points, first_paint); canvas->drawTextOnPath("text", 4, path, NULL, first_paint); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); @@ -656,7 +665,8 @@ TEST(PixelRefUtilsTest, DrawVertices) { 3, third_paint); - skia::RefPtr<SkPicture> picture = skia::AdoptRef(StopRecording(&recorder, canvas)); + skia::RefPtr<SkPicture> picture = + skia::AdoptRef(StopRecording(&recorder, canvas)); std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs; skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs); |