| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 // This test only works with the GPU backend. | 8 // This test only works with the GPU backend. |
| 9 | 9 |
| 10 #include "gm.h" | 10 #include "gm.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 // fill lower right | 63 // fill lower right |
| 64 offset = S * stride + S; | 64 offset = S * stride + S; |
| 65 for (int y = 0; y < S; ++y) { | 65 for (int y = 0; y < S; ++y) { |
| 66 for (int x = 0; x < S; ++x) { | 66 for (int x = 0; x < S; ++x) { |
| 67 gTextureData[offset + y * stride + x] = gray; | 67 gTextureData[offset + y * stride + x] = gray; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 GrSurfaceDesc desc; | 71 GrSurfaceDesc desc; |
| 72 // use RT flag bit because in GL it makes the texture be bottom-up | 72 desc.fOrigin = i ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; |
| 73 desc.fFlags = i ? kRenderTarget_GrSurfaceFlag : | |
| 74 kNone_GrSurfaceFlags; | |
| 75 desc.fConfig = kSkia8888_GrPixelConfig; | 73 desc.fConfig = kSkia8888_GrPixelConfig; |
| 76 desc.fWidth = 2 * S; | 74 desc.fWidth = 2 * S; |
| 77 desc.fHeight = 2 * S; | 75 desc.fHeight = 2 * S; |
| 78 GrTexture* texture = context->textureProvider()->createTexture( | 76 GrTexture* texture = context->textureProvider()->createTexture( |
| 79 desc, SkBudgeted::kNo, gTextureData.get(), 0); | 77 desc, SkBudgeted::kNo, gTextureData.get(), 0); |
| 80 | 78 |
| 81 if (!texture) { | 79 if (!texture) { |
| 82 return; | 80 return; |
| 83 } | 81 } |
| 84 SkAutoTUnref<GrTexture> au(texture); | 82 SkAutoTUnref<GrTexture> au(texture); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 114 } | 112 } |
| 115 } | 113 } |
| 116 texture->writePixels(S, (i ? 0 : S), S, S, | 114 texture->writePixels(S, (i ? 0 : S), S, S, |
| 117 texture->config(), gTextureData.get(), | 115 texture->config(), gTextureData.get(), |
| 118 4 * stride); | 116 4 * stride); |
| 119 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); | 117 drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S)); |
| 120 } | 118 } |
| 121 } | 119 } |
| 122 #endif | 120 #endif |
| 123 | 121 |
| OLD | NEW |