2 * Copyright 2022 Google LLC
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 // SkTestCanvas is a simple way to make a testing canvas which is allowed to use private
9 // facilities of SkCanvas without having to add a friend to SkCanvas.h.
11 // You create a Key (a simple empty struct) to make a template specialization class. You need to
12 // make a key for each of the different Canvases you need. The implementations of the canvases
13 // are in SkCanvas.cpp, which allows the use of helper classes.
15 #ifndef SkTestCanvas_DEFINED
16 #define SkTestCanvas_DEFINED
18 #include "include/core/SkSize.h"
19 #include "include/utils/SkNWayCanvas.h"
20 #include "src/core/SkDevice.h"
21 #include "src/core/SkGlyphRun.h"
23 // You can only make template specializations of SkTestCanvas.
24 template <typename Key> class SkTestCanvas;
26 // A test canvas to test using slug rendering instead of text blob rendering.
27 struct SkSlugTestKey {};
29 class SkTestCanvas<SkSlugTestKey> : public SkCanvas {
31 SkTestCanvas(SkCanvas* canvas);
32 void onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint) override;
35 #endif // SkTestCanvas_DEFINED