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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 return; | 113 return; |
114 } | 114 } |
115 | 115 |
116 GrBackendObject textureHandle = dummySurface->asTexture()->getTextureHandle(
); | 116 GrBackendObject textureHandle = dummySurface->asTexture()->getTextureHandle(
); |
117 | 117 |
118 GrBackendTextureDesc wrappedDesc; | 118 GrBackendTextureDesc wrappedDesc; |
119 wrappedDesc.fConfig = dummySurface->config(); | 119 wrappedDesc.fConfig = dummySurface->config(); |
120 wrappedDesc.fWidth = dummySurface->width(); | 120 wrappedDesc.fWidth = dummySurface->width(); |
121 wrappedDesc.fHeight = dummySurface->height(); | 121 wrappedDesc.fHeight = dummySurface->height(); |
122 wrappedDesc.fOrigin = dummySurface->origin(); | 122 wrappedDesc.fOrigin = dummySurface->origin(); |
123 wrappedDesc.fSampleCnt = dummySurface->asRenderTarget()->numSamples(); | 123 wrappedDesc.fSampleCnt = dummySurface->asRenderTarget()->numColorSamples(); |
124 wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag; | 124 wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag; |
125 wrappedDesc.fTextureHandle = textureHandle; | 125 wrappedDesc.fTextureHandle = textureHandle; |
126 | 126 |
127 SkAutoTUnref<SkSurface> surface(SkSurface::NewWrappedRenderTarget(ctx, wrapp
edDesc, NULL)); | 127 SkAutoTUnref<SkSurface> surface(SkSurface::NewWrappedRenderTarget(ctx, wrapp
edDesc, NULL)); |
128 REPORTER_ASSERT(reporter, surface); | 128 REPORTER_ASSERT(reporter, surface); |
129 } | 129 } |
130 #endif | 130 #endif |
131 | 131 |
132 | 132 |
133 static void test_image(skiatest::Reporter* reporter) { | 133 static void test_image(skiatest::Reporter* reporter) { |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // Now lets jam new colors into our "external" texture, and see if the image
s notice | 736 // Now lets jam new colors into our "external" texture, and see if the image
s notice |
737 const SkPMColor expected1 = SkPreMultiplyColor(SK_ColorBLUE); | 737 const SkPMColor expected1 = SkPreMultiplyColor(SK_ColorBLUE); |
738 sk_memset32(storage, expected1, w * h); | 738 sk_memset32(storage, expected1, w * h); |
739 tex->writePixels(0, 0, w, h, kSkia8888_GrPixelConfig, storage, GrContext::kF
lushWrites_PixelOp); | 739 tex->writePixels(0, 0, w, h, kSkia8888_GrPixelConfig, storage, GrContext::kF
lushWrites_PixelOp); |
740 | 740 |
741 // We expect the ref'd image to see the new color, but cpy'd one should stil
l see the old color | 741 // We expect the ref'd image to see the new color, but cpy'd one should stil
l see the old color |
742 test_image_color(reporter, refImg, expected1); | 742 test_image_color(reporter, refImg, expected1); |
743 test_image_color(reporter, cpyImg, expected0); | 743 test_image_color(reporter, cpyImg, expected0); |
744 } | 744 } |
745 #endif | 745 #endif |
OLD | NEW |