1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | #include "flutter/flow/testing/mock_texture.h" |
6 | |
7 | namespace flutter { |
8 | namespace testing { |
9 | |
10 | MockTexture::MockTexture(int64_t textureId) : Texture(textureId) {} |
11 | |
12 | void MockTexture::Paint(SkCanvas& canvas, |
13 | const SkRect& bounds, |
14 | bool freeze, |
15 | GrDirectContext* context, |
16 | SkFilterQuality filter_quality) { |
17 | paint_calls_.emplace_back( |
18 | PaintCall{canvas, bounds, freeze, context, filter_quality}); |
19 | } |
20 | |
21 | bool operator==(const MockTexture::PaintCall& a, |
22 | const MockTexture::PaintCall& b) { |
23 | return &a.canvas == &b.canvas && a.bounds == b.bounds && |
24 | a.context == b.context && a.freeze == b.freeze && |
25 | a.filter_quality == b.filter_quality; |
26 | } |
27 | |
28 | std::ostream& operator<<(std::ostream& os, const MockTexture::PaintCall& data) { |
29 | return os << &data.canvas << " " << data.bounds << " " << data.context << " " |
30 | << data.freeze << " " << data.filter_quality; |
31 | } |
32 | |
33 | } // namespace testing |
34 | } // namespace flutter |
35 | |