aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-08-29 08:03:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-29 08:03:56 -0700
commita8d7f0b13cd4c6d773fcf055fe17db75d260fa05 (patch)
tree37e85b212ccd5761b9a736282e75ebf838840798 /samplecode
parent77d724c07878b21602e96e095f6a446c429a079a (diff)
Try out scalar picture sizes
This paves the way for removing the 'fTile' parameter from SkPictureShader (although that should be a different CL). If we like this we could also move to providing an entire cull SkRect. R=reed@google.com, mtklein@google.com, fmalita@google.com, fmalita@chromium.org Author: robertphillips@google.com Review URL: https://codereview.chromium.org/513983002
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleFilterFuzz.cpp4
-rw-r--r--samplecode/SamplePictFile.cpp15
2 files changed, 14 insertions, 5 deletions
diff --git a/samplecode/SampleFilterFuzz.cpp b/samplecode/SampleFilterFuzz.cpp
index 298219dbc0..8aa48ed5c9 100644
--- a/samplecode/SampleFilterFuzz.cpp
+++ b/samplecode/SampleFilterFuzz.cpp
@@ -371,7 +371,9 @@ static SkImageFilter* make_image_filter(bool canBeNull = true) {
{
SkRTreeFactory factory;
SkPictureRecorder recorder;
- SkCanvas* recordingCanvas = recorder.beginRecording(kBitmapSize, kBitmapSize, &factory, 0);
+ SkCanvas* recordingCanvas = recorder.beginRecording(SkIntToScalar(kBitmapSize),
+ SkIntToScalar(kBitmapSize),
+ &factory, 0);
drawSomething(recordingCanvas);
SkAutoTUnref<SkPicture> pict(recorder.endRecording());
filter = SkPictureImageFilter::Create(pict.get(), make_rect());
diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp
index 87a0e67136..3d7acfc47d 100644
--- a/samplecode/SamplePictFile.cpp
+++ b/samplecode/SamplePictFile.cpp
@@ -123,7 +123,9 @@ private:
if (SkImageDecoder::DecodeFile(path, &bm)) {
bm.setImmutable();
SkPictureRecorder recorder;
- SkCanvas* can = recorder.beginRecording(bm.width(), bm.height(), NULL, 0);
+ SkCanvas* can = recorder.beginRecording(SkIntToScalar(bm.width()),
+ SkIntToScalar(bm.height()),
+ NULL, 0);
can->drawBitmap(bm, 0, 0, NULL);
pic.reset(recorder.endRecording());
} else {
@@ -135,13 +137,16 @@ private:
}
if (false) {
- SkSurface* surf = SkSurface::NewRasterPMColor(pic->width(), pic->height());
+ SkSurface* surf = SkSurface::NewRasterPMColor(SkScalarCeilToInt(pic->cullRect().width()),
+ SkScalarCeilToInt(pic->cullRect().height()));
surf->getCanvas()->drawPicture(pic);
surf->unref();
}
if (false) { // re-record
SkPictureRecorder recorder;
- pic->draw(recorder.beginRecording(pic->width(), pic->height(), NULL, 0));
+ pic->draw(recorder.beginRecording(pic->cullRect().width(),
+ pic->cullRect().height(),
+ NULL, 0));
SkAutoTUnref<SkPicture> p2(recorder.endRecording());
SkString path2(path);
@@ -177,7 +182,9 @@ private:
}
SkPictureRecorder recorder;
- pic->draw(recorder.beginRecording(pic->width(), pic->height(), factory.get(), 0));
+ pic->draw(recorder.beginRecording(pic->cullRect().width(),
+ pic->cullRect().height(),
+ factory.get(), 0));
return recorder.endRecording();
}