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(); |
955 desc.fOrigin = kDefault_GrSurfaceOrigin; | 956 desc.fOrigin = kDefault_GrSurfaceOrigin; |
956 desc.fWidth = w; | 957 desc.fWidth = w; |
957 desc.fHeight = h; | 958 desc.fHeight = h; |
958 desc.fConfig = kSkia8888_GrPixelConfig; | 959 desc.fConfig = kSkia8888_GrPixelConfig; |
959 desc.fSampleCnt = 0; | 960 desc.fSampleCnt = 0; |
960 | 961 |
961 SkAutoTUnref<GrTexture> tex(provider->createTexture(desc, false, storage, w
* 4)); | 962 SkAutoTUnref<GrTexture> tex(provider->createTexture(desc, false, storage, w
* 4)); |
962 if (!tex) { | 963 if (!tex) { |
963 REPORTER_ASSERT(reporter, false); | 964 REPORTER_ASSERT(reporter, false); |
964 return; | 965 return; |
(...skipping 16 matching lines...) Expand all Loading... |
981 // We expect the ref'd image to see the new color, but cpy'd one should stil
l see the old color | 982 // We expect the ref'd image to see the new color, but cpy'd one should stil
l see the old color |
982 test_image_color(reporter, refImg, expected1); | 983 test_image_color(reporter, refImg, expected1); |
983 test_image_color(reporter, cpyImg, expected0); | 984 test_image_color(reporter, cpyImg, expected0); |
984 | 985 |
985 // Now exercise the release proc | 986 // Now exercise the release proc |
986 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); | 987 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); |
987 refImg.reset(NULL); // force a release of the image | 988 refImg.reset(NULL); // force a release of the image |
988 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); | 989 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); |
989 } | 990 } |
990 #endif | 991 #endif |
OLD | NEW |