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

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

Issue 513983002: Try out scalar picture sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up 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
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 8
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 2457 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 const SkPaint* paint) { 2468 const SkPaint* paint) {
2469 SkBaseDevice* device = this->getTopDevice(); 2469 SkBaseDevice* device = this->getTopDevice();
2470 if (NULL != device) { 2470 if (NULL != device) {
2471 // Canvas has to first give the device the opportunity to render 2471 // Canvas has to first give the device the opportunity to render
2472 // the picture itself. 2472 // the picture itself.
2473 if (device->EXPERIMENTAL_drawPicture(this, picture, matrix, paint)) { 2473 if (device->EXPERIMENTAL_drawPicture(this, picture, matrix, paint)) {
2474 return; // the device has rendered the entire picture 2474 return; // the device has rendered the entire picture
2475 } 2475 }
2476 } 2476 }
2477 2477
2478 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->width(), picture- >height()); 2478 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
2479 2479
2480 picture->draw(this); 2480 picture->draw(this);
2481 } 2481 }
2482 2482
2483 /////////////////////////////////////////////////////////////////////////////// 2483 ///////////////////////////////////////////////////////////////////////////////
2484 /////////////////////////////////////////////////////////////////////////////// 2484 ///////////////////////////////////////////////////////////////////////////////
2485 2485
2486 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { 2486 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) {
2487 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small ); 2487 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small );
2488 2488
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 SkBitmap bitmap; 2572 SkBitmap bitmap;
2573 if (!bitmap.installPixels(info, pixels, rowBytes)) { 2573 if (!bitmap.installPixels(info, pixels, rowBytes)) {
2574 return NULL; 2574 return NULL;
2575 } 2575 }
2576 return SkNEW_ARGS(SkCanvas, (bitmap)); 2576 return SkNEW_ARGS(SkCanvas, (bitmap));
2577 } 2577 }
2578 2578
2579 /////////////////////////////////////////////////////////////////////////////// 2579 ///////////////////////////////////////////////////////////////////////////////
2580 2580
2581 SkAutoCanvasMatrixPaint::SkAutoCanvasMatrixPaint(SkCanvas* canvas, const SkMatri x* matrix, 2581 SkAutoCanvasMatrixPaint::SkAutoCanvasMatrixPaint(SkCanvas* canvas, const SkMatri x* matrix,
2582 const SkPaint* paint, int width , int height) 2582 const SkPaint* paint, const SkR ect& bounds)
2583 : fCanvas(canvas) 2583 : fCanvas(canvas)
2584 , fSaveCount(canvas->getSaveCount()) 2584 , fSaveCount(canvas->getSaveCount())
2585 { 2585 {
2586 if (NULL != paint) { 2586 if (NULL != paint) {
2587 SkRect bounds = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heigh t)); 2587 SkRect newBounds = bounds;
2588 if (matrix) { 2588 if (matrix) {
2589 matrix->mapRect(&bounds); 2589 matrix->mapRect(&newBounds);
2590 } 2590 }
2591 canvas->saveLayer(&bounds, paint); 2591 canvas->saveLayer(&newBounds, paint);
2592 } else if (NULL != matrix) { 2592 } else if (NULL != matrix) {
2593 canvas->save(); 2593 canvas->save();
2594 } 2594 }
2595 2595
2596 if (NULL != matrix) { 2596 if (NULL != matrix) {
2597 canvas->concat(*matrix); 2597 canvas->concat(*matrix);
2598 } 2598 }
2599 } 2599 }
2600 2600
2601 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2601 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2602 fCanvas->restoreToCount(fSaveCount); 2602 fCanvas->restoreToCount(fSaveCount);
2603 } 2603 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698