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

Side by Side Diff: src/image/SkImage_Gpu.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/image/SkImage.cpp ('k') | src/utils/SkRGBAToYUV.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 2012 Google Inc. 2 * Copyright 2012 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 "GrCaps.h" 8 #include "GrCaps.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
11 #include "GrImageIDTextureAdjuster.h" 11 #include "GrImageIDTextureAdjuster.h"
12 #include "effects/GrYUVtoRGBEffect.h" 12 #include "effects/GrYUVEffect.h"
13 #include "SkCanvas.h" 13 #include "SkCanvas.h"
14 #include "SkBitmapCache.h" 14 #include "SkBitmapCache.h"
15 #include "SkGpuDevice.h" 15 #include "SkGpuDevice.h"
16 #include "SkGrPixelRef.h" 16 #include "SkGrPixelRef.h"
17 #include "SkGrPriv.h" 17 #include "SkGrPriv.h"
18 #include "SkImageFilter.h" 18 #include "SkImageFilter.h"
19 #include "SkImage_Gpu.h" 19 #include "SkImage_Gpu.h"
20 #include "SkPixelRef.h" 20 #include "SkPixelRef.h"
21 21
22 SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrText ure* tex, 22 SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrText ure* tex,
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 dstDesc.fConfig = kRGBA_8888_GrPixelConfig; 259 dstDesc.fConfig = kRGBA_8888_GrPixelConfig;
260 dstDesc.fSampleCnt = 0; 260 dstDesc.fSampleCnt = 0;
261 261
262 SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->createTexture(dstDesc, t rue)); 262 SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->createTexture(dstDesc, t rue));
263 if (!dst) { 263 if (!dst) {
264 return nullptr; 264 return nullptr;
265 } 265 }
266 266
267 GrPaint paint; 267 GrPaint paint;
268 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); 268 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
269 paint.addColorFragmentProcessor(GrYUVtoRGBEffect::Create(yTex, uTex, vTex, y uvSizes, 269 paint.addColorFragmentProcessor(GrYUVEffect::CreateYUVToRGB(yTex, uTex, vTex , yuvSizes,
270 colorSpace))->unref (); 270 colorSpace))->un ref();
271 271
272 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), 272 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth),
273 SkIntToScalar(dstDesc.fHeight)); 273 SkIntToScalar(dstDesc.fHeight));
274 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(dst->asRenderTarget ())); 274 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext(dst->asRenderTarget ()));
275 if (!drawContext) { 275 if (!drawContext) {
276 return nullptr; 276 return nullptr;
277 } 277 }
278 278
279 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect); 279 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect);
280 ctx->flushSurfaceWrites(dst); 280 ctx->flushSurfaceWrites(dst);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 if (!dst) { 323 if (!dst) {
324 return nullptr; 324 return nullptr;
325 } 325 }
326 326
327 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); 327 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
328 const SkIPoint dstP = SkIPoint::Make(0, 0); 328 const SkIPoint dstP = SkIPoint::Make(0, 0);
329 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); 329 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp);
330 return dst; 330 return dst;
331 } 331 }
332 332
OLDNEW
« no previous file with comments | « src/image/SkImage.cpp ('k') | src/utils/SkRGBAToYUV.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698