Fix DM build failures:

- forgot tool_main;
  - skip building where skia_gpu is false;
  - lots of scalar -> int warnings;
  - stray return on a void method;
  - stifle warning about a uint32_t cast to bool

BUG=
R=bungeman@google.com

Author: mtklein@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@11821 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2013-10-16 18:21:03 +00:00
parent c7a40fad0b
commit 846872f75b
5 changed files with 25 additions and 9 deletions

View File

@ -129,8 +129,8 @@ public:
}
};
int main(int argc, char** argv) {
int tool_main(int argc, char** argv);
int tool_main(int argc, char** argv) {
SkGraphics::Init();
SkCommandLineFlags::Parse(argc, argv);
@ -164,3 +164,9 @@ int main(int argc, char** argv) {
return reporter.failed() > 0;
}
#if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
int main(int argc, char** argv) {
return tool_main(argc, argv);
}
#endif

View File

@ -24,7 +24,7 @@ CpuTask::CpuTask(const char* name,
void CpuTask::draw() {
SkBitmap bitmap;
bitmap.setConfig(fConfig, fGM->width(), fGM->height());
bitmap.setConfig(fConfig, SkScalarCeilToInt(fGM->width()), SkScalarCeilToInt(fGM->height()));
bitmap.allocPixels();
bitmap.eraseColor(0x00000000);
SkCanvas canvas(bitmap);

View File

@ -30,7 +30,7 @@ static void* new_gr_context_factory() {
}
static void delete_gr_context_factory(void* factory) {
return SkDELETE((GrContextFactory*) factory);
SkDELETE((GrContextFactory*) factory);
}
static GrContextFactory* get_gr_factory() {
@ -40,7 +40,11 @@ static GrContextFactory* get_gr_factory() {
void GpuTask::draw() {
GrContext* gr = get_gr_factory()->get(fContextType); // Will be owned by device.
SkGpuDevice device(gr, fConfig, fGM->width(), fGM->height(), fSampleCount);
SkGpuDevice device(gr,
fConfig,
SkScalarCeilToInt(fGM->width()),
SkScalarCeilToInt(fGM->height()),
fSampleCount);
SkCanvas canvas(&device);
canvas.concat(fGM->getInitialTransform());
@ -48,7 +52,7 @@ void GpuTask::draw() {
canvas.flush();
SkBitmap bitmap;
bitmap.setConfig(fConfig, fGM->width(), fGM->height());
bitmap.setConfig(fConfig, SkScalarCeilToInt(fGM->width()), SkScalarCeilToInt(fGM->height()));
canvas.readPixels(&bitmap, 0, 0);
// We offload checksum comparison to the main CPU threadpool.
@ -57,7 +61,7 @@ void GpuTask::draw() {
}
bool GpuTask::shouldSkip() const {
return fGM->getFlags() & skiagm::GM::kSkipGPU_Flag;
return SkToBool(fGM->getFlags() & skiagm::GM::kSkipGPU_Flag);
}
} // namespace DM

View File

@ -19,7 +19,9 @@ ReplayTask::ReplayTask(const char* suffix,
void ReplayTask::draw() {
SkPicture picture;
SkCanvas* canvas = picture.beginRecording(fGM->width(), fGM->height(), 0 /*flags*/);
SkCanvas* canvas = picture.beginRecording(SkScalarCeilToInt(fGM->width()),
SkScalarCeilToInt(fGM->height()),
0 /*flags*/);
canvas->concat(fGM->getInitialTransform());
fGM->draw(canvas);
@ -28,7 +30,7 @@ void ReplayTask::draw() {
picture.endRecording();
SkBitmap bitmap;
bitmap.setConfig(fConfig, fGM->width(), fGM->height());
bitmap.setConfig(fConfig, SkScalarCeilToInt(fGM->width()), SkScalarCeilToInt(fGM->height()));
bitmap.allocPixels();
bitmap.eraseColor(0x00000000);

View File

@ -21,6 +21,10 @@
}, {
'dependencies': [ 'debugger.gyp:debugger' ],
}],
# DM assumes you've got a GPU.
['skia_gpu == 1', {
'dependencies': [ 'dm.gyp:dm' ],
}],
],
},
],