OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 const size_t nbBytes = fBmp[i].rowBytes() * fBmp[i].height(); | 61 const size_t nbBytes = fBmp[i].rowBytes() * fBmp[i].height(); |
62 for (size_t j = 0; j < nbBytes; ++j) { | 62 for (size_t j = 0; j < nbBytes; ++j) { |
63 pixels[i][j] = (unsigned char)color[i]; | 63 pixels[i][j] = (unsigned char)color[i]; |
64 color[i] = (color[i] == limit[i]) ? invl[i] : color[i] + inc[i]; | 64 color[i] = (color[i] == limit[i]) ? invl[i] : color[i] + inc[i]; |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 void onDraw(SkCanvas* canvas) override { | 69 void onDraw(SkCanvas* canvas) override { |
70 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 70 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
71 if (NULL == rt) { | 71 if (nullptr == rt) { |
72 return; | 72 return; |
73 } | 73 } |
74 GrContext* context = rt->getContext(); | 74 GrContext* context = rt->getContext(); |
75 if (NULL == context) { | 75 if (nullptr == context) { |
76 this->drawGpuOnlyMessage(canvas); | 76 this->drawGpuOnlyMessage(canvas); |
77 return; | 77 return; |
78 } | 78 } |
79 | 79 |
80 GrTestTarget tt; | 80 GrTestTarget tt; |
81 context->getTestTarget(&tt); | 81 context->getTestTarget(&tt); |
82 if (NULL == tt.target()) { | 82 if (nullptr == tt.target()) { |
83 SkDEBUGFAIL("Couldn't get Gr test target."); | 83 SkDEBUGFAIL("Couldn't get Gr test target."); |
84 return; | 84 return; |
85 } | 85 } |
86 | 86 |
87 SkAutoTUnref<GrTexture> texture[3]; | 87 SkAutoTUnref<GrTexture> texture[3]; |
88 texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0], NULL)); | 88 texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0], nullptr)); |
89 texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], NULL)); | 89 texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], nullptr)); |
90 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], NULL)); | 90 texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], nullptr)); |
91 | 91 |
92 if (!texture[0] || !texture[1] || !texture[2]) { | 92 if (!texture[0] || !texture[1] || !texture[2]) { |
93 return; | 93 return; |
94 } | 94 } |
95 | 95 |
96 static const SkScalar kDrawPad = 10.f; | 96 static const SkScalar kDrawPad = 10.f; |
97 static const SkScalar kTestPad = 10.f; | 97 static const SkScalar kTestPad = 10.f; |
98 static const SkScalar kColorSpaceOffset = 36.f; | 98 static const SkScalar kColorSpaceOffset = 36.f; |
99 SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}}; | 99 SkISize sizes[3] = {{YSIZE, YSIZE}, {USIZE, USIZE}, {VSIZE, VSIZE}}; |
100 | 100 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 private: | 137 private: |
138 SkBitmap fBmp[3]; | 138 SkBitmap fBmp[3]; |
139 | 139 |
140 typedef GM INHERITED; | 140 typedef GM INHERITED; |
141 }; | 141 }; |
142 | 142 |
143 DEF_GM(return new YUVtoRGBEffect;) | 143 DEF_GM(return new YUVtoRGBEffect;) |
144 } | 144 } |
145 | 145 |
146 #endif | 146 #endif |
OLD | NEW |