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

Side by Side Diff: src/core/SkCanvas.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 * 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 "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength, 2472 void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength,
2473 const SkPath& path, SkScalar hOffset, 2473 const SkPath& path, SkScalar hOffset,
2474 SkScalar vOffset, const SkPaint& paint) { 2474 SkScalar vOffset, const SkPaint& paint) {
2475 SkMatrix matrix; 2475 SkMatrix matrix;
2476 2476
2477 matrix.setTranslate(hOffset, vOffset); 2477 matrix.setTranslate(hOffset, vOffset);
2478 this->drawTextOnPath(text, byteLength, path, &matrix, paint); 2478 this->drawTextOnPath(text, byteLength, path, &matrix, paint);
2479 } 2479 }
2480 2480
2481 /////////////////////////////////////////////////////////////////////////////// 2481 ///////////////////////////////////////////////////////////////////////////////
2482 void SkCanvas::EXPERIMENTAL_optimize(SkPicture* picture) { 2482 void SkCanvas::EXPERIMENTAL_optimize(const SkPicture* picture) {
2483 SkBaseDevice* device = this->getDevice(); 2483 SkBaseDevice* device = this->getDevice();
2484 if (NULL != device) { 2484 if (NULL != device) {
2485 device->EXPERIMENTAL_optimize(picture); 2485 device->EXPERIMENTAL_optimize(picture);
2486 } 2486 }
2487 } 2487 }
2488 2488
2489 void SkCanvas::EXPERIMENTAL_purge(SkPicture* picture) { 2489 void SkCanvas::EXPERIMENTAL_purge(const SkPicture* picture) {
2490 SkBaseDevice* device = this->getTopDevice(); 2490 SkBaseDevice* device = this->getTopDevice();
2491 if (NULL != device) { 2491 if (NULL != device) {
2492 device->EXPERIMENTAL_purge(picture); 2492 device->EXPERIMENTAL_purge(picture);
2493 } 2493 }
2494 } 2494 }
2495 2495
2496 void SkCanvas::drawPicture(SkPicture& picture) { 2496 void SkCanvas::drawPicture(const SkPicture* picture) {
2497 if (NULL != picture) {
2498 this->onDrawPicture(picture);
2499 }
2500 }
2501
2502 void SkCanvas::onDrawPicture(const SkPicture* picture) {
2503 SkASSERT(NULL != picture);
2504
2497 SkBaseDevice* device = this->getTopDevice(); 2505 SkBaseDevice* device = this->getTopDevice();
2498 if (NULL != device) { 2506 if (NULL != device) {
2499 // Canvas has to first give the device the opportunity to render 2507 // Canvas has to first give the device the opportunity to render
2500 // the picture itself. 2508 // the picture itself.
2501 if (device->EXPERIMENTAL_drawPicture(this, &picture)) { 2509 if (device->EXPERIMENTAL_drawPicture(this, picture)) {
2502 return; // the device has rendered the entire picture 2510 return; // the device has rendered the entire picture
2503 } 2511 }
2504 } 2512 }
2505 2513
2506 picture.draw(this); 2514 picture->draw(this);
2507 } 2515 }
2508 2516
2509 /////////////////////////////////////////////////////////////////////////////// 2517 ///////////////////////////////////////////////////////////////////////////////
2510 /////////////////////////////////////////////////////////////////////////////// 2518 ///////////////////////////////////////////////////////////////////////////////
2511 2519
2512 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { 2520 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) {
2513 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small ); 2521 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small );
2514 2522
2515 SkASSERT(canvas); 2523 SkASSERT(canvas);
2516 2524
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2594 if (!supported_for_raster_canvas(info)) { 2602 if (!supported_for_raster_canvas(info)) {
2595 return NULL; 2603 return NULL;
2596 } 2604 }
2597 2605
2598 SkBitmap bitmap; 2606 SkBitmap bitmap;
2599 if (!bitmap.installPixels(info, pixels, rowBytes)) { 2607 if (!bitmap.installPixels(info, pixels, rowBytes)) {
2600 return NULL; 2608 return NULL;
2601 } 2609 }
2602 return SkNEW_ARGS(SkCanvas, (bitmap)); 2610 return SkNEW_ARGS(SkCanvas, (bitmap));
2603 } 2611 }
OLDNEW
« include/core/SkCanvas.h ('K') | « src/core/SkBBoxRecord.cpp ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698