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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromBitmap(subset, bm)); | 72 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromBitmap(subset, bm)); |
73 | 73 |
74 test_surface(surf, reporter, kPad); | 74 test_surface(surf, reporter, kPad); |
75 | 75 |
76 // TODO: check that the clear didn't escape the active region | 76 // TODO: check that the clear didn't escape the active region |
77 } | 77 } |
78 | 78 |
79 #if SK_SUPPORT_GPU | 79 #if SK_SUPPORT_GPU |
80 | 80 |
81 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) { | 81 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) { |
82 GrSurfaceDesc desc; | 82 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.fGrC
ontext, |
83 desc.fConfig = kSkia8888_GrPixelConfig; | 83 kSmallerSize
, kSmallerSize, |
84 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 84 kSkia8888_Gr
PixelConfig)); |
85 desc.fWidth = kSmallerSize; | |
86 desc.fHeight = kSmallerSize; | |
87 | |
88 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.fGrC
ontext, desc)); | |
89 | 85 |
90 test_surface(surf, reporter, 0); | 86 test_surface(surf, reporter, 0); |
91 } | 87 } |
92 | 88 |
93 // test the more flexible factory | |
94 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialSurface_Gpu2, reporter, ctxInfo) { | |
95 GrSurfaceDesc desc; | |
96 desc.fConfig = kSkia8888_GrPixelConfig; | |
97 desc.fFlags = kRenderTarget_GrSurfaceFlag; | |
98 desc.fWidth = kFullSize; | |
99 desc.fHeight = kFullSize; | |
100 | |
101 sk_sp<GrTexture> temp(ctxInfo.fGrContext->textureProvider()->createApproxTex
ture(desc)); | |
102 SkASSERT_RELEASE(temp); | |
103 | |
104 const SkIRect subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerS
ize); | |
105 | |
106 sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeFromTexture(subset, std::
move(temp))); | |
107 | |
108 test_surface(surf, reporter, kPad); | |
109 | |
110 // TODO: check that the clear didn't escape the active region | |
111 } | |
112 | |
113 #endif | 89 #endif |
OLD | NEW |