OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 is a GPU-backend specific test. It relies on static intializers to work | 9 // This is a GPU-backend specific test. It relies on static intializers to work |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 GrSurfaceDesc surfDesc; | 76 GrSurfaceDesc surfDesc; |
77 surfDesc.fFlags = renderTarget ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfa
ceFlags; | 77 surfDesc.fFlags = renderTarget ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfa
ceFlags; |
78 if (linearTiling) { | 78 if (linearTiling) { |
79 surfDesc.fFlags |= kZeroCopy_GrSurfaceFlag; | 79 surfDesc.fFlags |= kZeroCopy_GrSurfaceFlag; |
80 } | 80 } |
81 surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin; | 81 surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin; |
82 surfDesc.fWidth = kWidth; | 82 surfDesc.fWidth = kWidth; |
83 surfDesc.fHeight = kHeight; | 83 surfDesc.fHeight = kHeight; |
84 surfDesc.fConfig = config; | 84 surfDesc.fConfig = config; |
85 surfDesc.fSampleCnt = 0; | 85 surfDesc.fSampleCnt = 0; |
86 GrTexture* tex0 = gpu->createTexture(surfDesc, false, srcBuffer, 0); | 86 GrTexture* tex0 = gpu->createTexture(surfDesc, SkBudgeted::kNo, srcBuffer, 0
); |
87 if (tex0) { | 87 if (tex0) { |
88 REPORTER_ASSERT(reporter, canCreate); | 88 REPORTER_ASSERT(reporter, canCreate); |
89 gpu->readPixels(tex0, 0, 0, kWidth, kHeight, config, dstBuffer, 0); | 89 gpu->readPixels(tex0, 0, 0, kWidth, kHeight, config, dstBuffer, 0); |
90 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(srcBuff
er, | 90 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(srcBuff
er, |
91 dstBuff
er, | 91 dstBuff
er, |
92 config, | 92 config, |
93 kWidth, | 93 kWidth, |
94 kHeight
)); | 94 kHeight
)); |
95 | 95 |
96 tex0->writePixels(2, 10, 10, 2, config, srcBuffer); | 96 tex0->writePixels(2, 10, 10, 2, config, srcBuffer); |
97 memset(dstBuffer, 0, kWidth*kHeight*sizeof(GrColor)); | 97 memset(dstBuffer, 0, kWidth*kHeight*sizeof(GrColor)); |
98 gpu->readPixels(tex0, 2, 10, 10, 2, config, dstBuffer, 0); | 98 gpu->readPixels(tex0, 2, 10, 10, 2, config, dstBuffer, 0); |
99 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(srcBuff
er, | 99 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(srcBuff
er, |
100 dstBuff
er, | 100 dstBuff
er, |
101 config, | 101 config, |
102 10, | 102 10, |
103 2)); | 103 2)); |
104 | 104 |
105 tex0->unref(); | 105 tex0->unref(); |
106 } else { | 106 } else { |
107 REPORTER_ASSERT(reporter, !canCreate); | 107 REPORTER_ASSERT(reporter, !canCreate); |
108 } | 108 } |
109 | 109 |
110 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 110 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
111 GrTexture* tex1 = gpu->createTexture(surfDesc, false, srcBuffer, 0); | 111 GrTexture* tex1 = gpu->createTexture(surfDesc, SkBudgeted::kNo, srcBuffer, 0
); |
112 if (tex1) { | 112 if (tex1) { |
113 REPORTER_ASSERT(reporter, canCreate); | 113 REPORTER_ASSERT(reporter, canCreate); |
114 gpu->readPixels(tex1, 0, 0, kWidth, kHeight, config, dstBuffer, 0); | 114 gpu->readPixels(tex1, 0, 0, kWidth, kHeight, config, dstBuffer, 0); |
115 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(srcBuff
er, | 115 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(srcBuff
er, |
116 dstBuff
er, | 116 dstBuff
er, |
117 config, | 117 config, |
118 kWidth, | 118 kWidth, |
119 kHeight
)); | 119 kHeight
)); |
120 | 120 |
121 tex1->writePixels(5, 4, 4, 5, config, srcBuffer); | 121 tex1->writePixels(5, 4, 4, 5, config, srcBuffer); |
(...skipping 29 matching lines...) Expand all Loading... |
151 basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, fals
e, false); | 151 basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, fals
e, false); |
152 basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, true
, false); | 152 basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, true
, false); |
153 basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, fals
e, true); | 153 basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, fals
e, true); |
154 basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, true
, true); | 154 basic_texture_test(reporter, context, kBGRA_8888_GrPixelConfig, true
, true); |
155 } | 155 } |
156 | 156 |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 #endif | 160 #endif |
OLD | NEW |