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

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

Issue 511613002: Convert BBH APIs to use SkRect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another in BBH test 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 SkIRect query; 74 return fPictureData->getActiveOps(clipBounds);
75 clipBounds.roundOut(&query);
76
77 return fPictureData->getActiveOps(query);
78 } 75 }
79 } 76 }
80 77
81 return NULL; 78 return NULL;
82 } 79 }
83 80
84 // Initialize the state tree iterator. Return false if there is nothing left to draw. 81 // Initialize the state tree iterator. Return false if there is nothing left to draw.
85 bool SkPicturePlayback::initIterator(SkPictureStateTree::Iterator* iter, 82 bool SkPicturePlayback::initIterator(SkPictureStateTree::Iterator* iter,
86 SkCanvas* canvas, 83 SkCanvas* canvas,
87 const SkPicture::OperationList *activeOpsLi st) { 84 const SkPicture::OperationList *activeOpsLi st) {
88 85
89 if (NULL != activeOpsList) { 86 if (NULL != activeOpsList) {
90 if (0 == activeOpsList->numOps()) { 87 if (0 == activeOpsList->numOps()) {
91 return false; // nothing to draw 88 return false; // nothing to draw
92 } 89 }
93 90
94 fPictureData->initIterator(iter, activeOpsList->fOps, canvas); 91 fPictureData->initIterator(iter, activeOpsList->fOps, canvas);
95 } 92 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 SkipIterTo(&it, &reader, fCurOffset + size); 162 SkipIterTo(&it, &reader, fCurOffset + size);
166 continue; 163 continue;
167 } 164 }
168 165
169 this->handleOp(&reader, op, size, canvas, initialMatrix); 166 this->handleOp(&reader, op, size, canvas, initialMatrix);
170 167
171 StepIterator(&it, &reader); 168 StepIterator(&it, &reader);
172 } 169 }
173 } 170 }
174 171
175 void SkPicturePlayback::handleOp(SkReader32* reader, 172 void SkPicturePlayback::handleOp(SkReader32* reader,
176 DrawType op, 173 DrawType op,
177 uint32_t size, 174 uint32_t size,
178 SkCanvas* canvas, 175 SkCanvas* canvas,
179 const SkMatrix& initialMatrix) { 176 const SkMatrix& initialMatrix) {
180 switch (op) { 177 switch (op) {
181 case CLIP_PATH: { 178 case CLIP_PATH: {
182 const SkPath& path = fPictureData->getPath(reader); 179 const SkPath& path = fPictureData->getPath(reader);
183 uint32_t packed = reader->readInt(); 180 uint32_t packed = reader->readInt();
184 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed); 181 SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed);
185 bool doAA = ClipParams_unpackDoAA(packed); 182 bool doAA = ClipParams_unpackDoAA(packed);
186 size_t offsetToRestore = reader->readInt(); 183 size_t offsetToRestore = reader->readInt();
187 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset()); 184 SkASSERT(!offsetToRestore || offsetToRestore >= reader->offset());
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } break; 300 } break;
304 case DRAW_OVAL: { 301 case DRAW_OVAL: {
305 const SkPaint& paint = *fPictureData->getPaint(reader); 302 const SkPaint& paint = *fPictureData->getPaint(reader);
306 canvas->drawOval(reader->skipT<SkRect>(), paint); 303 canvas->drawOval(reader->skipT<SkRect>(), paint);
307 } break; 304 } break;
308 case DRAW_PAINT: 305 case DRAW_PAINT:
309 canvas->drawPaint(*fPictureData->getPaint(reader)); 306 canvas->drawPaint(*fPictureData->getPaint(reader));
310 break; 307 break;
311 case DRAW_PATCH: { 308 case DRAW_PATCH: {
312 const SkPaint& paint = *fPictureData->getPaint(reader); 309 const SkPaint& paint = *fPictureData->getPaint(reader);
313 310
314 const SkPoint* cubics = (const SkPoint*)reader->skip(SkPatchUtils::k NumCtrlPts * 311 const SkPoint* cubics = (const SkPoint*)reader->skip(SkPatchUtils::k NumCtrlPts *
315 sizeof(SkPoint) ); 312 sizeof(SkPoint) );
316 uint32_t flag = reader->readInt(); 313 uint32_t flag = reader->readInt();
317 const SkColor* colors = NULL; 314 const SkColor* colors = NULL;
318 if (flag & DRAW_VERTICES_HAS_COLORS) { 315 if (flag & DRAW_VERTICES_HAS_COLORS) {
319 colors = (const SkColor*)reader->skip(SkPatchUtils::kNumCorners * sizeof(SkColor)); 316 colors = (const SkColor*)reader->skip(SkPatchUtils::kNumCorners * sizeof(SkColor));
320 } 317 }
321 const SkPoint* texCoords = NULL; 318 const SkPoint* texCoords = NULL;
322 if (flag & DRAW_VERTICES_HAS_TEXS) { 319 if (flag & DRAW_VERTICES_HAS_TEXS) {
323 texCoords = (const SkPoint*)reader->skip(SkPatchUtils::kNumCorne rs * 320 texCoords = (const SkPoint*)reader->skip(SkPatchUtils::kNumCorne rs *
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 case TRANSLATE: { 515 case TRANSLATE: {
519 SkScalar dx = reader->readScalar(); 516 SkScalar dx = reader->readScalar();
520 SkScalar dy = reader->readScalar(); 517 SkScalar dy = reader->readScalar();
521 canvas->translate(dx, dy); 518 canvas->translate(dx, dy);
522 } break; 519 } break;
523 default: 520 default:
524 SkASSERT(0); 521 SkASSERT(0);
525 } 522 }
526 } 523 }
527 524
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