| 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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 SkAutoTUnref<SkImage> cpyImg(make_desc_image(ctx, w, h, srcTex, NULL)); | 972 SkAutoTUnref<SkImage> cpyImg(make_desc_image(ctx, w, h, srcTex, NULL)); |
| 973 | 973 |
| 974 test_image_color(reporter, refImg, expected0); | 974 test_image_color(reporter, refImg, expected0); |
| 975 test_image_color(reporter, cpyImg, expected0); | 975 test_image_color(reporter, cpyImg, expected0); |
| 976 | 976 |
| 977 // Now lets jam new colors into our "external" texture, and see if the image
s notice | 977 // Now lets jam new colors into our "external" texture, and see if the image
s notice |
| 978 const SkPMColor expected1 = SkPreMultiplyColor(SK_ColorBLUE); | 978 const SkPMColor expected1 = SkPreMultiplyColor(SK_ColorBLUE); |
| 979 sk_memset32(storage, expected1, w * h); | 979 sk_memset32(storage, expected1, w * h); |
| 980 tex->writePixels(0, 0, w, h, kSkia8888_GrPixelConfig, storage, GrContext::kF
lushWrites_PixelOp); | 980 tex->writePixels(0, 0, w, h, kSkia8888_GrPixelConfig, storage, GrContext::kF
lushWrites_PixelOp); |
| 981 | 981 |
| 982 // We expect the ref'd image to see the new color, but cpy'd one should stil
l see the old color | 982 // The cpy'd one should still see the old color |
| 983 #if 0 |
| 984 // There is no guarantee that refImg sees the new color. We are free to have
made a copy. Our |
| 985 // write pixels call violated the contract with refImg and refImg is now und
efined. |
| 983 test_image_color(reporter, refImg, expected1); | 986 test_image_color(reporter, refImg, expected1); |
| 987 #endif |
| 984 test_image_color(reporter, cpyImg, expected0); | 988 test_image_color(reporter, cpyImg, expected0); |
| 985 | 989 |
| 986 // Now exercise the release proc | 990 // Now exercise the release proc |
| 987 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); | 991 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); |
| 988 refImg.reset(NULL); // force a release of the image | 992 refImg.reset(NULL); // force a release of the image |
| 989 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); | 993 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); |
| 990 } | 994 } |
| 991 #endif | 995 #endif |
| OLD | NEW |