| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#pragma once |
| 18 |
|
| 19 |
#include <SkCanvas.h> |
| 20 |
#include <gtest/gtest.h> |
| 21 |
|
| 22 |
namespace { |
| 23 |
|
| 24 |
class TestCanvasBase : public SkCanvas { |
| 25 |
public: |
| 26 |
TestCanvasBase(int width, int height) : SkCanvas(width, height) {} |
| 27 |
void onDrawAnnotation(const SkRect&, const char key[], SkData* value) { |
| 28 |
ADD_FAILURE() << "onDrawAnnotation not expected in this test"; |
| 29 |
} |
| 30 |
void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) { |
| 31 |
ADD_FAILURE() << "onDrawDRRect not expected in this test"; |
| 32 |
} |
| 33 |
void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) { |
| 34 |
ADD_FAILURE() << "onDrawTextBlob not expected in this test"; |
| 35 |
} |
| 36 |
void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], |
| 37 |
SkBlendMode, const SkPaint& paint) { |
| 38 |
ADD_FAILURE() << "onDrawPatch not expected in this test"; |
| 39 |
} |
| 40 |
void onDrawPaint(const SkPaint&) { ADD_FAILURE() << "onDrawPaint not expected in this test"; } |
| 41 |
void onDrawRect(const SkRect&, const SkPaint&) { |
| 42 |
ADD_FAILURE() << "onDrawRect not expected in this test"; |
| 43 |
} |
| 44 |
void onDrawRegion(const SkRegion& region, const SkPaint& paint) { |
| 45 |
ADD_FAILURE() << "onDrawRegion not expected in this test"; |
| 46 |
} |
| 47 |
void onDrawOval(const SkRect&, const SkPaint&) { |
| 48 |
ADD_FAILURE() << "onDrawOval not expected in this test"; |
| 49 |
} |
| 50 |
void onDrawArc(const SkRect&, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, |
| 51 |
const SkPaint&) { |
| 52 |
ADD_FAILURE() << "onDrawArc not expected in this test"; |
| 53 |
} |
| 54 |
void onDrawRRect(const SkRRect&, const SkPaint&) { |
| 55 |
ADD_FAILURE() << "onDrawRRect not expected in this test"; |
| 56 |
} |
| 57 |
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) { |
| 58 |
ADD_FAILURE() << "onDrawPoints not expected in this test"; |
| 59 |
} |
| 60 |
void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) { |
| 61 |
ADD_FAILURE() << "onDrawVertices not expected in this test"; |
| 62 |
} |
| 63 |
void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int count, |
| 64 |
SkBlendMode, const SkSamplingOptions&, const SkRect* cull, const SkPaint*) { |
| 65 |
ADD_FAILURE() << "onDrawAtlas not expected in this test"; |
| 66 |
} |
| 67 |
void onDrawPath(const SkPath&, const SkPaint&) { |
| 68 |
ADD_FAILURE() << "onDrawPath not expected in this test"; |
| 69 |
} |
| 70 |
void onDrawImage2(const SkImage*, SkScalar dx, SkScalar dy, const SkSamplingOptions&, |
| 71 |
const SkPaint*) { |
| 72 |
ADD_FAILURE() << "onDrawImage not expected in this test"; |
| 73 |
} |
| 74 |
void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&, |
| 75 |
const SkPaint*, SrcRectConstraint) { |
| 76 |
ADD_FAILURE() << "onDrawImageRect not expected in this test"; |
| 77 |
} |
| 78 |
void onDrawImageLattice2(const SkImage*, const Lattice& lattice, const SkRect& dst, |
| 79 |
SkFilterMode, const SkPaint*) { |
| 80 |
ADD_FAILURE() << "onDrawImageLattice not expected in this test"; |
| 81 |
} |
| 82 |
void onClipRRect(const SkRRect& rrect, SkClipOp, ClipEdgeStyle) { |
| 83 |
ADD_FAILURE() << "onClipRRect not expected in this test"; |
| 84 |
} |
| 85 |
void onClipPath(const SkPath& path, SkClipOp, ClipEdgeStyle) { |
| 86 |
ADD_FAILURE() << "onClipPath not expected in this test"; |
| 87 |
} |
| 88 |
void onClipRegion(const SkRegion& deviceRgn, SkClipOp) { |
| 89 |
ADD_FAILURE() << "onClipRegion not expected in this test"; |
| 90 |
} |
| 91 |
void onDiscard() { ADD_FAILURE() << "onDiscard not expected in this test"; } |
| 92 |
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) { |
| 93 |
ADD_FAILURE() << "onDrawPicture not expected in this test"; |
| 94 |
} |
| 95 |
|
| 96 |
int mDrawCounter = 0; |
| 97 |
}; |
| 98 |
} |