Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/utils/SkShadowPaintFilterCanvas.h

Issue 2198933002: Making a sample for shadow maps for more intensive development (Closed) Base URL: https://skia.googlesource.com/skia@shadow-gm
Patch Set: argh fixed utils include error Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkShadowShader.cpp ('k') | src/utils/SkShadowPaintFilterCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
15 /** \class SkShadowPaintFilterCanvas
16 *
17 * A utility proxy class for implementing shadow maps.
18 *
19 * We override the onFilter method to draw depths into the canvas
20 * depending on the current draw depth of the canvas, throwing out
21 * the actual draw color.
22 *
23 * Note that we can only do this for one light at a time!
24 * It is up to the user to set the 0th light in fLights to
25 * the light the want to render the depth map with.
26 */
27 class SkShadowPaintFilterCanvas : public SkPaintFilterCanvas {
28 public:
29
30 SkShadowPaintFilterCanvas(SkCanvas *canvas);
31
32 // TODO use a shader instead
33 bool onFilter(SkTCopyOnFirstWrite<SkPaint>* paint, Type type) const override ;
34
35 static SkISize ComputeDepthMapSize(const SkLights::Light& light, int maxDept h,
36 int width, int height);
37
38 protected:
39 void onDrawPicture(const SkPicture *picture, const SkMatrix *matrix,
40 const SkPaint *paint) override;
41
42 void updateMatrix();
43
44 void onDrawPaint(const SkPaint &paint) override;
45
46 void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
47 const SkPaint &paint) override;
48
49 void onDrawRect(const SkRect &rect, const SkPaint &paint) override;
50
51 void onDrawRRect(const SkRRect &rrect, const SkPaint &paint) override;
52
53 void onDrawDRRect(const SkRRect &outer, const SkRRect &inner,
54 const SkPaint &paint) override;
55
56 void onDrawOval(const SkRect &rect, const SkPaint &paint) override;
57
58 void onDrawPath(const SkPath &path, const SkPaint &paint) override;
59
60 void onDrawBitmap(const SkBitmap &bm, SkScalar left, SkScalar top,
61 const SkPaint *paint) override;
62
63 void onDrawBitmapRect(const SkBitmap &bm, const SkRect *src, const SkRect &d st,
64 const SkPaint *paint, SrcRectConstraint constraint) ov erride;
65
66 void onDrawBitmapNine(const SkBitmap &bm, const SkIRect &center,
67 const SkRect &dst, const SkPaint *paint) override;
68
69 void onDrawImage(const SkImage *image, SkScalar left, SkScalar top,
70 const SkPaint *paint) override;
71
72 void onDrawImageRect(const SkImage *image, const SkRect *src,
73 const SkRect &dst, const SkPaint *paint,
74 SrcRectConstraint constraint) override;
75
76 void onDrawImageNine(const SkImage *image, const SkIRect &center,
77 const SkRect &dst, const SkPaint *paint) override;
78
79 void onDrawVertices(VertexMode vmode, int vertexCount,
80 const SkPoint vertices[], const SkPoint texs[],
81 const SkColor colors[], SkXfermode *xmode,
82 const uint16_t indices[], int indexCount,
83 const SkPaint &paint) override;
84
85 void onDrawPatch(const SkPoint cubics[], const SkColor colors[],
86 const SkPoint texCoords[], SkXfermode *xmode,
87 const SkPaint &paint) override;
88
89 void onDrawText(const void *text, size_t byteLength, SkScalar x, SkScalar y,
90 const SkPaint &paint) override;
91
92 void onDrawPosText(const void *text, size_t byteLength, const SkPoint pos[],
93 const SkPaint &paint) override;
94
95 void onDrawPosTextH(const void *text, size_t byteLength, const SkScalar xpos [],
96 SkScalar constY, const SkPaint &paint) override;
97
98 void onDrawTextOnPath(const void *text, size_t byteLength, const SkPath &pat h,
99 const SkMatrix *matrix, const SkPaint &paint) override ;
100
101 void onDrawTextRSXform(const void *text, size_t byteLength,
102 const SkRSXform xform[], const SkRect *cull,
103 const SkPaint &paint) override;
104
105 void onDrawTextBlob(const SkTextBlob *blob, SkScalar x,
106 SkScalar y, const SkPaint &paint) override;
107 private:
108 typedef SkPaintFilterCanvas INHERITED;
109 };
110
111
112 #endif
113 #endif
OLDNEW
« no previous file with comments | « src/core/SkShadowShader.cpp ('k') | src/utils/SkShadowPaintFilterCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698