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

Unified Diff: tests/SerializationTest.cpp

Issue 513983002: Try out scalar picture sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT again 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 | « tests/PictureTest.cpp ('k') | tools/PictureRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SerializationTest.cpp
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 2dc0c62cb5ca4db4f82877af599896f75518ebbd..4e11f120db7a984902050c89e303a35212bdf151 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -263,7 +263,8 @@ static void TestBitmapSerialization(const SkBitmap& validBitmap,
static SkBitmap draw_picture(SkPicture& picture) {
SkBitmap bitmap;
- bitmap.allocN32Pixels(picture.width(), picture.height());
+ bitmap.allocN32Pixels(SkScalarCeilToInt(picture.cullRect().width()),
+ SkScalarCeilToInt(picture.cullRect().height()));
SkCanvas canvas(bitmap);
picture.draw(&canvas);
return bitmap;
@@ -315,7 +316,9 @@ static void TestPictureTypefaceSerialization(skiatest::Reporter* reporter) {
// Paint some text.
SkPictureRecorder recorder;
SkIRect canvasRect = SkIRect::MakeWH(kBitmapSize, kBitmapSize);
- SkCanvas* canvas = recorder.beginRecording(canvasRect.width(), canvasRect.height(), NULL, 0);
+ SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(canvasRect.width()),
+ SkIntToScalar(canvasRect.height()),
+ NULL, 0);
canvas->drawColor(SK_ColorWHITE);
canvas->drawText("A", 1, 24, 32, paint);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
@@ -364,7 +367,7 @@ static bool make_checkerboard_bitmap(SkBitmap& bitmap) {
return success;
}
-static bool drawSomething(SkCanvas* canvas) {
+static bool draw_something(SkCanvas* canvas) {
SkPaint paint;
SkBitmap bitmap;
bool success = make_checkerboard_bitmap(bitmap);
@@ -478,7 +481,9 @@ DEF_TEST(Serialization, reporter) {
// Test simple SkPicture serialization
{
SkPictureRecorder recorder;
- bool didDraw = drawSomething(recorder.beginRecording(kBitmapSize, kBitmapSize, NULL, 0));
+ bool didDraw = draw_something(recorder.beginRecording(SkIntToScalar(kBitmapSize),
+ SkIntToScalar(kBitmapSize),
+ NULL, 0));
REPORTER_ASSERT(reporter, didDraw);
SkAutoTUnref<SkPicture> pict(recorder.endRecording());
« no previous file with comments | « tests/PictureTest.cpp ('k') | tools/PictureRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698