Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: gm/imagefromyuvtextures.cpp

Issue 1658823002: Remove deferred clear from SkGpuDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix ptr->bool warning on windows Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 uvPixels[0][uvIndex] = static_cast<signed char>( 87 uvPixels[0][uvIndex] = static_cast<signed char>(
88 ((-38 * rgb[0] - 74 * rgb[1] + 112 * rgb[2] + 128) >> 8) + 128); 88 ((-38 * rgb[0] - 74 * rgb[1] + 112 * rgb[2] + 128) >> 8) + 128);
89 uvPixels[1][uvIndex] = static_cast<signed char>( 89 uvPixels[1][uvIndex] = static_cast<signed char>(
90 ((112 * rgb[0] - 94 * rgb[1] - 18 * rgb[2] + 128) >> 8) + 128); 90 ((112 * rgb[0] - 94 * rgb[1] - 18 * rgb[2] + 128) >> 8) + 128);
91 } 91 }
92 } 92 }
93 fRGBImage.reset(SkImage::NewRasterCopy(rgbBmp.info(), rgbColors, rgbBmp. rowBytes())); 93 fRGBImage.reset(SkImage::NewRasterCopy(rgbBmp.info(), rgbColors, rgbBmp. rowBytes()));
94 } 94 }
95 95
96 void createYUVTextures(GrContext* context, GrBackendObject yuvHandles[3]) { 96 void createYUVTextures(GrContext* context, GrBackendObject yuvHandles[3]) {
97 const GrGpu* gpu = context->getGpu(); 97 GrGpu* gpu = context->getGpu();
98 if (!gpu) { 98 if (!gpu) {
99 return; 99 return;
100 } 100 }
101 101
102 for (int i = 0; i < 3; ++i) { 102 for (int i = 0; i < 3; ++i) {
103 SkASSERT(fYUVBmps[i].width() == SkToInt(fYUVBmps[i].rowBytes())); 103 SkASSERT(fYUVBmps[i].width() == SkToInt(fYUVBmps[i].rowBytes()));
104 yuvHandles[i] = gpu->createTestingOnlyBackendTexture(fYUVBmps[i].get Pixels(), 104 yuvHandles[i] = gpu->createTestingOnlyBackendTexture(fYUVBmps[i].get Pixels(),
105 fYUVBmps[i].wid th(), 105 fYUVBmps[i].wid th(),
106 fYUVBmps[i].hei ght(), 106 fYUVBmps[i].hei ght(),
107 kAlpha_8_GrPixe lConfig); 107 kAlpha_8_GrPixe lConfig);
108 } 108 }
109 context->resetContext(); 109 context->resetContext();
110 } 110 }
111 111
112 void deleteYUVTextures(GrContext* context, const GrBackendObject yuvHandles[ 3]) { 112 void deleteYUVTextures(GrContext* context, const GrBackendObject yuvHandles[ 3]) {
113 113
114 const GrGpu* gpu = context->getGpu(); 114 GrGpu* gpu = context->getGpu();
115 if (!gpu) { 115 if (!gpu) {
116 return; 116 return;
117 } 117 }
118 118
119 for (int i = 0; i < 3; ++i) { 119 for (int i = 0; i < 3; ++i) {
120 gpu->deleteTestingOnlyBackendTexture(yuvHandles[i]); 120 gpu->deleteTestingOnlyBackendTexture(yuvHandles[i]);
121 } 121 }
122 122
123 context->resetContext(); 123 context->resetContext();
124 } 124 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 static const int kBmpSize = 32; 167 static const int kBmpSize = 32;
168 168
169 typedef GM INHERITED; 169 typedef GM INHERITED;
170 }; 170 };
171 171
172 DEF_GM(return new ImageFromYUVTextures;) 172 DEF_GM(return new ImageFromYUVTextures;)
173 } 173 }
174 174
175 #endif 175 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698