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

Side by Side Diff: Source/platform/graphics/ImageLayerChromiumTest.cpp

Issue 540033002: use tryAllocPixels to check the result, allocPixels to require success (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 static PassRefPtr<TestImage> create(const IntSize& size, bool isOpaque) 49 static PassRefPtr<TestImage> create(const IntSize& size, bool isOpaque)
50 { 50 {
51 return adoptRef(new TestImage(size, isOpaque)); 51 return adoptRef(new TestImage(size, isOpaque));
52 } 52 }
53 53
54 explicit TestImage(const IntSize& size, bool isOpaque) 54 explicit TestImage(const IntSize& size, bool isOpaque)
55 : Image(0) 55 : Image(0)
56 , m_size(size) 56 , m_size(size)
57 { 57 {
58 SkBitmap bitmap; 58 SkBitmap bitmap;
59 EXPECT_TRUE(bitmap.allocN32Pixels(size.width(), size.height(), isOpaque) ); 59 bitmap.allocN32Pixels(size.width(), size.height(), isOpaque);
60 m_nativeImage = NativeImageSkia::create(bitmap); 60 m_nativeImage = NativeImageSkia::create(bitmap);
61 } 61 }
62 62
63 virtual bool isBitmapImage() const OVERRIDE 63 virtual bool isBitmapImage() const OVERRIDE
64 { 64 {
65 return true; 65 return true;
66 } 66 }
67 67
68 virtual bool currentFrameKnownToBeOpaque() OVERRIDE 68 virtual bool currentFrameKnownToBeOpaque() OVERRIDE
69 { 69 {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 ASSERT_FALSE(graphicsLayer->contentsLayer()); 142 ASSERT_FALSE(graphicsLayer->contentsLayer());
143 143
144 graphicsLayer->setContentsToImage(opaqueImage.get()); 144 graphicsLayer->setContentsToImage(opaqueImage.get());
145 ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque()); 145 ASSERT_TRUE(graphicsLayer->contentsLayer()->opaque());
146 146
147 graphicsLayer->setContentsToImage(nonOpaqueImage.get()); 147 graphicsLayer->setContentsToImage(nonOpaqueImage.get());
148 ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque()); 148 ASSERT_FALSE(graphicsLayer->contentsLayer()->opaque());
149 } 149 }
150 150
151 } // namespace 151 } // namespace
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsContextTest.cpp ('k') | Source/platform/graphics/gpu/DrawingBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698