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

Side by Side Diff: components/test_runner/pixel_dump.cc

Issue 2682813002: components: Clean up naming of paint-related identifiers (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « components/test_runner/mock_web_theme_engine.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/test_runner/pixel_dump.h" 5 #include "components/test_runner/pixel_dump.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // See if we need to draw the selection bounds rect. Selection bounds 71 // See if we need to draw the selection bounds rect. Selection bounds
72 // rect is the rect enclosing the (possibly transformed) selection. 72 // rect is the rect enclosing the (possibly transformed) selection.
73 // The rect should be drawn after everything is laid out and painted. 73 // The rect should be drawn after everything is laid out and painted.
74 if (!dump_request.layout_test_runtime_flags.dump_selection_rect()) 74 if (!dump_request.layout_test_runtime_flags.dump_selection_rect())
75 return; 75 return;
76 // If there is a selection rect - draw a red 1px border enclosing rect 76 // If there is a selection rect - draw a red 1px border enclosing rect
77 blink::WebRect wr = dump_request.web_view->mainFrame()->selectionBoundsRect(); 77 blink::WebRect wr = dump_request.web_view->mainFrame()->selectionBoundsRect();
78 if (wr.isEmpty()) 78 if (wr.isEmpty())
79 return; 79 return;
80 // Render a red rectangle bounding selection rect 80 // Render a red rectangle bounding selection rect
81 cc::PaintFlags paint; 81 cc::PaintFlags flags;
82 paint.setColor(0xFFFF0000); // Fully opaque red 82 flags.setColor(0xFFFF0000); // Fully opaque red
83 paint.setStyle(cc::PaintFlags::kStroke_Style); 83 flags.setStyle(cc::PaintFlags::kStroke_Style);
84 paint.setAntiAlias(true); 84 flags.setAntiAlias(true);
85 paint.setStrokeWidth(1.0f); 85 flags.setStrokeWidth(1.0f);
86 SkIRect rect; // Bounding rect 86 SkIRect rect; // Bounding rect
87 rect.set(wr.x, wr.y, wr.x + wr.width, wr.y + wr.height); 87 rect.set(wr.x, wr.y, wr.x + wr.width, wr.y + wr.height);
88 canvas->drawIRect(rect, paint); 88 canvas->drawIRect(rect, flags);
89 } 89 }
90 90
91 void CapturePixelsForPrinting(std::unique_ptr<PixelsDumpRequest> dump_request) { 91 void CapturePixelsForPrinting(std::unique_ptr<PixelsDumpRequest> dump_request) {
92 dump_request->web_view->updateAllLifecyclePhases(); 92 dump_request->web_view->updateAllLifecyclePhases();
93 93
94 blink::WebSize page_size_in_pixels = dump_request->web_view->size(); 94 blink::WebSize page_size_in_pixels = dump_request->web_view->size();
95 blink::WebFrame* web_frame = dump_request->web_view->mainFrame(); 95 blink::WebFrame* web_frame = dump_request->web_view->mainFrame();
96 96
97 int page_count = web_frame->printBegin(page_size_in_pixels); 97 int page_count = web_frame->printBegin(page_size_in_pixels);
98 int totalHeight = page_count * (page_size_in_pixels.height + 1) - 1; 98 int totalHeight = page_count * (page_size_in_pixels.height + 1) - 1;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 blink::WebImage image = static_cast<blink::WebMockClipboard*>( 204 blink::WebImage image = static_cast<blink::WebMockClipboard*>(
205 blink::Platform::current()->clipboard()) 205 blink::Platform::current()->clipboard())
206 ->readRawImage(blink::WebClipboard::Buffer()); 206 ->readRawImage(blink::WebClipboard::Buffer());
207 const SkBitmap& bitmap = image.getSkBitmap(); 207 const SkBitmap& bitmap = image.getSkBitmap();
208 SkAutoLockPixels autoLock(bitmap); 208 SkAutoLockPixels autoLock(bitmap);
209 callback.Run(bitmap); 209 callback.Run(bitmap);
210 } 210 }
211 211
212 } // namespace test_runner 212 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/mock_web_theme_engine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698