提交 65a4c997 编写于 作者: C Chinmay Garde 提交者: GitHub

Remove unused checkerboard.cc (#2865)

上级 5556355d
......@@ -4,8 +4,6 @@
source_set("flow") {
sources = [
"checkerboard.cc",
"checkerboard.h",
"compositor_context.cc",
"compositor_context.h",
"instrumentation.cc",
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flow/checkerboard.h"
#include "third_party/skia/include/core/SkShader.h"
namespace flow {
static sk_sp<SkShader> CreateCheckerboardShader(SkColor c1,
SkColor c2,
int size) {
SkBitmap bm;
bm.allocN32Pixels(2 * size, 2 * size);
bm.eraseColor(c1);
bm.eraseArea(SkIRect::MakeLTRB(0, 0, size, size), c2);
bm.eraseArea(SkIRect::MakeLTRB(size, size, 2 * size, 2 * size), c2);
return SkShader::MakeBitmapShader(bm, SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode);
}
static void DrawCheckerboard(SkCanvas* canvas,
SkColor c1,
SkColor c2,
int size) {
SkPaint paint;
paint.setShader(CreateCheckerboardShader(c1, c2, size));
canvas->drawPaint(paint);
}
void DrawCheckerboard(SkCanvas* canvas, const SkRect& rect) {
// Draw a checkerboard
canvas->save();
canvas->clipRect(rect);
DrawCheckerboard(canvas, 0x4400FF00, 0x00000000, 12);
canvas->restore();
// Stroke the drawn area
SkPaint debugPaint;
debugPaint.setStrokeWidth(3);
debugPaint.setColor(SK_ColorRED);
debugPaint.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(rect, debugPaint);
}
} // namespace flow
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLOW_CHECKERBOARD_H_
#define FLOW_CHECKERBOARD_H_
#include "third_party/skia/include/core/SkCanvas.h"
namespace flow {
void DrawCheckerboard(SkCanvas* canvas, const SkRect& rect);
} // namespace flow
#endif // FLOW_CHECKERBOARD_H_
......@@ -4,15 +4,11 @@
#include "flow/layers/picture_layer.h"
#include "flow/checkerboard.h"
#include "flow/raster_cache.h"
#include "lib/ftl/logging.h"
namespace flow {
// TODO(abarth): Make this configurable by developers.
const bool kDebugCheckerboardRasterizedLayers = false;
PictureLayer::PictureLayer() {}
PictureLayer::~PictureLayer() {}
......@@ -32,8 +28,6 @@ void PictureLayer::Paint(PaintContext& context) {
SkRect rect = picture_->cullRect().makeOffset(offset_.x(), offset_.y());
context.canvas.drawImageRect(image_.get(), rect, nullptr,
SkCanvas::kFast_SrcRectConstraint);
if (kDebugCheckerboardRasterizedLayers)
DrawCheckerboard(&context.canvas, rect);
} else {
TRACE_EVENT1("flutter", "PictureLayer::Paint", "image", "normal");
SkAutoCanvasRestore save(&context.canvas, true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册