1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
cc / test / test_skcanvas.cc [blame]
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/test/test_skcanvas.h"
#include "third_party/skia/include/gpu/ganesh/gl/GrGLInterface.h"
namespace cc {
SaveCountingCanvas::SaveCountingCanvas() : SkNoDrawCanvas(100, 100) {}
SkCanvas::SaveLayerStrategy SaveCountingCanvas::getSaveLayerStrategy(
const SaveLayerRec& rec) {
save_count_++;
return SkNoDrawCanvas::getSaveLayerStrategy(rec);
}
void SaveCountingCanvas::willRestore() {
restore_count_++;
}
void SaveCountingCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
draw_rect_ = rect;
paint_ = paint;
}
void SaveCountingCanvas::onDrawPaint(const SkPaint& paint) {
paint_ = paint;
}
MockCanvas::MockCanvas() : SkNoDrawCanvas(100, 100) {
context_ = GrDirectContext::MakeMock(nullptr);
}
MockCanvas::~MockCanvas() = default;
} // namespace cc