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

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

Issue 313613004: Alter SkCanvas::drawPicture (devirtualize, take const SkPicture, take pointer) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add staging entry point for Chromium and Android Created 6 years, 6 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
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 "SkBBoxRecord.h" 9 #include "SkBBoxRecord.h"
10 10
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 const uint16_t indices[], int indexCount, 273 const uint16_t indices[], int indexCount,
274 const SkPaint& paint) { 274 const SkPaint& paint) {
275 SkRect bbox; 275 SkRect bbox;
276 bbox.set(vertices, vertexCount); 276 bbox.set(vertices, vertexCount);
277 if (this->transformBounds(bbox, &paint)) { 277 if (this->transformBounds(bbox, &paint)) {
278 INHERITED::drawVertices(mode, vertexCount, vertices, texs, 278 INHERITED::drawVertices(mode, vertexCount, vertices, texs,
279 colors, xfer, indices, indexCount, paint); 279 colors, xfer, indices, indexCount, paint);
280 } 280 }
281 } 281 }
282 282
283 void SkBBoxRecord::drawPicture(SkPicture& picture) { 283 void SkBBoxRecord::onDrawPicture(const SkPicture* picture) {
284 if (picture.width() > 0 && picture.height() > 0 && 284 if (picture->width() > 0 && picture->height() > 0 &&
285 this->transformBounds(SkRect::MakeWH(picture.width(), picture.height()), NULL)) { 285 this->transformBounds(SkRect::MakeWH(picture->width(), picture->height() ), NULL)) {
286 INHERITED::drawPicture(picture); 286 this->INHERITED::onDrawPicture(picture);
287 } 287 }
288 } 288 }
289 289
290 bool SkBBoxRecord::transformBounds(const SkRect& bounds, const SkPaint* paint) { 290 bool SkBBoxRecord::transformBounds(const SkRect& bounds, const SkPaint* paint) {
291 SkRect outBounds = bounds; 291 SkRect outBounds = bounds;
292 outBounds.sort(); 292 outBounds.sort();
293 293
294 if (paint) { 294 if (paint) {
295 // account for stroking, path effects, shadows, etc 295 // account for stroking, path effects, shadows, etc
296 if (paint->canComputeFastBounds()) { 296 if (paint->canComputeFastBounds()) {
297 SkRect temp; 297 SkRect temp;
298 outBounds = paint->computeFastBounds(outBounds, &temp); 298 outBounds = paint->computeFastBounds(outBounds, &temp);
299 } else { 299 } else {
300 // set bounds to current clip 300 // set bounds to current clip
301 if (!this->getClipBounds(&outBounds)) { 301 if (!this->getClipBounds(&outBounds)) {
302 // current clip is empty 302 // current clip is empty
303 return false; 303 return false;
304 } 304 }
305 } 305 }
306 } 306 }
307 307
308 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) { 308 if (!outBounds.isEmpty() && !this->quickReject(outBounds)) {
309 this->getTotalMatrix().mapRect(&outBounds); 309 this->getTotalMatrix().mapRect(&outBounds);
310 this->handleBBox(outBounds); 310 this->handleBBox(outBounds);
311 return true; 311 return true;
312 } 312 }
313 313
314 return false; 314 return false;
315 } 315 }
OLDNEW
« include/core/SkCanvas.h ('K') | « src/core/SkBBoxRecord.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698