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

Side by Side Diff: tools/CopyTilesRenderer.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 2012 Google Inc. 2 * Copyright 2012 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 "picture_utils.h" 8 #include "picture_utils.h"
9 #include "CopyTilesRenderer.h" 9 #include "CopyTilesRenderer.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 for (int x = 0; x < this->getViewWidth(); x += fLargeTileWidth) { 48 for (int x = 0; x < this->getViewWidth(); x += fLargeTileWidth) {
49 for (int y = 0; y < this->getViewHeight(); y += fLargeTileHeight) { 49 for (int y = 0; y < this->getViewHeight(); y += fLargeTileHeight) {
50 SkAutoCanvasRestore autoRestore(fCanvas, true); 50 SkAutoCanvasRestore autoRestore(fCanvas, true);
51 // Translate so that we draw the correct portion of the picture. 51 // Translate so that we draw the correct portion of the picture.
52 // Perform a postTranslate so that the scaleFactor does not inte rfere with the 52 // Perform a postTranslate so that the scaleFactor does not inte rfere with the
53 // positioning. 53 // positioning.
54 SkMatrix mat(fCanvas->getTotalMatrix()); 54 SkMatrix mat(fCanvas->getTotalMatrix());
55 mat.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); 55 mat.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
56 fCanvas->setMatrix(mat); 56 fCanvas->setMatrix(mat);
57 // Draw the picture 57 // Draw the picture
58 fCanvas->drawPicture(*fPicture); 58 fCanvas->drawPicture(fPicture);
59 // Now extract the picture into tiles 59 // Now extract the picture into tiles
60 const SkBitmap& baseBitmap = fCanvas->getDevice()->accessBitmap( false); 60 const SkBitmap& baseBitmap = fCanvas->getDevice()->accessBitmap( false);
61 SkIRect subset; 61 SkIRect subset;
62 for (int tileY = 0; tileY < fLargeTileHeight; tileY += this->get TileHeight()) { 62 for (int tileY = 0; tileY < fLargeTileHeight; tileY += this->get TileHeight()) {
63 for (int tileX = 0; tileX < fLargeTileWidth; tileX += this-> getTileWidth()) { 63 for (int tileX = 0; tileX < fLargeTileWidth; tileX += this-> getTileWidth()) {
64 subset.set(tileX, tileY, tileX + this->getTileWidth(), 64 subset.set(tileX, tileY, tileX + this->getTileWidth(),
65 tileY + this->getTileHeight()); 65 tileY + this->getTileHeight());
66 SkDEBUGCODE(bool extracted =) 66 SkDEBUGCODE(bool extracted =)
67 baseBitmap.extractSubset(&dst, subset); 67 baseBitmap.extractSubset(&dst, subset);
68 SkASSERT(extracted); 68 SkASSERT(extracted);
(...skipping 23 matching lines...) Expand all
92 } 92 }
93 } 93 }
94 } 94 }
95 return success; 95 return success;
96 } 96 }
97 97
98 SkString CopyTilesRenderer::getConfigNameInternal() { 98 SkString CopyTilesRenderer::getConfigNameInternal() {
99 return SkString("copy_tiles"); 99 return SkString("copy_tiles");
100 } 100 }
101 } 101 }
OLDNEW
« include/core/SkCanvas.h ('K') | « tests/PictureTest.cpp ('k') | tools/PdfRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698