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

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

Issue 1513393002: Add ability to extract YUV planes from SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: gm cleanup 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 | « src/gpu/GrTextureToYUVPlanes.cpp ('k') | src/gpu/SkGr.cpp » ('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"
11 #include "effects/GrYUVtoRGBEffect.h" 11 #include "effects/GrYUVEffect.h"
12 12
13 #include "SkCachedData.h" 13 #include "SkCachedData.h"
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 #include "SkResourceCache.h" 15 #include "SkResourceCache.h"
16 #include "SkYUVPlanesCache.h" 16 #include "SkYUVPlanesCache.h"
17 17
18 namespace { 18 namespace {
19 /** 19 /**
20 * Helper class to manage the resources used for storing the YUV planar data. D epending on the 20 * Helper class to manage the resources used for storing the YUV planar data. D epending on the
21 * useCache option, we may find (and lock) the data in our ResourceCache, or we may have allocated 21 * useCache option, we may find (and lock) the data in our ResourceCache, or we may have allocated
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 SkAutoTUnref<GrTexture> result(ctx->textureProvider()->createTexture(rtDesc, true, nullptr, 0)); 115 SkAutoTUnref<GrTexture> result(ctx->textureProvider()->createTexture(rtDesc, true, nullptr, 0));
116 if (!result) { 116 if (!result) {
117 return nullptr; 117 return nullptr;
118 } 118 }
119 119
120 GrRenderTarget* renderTarget = result->asRenderTarget(); 120 GrRenderTarget* renderTarget = result->asRenderTarget();
121 SkASSERT(renderTarget); 121 SkASSERT(renderTarget);
122 122
123 GrPaint paint; 123 GrPaint paint;
124 SkAutoTUnref<GrFragmentProcessor> yuvToRgbProcessor( 124 SkAutoTUnref<const GrFragmentProcessor> yuvToRgbProcessor(
125 GrYUVtoRGBEffect::Create(yuvTextures[0], 125 GrYUVEffect::CreateYUVToRGB(yuvTextures[ 0],
126 yuvTextures[1], 126 yuvTextures[ 1],
127 yuvTextures[2], 127 yuvTextures[ 2],
128 yuvInfo.fSize, 128 yuvInfo.fSiz e,
129 yuvInfo.fColorS pace)); 129 yuvInfo.fCol orSpace));
130 paint.addColorFragmentProcessor(yuvToRgbProcessor); 130 paint.addColorFragmentProcessor(yuvToRgbProcessor);
131 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 131 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
132 const SkRect r = SkRect::MakeIWH(yuvInfo.fSize[0].fWidth, yuvInfo.fSize[0].f Height); 132 const SkRect r = SkRect::MakeIWH(yuvInfo.fSize[0].fWidth, yuvInfo.fSize[0].f Height);
133 133
134 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(renderTarget)); 134 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(renderTarget));
135 if (!drawContext) { 135 if (!drawContext) {
136 return nullptr; 136 return nullptr;
137 } 137 }
138 138
139 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), r); 139 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), r);
140 140
141 return result.detach(); 141 return result.detach();
142 } 142 }
143 143
OLDNEW
« no previous file with comments | « src/gpu/GrTextureToYUVPlanes.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698