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

Side by Side Diff: include/core/SkCanvas.h

Issue 2146073003: Creating framework for drawShadowedPicture (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Fixed 'const sk_sp<SkLights>', also fixed some crumbs from merging Created 4 years, 5 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 | « no previous file | include/core/SkLights.h » ('j') | src/core/SkLightingShader.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkCanvas_DEFINED 8 #ifndef SkCanvas_DEFINED
9 #define SkCanvas_DEFINED 9 #define SkCanvas_DEFINED
10 10
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkDeque.h" 13 #include "SkDeque.h"
14 #include "SkImage.h" 14 #include "SkImage.h"
15 #include "SkPaint.h" 15 #include "SkPaint.h"
16 #include "SkRefCnt.h" 16 #include "SkRefCnt.h"
17 #include "SkRegion.h" 17 #include "SkRegion.h"
18 #include "SkSurfaceProps.h" 18 #include "SkSurfaceProps.h"
19 #include "SkXfermode.h" 19 #include "SkXfermode.h"
20 #include "SkLights.h"
20 21
21 class GrContext; 22 class GrContext;
22 class GrDrawContext; 23 class GrDrawContext;
23 class SkBaseDevice; 24 class SkBaseDevice;
24 class SkCanvasClipVisitor; 25 class SkCanvasClipVisitor;
25 class SkClipStack; 26 class SkClipStack;
26 class SkData; 27 class SkData;
27 class SkDraw; 28 class SkDraw;
28 class SkDrawable; 29 class SkDrawable;
29 class SkDrawFilter; 30 class SkDrawFilter;
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 * If paint is non-null, draw the picture into a temporary buffer, and then apply the paint's 1043 * If paint is non-null, draw the picture into a temporary buffer, and then apply the paint's
1043 * alpha/colorfilter/imagefilter/xfermode to that buffer as it is drawn to the canvas. 1044 * alpha/colorfilter/imagefilter/xfermode to that buffer as it is drawn to the canvas.
1044 * This is logically equivalent to 1045 * This is logically equivalent to
1045 * saveLayer(paint)/drawPicture/restore 1046 * saveLayer(paint)/drawPicture/restore
1046 */ 1047 */
1047 void drawPicture(const SkPicture*, const SkMatrix* matrix, const SkPaint* pa int); 1048 void drawPicture(const SkPicture*, const SkMatrix* matrix, const SkPaint* pa int);
1048 void drawPicture(const sk_sp<SkPicture>& picture, const SkMatrix* matrix, co nst SkPaint* paint) { 1049 void drawPicture(const sk_sp<SkPicture>& picture, const SkMatrix* matrix, co nst SkPaint* paint) {
1049 this->drawPicture(picture.get(), matrix, paint); 1050 this->drawPicture(picture.get(), matrix, paint);
1050 } 1051 }
1051 1052
1053 /**
1054 * Draw the picture into this canvas.
1055 *
1056 * However, this time, we will use the passed-in lights to generate shadows !
jvanverth1 2016/07/14 17:27:09 This is a little too vague. Suggestion: Will use t
vjiaoblack 2016/07/14 20:38:17 Done.
1057 */
1058 void drawShadowedPicture(const SkPicture*, sk_sp<SkLights>);
jvanverth1 2016/07/14 17:27:09 Do we not need a matrix or paint?
vjiaoblack 2016/07/14 20:38:18 I originally thought the proposed function didn't,
1059 void drawShadowedPicture(const sk_sp<SkPicture>& picture, sk_sp<SkLights> li ghts) {
1060 this->drawShadowedPicture(picture.get(), lights);
1061 }
1062
1052 enum VertexMode { 1063 enum VertexMode {
1053 kTriangles_VertexMode, 1064 kTriangles_VertexMode,
1054 kTriangleStrip_VertexMode, 1065 kTriangleStrip_VertexMode,
1055 kTriangleFan_VertexMode 1066 kTriangleFan_VertexMode
1056 }; 1067 };
1057 1068
1058 /** Draw the array of vertices, interpreted as triangles (based on mode). 1069 /** Draw the array of vertices, interpreted as triangles (based on mode).
1059 1070
1060 If both textures and vertex-colors are NULL, it strokes hairlines with 1071 If both textures and vertex-colors are NULL, it strokes hairlines with
1061 the paint's color. This behavior is a useful debugging mode to visualize 1072 the paint's color. This behavior is a useful debugging mode to visualize
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 }; 1406 };
1396 1407
1397 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle); 1408 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle);
1398 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle); 1409 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle);
1399 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle); 1410 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle);
1400 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); 1411 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op);
1401 1412
1402 virtual void onDiscard(); 1413 virtual void onDiscard();
1403 1414
1404 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint* ); 1415 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint* );
1416 virtual void onDrawShadowedPicture(const SkPicture*, sk_sp<SkLights>);
1405 1417
1406 // Returns the canvas to be used by DrawIter. Default implementation 1418 // Returns the canvas to be used by DrawIter. Default implementation
1407 // returns this. Subclasses that encapsulate an indirect canvas may 1419 // returns this. Subclasses that encapsulate an indirect canvas may
1408 // need to overload this method. The impl must keep track of this, as it 1420 // need to overload this method. The impl must keep track of this, as it
1409 // is not released or deleted by the caller. 1421 // is not released or deleted by the caller.
1410 virtual SkCanvas* canvasForDrawIter(); 1422 virtual SkCanvas* canvasForDrawIter();
1411 1423
1412 // Clip rectangle bounds. Called internally by saveLayer. 1424 // Clip rectangle bounds. Called internally by saveLayer.
1413 // returns false if the entire rectangle is entirely clipped out 1425 // returns false if the entire rectangle is entirely clipped out
1414 // If non-NULL, The imageFilter parameter will be used to expand the clip 1426 // If non-NULL, The imageFilter parameter will be used to expand the clip
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 1629
1618 class SkCanvasClipVisitor { 1630 class SkCanvasClipVisitor {
1619 public: 1631 public:
1620 virtual ~SkCanvasClipVisitor(); 1632 virtual ~SkCanvasClipVisitor();
1621 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1633 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1622 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1634 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1623 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1635 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1624 }; 1636 };
1625 1637
1626 #endif 1638 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkLights.h » ('j') | src/core/SkLightingShader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698