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

Side by Side Diff: src/core/SkBBoxHierarchyRecord.cpp

Issue 12817011: Fixing SkPicture command pattern optimizations to make them work correctly with bounding box hierar… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « src/core/SkBBoxHierarchyRecord.h ('k') | src/core/SkPicturePlayback.cpp » ('j') | no next file with comments »
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 #include "SkBBoxHierarchyRecord.h" 9 #include "SkBBoxHierarchyRecord.h"
10 #include "SkPictureStateTree.h" 10 #include "SkPictureStateTree.h"
11 #include "SkBBoxHierarchy.h"
12 11
13 SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(uint32_t recordFlags, 12 SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(uint32_t recordFlags,
14 SkBBoxHierarchy* h, 13 SkBBoxHierarchy* h,
15 SkDevice* device) 14 SkDevice* device)
16 : INHERITED(recordFlags, device) { 15 : INHERITED(recordFlags, device) {
17 fStateTree = SkNEW(SkPictureStateTree); 16 fStateTree = SkNEW(SkPictureStateTree);
18 fBoundingHierarchy = h; 17 fBoundingHierarchy = h;
19 fBoundingHierarchy->ref(); 18 fBoundingHierarchy->ref();
19 fBoundingHierarchy->setClient(this);
20 } 20 }
21 21
22 void SkBBoxHierarchyRecord::handleBBox(const SkRect& bounds) { 22 void SkBBoxHierarchyRecord::handleBBox(const SkRect& bounds) {
23 SkIRect r; 23 SkIRect r;
24 bounds.roundOut(&r); 24 bounds.roundOut(&r);
25 SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream(). size()); 25 SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream(). size());
26 fBoundingHierarchy->insert(draw, r, true); 26 fBoundingHierarchy->insert(draw, r, true);
27 } 27 }
28 28
29 int SkBBoxHierarchyRecord::save(SaveFlags flags) { 29 int SkBBoxHierarchyRecord::save(SaveFlags flags) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 fStateTree->appendClip(this->writeStream().size()); 96 fStateTree->appendClip(this->writeStream().size());
97 return INHERITED::clipPath(path, op, doAntiAlias); 97 return INHERITED::clipPath(path, op, doAntiAlias);
98 } 98 }
99 99
100 bool SkBBoxHierarchyRecord::clipRRect(const SkRRect& rrect, 100 bool SkBBoxHierarchyRecord::clipRRect(const SkRRect& rrect,
101 SkRegion::Op op, 101 SkRegion::Op op,
102 bool doAntiAlias) { 102 bool doAntiAlias) {
103 fStateTree->appendClip(this->writeStream().size()); 103 fStateTree->appendClip(this->writeStream().size());
104 return INHERITED::clipRRect(rrect, op, doAntiAlias); 104 return INHERITED::clipRRect(rrect, op, doAntiAlias);
105 } 105 }
106
107 bool SkBBoxHierarchyRecord::shouldRewind(void* data) {
108 // SkBBoxHierarchy::rewindInserts is called by SkPicture after the
109 // SkPicture has rewound its command stream. To match that rewind in the
110 // BBH, we rewind all draws that reference commands that were recorded
111 // past the point to which the SkPicture has rewound, which is given by
112 // writeStream().size().
113 SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data );
114 return draw->fOffset >= writeStream().size();
115 }
OLDNEW
« no previous file with comments | « src/core/SkBBoxHierarchyRecord.h ('k') | src/core/SkPicturePlayback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698