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

Side by Side Diff: tests/DrawBitmapRectTest.cpp

Issue 68973005: Expand pixelref to return SkImageInfo and rowbytes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: undo mod to GpuBitmapCopy test, and change bitmapdevice to not ask for alloc w/ kNo_Config Created 7 years 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 | « src/lazy/SkDiscardablePixelRef.cpp ('k') | tests/PictureTest.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Test.h" 8 #include "Test.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 26 matching lines...) Expand all
37 // to decode into pixels. 37 // to decode into pixels.
38 return false; 38 return false;
39 } 39 }
40 }; 40 };
41 } // namespace 41 } // namespace
42 42
43 // crbug.com/295895 43 // crbug.com/295895
44 // Crashing in skia when a pixelref fails in lockPixels 44 // Crashing in skia when a pixelref fails in lockPixels
45 // 45 //
46 static void test_faulty_pixelref(skiatest::Reporter* reporter) { 46 static void test_faulty_pixelref(skiatest::Reporter* reporter) {
47 SkImageInfo info;
48 info.fWidth = 100;
49 info.fHeight = 100;
50 info.fColorType = kPMColor_SkColorType;
51 info.fAlphaType = kPremul_SkAlphaType;
52
47 // need a cache, but don't expect to use it, so the budget is not critical 53 // need a cache, but don't expect to use it, so the budget is not critical
48 SkAutoTUnref<SkDiscardableMemoryPool> pool(SkNEW_ARGS(SkDiscardableMemoryPoo l, 54 SkAutoTUnref<SkDiscardableMemoryPool> pool(SkNEW_ARGS(SkDiscardableMemoryPoo l,
49 (10 * 1000, NULL))); 55 (10 * 1000, NULL)));
50 SkBitmap bm; 56 SkBitmap bm;
51 bool installSuccess = SkDiscardablePixelRef::Install(SkNEW(FailureImageGener ator), &bm, pool); 57 bool installSuccess = SkDiscardablePixelRef::Install(SkNEW(FailureImageGener ator), &bm, pool);
52 REPORTER_ASSERT(reporter, installSuccess); 58 REPORTER_ASSERT(reporter, installSuccess);
59
53 // now our bitmap has a pixelref, but we know it will fail to lock 60 // now our bitmap has a pixelref, but we know it will fail to lock
54 61
55 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(200, 200)); 62 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(200, 200));
56 SkCanvas* canvas = surface->getCanvas(); 63 SkCanvas* canvas = surface->getCanvas();
57 64
58 const SkPaint::FilterLevel levels[] = { 65 const SkPaint::FilterLevel levels[] = {
59 SkPaint::kNone_FilterLevel, 66 SkPaint::kNone_FilterLevel,
60 SkPaint::kLow_FilterLevel, 67 SkPaint::kLow_FilterLevel,
61 SkPaint::kMedium_FilterLevel, 68 SkPaint::kMedium_FilterLevel,
62 SkPaint::kHigh_FilterLevel, 69 SkPaint::kHigh_FilterLevel,
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 333
327 test_nan_antihair(); 334 test_nan_antihair();
328 test_giantrepeat_crbug118018(reporter); 335 test_giantrepeat_crbug118018(reporter);
329 336
330 test_treatAsSprite(reporter); 337 test_treatAsSprite(reporter);
331 test_faulty_pixelref(reporter); 338 test_faulty_pixelref(reporter);
332 } 339 }
333 340
334 #include "TestClassDef.h" 341 #include "TestClassDef.h"
335 DEFINE_TESTCLASS("DrawBitmapRect", TestDrawBitmapRectClass, TestDrawBitmapRect) 342 DEFINE_TESTCLASS("DrawBitmapRect", TestDrawBitmapRectClass, TestDrawBitmapRect)
OLDNEW
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698