OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2016 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 SkShadowPaintFilterCanvas_DEFINED | |
9 #define SkShadowPaintFilterCanvas_DEFINED | |
10 | |
11 #include "SkPaintFilterCanvas.h" | |
12 | |
13 #ifdef SK_EXPERIMENTAL_SHADOWING | |
14 | |
robertphillips
2016/08/04 15:17:35
class is now named differently
vjiaoblack
2016/08/04 18:03:58
Done.
| |
15 /** \class SkPaintFilterCanvas | |
16 | |
robertphillips
2016/08/04 15:17:35
It's not really a base class
vjiaoblack
2016/08/04 18:03:58
Done.
| |
17 A utility proxy base class for implementing shadow maps. | |
18 */ | |
19 | |
20 /* We override the onFilter method to draw depths into the canvas | |
21 * depending on the current draw depth of the canvas, throwing out | |
22 * the actual draw color. | |
23 * | |
24 * Note that we can only do this for one light at a time! | |
25 * It is up to the user to set the 0th light in fLights to | |
26 * the light the want to render the depth map with. | |
27 */ | |
28 class SkShadowPaintFilterCanvas : public SkPaintFilterCanvas { | |
29 public: | |
30 | |
31 SkShadowPaintFilterCanvas(SkCanvas *canvas); | |
32 | |
33 // TODO use a shader instead | |
34 bool onFilter(SkTCopyOnFirstWrite<SkPaint>* paint, Type type) const override ; | |
35 | |
36 protected: | |
37 void onDrawPicture(const SkPicture *picture, const SkMatrix *matrix, | |
38 const SkPaint *paint) override; | |
39 | |
40 void updateMatrix(); | |
41 | |
42 void onDrawPaint(const SkPaint &paint) override; | |
43 | |
44 void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], | |
45 const SkPaint &paint) override; | |
46 | |
47 void onDrawRect(const SkRect &rect, const SkPaint &paint) override; | |
48 | |
49 void onDrawRRect(const SkRRect &rrect, const SkPaint &paint) override; | |
50 | |
51 void onDrawDRRect(const SkRRect &outer, const SkRRect &inner, | |
52 const SkPaint &paint) override; | |
53 | |
54 void onDrawOval(const SkRect &rect, const SkPaint &paint) override; | |
55 | |
56 void onDrawPath(const SkPath &path, const SkPaint &paint) override; | |
57 | |
58 void onDrawBitmap(const SkBitmap &bm, SkScalar left, SkScalar top, | |
59 const SkPaint *paint) override; | |
60 | |
61 void onDrawBitmapRect(const SkBitmap &bm, const SkRect *src, const SkRect &d st, | |
62 const SkPaint *paint, SrcRectConstraint constraint) ov erride; | |
63 | |
64 void onDrawBitmapNine(const SkBitmap &bm, const SkIRect ¢er, | |
65 const SkRect &dst, const SkPaint *paint) override; | |
66 | |
67 void onDrawImage(const SkImage *image, SkScalar left, SkScalar top, | |
68 const SkPaint *paint) override; | |
69 | |
70 void onDrawImageRect(const SkImage *image, const SkRect *src, | |
71 const SkRect &dst, const SkPaint *paint, | |
72 SrcRectConstraint constraint) override; | |
73 | |
74 void onDrawImageNine(const SkImage *image, const SkIRect ¢er, | |
75 const SkRect &dst, const SkPaint *paint) override; | |
76 | |
77 void onDrawVertices(VertexMode vmode, int vertexCount, | |
78 const SkPoint vertices[], const SkPoint texs[], | |
79 const SkColor colors[], SkXfermode *xmode, | |
80 const uint16_t indices[], int indexCount, | |
81 const SkPaint &paint) override; | |
82 | |
83 void onDrawPatch(const SkPoint cubics[], const SkColor colors[], | |
84 const SkPoint texCoords[], SkXfermode *xmode, | |
85 const SkPaint &paint) override; | |
86 | |
87 void onDrawText(const void *text, size_t byteLength, SkScalar x, SkScalar y, | |
88 const SkPaint &paint) override; | |
89 | |
90 void onDrawPosText(const void *text, size_t byteLength, const SkPoint pos[], | |
91 const SkPaint &paint) override; | |
92 | |
93 void onDrawPosTextH(const void *text, size_t byteLength, const SkScalar xpos [], | |
94 SkScalar constY, const SkPaint &paint) override; | |
95 | |
96 void onDrawTextOnPath(const void *text, size_t byteLength, const SkPath &pat h, | |
97 const SkMatrix *matrix, const SkPaint &paint) override ; | |
98 | |
99 void onDrawTextRSXform(const void *text, size_t byteLength, | |
100 const SkRSXform xform[], const SkRect *cull, | |
101 const SkPaint &paint) override; | |
102 | |
103 void onDrawTextBlob(const SkTextBlob *blob, SkScalar x, | |
104 SkScalar y, const SkPaint &paint) override; | |
105 private: | |
106 typedef SkPaintFilterCanvas INHERITED; | |
107 }; | |
108 | |
109 | |
110 #endif | |
111 #endif | |
OLD | NEW |