OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkSpecialImage.h" | 9 #include "SkSpecialImage.h" |
10 #include "SkSpecialSurface.h" | 10 #include "SkSpecialSurface.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromBitmap(nullptr, subse
t, bm)); | 76 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromBitmap(nullptr, subse
t, bm)); |
77 | 77 |
78 test_surface(surf, reporter, kPad); | 78 test_surface(surf, reporter, kPad); |
79 | 79 |
80 // TODO: check that the clear didn't escape the active region | 80 // TODO: check that the clear didn't escape the active region |
81 } | 81 } |
82 | 82 |
83 #if SK_SUPPORT_GPU | 83 #if SK_SUPPORT_GPU |
84 | 84 |
85 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, context) { | 85 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) { |
86 GrSurfaceDesc desc; | 86 GrSurfaceDesc desc; |
87 desc.fConfig = kSkia8888_GrPixelConfig; | 87 desc.fConfig = kSkia8888_GrPixelConfig; |
88 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 88 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
89 desc.fWidth = kSmallerSize; | 89 desc.fWidth = kSmallerSize; |
90 desc.fHeight = kSmallerSize; | 90 desc.fHeight = kSmallerSize; |
91 | 91 |
92 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(nullptr, con
text, desc)); | 92 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(nullptr, ctx
Info.fGrContext, |
| 93 desc)); |
93 | 94 |
94 test_surface(surf, reporter, 0); | 95 test_surface(surf, reporter, 0); |
95 } | 96 } |
96 | 97 |
97 // test the more flexible factory | 98 // test the more flexible factory |
98 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu2, reporter, context) { | 99 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu2, reporter, ctxInfo) { |
99 GrSurfaceDesc desc; | 100 GrSurfaceDesc desc; |
100 desc.fConfig = kSkia8888_GrPixelConfig; | 101 desc.fConfig = kSkia8888_GrPixelConfig; |
101 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 102 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
102 desc.fWidth = kFullSize; | 103 desc.fWidth = kFullSize; |
103 desc.fHeight = kFullSize; | 104 desc.fHeight = kFullSize; |
104 | 105 |
105 SkAutoTUnref<GrTexture> temp(context->textureProvider()->createApproxTexture
(desc)); | 106 SkAutoTUnref<GrTexture> temp(ctxInfo.fGrContext->textureProvider()->createAp
proxTexture(desc)); |
106 SkASSERT_RELEASE(temp); | 107 SkASSERT_RELEASE(temp); |
107 | 108 |
108 const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerS
ize); | 109 const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerS
ize); |
109 | 110 |
110 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromTexture(nullptr, subs
et, temp)); | 111 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromTexture(nullptr, subs
et, temp)); |
111 | 112 |
112 test_surface(surf, reporter, kPad); | 113 test_surface(surf, reporter, kPad); |
113 | 114 |
114 // TODO: check that the clear didn't escape the active region | 115 // TODO: check that the clear didn't escape the active region |
115 } | 116 } |
116 | 117 |
117 #endif | 118 #endif |
OLD | NEW |