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

Side by Side Diff: tests/PictureTest.cpp

Issue 308683005: setConfig -> setInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: missed one setConfig (release only) Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/ImageDecodingTest.cpp ('k') | tests/PipeTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 } 1178 }
1179 } 1179 }
1180 1180
1181 #ifndef SK_DEBUG 1181 #ifndef SK_DEBUG
1182 // Only test this is in release mode. We deliberately crash in debug mode, since a valid caller 1182 // Only test this is in release mode. We deliberately crash in debug mode, since a valid caller
1183 // should never do this. 1183 // should never do this.
1184 static void test_bad_bitmap() { 1184 static void test_bad_bitmap() {
1185 // This bitmap has a width and height but no pixels. As a result, attempting to record it will 1185 // This bitmap has a width and height but no pixels. As a result, attempting to record it will
1186 // fail. 1186 // fail.
1187 SkBitmap bm; 1187 SkBitmap bm;
1188 bm.setConfig(SkImageInfo::MakeN32Premul(100, 100)); 1188 bm.setInfo(SkImageInfo::MakeN32Premul(100, 100));
1189 SkPictureRecorder recorder; 1189 SkPictureRecorder recorder;
1190 SkCanvas* recordingCanvas = recorder.beginRecording(100, 100, NULL, 0); 1190 SkCanvas* recordingCanvas = recorder.beginRecording(100, 100, NULL, 0);
1191 recordingCanvas->drawBitmap(bm, 0, 0); 1191 recordingCanvas->drawBitmap(bm, 0, 0);
1192 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); 1192 SkAutoTUnref<SkPicture> picture(recorder.endRecording());
1193 1193
1194 SkCanvas canvas; 1194 SkCanvas canvas;
1195 canvas.drawPicture(*picture); 1195 canvas.drawPicture(*picture);
1196 } 1196 }
1197 #endif 1197 #endif
1198 1198
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint); 1609 canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint);
1610 canvas->drawBitmapRectToRect(bitmap, &rect, rect, &paint, SkCanvas::kNone_Dr awBitmapRectFlag); 1610 canvas->drawBitmapRectToRect(bitmap, &rect, rect, &paint, SkCanvas::kNone_Dr awBitmapRectFlag);
1611 canvas->drawBitmapMatrix(bitmap, SkMatrix::I(), &paint); 1611 canvas->drawBitmapMatrix(bitmap, SkMatrix::I(), &paint);
1612 canvas->drawBitmapNine(bitmap, irect, rect, &paint); 1612 canvas->drawBitmapNine(bitmap, irect, rect, &paint);
1613 canvas->drawSprite(bitmap, 1, 1); 1613 canvas->drawSprite(bitmap, 1, 1);
1614 } 1614 }
1615 1615
1616 static void test_draw_bitmaps(SkCanvas* canvas) { 1616 static void test_draw_bitmaps(SkCanvas* canvas) {
1617 SkBitmap empty; 1617 SkBitmap empty;
1618 draw_bitmaps(empty, canvas); 1618 draw_bitmaps(empty, canvas);
1619 empty.setConfig(SkImageInfo::MakeN32Premul(10, 10)); 1619 empty.setInfo(SkImageInfo::MakeN32Premul(10, 10));
1620 draw_bitmaps(empty, canvas); 1620 draw_bitmaps(empty, canvas);
1621 } 1621 }
1622 1622
1623 DEF_TEST(Picture_EmptyBitmap, r) { 1623 DEF_TEST(Picture_EmptyBitmap, r) {
1624 SkPictureRecorder recorder; 1624 SkPictureRecorder recorder;
1625 test_draw_bitmaps(recorder.beginRecording(10, 10, NULL, 0)); 1625 test_draw_bitmaps(recorder.beginRecording(10, 10, NULL, 0));
1626 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); 1626 SkAutoTUnref<SkPicture> picture(recorder.endRecording());
1627 } 1627 }
1628 1628
1629 DEF_TEST(Canvas_EmptyBitmap, r) { 1629 DEF_TEST(Canvas_EmptyBitmap, r) {
1630 SkBitmap dst; 1630 SkBitmap dst;
1631 dst.allocN32Pixels(10, 10); 1631 dst.allocN32Pixels(10, 10);
1632 SkCanvas canvas(dst); 1632 SkCanvas canvas(dst);
1633 1633
1634 test_draw_bitmaps(&canvas); 1634 test_draw_bitmaps(&canvas);
1635 } 1635 }
OLDNEW
« no previous file with comments | « tests/ImageDecodingTest.cpp ('k') | tests/PipeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698