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

Side by Side Diff: Source/platform/graphics/InterceptingCanvas.h

Issue 1183863005: Paint Profiler: unroll SkPictures (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef InterceptingCanvas_h 31 #ifndef InterceptingCanvas_h
32 #define InterceptingCanvas_h 32 #define InterceptingCanvas_h
33 33
34 #include "third_party/skia/include/core/SkCanvas.h" 34 #include "third_party/skia/include/core/SkCanvas.h"
35 #include "third_party/skia/include/core/SkPicture.h"
35 #include "wtf/Assertions.h" 36 #include "wtf/Assertions.h"
36 #include "wtf/Noncopyable.h" 37 #include "wtf/Noncopyable.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 class InterceptingCanvasBase : public SkCanvas { 41 class InterceptingCanvasBase : public SkCanvas {
41 WTF_MAKE_NONCOPYABLE(InterceptingCanvasBase); 42 WTF_MAKE_NONCOPYABLE(InterceptingCanvasBase);
42 public: 43 public:
43 template<typename DerivedCanvas> class CanvasInterceptorBase { 44 template<typename DerivedCanvas> class CanvasInterceptorBase {
44 WTF_MAKE_NONCOPYABLE(CanvasInterceptorBase); 45 WTF_MAKE_NONCOPYABLE(CanvasInterceptorBase);
(...skipping 15 matching lines...) Expand all
60 bool topLevelCall() const { return m_canvas->callNestingDepth() == 1; } 61 bool topLevelCall() const { return m_canvas->callNestingDepth() == 1; }
61 InterceptingCanvasBase* m_canvas; 62 InterceptingCanvasBase* m_canvas;
62 }; 63 };
63 64
64 void resetStepCount() { m_callCount = 0; } 65 void resetStepCount() { m_callCount = 0; }
65 66
66 protected: 67 protected:
67 explicit InterceptingCanvasBase(SkBitmap bitmap) : SkCanvas(bitmap), m_callN estingDepth(0), m_callCount(0) { }; 68 explicit InterceptingCanvasBase(SkBitmap bitmap) : SkCanvas(bitmap), m_callN estingDepth(0), m_callCount(0) { };
68 InterceptingCanvasBase(int width, int height) : SkCanvas(width, height), m_c allNestingDepth(0), m_callCount(0) { }; 69 InterceptingCanvasBase(int width, int height) : SkCanvas(width, height), m_c allNestingDepth(0), m_callCount(0) { };
69 70
71 void unrollDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*, Sk Picture::AbortCallback*);
72
70 void onDrawPaint(const SkPaint&) override = 0; 73 void onDrawPaint(const SkPaint&) override = 0;
71 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain t&) override = 0; 74 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain t&) override = 0;
72 void onDrawRect(const SkRect&, const SkPaint&) override = 0; 75 void onDrawRect(const SkRect&, const SkPaint&) override = 0;
73 void onDrawOval(const SkRect&, const SkPaint&) override = 0; 76 void onDrawOval(const SkRect&, const SkPaint&) override = 0;
74 void onDrawRRect(const SkRRect&, const SkPaint&) override = 0; 77 void onDrawRRect(const SkRRect&, const SkPaint&) override = 0;
75 void onDrawPath(const SkPath&, const SkPaint&) override = 0; 78 void onDrawPath(const SkPath&, const SkPaint&) override = 0;
76 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain t*) override = 0; 79 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain t*) override = 0;
77 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, DrawBitmapRectFlags) override = 0; 80 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, DrawBitmapRectFlags) override = 0;
78 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override = 0; 81 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, const SkPaint*) override = 0;
79 void onDrawImage(const SkImage*, SkScalar, SkScalar, const SkPaint*) overrid e = 0; 82 void onDrawImage(const SkImage*, SkScalar, SkScalar, const SkPaint*) overrid e = 0;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 252 }
250 253
251 void onClipRegion(const SkRegion& region, SkRegion::Op op) override 254 void onClipRegion(const SkRegion& region, SkRegion::Op op) override
252 { 255 {
253 Interceptor interceptor(this); 256 Interceptor interceptor(this);
254 this->SkCanvas::onClipRegion(region, op); 257 this->SkCanvas::onClipRegion(region, op);
255 } 258 }
256 259
257 void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, const S kPaint* paint) override 260 void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, const S kPaint* paint) override
258 { 261 {
259 Interceptor interceptor(this); 262 this->unrollDrawPicture(picture, matrix, paint, nullptr);
260 this->SkCanvas::onDrawPicture(picture, matrix, paint);
261 } 263 }
262 264
263 void didSetMatrix(const SkMatrix& matrix) override 265 void didSetMatrix(const SkMatrix& matrix) override
264 { 266 {
265 Interceptor interceptor(this); 267 Interceptor interceptor(this);
266 this->SkCanvas::didSetMatrix(matrix); 268 this->SkCanvas::didSetMatrix(matrix);
267 } 269 }
268 270
269 void didConcat(const SkMatrix& matrix) override 271 void didConcat(const SkMatrix& matrix) override
270 { 272 {
(...skipping 16 matching lines...) Expand all
287 void willRestore() override 289 void willRestore() override
288 { 290 {
289 Interceptor interceptor(this); 291 Interceptor interceptor(this);
290 this->SkCanvas::willRestore(); 292 this->SkCanvas::willRestore();
291 } 293 }
292 }; 294 };
293 295
294 } // namespace blink 296 } // namespace blink
295 297
296 #endif // InterceptingCanvas_h 298 #endif // InterceptingCanvas_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698