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

Side by Side Diff: src/gpu/GrYUVProvider.cpp

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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 | « src/gpu/GrXferProcessor.cpp ('k') | src/gpu/SkGpuDevice.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "GrContext.h" 8 #include "GrContext.h"
9 #include "GrDrawContext.h" 9 #include "GrDrawContext.h"
10 #include "GrYUVProvider.h" 10 #include "GrYUVProvider.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 yuvDesc.fHeight = yuvInfo.fSize[i].fHeight; 96 yuvDesc.fHeight = yuvInfo.fSize[i].fHeight;
97 // TODO: why do we need this check? 97 // TODO: why do we need this check?
98 bool needsExactTexture = (yuvDesc.fWidth != yuvInfo.fSize[0].fWidth) || 98 bool needsExactTexture = (yuvDesc.fWidth != yuvInfo.fSize[0].fWidth) ||
99 (yuvDesc.fHeight != yuvInfo.fSize[0].fHeight); 99 (yuvDesc.fHeight != yuvInfo.fSize[0].fHeight);
100 if (needsExactTexture) { 100 if (needsExactTexture) {
101 yuvTextures[i].reset(ctx->textureProvider()->createTexture(yuvDesc, true)); 101 yuvTextures[i].reset(ctx->textureProvider()->createTexture(yuvDesc, true));
102 } else { 102 } else {
103 yuvTextures[i].reset(ctx->textureProvider()->createApproxTexture(yuv Desc)); 103 yuvTextures[i].reset(ctx->textureProvider()->createApproxTexture(yuv Desc));
104 } 104 }
105 if (!yuvTextures[i] || 105 if (!yuvTextures[i] ||
106 !yuvTextures[i]->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight, 106 !yuvTextures[i]->writePixels(NULL, 0, 0, yuvDesc.fWidth, yuvDesc.fHe ight,
107 yuvDesc.fConfig, planes[i], yuvInfo.fRo wBytes[i])) { 107 yuvDesc.fConfig, planes[i], yuvInfo.fRo wBytes[i])) {
108 return nullptr; 108 return nullptr;
109 } 109 }
110
111 yuvTextures[i]->setFromRawPixels(true);
112 yuvTextures[i]->setException(true);
110 } 113 }
111 114
112 GrSurfaceDesc rtDesc = desc; 115 GrSurfaceDesc rtDesc = desc;
113 rtDesc.fFlags = rtDesc.fFlags | kRenderTarget_GrSurfaceFlag; 116 rtDesc.fFlags = rtDesc.fFlags | kRenderTarget_GrSurfaceFlag;
114 117
115 SkAutoTUnref<GrTexture> result(ctx->textureProvider()->createTexture(rtDesc, true, nullptr, 0)); 118 SkAutoTUnref<GrTexture> result(ctx->textureProvider()->createTexture(rtDesc, true, nullptr, 0));
116 if (!result) { 119 if (!result) {
117 return nullptr; 120 return nullptr;
118 } 121 }
119 122
123 // We're rendering to this guy but he is actually coming from raw pixels
124 result->fException2 = true;
125
120 GrRenderTarget* renderTarget = result->asRenderTarget(); 126 GrRenderTarget* renderTarget = result->asRenderTarget();
121 SkASSERT(renderTarget); 127 SkASSERT(renderTarget);
122 128
123 GrPaint paint; 129 GrPaint paint;
124 SkAutoTUnref<GrFragmentProcessor> yuvToRgbProcessor( 130 SkAutoTUnref<GrFragmentProcessor> yuvToRgbProcessor(
125 GrYUVtoRGBEffect::Create(yuvTextures[0], 131 GrYUVtoRGBEffect::Create(yuvTextures[0],
126 yuvTextures[1], 132 yuvTextures[1],
127 yuvTextures[2], 133 yuvTextures[2],
128 yuvInfo.fSize, 134 yuvInfo.fSize,
129 yuvInfo.fColorS pace)); 135 yuvInfo.fColorS pace,
136 renderTarget));
130 paint.addColorFragmentProcessor(yuvToRgbProcessor); 137 paint.addColorFragmentProcessor(yuvToRgbProcessor);
131 const SkRect r = SkRect::MakeIWH(yuvInfo.fSize[0].fWidth, yuvInfo.fSize[0].f Height); 138 const SkRect r = SkRect::MakeIWH(yuvInfo.fSize[0].fWidth, yuvInfo.fSize[0].f Height);
132 139
133 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(renderTarget)); 140 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(renderTarget));
134 if (!drawContext) { 141 if (!drawContext) {
135 return nullptr; 142 return nullptr;
136 } 143 }
137 144
138 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), r); 145 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), r);
139 146
140 return result.detach(); 147 return result.detach();
141 } 148 }
142 149
OLDNEW
« no previous file with comments | « src/gpu/GrXferProcessor.cpp ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698