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