Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkRecorder_DEFINED | 8 #ifndef SkRecorder_DEFINED |
| 9 #define SkRecorder_DEFINED | 9 #define SkRecorder_DEFINED |
| 10 | 10 |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkRecord.h" | 12 #include "SkRecord.h" |
| 13 #include "SkRecords.h" | 13 #include "SkRecords.h" |
| 14 #include "SkTDArray.h" | |
| 14 | 15 |
| 15 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. | 16 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. |
| 16 | 17 |
| 17 class SkRecorder : public SkCanvas { | 18 class SkRecorder : public SkCanvas { |
| 18 public: | 19 public: |
| 19 // Does not take ownership of the SkRecord. | 20 // Does not take ownership of the SkRecord. |
| 20 SkRecorder(SkRecord*, int width, int height); | 21 SkRecorder(SkRecord*, int width, int height); |
| 21 | 22 |
| 22 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor der will fail. | 23 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor der will fail. |
| 23 void forgetRecord(); | 24 void forgetRecord(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 const SkPoint vertices[], | 58 const SkPoint vertices[], |
| 58 const SkPoint texs[], | 59 const SkPoint texs[], |
| 59 const SkColor colors[], | 60 const SkColor colors[], |
| 60 SkXfermode* xmode, | 61 SkXfermode* xmode, |
| 61 const uint16_t indices[], | 62 const uint16_t indices[], |
| 62 int indexCount, | 63 int indexCount, |
| 63 const SkPaint& paint) SK_OVERRIDE; | 64 const SkPaint& paint) SK_OVERRIDE; |
| 64 | 65 |
| 65 void willSave() SK_OVERRIDE; | 66 void willSave() SK_OVERRIDE; |
| 66 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SkCanvas::Sav eFlags) SK_OVERRIDE; | 67 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SkCanvas::Sav eFlags) SK_OVERRIDE; |
| 68 void willRestore() SK_OVERRIDE {} | |
| 67 void didRestore() SK_OVERRIDE; | 69 void didRestore() SK_OVERRIDE; |
| 68 | 70 |
| 69 void didConcat(const SkMatrix&) SK_OVERRIDE; | 71 void didConcat(const SkMatrix&) SK_OVERRIDE; |
| 70 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 72 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; |
| 71 | 73 |
| 72 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID E; | 74 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID E; |
| 73 void onDrawText(const void* text, | 75 void onDrawText(const void* text, |
| 74 size_t byteLength, | 76 size_t byteLength, |
| 75 SkScalar x, | 77 SkScalar x, |
| 76 SkScalar y, | 78 SkScalar y, |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 103 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) SK_OVERRIDE; | 105 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) SK_OVERRIDE; |
| 104 | 106 |
| 105 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE RRIDE; | 107 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE RRIDE; |
| 106 | 108 |
| 107 void onPushCull(const SkRect& cullRect) SK_OVERRIDE; | 109 void onPushCull(const SkRect& cullRect) SK_OVERRIDE; |
| 108 void onPopCull() SK_OVERRIDE; | 110 void onPopCull() SK_OVERRIDE; |
| 109 | 111 |
| 110 void beginCommentGroup(const char*) SK_OVERRIDE; | 112 void beginCommentGroup(const char*) SK_OVERRIDE; |
| 111 void addComment(const char*, const char*) SK_OVERRIDE; | 113 void addComment(const char*, const char*) SK_OVERRIDE; |
| 112 void endCommentGroup() SK_OVERRIDE; | 114 void endCommentGroup() SK_OVERRIDE; |
| 115 void drawData(const void*, size_t) SK_OVERRIDE; | |
| 116 | |
| 117 bool isDrawingToLayer() const SK_OVERRIDE; | |
| 118 SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE { return NULL; } | |
| 113 | 119 |
| 114 private: | 120 private: |
| 115 template <typename T> | 121 template <typename T> |
| 116 T* copy(const T*); | 122 T* copy(const T*); |
| 117 | 123 |
| 118 template <typename T> | 124 template <typename T> |
| 119 T* copy(const T[], size_t count); | 125 T* copy(const T[], size_t count); |
| 120 | 126 |
| 121 SkIRect devBounds() const { | 127 SkIRect devBounds() const { |
| 122 SkIRect devBounds; | 128 SkIRect devBounds; |
| 123 this->getClipDeviceBounds(&devBounds); | 129 this->getClipDeviceBounds(&devBounds); |
| 124 return devBounds; | 130 return devBounds; |
| 125 } | 131 } |
| 126 | 132 |
| 127 SkRecord* fRecord; | 133 SkRecord* fRecord; |
| 134 | |
| 135 int fSaveLayerCount; | |
| 136 SkTDArray<bool> fSaveIsSaveLayer; | |
|
reed1
2014/09/04 20:53:04
absurd nit: SkBool8 may be smaller than bool
mtklein
2014/09/04 20:57:15
Done.
| |
| 128 }; | 137 }; |
| 129 | 138 |
| 130 #endif//SkRecorder_DEFINED | 139 #endif//SkRecorder_DEFINED |
| OLD | NEW |