| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkData.h" | 9 #include "SkData.h" |
| 10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 } | 945 } |
| 946 GrTextureProvider* provider = ctx->textureProvider(); | 946 GrTextureProvider* provider = ctx->textureProvider(); |
| 947 | 947 |
| 948 const int w = 10; | 948 const int w = 10; |
| 949 const int h = 10; | 949 const int h = 10; |
| 950 SkPMColor storage[w * h]; | 950 SkPMColor storage[w * h]; |
| 951 const SkPMColor expected0 = SkPreMultiplyColor(SK_ColorRED); | 951 const SkPMColor expected0 = SkPreMultiplyColor(SK_ColorRED); |
| 952 sk_memset32(storage, expected0, w * h); | 952 sk_memset32(storage, expected0, w * h); |
| 953 | 953 |
| 954 GrSurfaceDesc desc; | 954 GrSurfaceDesc desc; |
| 955 desc.fFlags = kRenderTarget_GrSurfaceFlag; // needs to be a rendertarget fo
r readpixels(); | |
| 956 desc.fOrigin = kDefault_GrSurfaceOrigin; | 955 desc.fOrigin = kDefault_GrSurfaceOrigin; |
| 957 desc.fWidth = w; | 956 desc.fWidth = w; |
| 958 desc.fHeight = h; | 957 desc.fHeight = h; |
| 959 desc.fConfig = kSkia8888_GrPixelConfig; | 958 desc.fConfig = kSkia8888_GrPixelConfig; |
| 960 desc.fSampleCnt = 0; | 959 desc.fSampleCnt = 0; |
| 961 | 960 |
| 962 SkAutoTUnref<GrTexture> tex(provider->createTexture(desc, false, storage, w
* 4)); | 961 SkAutoTUnref<GrTexture> tex(provider->createTexture(desc, false, storage, w
* 4)); |
| 963 if (!tex) { | 962 if (!tex) { |
| 964 REPORTER_ASSERT(reporter, false); | 963 REPORTER_ASSERT(reporter, false); |
| 965 return; | 964 return; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 982 // We expect the ref'd image to see the new color, but cpy'd one should stil
l see the old color | 981 // We expect the ref'd image to see the new color, but cpy'd one should stil
l see the old color |
| 983 test_image_color(reporter, refImg, expected1); | 982 test_image_color(reporter, refImg, expected1); |
| 984 test_image_color(reporter, cpyImg, expected0); | 983 test_image_color(reporter, cpyImg, expected0); |
| 985 | 984 |
| 986 // Now exercise the release proc | 985 // Now exercise the release proc |
| 987 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); | 986 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); |
| 988 refImg.reset(NULL); // force a release of the image | 987 refImg.reset(NULL); // force a release of the image |
| 989 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); | 988 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); |
| 990 } | 989 } |
| 991 #endif | 990 #endif |
| OLD | NEW |