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

Side by Side Diff: src/core/SkBBoxRecord.h

Issue 380373003: Fix for saveLayer() with filters vs. the BBox Hierarchy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Eliminate SaveEntry; clone SkPaint on push() Created 6 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 | src/core/SkBBoxRecord.cpp » ('j') | src/core/SkBBoxRecord.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkBBoxRecord_DEFINED 9 #ifndef SkBBoxRecord_DEFINED
10 #define SkBBoxRecord_DEFINED 10 #define SkBBoxRecord_DEFINED
11 11
12 #include "SkPictureRecord.h" 12 #include "SkPictureRecord.h"
13 #include "SkTDStack.h"
13 14
14 /** 15 /**
15 * This is an abstract SkPictureRecord subclass that intercepts draw calls and computes an 16 * This is an abstract SkPictureRecord subclass that intercepts draw calls and computes an
16 * axis-aligned bounding box for each draw that it sees, subclasses implement h andleBBox() 17 * axis-aligned bounding box for each draw that it sees, subclasses implement h andleBBox()
17 * which will be called every time we get a new bounding box. 18 * which will be called every time we get a new bounding box.
18 */ 19 */
19 class SkBBoxRecord : public SkPictureRecord { 20 class SkBBoxRecord : public SkPictureRecord {
20 public: 21 public:
21 22
22 SkBBoxRecord(const SkISize& size, uint32_t recordFlags) 23 SkBBoxRecord(const SkISize& size, uint32_t recordFlags)
23 : INHERITED(size, recordFlags) { 24 : INHERITED(size, recordFlags) {
24 } 25 }
25 virtual ~SkBBoxRecord() { } 26 virtual ~SkBBoxRecord();
26 27
27 /** 28 /**
28 * This is called each time we get a bounding box, it will be axis-aligned, 29 * This is called each time we get a bounding box, it will be axis-aligned,
29 * in device coordinates, and expanded to include stroking, shadows, etc. 30 * in device coordinates, and expanded to include stroking, shadows, etc.
30 */ 31 */
31 virtual void handleBBox(const SkRect& bbox) = 0; 32 virtual void handleBBox(const SkRect& bbox) = 0;
32 33
33 virtual void drawOval(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE; 34 virtual void drawOval(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
34 virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRI DE; 35 virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRI DE;
35 virtual void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE; 36 virtual void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
(...skipping 23 matching lines...) Expand all
59 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK _OVERRIDE; 60 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK _OVERRIDE;
60 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS calar y, 61 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS calar y,
61 const SkPaint&) SK_OVERRIDE; 62 const SkPaint&) SK_OVERRIDE;
62 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin t pos[], 63 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin t pos[],
63 const SkPaint&) SK_OVERRIDE; 64 const SkPaint&) SK_OVERRIDE;
64 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca lar xpos[], 65 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca lar xpos[],
65 SkScalar constY, const SkPaint&) SK_OVERRIDE; 66 SkScalar constY, const SkPaint&) SK_OVERRIDE;
66 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP ath& path, 67 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP ath& path,
67 const SkMatrix* matrix, const SkPaint&) SK_OVE RRIDE; 68 const SkMatrix* matrix, const SkPaint&) SK_OVE RRIDE;
68 virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE; 69 virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE;
70 virtual void willSave() SK_OVERRIDE;
71 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF lags) SK_OVERRIDE;
72 virtual void willRestore() SK_OVERRIDE;
73
74 SkTDStack<const SkPaint*> fSaveStack;
mtklein 2014/07/11 15:37:14 // Paints from (possibly nested) saveLayers that n
69 75
70 private: 76 private:
71 /** 77 /**
72 * Takes a bounding box in current canvas view space, accounts for stroking and effects, and 78 * Takes a bounding box in current canvas view space, accounts for stroking and effects, and
73 * computes an axis-aligned bounding box in device coordinates, then passes it to handleBBox() 79 * computes an axis-aligned bounding box in device coordinates, then passes it to handleBBox()
74 * returns false if the draw is completely clipped out, and may safely be ig nored. 80 * returns false if the draw is completely clipped out, and may safely be ig nored.
75 **/ 81 **/
76 bool transformBounds(const SkRect& bounds, const SkPaint* paint); 82 bool transformBounds(const SkRect& bounds, const SkPaint* paint);
77 83
78 typedef SkPictureRecord INHERITED; 84 typedef SkPictureRecord INHERITED;
79 }; 85 };
80 86
81 #endif 87 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBBoxRecord.cpp » ('j') | src/core/SkBBoxRecord.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698