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

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

Issue 2164363002: Add SkColorSpace to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove ':' from comment Created 4 years, 5 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/GrTextureToYUVPlanes.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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } else { 106 } else {
107 yuvTextures[i].reset(ctx->textureProvider()->createApproxTexture(yuv Desc)); 107 yuvTextures[i].reset(ctx->textureProvider()->createApproxTexture(yuv Desc));
108 } 108 }
109 if (!yuvTextures[i] || 109 if (!yuvTextures[i] ||
110 !yuvTextures[i]->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight, yuvDesc.fConfig, 110 !yuvTextures[i]->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight, yuvDesc.fConfig,
111 planes[i], yuvInfo.fSizeInfo.fWidthByte s[i])) { 111 planes[i], yuvInfo.fSizeInfo.fWidthByte s[i])) {
112 return nullptr; 112 return nullptr;
113 } 113 }
114 } 114 }
115 115
116 // We never want to perform color-space conversion during the decode
116 sk_sp<GrDrawContext> drawContext(ctx->newDrawContext(SkBackingFit::kExact, 117 sk_sp<GrDrawContext> drawContext(ctx->newDrawContext(SkBackingFit::kExact,
117 desc.fWidth, desc.fHeig ht, 118 desc.fWidth, desc.fHeig ht,
118 desc.fConfig, desc.fSam pleCnt)); 119 desc.fConfig, nullptr,
120 desc.fSampleCnt));
119 if (!drawContext) { 121 if (!drawContext) {
120 return nullptr; 122 return nullptr;
121 } 123 }
122 124
123 GrPaint paint; 125 GrPaint paint;
124 sk_sp<GrFragmentProcessor> yuvToRgbProcessor( 126 sk_sp<GrFragmentProcessor> yuvToRgbProcessor(
125 GrYUVEffect::MakeYUVToRGB(yuvTextures[0], yuvTextures[1], yuvTextures[2] , 127 GrYUVEffect::MakeYUVToRGB(yuvTextures[0], yuvTextures[1], yuvTextures[2] ,
126 yuvInfo.fSizeInfo.fSizes, yuvInfo.fColorSpace, false)); 128 yuvInfo.fSizeInfo.fSizes, yuvInfo.fColorSpace, false));
127 paint.addColorFragmentProcessor(std::move(yuvToRgbProcessor)); 129 paint.addColorFragmentProcessor(std::move(yuvToRgbProcessor));
128 130
(...skipping 12 matching lines...) Expand all
141 } 143 }
142 144
143 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 145 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
144 const SkRect r = SkRect::MakeIWH(yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY] .fWidth, 146 const SkRect r = SkRect::MakeIWH(yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY] .fWidth,
145 yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fHeight); 147 yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fHeight);
146 148
147 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), r); 149 drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), r);
148 150
149 return drawContext->asTexture(); 151 return drawContext->asTexture();
150 } 152 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextureToYUVPlanes.cpp ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698