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

Unified Diff: cc/test/fake_content_layer_client.cc

Issue 2509983004: Revert "Change call-sites now that SkCanvas is not ref-counted" (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/raster/gpu_raster_buffer_provider.cc ('k') | cc/test/solid_color_content_layer_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_content_layer_client.cc
diff --git a/cc/test/fake_content_layer_client.cc b/cc/test/fake_content_layer_client.cc
index e192e3a3f09151e5a84146a05fcf043f591cbe04..11c8b3e6cae7c7ba13e8945c45e77870f3fc8105 100644
--- a/cc/test/fake_content_layer_client.cc
+++ b/cc/test/fake_content_layer_client.cc
@@ -58,12 +58,13 @@ FakeContentLayerClient::PaintContentsToDisplayList(
DisplayItemList::Create(settings);
display_list->SetRetainVisualRectsForTesting(true);
SkPictureRecorder recorder;
+ sk_sp<SkCanvas> canvas;
for (RectPaintVector::const_iterator it = draw_rects_.begin();
it != draw_rects_.end(); ++it) {
const gfx::RectF& draw_rect = it->first;
const SkPaint& paint = it->second;
- SkCanvas* canvas = recorder.beginRecording(gfx::RectFToSkRect(draw_rect));
+ canvas = sk_ref_sp(recorder.beginRecording(gfx::RectFToSkRect(draw_rect)));
canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint);
display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
ToEnclosingRect(draw_rect), recorder.finishRecordingAsPicture());
@@ -75,8 +76,8 @@ FakeContentLayerClient::PaintContentsToDisplayList(
display_list->CreateAndAppendPairedBeginItem<TransformDisplayItem>(
it->transform);
}
- SkCanvas* canvas =
- recorder.beginRecording(it->image->width(), it->image->height());
+ canvas = sk_ref_sp(
+ recorder.beginRecording(it->image->width(), it->image->height()));
canvas->drawImage(it->image.get(), it->point.x(), it->point.y(),
&it->paint);
display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
@@ -92,7 +93,7 @@ FakeContentLayerClient::PaintContentsToDisplayList(
while (!draw_rect.IsEmpty()) {
SkPaint paint;
paint.setColor(red ? SK_ColorRED : SK_ColorBLUE);
- SkCanvas* canvas = recorder.beginRecording(gfx::RectToSkRect(draw_rect));
+ canvas = sk_ref_sp(recorder.beginRecording(gfx::RectToSkRect(draw_rect)));
canvas->drawIRect(gfx::RectToSkIRect(draw_rect), paint);
display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
draw_rect, recorder.finishRecordingAsPicture());
« no previous file with comments | « cc/raster/gpu_raster_buffer_provider.cc ('k') | cc/test/solid_color_content_layer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698