Chromium Code Reviews| Index: include/utils/SkShadowPaintFilterCanvas.h |
| diff --git a/include/utils/SkShadowPaintFilterCanvas.h b/include/utils/SkShadowPaintFilterCanvas.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..529de09c8c6f842e716cc414fa6c3da02d78e94b |
| --- /dev/null |
| +++ b/include/utils/SkShadowPaintFilterCanvas.h |
| @@ -0,0 +1,115 @@ |
| +/* |
| + * Copyright 2016 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#ifndef SkShadowPaintFilterCanvas_DEFINED |
| +#define SkShadowPaintFilterCanvas_DEFINED |
| + |
|
robertphillips
2016/08/03 18:47:47
I think all we need to include is SkPaintFilterCan
vjiaoblack
2016/08/04 13:36:22
Done.
|
| +#include "SkNWayCanvas.h" |
| +#include "SkTLazy.h" |
| +#include "SkLights.h" |
| +#include "SkPaintFilterCanvas.h" |
| +#include "SkPathEffect.h" |
| +#include "SkCanvas.h" |
| + |
| +#ifdef SK_EXPERIMENTAL_SHADOWING |
| + |
| +/** \class SkPaintFilterCanvas |
| + |
| + A utility proxy base class for implementing shadow maps. |
| +*/ |
| + |
| +/* We override the onFilter method to draw depths into the canvas |
| + * depending on the current draw depth of the canvas, throwing out |
| + * the actual draw color. |
| + * |
| + * Note that we can only do this for one light at a time! |
| + * It is up to the user to set the 0th light in fLights to |
| + * the light the want to render the depth map with. |
| + */ |
| +class SkShadowPaintFilterCanvas : public SkPaintFilterCanvas { |
| +public: |
| + |
| + SkShadowPaintFilterCanvas(SkCanvas *canvas); |
| + |
|
robertphillips
2016/08/03 18:47:47
I think all the onDraw*s are supposed to be protec
vjiaoblack
2016/08/04 13:36:21
Done.
|
| + // TODO use a shader instead |
| + bool onFilter(SkTCopyOnFirstWrite<SkPaint>* paint, Type type) const override; |
| + |
| + void onDrawPicture(const SkPicture *picture, const SkMatrix *matrix, |
| + const SkPaint *paint) override; |
| + |
| + void updateMatrix(); |
| + |
| + void onDrawPaint(const SkPaint &paint) override; |
| + |
| + void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], |
| + const SkPaint &paint) override; |
| + |
| + void onDrawRect(const SkRect &rect, const SkPaint &paint) override; |
| + |
| + void onDrawRRect(const SkRRect &rrect, const SkPaint &paint) override; |
| + |
| + void onDrawDRRect(const SkRRect &outer, const SkRRect &inner, |
| + const SkPaint &paint) override; |
| + |
| + void onDrawOval(const SkRect &rect, const SkPaint &paint) override; |
| + |
| + void onDrawPath(const SkPath &path, const SkPaint &paint) override; |
| + |
| + void onDrawBitmap(const SkBitmap &bm, SkScalar left, SkScalar top, |
| + const SkPaint *paint) override; |
| + |
| + void onDrawBitmapRect(const SkBitmap &bm, const SkRect *src, const SkRect &dst, |
| + const SkPaint *paint, SrcRectConstraint constraint) override; |
| + |
| + void onDrawBitmapNine(const SkBitmap &bm, const SkIRect ¢er, |
| + const SkRect &dst, const SkPaint *paint) override; |
| + |
| + void onDrawImage(const SkImage *image, SkScalar left, SkScalar top, |
| + const SkPaint *paint) override; |
| + |
| + void onDrawImageRect(const SkImage *image, const SkRect *src, |
| + const SkRect &dst, const SkPaint *paint, |
| + SrcRectConstraint constraint) override; |
| + |
| + void onDrawImageNine(const SkImage *image, const SkIRect ¢er, |
| + const SkRect &dst, const SkPaint *paint) override; |
| + |
| + void onDrawVertices(VertexMode vmode, int vertexCount, |
| + const SkPoint vertices[], const SkPoint texs[], |
| + const SkColor colors[], SkXfermode *xmode, |
| + const uint16_t indices[], int indexCount, |
| + const SkPaint &paint) override; |
| + |
| + void onDrawPatch(const SkPoint cubics[], const SkColor colors[], |
| + const SkPoint texCoords[], SkXfermode *xmode, |
| + const SkPaint &paint) override; |
| + |
| + void onDrawText(const void *text, size_t byteLength, SkScalar x, SkScalar y, |
| + const SkPaint &paint) override; |
| + |
| + void onDrawPosText(const void *text, size_t byteLength, const SkPoint pos[], |
| + const SkPaint &paint) override; |
| + |
| + void onDrawPosTextH(const void *text, size_t byteLength, const SkScalar xpos[], |
| + SkScalar constY, const SkPaint &paint) override; |
| + |
| + void onDrawTextOnPath(const void *text, size_t byteLength, const SkPath &path, |
| + const SkMatrix *matrix, const SkPaint &paint) override; |
| + |
| + void onDrawTextRSXform(const void *text, size_t byteLength, |
| + const SkRSXform xform[], const SkRect *cull, |
| + const SkPaint &paint) override; |
| + |
| + void onDrawTextBlob(const SkTextBlob *blob, SkScalar x, |
| + SkScalar y, const SkPaint &paint) override; |
| +private: |
| + typedef SkPaintFilterCanvas INHERITED; |
| +}; |
| + |
| + |
| +#endif |
| +#endif |