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

Unified Diff: ui/gfx/render_text_unittest.cc

Issue 1124223010: ui: Eliminate allocating gfx::Canvas on the heap for every view. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: canvasstack: fixcompile Created 5 years, 7 months 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
Index: ui/gfx/render_text_unittest.cc
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc
index 1ceec5171d0afdd4d9c7d87f514ef8c2a22d17a6..5607a3ad465211a73eaf9800ffda1ab872be205e 100644
--- a/ui/gfx/render_text_unittest.cc
+++ b/ui/gfx/render_text_unittest.cc
@@ -2798,8 +2798,7 @@ TEST_F(RenderTextTest, TextDoesntClip) {
skia::RefPtr<SkSurface> surface = skia::AdoptRef(
SkSurface::NewRasterN32Premul(kCanvasSize.width(), kCanvasSize.height()));
- scoped_ptr<Canvas> canvas(
- Canvas::CreateCanvasWithoutScaling(surface->getCanvas(), 1.0f));
+ Canvas canvas(surface->getCanvas(), 1.0f);
scoped_ptr<RenderText> render_text(RenderText::CreateInstance());
render_text->SetHorizontalAlignment(ALIGN_LEFT);
render_text->SetColor(SK_ColorBLACK);
@@ -2819,7 +2818,7 @@ TEST_F(RenderTextTest, TextDoesntClip) {
render_text->set_clip_to_display_rect(false);
ASSERT_LE(string_size.width() + kTestSize * 2, kCanvasSize.width());
- render_text->Draw(canvas.get());
+ render_text->Draw(&canvas);
ASSERT_LT(string_size.width() + kTestSize, kCanvasSize.width());
const uint32* buffer =
static_cast<const uint32*>(surface->peekPixels(nullptr, nullptr));
@@ -2881,8 +2880,7 @@ TEST_F(RenderTextTest, TextDoesClip) {
skia::RefPtr<SkSurface> surface = skia::AdoptRef(
SkSurface::NewRasterN32Premul(kCanvasSize.width(), kCanvasSize.height()));
- scoped_ptr<Canvas> canvas(
- Canvas::CreateCanvasWithoutScaling(surface->getCanvas(), 1.0f));
+ Canvas canvas(surface->getCanvas(), 1.0f);
scoped_ptr<RenderText> render_text(RenderText::CreateInstance());
render_text->SetHorizontalAlignment(ALIGN_LEFT);
render_text->SetColor(SK_ColorBLACK);
@@ -2896,7 +2894,7 @@ TEST_F(RenderTextTest, TextDoesClip) {
render_text->SetDisplayRect(
Rect(kTestSize, kTestSize, fake_width, fake_height));
render_text->set_clip_to_display_rect(true);
- render_text->Draw(canvas.get());
+ render_text->Draw(&canvas);
ASSERT_LT(string_size.width() + kTestSize, kCanvasSize.width());
const uint32* buffer =
static_cast<const uint32*>(surface->peekPixels(nullptr, nullptr));
« ui/gfx/canvas.cc ('K') | « ui/gfx/canvas.cc ('k') | ui/native_theme/common_theme.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698