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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return; | 110 return; |
111 } | 111 } |
112 | 112 |
113 // Test the wrapped factory for SkSurface by creating a backend texture and
then wrap it in | 113 // Test the wrapped factory for SkSurface by creating a backend texture and
then wrap it in |
114 // a SkSurface. | 114 // a SkSurface. |
115 static const int kW = 100; | 115 static const int kW = 100; |
116 static const int kH = 100; | 116 static const int kH = 100; |
117 static const uint32_t kOrigColor = 0xFFAABBCC; | 117 static const uint32_t kOrigColor = 0xFFAABBCC; |
118 SkAutoTArray<uint32_t> pixels(kW * kH); | 118 SkAutoTArray<uint32_t> pixels(kW * kH); |
119 sk_memset32(pixels.get(), kOrigColor, kW * kH); | 119 sk_memset32(pixels.get(), kOrigColor, kW * kH); |
120 GrBackendObject texID = gpu->createBackendTexture(pixels.get(), kW, kH, | 120 GrBackendObject texID = gpu->createTestingOnlyBackendTexture(pixels.get(), k
W, kH, |
121 kRGBA_8888_GrPixelConfig); | 121 kRGBA_8888_GrPi
xelConfig); |
122 | 122 |
123 GrBackendTextureDesc wrappedDesc; | 123 GrBackendTextureDesc wrappedDesc; |
124 wrappedDesc.fConfig = kRGBA_8888_GrPixelConfig; | 124 wrappedDesc.fConfig = kRGBA_8888_GrPixelConfig; |
125 wrappedDesc.fWidth = kW; | 125 wrappedDesc.fWidth = kW; |
126 wrappedDesc.fHeight = kH; | 126 wrappedDesc.fHeight = kH; |
127 wrappedDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; | 127 wrappedDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; |
128 wrappedDesc.fSampleCnt = 0; | 128 wrappedDesc.fSampleCnt = 0; |
129 wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag; | 129 wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag; |
130 wrappedDesc.fTextureHandle = texID; | 130 wrappedDesc.fTextureHandle = texID; |
131 | 131 |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 // 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 |
983 test_image_color(reporter, refImg, expected1); | 983 test_image_color(reporter, refImg, expected1); |
984 test_image_color(reporter, cpyImg, expected0); | 984 test_image_color(reporter, cpyImg, expected0); |
985 | 985 |
986 // Now exercise the release proc | 986 // Now exercise the release proc |
987 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); | 987 REPORTER_ASSERT(reporter, !releaseCtx.fIsReleased); |
988 refImg.reset(NULL); // force a release of the image | 988 refImg.reset(NULL); // force a release of the image |
989 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); | 989 REPORTER_ASSERT(reporter, releaseCtx.fIsReleased); |
990 } | 990 } |
991 #endif | 991 #endif |
OLD | NEW |