aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
Diffstat (limited to 'dm')
-rw-r--r--dm/DMCpuGMTask.cpp4
-rw-r--r--dm/DMQuiltTask.cpp (renamed from dm/DMTileGridTask.cpp)37
-rw-r--r--dm/DMQuiltTask.h (renamed from dm/DMTileGridTask.h)14
3 files changed, 20 insertions, 35 deletions
diff --git a/dm/DMCpuGMTask.cpp b/dm/DMCpuGMTask.cpp
index 7ab1d44ee5..e1ba81d1c1 100644
--- a/dm/DMCpuGMTask.cpp
+++ b/dm/DMCpuGMTask.cpp
@@ -1,10 +1,10 @@
#include "DMCpuGMTask.h"
#include "DMExpectationsTask.h"
#include "DMPipeTask.h"
+#include "DMQuiltTask.h"
#include "DMRecordTask.h"
#include "DMReplayTask.h"
#include "DMSerializeTask.h"
-#include "DMTileGridTask.h"
#include "DMUtil.h"
#include "DMWriteTask.h"
@@ -39,11 +39,11 @@ void CpuGMTask::draw() {
SPAWN(PipeTask, fGMFactory(NULL), bitmap, false, false);
SPAWN(PipeTask, fGMFactory(NULL), bitmap, true, false);
SPAWN(PipeTask, fGMFactory(NULL), bitmap, true, true);
+ SPAWN(QuiltTask, fGMFactory(NULL), bitmap);
SPAWN(RecordTask, fGMFactory(NULL), bitmap);
SPAWN(ReplayTask, fGMFactory(NULL), bitmap, false);
SPAWN(ReplayTask, fGMFactory(NULL), bitmap, true);
SPAWN(SerializeTask, fGMFactory(NULL), bitmap);
- SPAWN(TileGridTask, fGMFactory(NULL), bitmap, SkISize::Make(16,16));
SPAWN(WriteTask, bitmap);
#undef SPAWN
diff --git a/dm/DMTileGridTask.cpp b/dm/DMQuiltTask.cpp
index 4299bd7985..e8f8b60a0f 100644
--- a/dm/DMTileGridTask.cpp
+++ b/dm/DMQuiltTask.cpp
@@ -1,51 +1,38 @@
-#include "DMTileGridTask.h"
-#include "DMWriteTask.h"
+#include "DMQuiltTask.h"
#include "DMUtil.h"
+#include "DMWriteTask.h"
-#include "SkBBHFactory.h"
#include "SkCommandLineFlags.h"
#include "SkPicture.h"
-// TODO(mtklein): Tile grid tests are currently failing. (Skia issue 1198). When fixed, -> true.
-DEFINE_bool(tileGrid, false, "If true, run picture replay tests with a tile grid.");
+DEFINE_bool(quilt, true, "If true, draw into a quilt of small tiles and compare.");
+DEFINE_int32(quiltTile, 16, "Dimension of (square) quilt tile.");
namespace DM {
-TileGridTask::TileGridTask(const Task& parent, skiagm::GM* gm, SkBitmap reference, SkISize tileSize)
+QuiltTask::QuiltTask(const Task& parent, skiagm::GM* gm, SkBitmap reference)
: CpuTask(parent)
- , fName(UnderJoin(parent.name().c_str(), "tilegrid"))
+ , fName(UnderJoin(parent.name().c_str(), "quilt"))
, fGM(gm)
, fReference(reference)
- , fTileSize(tileSize)
{}
static int tiles_needed(int fullDimension, int tileDimension) {
return (fullDimension + tileDimension - 1) / tileDimension;
}
-void TileGridTask::draw() {
- const SkTileGridFactory::TileGridInfo info = {
- fTileSize,
- SkISize::Make(0,0), // Overlap between adjacent tiles.
- SkIPoint::Make(0,0), // Offset.
- };
- SkTileGridFactory factory(info);
- SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(),
- SkPicture::kUsePathBoundsForClip_RecordingFlag,
- &factory));
+void QuiltTask::draw() {
+ SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get()));
SkBitmap full;
SetupBitmap(fReference.colorType(), fGM.get(), &full);
SkCanvas fullCanvas(full);
SkBitmap tile;
- tile.allocPixels(SkImageInfo::Make(fTileSize.width(), fTileSize.height(),
+ tile.allocPixels(SkImageInfo::Make(FLAGS_quiltTile, FLAGS_quiltTile,
fReference.colorType(), kPremul_SkAlphaType));
SkCanvas tileCanvas(tile);
- SkPaint paint;
- paint.setXfermodeMode(SkXfermode::kSrc_Mode);
-
for (int y = 0; y < tiles_needed(full.height(), tile.height()); y++) {
for (int x = 0; x < tiles_needed(full.width(), tile.width()); x++) {
SkAutoCanvasRestore ar(&tileCanvas, true/*also save now*/);
@@ -58,7 +45,7 @@ void TileGridTask::draw() {
recorded->draw(&tileCanvas);
tileCanvas.flush();
- fullCanvas.drawBitmap(tile, xOffset, yOffset, &paint);
+ fullCanvas.drawBitmap(tile, xOffset, yOffset, NULL);
}
}
@@ -68,14 +55,14 @@ void TileGridTask::draw() {
}
}
-bool TileGridTask::shouldSkip() const {
+bool QuiltTask::shouldSkip() const {
if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) {
return true;
}
if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) {
return true;
}
- return !FLAGS_tileGrid;
+ return !FLAGS_quilt;
}
} // namespace DM
diff --git a/dm/DMTileGridTask.h b/dm/DMQuiltTask.h
index 911a1c52a1..56f322f067 100644
--- a/dm/DMTileGridTask.h
+++ b/dm/DMQuiltTask.h
@@ -1,5 +1,5 @@
-#ifndef DMTileGridTask_DEFINED
-#define DMTileGridTask_DEFINED
+#ifndef DMQuiltTask_DEFINED
+#define DMQuiltTask_DEFINED
#include "DMTask.h"
#include "SkBitmap.h"
@@ -11,13 +11,12 @@
namespace DM {
-class TileGridTask : public CpuTask {
+class QuiltTask : public CpuTask {
public:
- TileGridTask(const Task& parent, // TileGridTask must be a child task. Pass its parent here.
- skiagm::GM*, // GM to run through a picture. Takes ownership.
- SkBitmap reference, // Bitmap to compare picture replay results to.
- SkISize tileSize); // Tile size to use.
+ QuiltTask(const Task& parent, // QuiltTask must be a child task. Pass its parent here.
+ skiagm::GM*, // GM to run through a picture. Takes ownership.
+ SkBitmap reference); // Bitmap to compare picture replay results to.
virtual void draw() SK_OVERRIDE;
virtual bool shouldSkip() const SK_OVERRIDE;
@@ -27,7 +26,6 @@ private:
const SkString fName;
SkAutoTDelete<skiagm::GM> fGM;
const SkBitmap fReference;
- const SkISize fTileSize;
};
} // namespace DM