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

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

Issue 554033003: Revert of allow canvas to force conservative clips (for speed) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « src/core/SkRasterClip.cpp ('k') | tests/AAClipTest.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
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 #include "SkRecorder.h" 8 #include "SkRecorder.h"
9 #include "SkPatchUtils.h" 9 #include "SkPatchUtils.h"
10 #include "SkPicture.h" 10 #include "SkPicture.h"
11 11
12 // SkCanvas will fail in mysterious ways if it doesn't know the real width and h eight. 12 // SkCanvas will fail in mysterious ways if it doesn't know the real width and h eight.
13 SkRecorder::SkRecorder(SkRecord* record, int width, int height) 13 SkRecorder::SkRecorder(SkRecord* record, int width, int height)
14 : SkCanvas(width, height, SkCanvas::kConservativeRasterClip_InitFlag) 14 : SkCanvas(width, height)
15 , fRecord(record) 15 , fRecord(record)
16 , fSaveLayerCount(0) {} 16 , fSaveLayerCount(0) {}
17 17
18 void SkRecorder::forgetRecord() { 18 void SkRecorder::forgetRecord() {
19 fRecord = NULL; 19 fRecord = NULL;
20 } 20 }
21 21
22 // To make appending to fRecord a little less verbose. 22 // To make appending to fRecord a little less verbose.
23 #define APPEND(T, ...) \ 23 #define APPEND(T, ...) \
24 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__V A_ARGS__)) 24 SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__V A_ARGS__))
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 }) 273 })
274 APPEND(SetMatrix, matrix); 274 APPEND(SetMatrix, matrix);
275 } 275 }
276 276
277 void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle) { 277 void SkRecorder::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle) {
278 INHERITED(onClipRect, rect, op, edgeStyle); 278 INHERITED(onClipRect, rect, op, edgeStyle);
279 APPEND(ClipRect, this->devBounds(), rect, op, edgeStyle == kSoft_ClipEdgeSty le); 279 APPEND(ClipRect, this->devBounds(), rect, op, edgeStyle == kSoft_ClipEdgeSty le);
280 } 280 }
281 281
282 void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle) { 282 void SkRecorder::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle) {
283 INHERITED(onClipRRect, rrect, op, edgeStyle); 283 INHERITED(updateClipConservativelyUsingBounds, rrect.getBounds(), op, false) ;
284 APPEND(ClipRRect, this->devBounds(), rrect, op, edgeStyle == kSoft_ClipEdgeS tyle); 284 APPEND(ClipRRect, this->devBounds(), rrect, op, edgeStyle == kSoft_ClipEdgeS tyle);
285 } 285 }
286 286
287 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle) { 287 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle) {
288 INHERITED(onClipPath, path, op, edgeStyle); 288 INHERITED(updateClipConservativelyUsingBounds, path.getBounds(), op, path.is InverseFillType());
289 APPEND(ClipPath, this->devBounds(), delay_copy(path), op, edgeStyle == kSoft _ClipEdgeStyle); 289 APPEND(ClipPath, this->devBounds(), delay_copy(path), op, edgeStyle == kSoft _ClipEdgeStyle);
290 } 290 }
291 291
292 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 292 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
293 INHERITED(onClipRegion, deviceRgn, op); 293 INHERITED(onClipRegion, deviceRgn, op);
294 APPEND(ClipRegion, this->devBounds(), delay_copy(deviceRgn), op); 294 APPEND(ClipRegion, this->devBounds(), delay_copy(deviceRgn), op);
295 } 295 }
296 296
297 void SkRecorder::beginCommentGroup(const char* description) { 297 void SkRecorder::beginCommentGroup(const char* description) {
298 APPEND(BeginCommentGroup, this->copy(description)); 298 APPEND(BeginCommentGroup, this->copy(description));
299 } 299 }
300 300
301 void SkRecorder::addComment(const char* key, const char* value) { 301 void SkRecorder::addComment(const char* key, const char* value) {
302 APPEND(AddComment, this->copy(key), this->copy(value)); 302 APPEND(AddComment, this->copy(key), this->copy(value));
303 } 303 }
304 304
305 void SkRecorder::endCommentGroup() { 305 void SkRecorder::endCommentGroup() {
306 APPEND(EndCommentGroup); 306 APPEND(EndCommentGroup);
307 } 307 }
308 308
309 bool SkRecorder::isDrawingToLayer() const { 309 bool SkRecorder::isDrawingToLayer() const {
310 return fSaveLayerCount > 0; 310 return fSaveLayerCount > 0;
311 } 311 }
312 312
313 void SkRecorder::drawData(const void* data, size_t length) { 313 void SkRecorder::drawData(const void* data, size_t length) {
314 APPEND(DrawData, copy((const char*)data), length); 314 APPEND(DrawData, copy((const char*)data), length);
315 } 315 }
OLDNEW
« no previous file with comments | « src/core/SkRasterClip.cpp ('k') | tests/AAClipTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698