| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #ifndef SkDumpCanvas_DEFINED | 8 #ifndef SkDumpCanvas_DEFINED |
| 9 #define SkDumpCanvas_DEFINED | 9 #define SkDumpCanvas_DEFINED |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 typedef SkRefCnt INHERITED; | 70 typedef SkRefCnt INHERITED; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 Dumper* getDumper() const { return fDumper; } | 73 Dumper* getDumper() const { return fDumper; } |
| 74 void setDumper(Dumper*); | 74 void setDumper(Dumper*); |
| 75 | 75 |
| 76 int getNestLevel() const { return fNestLevel; } | 76 int getNestLevel() const { return fNestLevel; } |
| 77 | 77 |
| 78 void beginCommentGroup(const char* description) SK_OVERRIDE; | 78 void beginCommentGroup(const char* description) override; |
| 79 void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 79 void addComment(const char* kywd, const char* value) override; |
| 80 void endCommentGroup() SK_OVERRIDE; | 80 void endCommentGroup() override; |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 void willSave() SK_OVERRIDE; | 83 void willSave() override; |
| 84 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK
_OVERRIDE; | 84 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) ov
erride; |
| 85 void willRestore() SK_OVERRIDE; | 85 void willRestore() override; |
| 86 | 86 |
| 87 void didConcat(const SkMatrix&) SK_OVERRIDE; | 87 void didConcat(const SkMatrix&) override; |
| 88 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 88 void didSetMatrix(const SkMatrix&) override; |
| 89 | 89 |
| 90 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; | 90 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
| 91 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, | 91 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, |
| 92 const SkPaint&) SK_OVERRIDE; | 92 const SkPaint&) override; |
| 93 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], | 93 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], |
| 94 const SkPaint&) SK_OVERRIDE; | 94 const SkPaint&) override; |
| 95 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], | 95 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], |
| 96 SkScalar constY, const SkPaint&) SK_OVERRIDE; | 96 SkScalar constY, const SkPaint&) override; |
| 97 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, | 97 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, |
| 98 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; | 98 const SkMatrix* matrix, const SkPaint&) overri
de; |
| 99 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 99 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
| 100 const SkPaint& paint) SK_OVERRIDE; | 100 const SkPaint& paint) override; |
| 101 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], | 101 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
| 102 const SkPoint texCoords[4], SkXfermode* xmode, | 102 const SkPoint texCoords[4], SkXfermode* xmode, |
| 103 const SkPaint& paint) SK_OVERRIDE; | 103 const SkPaint& paint) override; |
| 104 | 104 |
| 105 void onDrawPaint(const SkPaint&) SK_OVERRIDE; | 105 void onDrawPaint(const SkPaint&) override; |
| 106 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) SK_OVERRIDE; | 106 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) override; |
| 107 void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; | 107 void onDrawRect(const SkRect&, const SkPaint&) override; |
| 108 void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; | 108 void onDrawOval(const SkRect&, const SkPaint&) override; |
| 109 void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; | 109 void onDrawRRect(const SkRRect&, const SkPaint&) override; |
| 110 void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE; | 110 void onDrawPath(const SkPath&, const SkPaint&) override; |
| 111 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) SK_OVERRIDE; | 111 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) override; |
| 112 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, | 112 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, |
| 113 DrawBitmapRectFlags flags) SK_OVERRIDE; | 113 DrawBitmapRectFlags flags) override; |
| 114 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) SK_OVERRIDE; | 114 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) override; |
| 115 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, | 115 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, |
| 116 const SkPaint*) SK_OVERRIDE; | 116 const SkPaint*) override; |
| 117 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, | 117 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, |
| 118 const SkPaint*) SK_OVERRIDE; | 118 const SkPaint*) override; |
| 119 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVE
RRIDE; | 119 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) overri
de; |
| 120 void onDrawVertices(VertexMode vmode, int vertexCount, | 120 void onDrawVertices(VertexMode vmode, int vertexCount, |
| 121 const SkPoint vertices[], const SkPoint texs[], | 121 const SkPoint vertices[], const SkPoint texs[], |
| 122 const SkColor colors[], SkXfermode* xmode, | 122 const SkColor colors[], SkXfermode* xmode, |
| 123 const uint16_t indices[], int indexCount, | 123 const uint16_t indices[], int indexCount, |
| 124 const SkPaint&) SK_OVERRIDE; | 124 const SkPaint&) override; |
| 125 | 125 |
| 126 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 126 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 127 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 127 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 128 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 128 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; |
| 129 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 129 void onClipRegion(const SkRegion&, SkRegion::Op) override; |
| 130 | 130 |
| 131 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE; | 131 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; |
| 132 | 132 |
| 133 static const char* EdgeStyleToAAString(ClipEdgeStyle edgeStyle); | 133 static const char* EdgeStyleToAAString(ClipEdgeStyle edgeStyle); |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 Dumper* fDumper; | 136 Dumper* fDumper; |
| 137 int fNestLevel; // for nesting recursive elements like pictures | 137 int fNestLevel; // for nesting recursive elements like pictures |
| 138 | 138 |
| 139 void dump(Verb, const SkPaint*, const char format[], ...); | 139 void dump(Verb, const SkPaint*, const char format[], ...); |
| 140 | 140 |
| 141 typedef SkCanvas INHERITED; | 141 typedef SkCanvas INHERITED; |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 /** Formats the draw commands, and send them to a function-pointer provided | 144 /** Formats the draw commands, and send them to a function-pointer provided |
| 145 by the caller. | 145 by the caller. |
| 146 */ | 146 */ |
| 147 class SkFormatDumper : public SkDumpCanvas::Dumper { | 147 class SkFormatDumper : public SkDumpCanvas::Dumper { |
| 148 public: | 148 public: |
| 149 SkFormatDumper(void (*)(const char text[], void* refcon), void* refcon); | 149 SkFormatDumper(void (*)(const char text[], void* refcon), void* refcon); |
| 150 | 150 |
| 151 // override from baseclass that does the formatting, and in turn calls | 151 // override from baseclass that does the formatting, and in turn calls |
| 152 // the function pointer that was passed to the constructor | 152 // the function pointer that was passed to the constructor |
| 153 virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[], | 153 virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[], |
| 154 const SkPaint*) SK_OVERRIDE; | 154 const SkPaint*) override; |
| 155 | 155 |
| 156 private: | 156 private: |
| 157 void (*fProc)(const char*, void*); | 157 void (*fProc)(const char*, void*); |
| 158 void* fRefcon; | 158 void* fRefcon; |
| 159 | 159 |
| 160 typedef SkDumpCanvas::Dumper INHERITED; | 160 typedef SkDumpCanvas::Dumper INHERITED; |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 /** Subclass of Dumper that dumps the drawing command to SkDebugf | 163 /** Subclass of Dumper that dumps the drawing command to SkDebugf |
| 164 */ | 164 */ |
| 165 class SkDebugfDumper : public SkFormatDumper { | 165 class SkDebugfDumper : public SkFormatDumper { |
| 166 public: | 166 public: |
| 167 SkDebugfDumper(); | 167 SkDebugfDumper(); |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 typedef SkFormatDumper INHERITED; | 170 typedef SkFormatDumper INHERITED; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 #endif | 173 #endif |
| 174 | 174 |
| 175 #endif | 175 #endif |
| OLD | NEW |