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