OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 | 8 |
9 // This test is specific to the GPU backend. | 9 // This test is specific to the GPU backend. |
10 #if SK_SUPPORT_GPU && !defined(SK_BUILD_FOR_ANDROID) | 10 #if SK_SUPPORT_GPU && !defined(SK_BUILD_FOR_ANDROID) |
(...skipping 28 matching lines...) Expand all Loading... |
39 desc.fConfig = kAlpha_8_GrPixelConfig; | 39 desc.fConfig = kAlpha_8_GrPixelConfig; |
40 desc.fWidth = X_SIZE; | 40 desc.fWidth = X_SIZE; |
41 desc.fHeight = Y_SIZE; | 41 desc.fHeight = Y_SIZE; |
42 | 42 |
43 // We are initializing the texture with zeros here | 43 // We are initializing the texture with zeros here |
44 GrTexture* texture = context->createUncachedTexture(desc, textureData, 0
); | 44 GrTexture* texture = context->createUncachedTexture(desc, textureData, 0
); |
45 if (!texture) { | 45 if (!texture) { |
46 return; | 46 return; |
47 } | 47 } |
48 | 48 |
49 GrAutoUnref au(texture); | 49 SkAutoUnref au(texture); |
50 | 50 |
51 // create a distinctive texture | 51 // create a distinctive texture |
52 for (int y = 0; y < Y_SIZE; ++y) { | 52 for (int y = 0; y < Y_SIZE; ++y) { |
53 for (int x = 0; x < X_SIZE; ++x) { | 53 for (int x = 0; x < X_SIZE; ++x) { |
54 textureData[x][y] = x*Y_SIZE+y; | 54 textureData[x][y] = x*Y_SIZE+y; |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 // upload the texture | 58 // upload the texture |
59 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, | 59 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 REPORTER_ASSERT(reporter, match); | 109 REPORTER_ASSERT(reporter, match); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 #include "TestClassDef.h" | 113 #include "TestClassDef.h" |
114 DEFINE_GPUTESTCLASS("ReadWriteAlpha", ReadWriteAlphaTestClass, ReadWriteAlphaTes
t) | 114 DEFINE_GPUTESTCLASS("ReadWriteAlpha", ReadWriteAlphaTestClass, ReadWriteAlphaTes
t) |
115 | 115 |
116 #endif | 116 #endif |
OLD | NEW |