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

Unified Diff: dm/DMSKPTask.cpp

Issue 448263002: DM: conserve memory when using --skps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « dm/DM.cpp ('k') | gyp/dm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSKPTask.cpp
diff --git a/dm/DMSKPTask.cpp b/dm/DMSKPTask.cpp
index 357d46e71915dd61576688d6b33d0aaad3e0c2ef..3d0291598fe9dfa6f42c781c5d404b5136e7ec8e 100644
--- a/dm/DMSKPTask.cpp
+++ b/dm/DMSKPTask.cpp
@@ -6,6 +6,8 @@
#include "SkPictureRecorder.h"
DEFINE_bool(skr, true, "Test that SKPs draw the same when re-recorded with SkRecord backend.");
+DEFINE_int32(skpMaxWidth, 1000, "Max SKPTask viewport width.");
+DEFINE_int32(skpMaxHeight, 1000, "Max SKPTask viewport height.");
namespace DM {
@@ -28,7 +30,7 @@ public:
SkAutoTDelete<const SkPicture> skrPicture(recorder.endRecording());
SkBitmap bitmap;
- AllocatePixels(kN32_SkColorType, fPicture->width(), fPicture->height(), &bitmap);
+ AllocatePixels(kN32_SkColorType, fReference.width(), fReference.height(), &bitmap);
DrawPicture(*skrPicture, &bitmap);
if (!BitmapsEqual(fReference, bitmap)) {
@@ -48,8 +50,10 @@ SKPTask::SKPTask(Reporter* r, TaskRunner* tr, const SkPicture* pic, SkString fil
: CpuTask(r, tr), fPicture(SkRef(pic)), fName(FileToTaskName(filename)) {}
void SKPTask::draw() {
+ const int width = SkTMin(fPicture->width(), FLAGS_skpMaxWidth),
+ height = SkTMin(fPicture->height(), FLAGS_skpMaxHeight);
SkBitmap bitmap;
- AllocatePixels(kN32_SkColorType, fPicture->width(), fPicture->height(), &bitmap);
+ AllocatePixels(kN32_SkColorType, width, height, &bitmap);
DrawPicture(*fPicture, &bitmap);
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
« no previous file with comments | « dm/DM.cpp ('k') | gyp/dm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698