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

Unified Diff: tools/PictureRenderer.cpp

Issue 197123003: Proposed SkCanvas API for preLoading textures to VRAM v2.0 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: retry upload Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/PictureRenderer.h ('k') | tools/render_pictures_main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/PictureRenderer.cpp
===================================================================
--- tools/PictureRenderer.cpp (revision 13812)
+++ tools/PictureRenderer.cpp (working copy)
@@ -570,20 +570,19 @@
}
/**
- * Draw the specified playback to the canvas translated to rectangle provided, so that this mini
+ * Draw the specified picture to the canvas translated to rectangle provided, so that this mini
* canvas represents the rectangle's portion of the overall picture.
* Saves and restores so that the initial clip and matrix return to their state before this function
* is called.
*/
-template<class T>
-static void DrawTileToCanvas(SkCanvas* canvas, const SkRect& tileRect, T* playback) {
+static void draw_tile_to_canvas(SkCanvas* canvas, const SkRect& tileRect, SkPicture* picture) {
int saveCount = canvas->save();
// Translate so that we draw the correct portion of the picture.
// Perform a postTranslate so that the scaleFactor does not interfere with the positioning.
SkMatrix mat(canvas->getTotalMatrix());
mat.postTranslate(-tileRect.fLeft, -tileRect.fTop);
canvas->setMatrix(mat);
- playback->draw(canvas);
+ canvas->drawPicture(*picture);
canvas->restoreToCount(saveCount);
canvas->flush();
}
@@ -621,7 +620,7 @@
void TiledPictureRenderer::drawCurrentTile() {
SkASSERT(fCurrentTileOffset >= 0 && fCurrentTileOffset < fTileRects.count());
- DrawTileToCanvas(fCanvas, fTileRects[fCurrentTileOffset], fPicture);
+ draw_tile_to_canvas(fCanvas, fTileRects[fCurrentTileOffset], fPicture);
}
bool TiledPictureRenderer::render(const SkString* path, SkBitmap** out) {
@@ -638,7 +637,7 @@
}
bool success = true;
for (int i = 0; i < fTileRects.count(); ++i) {
- DrawTileToCanvas(fCanvas, fTileRects[i], fPicture);
+ draw_tile_to_canvas(fCanvas, fTileRects[i], fPicture);
if (NULL != path) {
success &= writeAppendNumber(fCanvas, path, i, fJsonSummaryPtr);
}
@@ -722,7 +721,7 @@
}
for (int i = fStart; i < fEnd; i++) {
- DrawTileToCanvas(fCanvas, fRects[i], fClone);
+ draw_tile_to_canvas(fCanvas, fRects[i], fClone);
if ((fPath != NULL) && !writeAppendNumber(fCanvas, fPath, i, fJsonSummaryPtr)
&& fSuccess != NULL) {
*fSuccess = false;
« no previous file with comments | « tools/PictureRenderer.h ('k') | tools/render_pictures_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698