Chromium Code Reviews| Index: include/core/SkCanvas.h |
| diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h |
| index 35a8d1c7b92193a4d247a4766efe54a2976ce0a6..cde3d92f0fd8e3bb550aa8d8ed4a7b4ac8596611 100644 |
| --- a/include/core/SkCanvas.h |
| +++ b/include/core/SkCanvas.h |
| @@ -17,6 +17,7 @@ |
| #include "SkRegion.h" |
| #include "SkSurfaceProps.h" |
| #include "SkXfermode.h" |
| +#include "SkLights.h" |
| class GrContext; |
| class GrDrawContext; |
| @@ -458,6 +459,11 @@ public: |
| */ |
| void translateZ(SkScalar z); |
| + /** Set the current set of lights in the canvas. |
| + @param lights The lights that we want the canvas to have. |
| + */ |
| + void setLights(sk_sp<SkLights> lights); |
|
jvanverth1
2016/07/15 19:16:30
You need to hide this (and translateZ) behind a #i
vjiaoblack
2016/07/18 13:03:23
Done.
|
| + |
| /** |
| * Modify the current clip with the specified rectangle. |
| * @param rect The rect to combine with the current clip |
| @@ -1049,6 +1055,32 @@ public: |
| this->drawPicture(picture.get(), matrix, paint); |
| } |
| + /** |
| + * Draw the picture into this canvas. |
| + * |
| + * We will use the canvas's lights along with the picture information (draw depths of |
| + * objects, etc) to first create a set of shadowmaps for the light-picture pairs, and |
| + * then use that set of shadowmaps to render the scene with shadows. |
| + * |
| + * If matrix is non-null, apply that matrix to the CTM when drawing this picture. This is |
| + * logically equivalent to |
| + * save/concat/drawPicture/restore |
| + * |
| + * If paint is non-null, draw the picture into a temporary buffer, and then apply the paint's |
| + * alpha/colorfilter/imagefilter/xfermode to that buffer as it is drawn to the canvas. |
| + * This is logically equivalent to |
| + * saveLayer(paint)/drawPicture/restore |
| + * |
| + */ |
| + void drawShadowedPicture(const SkPicture*, |
|
jvanverth1
2016/07/15 19:16:30
Hide these calls in an #ifdef block too.
vjiaoblack
2016/07/18 13:03:22
Done.
|
| + const SkMatrix* matrix, |
| + const SkPaint* paint); |
| + void drawShadowedPicture(const sk_sp<SkPicture>& picture, |
| + const SkMatrix* matrix, |
| + const SkPaint* paint) { |
| + this->drawShadowedPicture(picture.get(), matrix, paint); |
| + } |
| + |
| enum VertexMode { |
| kTriangles_VertexMode, |
| kTriangleStrip_VertexMode, |
| @@ -1271,6 +1303,11 @@ protected: |
| */ |
| SkScalar getZ() const; |
| + /** Returns the current set of lights the canvas uses |
| + */ |
| + sk_sp<SkLights> getLights() const; |
|
jvanverth1
2016/07/15 19:16:30
I'm not sure I understand the point of having a pr
vjiaoblack
2016/07/18 13:03:23
Done.
|
| + sk_sp<SkLights> fLights; |
| + |
| /** After calling saveLayer(), there can be any number of devices that make |
| up the top-most drawing area. LayerIter can be used to iterate through |
| those devices. Note that the iterator is only valid until the next API |
| @@ -1402,6 +1439,9 @@ protected: |
| virtual void onDiscard(); |
| virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*); |
| + virtual void onDrawShadowedPicture(const SkPicture*, |
| + const SkMatrix*, |
| + const SkPaint*); |
| // Returns the canvas to be used by DrawIter. Default implementation |
| // returns this. Subclasses that encapsulate an indirect canvas may |