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

Unified Diff: components/test_runner/pixel_dump.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Clean up comments, fix mac build Created 3 years, 11 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: components/test_runner/pixel_dump.cc
diff --git a/components/test_runner/pixel_dump.cc b/components/test_runner/pixel_dump.cc
index 67881c94b30008ab4e48d40cc36e9bd873e868de..52c89c81d2bc3af0e3b253ec5778d7d418231929 100644
--- a/components/test_runner/pixel_dump.cc
+++ b/components/test_runner/pixel_dump.cc
@@ -12,6 +12,8 @@
#include "base/logging.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
+#include "cc/paint/paint_canvas.h"
+#include "cc/paint/paint_flags.h"
#include "components/test_runner/layout_test_runtime_flags.h"
// FIXME: Including platform_canvas.h here is a layering violation.
#include "skia/ext/platform_canvas.h"
@@ -65,7 +67,7 @@ class CaptureCallback : public blink::WebCompositeAndReadbackAsyncCallback {
};
void DrawSelectionRect(const PixelsDumpRequest& dump_request,
- SkCanvas* canvas) {
+ cc::PaintCanvas* canvas) {
// See if we need to draw the selection bounds rect. Selection bounds
// rect is the rect enclosing the (possibly transformed) selection.
// The rect should be drawn after everything is laid out and painted.
@@ -76,10 +78,10 @@ void DrawSelectionRect(const PixelsDumpRequest& dump_request,
if (wr.isEmpty())
return;
// Render a red rectangle bounding selection rect
- SkPaint paint;
+ cc::PaintFlags paint;
paint.setColor(0xFFFF0000); // Fully opaque red
- paint.setStyle(SkPaint::kStroke_Style);
- paint.setFlags(SkPaint::kAntiAlias_Flag);
+ paint.setStyle(cc::PaintFlags::kStroke_Style);
+ paint.setAntiAlias(true);
paint.setStrokeWidth(1.0f);
SkIRect rect; // Bounding rect
rect.set(wr.x, wr.y, wr.x + wr.width, wr.y + wr.height);
@@ -96,7 +98,7 @@ void CapturePixelsForPrinting(std::unique_ptr<PixelsDumpRequest> dump_request) {
int totalHeight = page_count * (page_size_in_pixels.height + 1) - 1;
bool is_opaque = false;
- std::unique_ptr<SkCanvas> canvas = skia::TryCreateBitmapCanvas(
+ std::unique_ptr<cc::PaintCanvas> canvas = skia::TryCreateBitmapCanvas(
danakj 2017/01/20 23:34:14 this looks like a type mismatch? also noting that
enne (OOO) 2017/01/24 01:51:28 Yeah, I was trying to avoid changing too much logi
page_size_in_pixels.width, totalHeight, is_opaque);
if (!canvas) {
LOG(ERROR) << "Failed to create canvas width="
@@ -138,7 +140,7 @@ void CaptureCallback::didCompositeAndReadback(const SkBitmap& bitmap) {
void DidCapturePixelsAsync(std::unique_ptr<PixelsDumpRequest> dump_request,
const SkBitmap& bitmap) {
- SkCanvas canvas(bitmap);
+ cc::PaintCanvas canvas(bitmap);
DrawSelectionRect(*dump_request, &canvas);
if (!dump_request->callback.is_null())
dump_request->callback.Run(bitmap);

Powered by Google App Engine
This is Rietveld 408576698