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