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

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

Issue 508873004: Revert of Convert BBH APIs to use SkRect. (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/SkPictureData.cpp ('k') | src/core/SkRTree.h » ('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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPatchUtils.h" 9 #include "SkPatchUtils.h"
10 #include "SkPictureData.h" 10 #include "SkPictureData.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // FIXME: SkBitmaps are stateful, so we need to copy them to play back in multip le threads. 64 // FIXME: SkBitmaps are stateful, so we need to copy them to play back in multip le threads.
65 static SkBitmap shallow_copy(const SkBitmap& bitmap) { 65 static SkBitmap shallow_copy(const SkBitmap& bitmap) {
66 return bitmap; 66 return bitmap;
67 } 67 }
68 68
69 const SkPicture::OperationList* SkPicturePlayback::getActiveOps(const SkCanvas* canvas) { 69 const SkPicture::OperationList* SkPicturePlayback::getActiveOps(const SkCanvas* canvas) {
70 70
71 if (fUseBBH) { 71 if (fUseBBH) {
72 SkRect clipBounds; 72 SkRect clipBounds;
73 if (canvas->getClipBounds(&clipBounds)) { 73 if (canvas->getClipBounds(&clipBounds)) {
74 return fPictureData->getActiveOps(clipBounds); 74 SkIRect query;
75 clipBounds.roundOut(&query);
76
77 return fPictureData->getActiveOps(query);
75 } 78 }
76 } 79 }
77 80
78 return NULL; 81 return NULL;
79 } 82 }
80 83
81 // Initialize the state tree iterator. Return false if there is nothing left to draw. 84 // Initialize the state tree iterator. Return false if there is nothing left to draw.
82 bool SkPicturePlayback::initIterator(SkPictureStateTree::Iterator* iter, 85 bool SkPicturePlayback::initIterator(SkPictureStateTree::Iterator* iter,
83 SkCanvas* canvas, 86 SkCanvas* canvas,
84 const SkPicture::OperationList *activeOpsLi st) { 87 const SkPicture::OperationList *activeOpsLi st) {
85 88
86 if (NULL != activeOpsList) { 89 if (NULL != activeOpsList) {
87 if (0 == activeOpsList->numOps()) { 90 if (0 == activeOpsList->numOps()) {
88 return false; // nothing to draw 91 return false; // nothing to draw
89 } 92 }
90 93
91 fPictureData->initIterator(iter, activeOpsList->fOps, canvas); 94 fPictureData->initIterator(iter, activeOpsList->fOps, canvas);
92 } 95 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 SkipIterTo(&it, &reader, fCurOffset + size); 165 SkipIterTo(&it, &reader, fCurOffset + size);
163 continue; 166 continue;
164 } 167 }
165 168
166 this->handleOp(&reader, op, size, canvas, initialMatrix); 169 this->handleOp(&reader, op, size, canvas, initialMatrix);
167 170
168 StepIterator(&it, &reader); 171 StepIterator(&it, &reader);
169 } 172 }
170 } 173 }
171 174
172 void SkPicturePlayback::handleOp(SkReader32* reader, 175 void SkPicturePlayback::handleOp(SkReader32* reader,
173 DrawType op, 176 DrawType op,
174 uint32_t size, 177 uint32_t size,
175 SkCanvas* canvas, 178 SkCanvas* canvas,
176 const SkMatrix& initialMatrix) { 179 const SkMatrix& initialMatrix) {
177 switch (op) { 180 switch (op) {
178 case CLIP_PATH: { 181 case CLIP_PATH: {
179 const SkPath& path = fPictureData->getPath(reader); 182 const SkPath& path = fPictureData->getPath(reader);
180 uint32_t packed = reader->readInt(); 183 uint32_t packed = reader->readInt();
181 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); 184 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed);
182 bool doAA = ClipParams_unpackDoAA(packed); 185 bool doAA = ClipParams_unpackDoAA(packed);
183 size_t offsetToRestore = reader->readInt(); 186 size_t offsetToRestore = reader->readInt();
184 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset()); 187 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset());
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } break; 303 } break;
301 case DRAW_OVAL: { 304 case DRAW_OVAL: {
302 const SkPaint& paint = *fPictureData->getPaint(reader); 305 const SkPaint& paint = *fPictureData->getPaint(reader);
303 canvas->drawOval(reader->skipT<SkRect>(), paint); 306 canvas->drawOval(reader->skipT<SkRect>(), paint);
304 } break; 307 } break;
305 case DRAW_PAINT: 308 case DRAW_PAINT:
306 canvas->drawPaint(*fPictureData->getPaint(reader)); 309 canvas->drawPaint(*fPictureData->getPaint(reader));
307 break; 310 break;
308 case DRAW_PATCH: { 311 case DRAW_PATCH: {
309 const SkPaint& paint = *fPictureData->getPaint(reader); 312 const SkPaint& paint = *fPictureData->getPaint(reader);
310 313
311 const SkPoint* cubics = (const SkPoint*)reader->skip(SkPatchUtils::k NumCtrlPts * 314 const SkPoint* cubics = (const SkPoint*)reader->skip(SkPatchUtils::k NumCtrlPts *
312 sizeof(SkPoint) ); 315 sizeof(SkPoint) );
313 uint32_t flag = reader->readInt(); 316 uint32_t flag = reader->readInt();
314 const SkColor* colors = NULL; 317 const SkColor* colors = NULL;
315 if (flag & DRAW_VERTICES_HAS_COLORS) { 318 if (flag & DRAW_VERTICES_HAS_COLORS) {
316 colors = (const SkColor*)reader->skip(SkPatchUtils::kNumCorners * sizeof(SkColor)); 319 colors = (const SkColor*)reader->skip(SkPatchUtils::kNumCorners * sizeof(SkColor));
317 } 320 }
318 const SkPoint* texCoords = NULL; 321 const SkPoint* texCoords = NULL;
319 if (flag & DRAW_VERTICES_HAS_TEXS) { 322 if (flag & DRAW_VERTICES_HAS_TEXS) {
320 texCoords = (const SkPoint*)reader->skip(SkPatchUtils::kNumCorne rs * 323 texCoords = (const SkPoint*)reader->skip(SkPatchUtils::kNumCorne rs *
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 case TRANSLATE: { 518 case TRANSLATE: {
516 SkScalar dx = reader->readScalar(); 519 SkScalar dx = reader->readScalar();
517 SkScalar dy = reader->readScalar(); 520 SkScalar dy = reader->readScalar();
518 canvas->translate(dx, dy); 521 canvas->translate(dx, dy);
519 } break; 522 } break;
520 default: 523 default:
521 SkASSERT(0); 524 SkASSERT(0);
522 } 525 }
523 } 526 }
524 527
OLDNEW
« no previous file with comments | « src/core/SkPictureData.cpp ('k') | src/core/SkRTree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698