Index: ui/gfx/render_text_unittest.cc |
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc |
index d83fd6ca5a9f3e68b247bc64ede0f002174c29cf..2400f222a1185c7b277cc25e53f077c39b2ecfe5 100644 |
--- a/ui/gfx/render_text_unittest.cc |
+++ b/ui/gfx/render_text_unittest.cc |
@@ -3759,15 +3759,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)); |
@@ -3784,7 +3786,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); |
const uint32_t* buffer = static_cast<const uint32_t*>(pixmap.addr()); |
ASSERT_NE(nullptr, buffer); |
TestRectangleBuffer rect_buffer(string, buffer, kCanvasSize.width(), |
@@ -3852,15 +3854,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; |
@@ -3871,7 +3875,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); |
const uint32_t* buffer = static_cast<const uint32_t*>(pixmap.addr()); |
ASSERT_NE(nullptr, buffer); |
TestRectangleBuffer rect_buffer(string, buffer, kCanvasSize.width(), |