skia2/dm/DMUtil.h
commit-bot@chromium.org 192cbf67b2 DM: add --serialize
Plus:
  - minor ReplayTask refactoring to share code with SerializeTask
  - move --replay to ReplayTask and --serialize to SerializeTask like WriteTask
  - when --writePath is given, write failures for Replay and Serialize tasks
  - function names have fewer blatant Skia style violations

BUG=
R=bsalomon@google.com

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/32613003

git-svn-id: http://skia.googlecode.com/svn/trunk@11890 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-10-21 18:40:25 +00:00

36 lines
954 B
C++

#ifndef DMUtil_DEFINED
#define DMUtil_DEFINED
#include "SkBitmap.h"
#include "SkString.h"
#include "gm_expectations.h"
// Small free functions used in more than one place in DM.
namespace DM {
// UnderJoin("a", "b") -> "a_b"
SkString UnderJoin(const char* a, const char* b);
// Png("a") -> "a.png"
SkString Png(SkString s);
// Roughly, expectations.match(GmResultDigest(bitmap)), but calculates the digest lazily.
bool MeetsExpectations(const skiagm::Expectations& expectations, const SkBitmap bitmap);
// Draw gm to picture.
void RecordPicture(skiagm::GM* gm, SkPicture* picture);
// Prepare bitmap to have gm draw into it with this config.
void SetupBitmap(const SkBitmap::Config config, skiagm::GM* gm, SkBitmap* bitmap);
// Draw picture to bitmap.
void DrawPicture(SkPicture* picture, SkBitmap* bitmap);
// Are these identical bitmaps?
bool BitmapsEqual(const SkBitmap& a, const SkBitmap& b);
} // namespace DM
#endif // DMUtil_DEFINED