Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SkMiniRecorder_DEFINED | |
| 9 #define SkMiniRecorder_DEFINED | |
| 10 | |
| 11 #include "SkScalar.h" | |
| 12 #include "SkTypes.h" | |
| 13 class SkCanvas; | |
| 14 class SkPaint; | |
| 15 class SkPath; | |
| 16 class SkPicture; | |
| 17 class SkTextBlob; | |
| 18 struct SkRect; | |
| 19 | |
| 20 // Records small pictures, but only a limited subset of the canvas API, and may fail. | |
| 21 class SkMiniRecorder : SkNoncopyable { | |
| 22 public: | |
| 23 SkMiniRecorder(); | |
| 24 ~SkMiniRecorder(); | |
| 25 | |
| 26 // Try to record an op. Returns false on failure. | |
| 27 bool drawRect(const SkRect&, const SkPaint&); | |
| 28 bool drawPath(const SkPath&, const SkPaint&); | |
| 29 bool drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint&) ; | |
| 30 | |
| 31 // Detach anything we've recorded as a picture, resetting this SkMiniRecorde r. | |
| 32 SkPicture* detachAsPicture(const SkRect& cull); | |
| 33 | |
| 34 // Equivalent to | |
| 35 // SkAutoTUnref<SkPicture> p(this->detachAsPicture()); | |
| 36 // p->playback(canvas); | |
| 37 // but may be more efficient. | |
| 38 void flushToCanvas(SkCanvas*); | |
|
reed1
2015/05/04 13:26:34
detachToCanvas?
detachAndPlayback?
detachAndDraw?
mtklein
2015/05/04 15:52:45
Removed the whole method for now, given that it's
| |
| 39 | |
| 40 private: | |
| 41 enum class State { kEmpty, kDrawRect, kDrawPath, kDrawTextBlob }; | |
| 42 | |
| 43 State fState; | |
| 44 char fBuffer[1024]; // TODO: size/align this carefully | |
|
reed1
2015/05/04 13:26:34
do we already have an Aligned buffer helper templa
mtklein
2015/05/04 15:52:45
Yep, done.
| |
| 45 }; | |
| 46 | |
| 47 #endif//SkMiniRecorder_DEFINED | |
| OLD | NEW |