Chromium Code Reviews| Index: ui/gfx/render_text_unittest.cc |
| diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc |
| index ca8677a35f900a6ac47c0b24c8f35bf95a75a7ee..cd2ccaf22d36d383006113a2cee9ac0343a16b91 100644 |
| --- a/ui/gfx/render_text_unittest.cc |
| +++ b/ui/gfx/render_text_unittest.cc |
| @@ -3798,15 +3798,17 @@ TEST_P(RenderTextTest, TextDoesntClip) { |
| const Size kCanvasSize(300, 50); |
| const int kTestSize = 10; |
| - sk_sp<cc::PaintSurface> surface = cc::PaintSurface::MakeRasterN32Premul( |
| - kCanvasSize.width(), kCanvasSize.height()); |
| - Canvas canvas(surface->getCanvas(), 1.0f); |
| + SkBitmap bitmap; |
| + bitmap.allocPixels( |
| + SkImageInfo::MakeN32Premul(kCanvasSize.width(), kCanvasSize.height())); |
| + cc::SkiaPaintCanvas paint_canvas(bitmap); |
| + Canvas canvas(&paint_canvas, 1.0f); |
| RenderText* render_text = GetRenderText(); |
| render_text->SetHorizontalAlignment(ALIGN_LEFT); |
| render_text->SetColor(SK_ColorBLACK); |
| for (auto* string : kTestStrings) { |
| - surface->getCanvas()->clear(SK_ColorWHITE); |
| + paint_canvas.clear(SK_ColorWHITE); |
| render_text->SetText(WideToUTF16(string)); |
| const Size string_size = render_text->GetStringSize(); |
| render_text->ApplyBaselineStyle(SUPERSCRIPT, Range(1, 2)); |
| @@ -3823,7 +3825,7 @@ TEST_P(RenderTextTest, TextDoesntClip) { |
| render_text->Draw(&canvas); |
| ASSERT_LT(string_size.width() + kTestSize, kCanvasSize.width()); |
| SkPixmap pixmap; |
| - surface->getCanvas()->peekPixels(&pixmap); |
| + bitmap.peekPixels(&pixmap); |
|
danakj
2017/03/21 20:02:57
this could just use the bitmap directly instead of
vmpstr
2017/03/21 22:34:54
Done.
|
| const uint32_t* buffer = static_cast<const uint32_t*>(pixmap.addr()); |
| ASSERT_NE(nullptr, buffer); |
| TestRectangleBuffer rect_buffer(string, buffer, kCanvasSize.width(), |
| @@ -3891,15 +3893,17 @@ TEST_P(RenderTextTest, TextDoesClip) { |
| const Size kCanvasSize(300, 50); |
| const int kTestSize = 10; |
| - sk_sp<cc::PaintSurface> surface = cc::PaintSurface::MakeRasterN32Premul( |
| - kCanvasSize.width(), kCanvasSize.height()); |
| - Canvas canvas(surface->getCanvas(), 1.0f); |
| + SkBitmap bitmap; |
| + bitmap.allocPixels( |
| + SkImageInfo::MakeN32Premul(kCanvasSize.width(), kCanvasSize.height())); |
| + cc::SkiaPaintCanvas paint_canvas(bitmap); |
| + Canvas canvas(&paint_canvas, 1.0f); |
| RenderText* render_text = GetRenderText(); |
| render_text->SetHorizontalAlignment(ALIGN_LEFT); |
| render_text->SetColor(SK_ColorBLACK); |
| for (auto* string : kTestStrings) { |
| - surface->getCanvas()->clear(SK_ColorWHITE); |
| + paint_canvas.clear(SK_ColorWHITE); |
| render_text->SetText(WideToUTF16(string)); |
| const Size string_size = render_text->GetStringSize(); |
| int fake_width = string_size.width() / 2; |
| @@ -3910,7 +3914,7 @@ TEST_P(RenderTextTest, TextDoesClip) { |
| render_text->Draw(&canvas); |
| ASSERT_LT(string_size.width() + kTestSize, kCanvasSize.width()); |
| SkPixmap pixmap; |
| - surface->getCanvas()->peekPixels(&pixmap); |
| + bitmap.peekPixels(&pixmap); |
|
danakj
2017/03/21 20:02:57
same
vmpstr
2017/03/21 22:34:54
Done.
|
| const uint32_t* buffer = static_cast<const uint32_t*>(pixmap.addr()); |
| ASSERT_NE(nullptr, buffer); |
| TestRectangleBuffer rect_buffer(string, buffer, kCanvasSize.width(), |