2 * Copyright 2014 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkRecordDraw_DEFINED
9 #define SkRecordDraw_DEFINED
11 #include "SkBBoxHierarchy.h"
13 #include "SkDrawPictureCallback.h"
16 // Fill a BBH to be used by SkRecordDraw to accelerate playback.
17 void SkRecordFillBounds(const SkRecord&, SkBBoxHierarchy*);
19 // Draw an SkRecord into an SkCanvas. A convenience wrapper around SkRecords::Draw.
20 void SkRecordDraw(const SkRecord&, SkCanvas*, const SkBBoxHierarchy*, SkDrawPictureCallback*);
24 // This is an SkRecord visitor that will draw that SkRecord to an SkCanvas.
25 class Draw : SkNoncopyable {
27 explicit Draw(SkCanvas* canvas)
28 : fInitialCTM(canvas->getTotalMatrix()), fCanvas(canvas), fIndex(0) {}
30 unsigned index() const { return fIndex; }
31 void next() { ++fIndex; }
33 template <typename T> void operator()(const T& r) {
38 // No base case, so we'll be compile-time checked that we implement all possibilities.
39 template <typename T> void draw(const T&);
41 const SkMatrix fInitialCTM;
46 } // namespace SkRecords
48 #endif//SkRecordDraw_DEFINED