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

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: Update to ToT again 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/SkBBoxRecord.cpp ('k') | src/core/SkCanvasPriv.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 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 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 const SkPaint* paint) { 2438 const SkPaint* paint) {
2439 SkBaseDevice* device = this->getTopDevice(); 2439 SkBaseDevice* device = this->getTopDevice();
2440 if (NULL != device) { 2440 if (NULL != device) {
2441 // Canvas has to first give the device the opportunity to render 2441 // Canvas has to first give the device the opportunity to render
2442 // the picture itself. 2442 // the picture itself.
2443 if (device->EXPERIMENTAL_drawPicture(this, picture, matrix, paint)) { 2443 if (device->EXPERIMENTAL_drawPicture(this, picture, matrix, paint)) {
2444 return; // the device has rendered the entire picture 2444 return; // the device has rendered the entire picture
2445 } 2445 }
2446 } 2446 }
2447 2447
2448 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->width(), picture- >height()); 2448 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
2449 2449
2450 picture->draw(this); 2450 picture->draw(this);
2451 } 2451 }
2452 2452
2453 /////////////////////////////////////////////////////////////////////////////// 2453 ///////////////////////////////////////////////////////////////////////////////
2454 /////////////////////////////////////////////////////////////////////////////// 2454 ///////////////////////////////////////////////////////////////////////////////
2455 2455
2456 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { 2456 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) {
2457 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small ); 2457 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small );
2458 2458
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2542 SkBitmap bitmap; 2542 SkBitmap bitmap;
2543 if (!bitmap.installPixels(info, pixels, rowBytes)) { 2543 if (!bitmap.installPixels(info, pixels, rowBytes)) {
2544 return NULL; 2544 return NULL;
2545 } 2545 }
2546 return SkNEW_ARGS(SkCanvas, (bitmap)); 2546 return SkNEW_ARGS(SkCanvas, (bitmap));
2547 } 2547 }
2548 2548
2549 /////////////////////////////////////////////////////////////////////////////// 2549 ///////////////////////////////////////////////////////////////////////////////
2550 2550
2551 SkAutoCanvasMatrixPaint::SkAutoCanvasMatrixPaint(SkCanvas* canvas, const SkMatri x* matrix, 2551 SkAutoCanvasMatrixPaint::SkAutoCanvasMatrixPaint(SkCanvas* canvas, const SkMatri x* matrix,
2552 const SkPaint* paint, int width , int height) 2552 const SkPaint* paint, const SkR ect& bounds)
2553 : fCanvas(canvas) 2553 : fCanvas(canvas)
2554 , fSaveCount(canvas->getSaveCount()) 2554 , fSaveCount(canvas->getSaveCount())
2555 { 2555 {
2556 if (NULL != paint) { 2556 if (NULL != paint) {
2557 SkRect bounds = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heigh t)); 2557 SkRect newBounds = bounds;
2558 if (matrix) { 2558 if (matrix) {
2559 matrix->mapRect(&bounds); 2559 matrix->mapRect(&newBounds);
2560 } 2560 }
2561 canvas->saveLayer(&bounds, paint); 2561 canvas->saveLayer(&newBounds, paint);
2562 } else if (NULL != matrix) { 2562 } else if (NULL != matrix) {
2563 canvas->save(); 2563 canvas->save();
2564 } 2564 }
2565 2565
2566 if (NULL != matrix) { 2566 if (NULL != matrix) {
2567 canvas->concat(*matrix); 2567 canvas->concat(*matrix);
2568 } 2568 }
2569 } 2569 }
2570 2570
2571 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2571 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2572 fCanvas->restoreToCount(fSaveCount); 2572 fCanvas->restoreToCount(fSaveCount);
2573 } 2573 }
OLDNEW
« no previous file with comments | « src/core/SkBBoxRecord.cpp ('k') | src/core/SkCanvasPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698