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

Side by Side Diff: src/image/SkImage.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/effects/GrYUVtoRGBEffect.cpp ('k') | src/image/SkImage_Gpu.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 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 return true; 252 return true;
253 } 253 }
254 return false; 254 return false;
255 } 255 }
256 256
257 bool SkImage::readPixels(const SkPixmap& pmap, int srcX, int srcY, CachingHint c hint) const { 257 bool SkImage::readPixels(const SkPixmap& pmap, int srcX, int srcY, CachingHint c hint) const {
258 return this->readPixels(pmap.info(), pmap.writable_addr(), pmap.rowBytes(), srcX, srcY, chint); 258 return this->readPixels(pmap.info(), pmap.writable_addr(), pmap.rowBytes(), srcX, srcY, chint);
259 } 259 }
260 260
261 #if SK_SUPPORT_GPU
262 #include "GrTextureToYUVPlanes.h"
263 #endif
264
265 #include "SkRGBAToYUV.h"
266
267 bool SkImage::readYUV8Planes(const SkISize sizes[3], void* const planes[3],
268 const size_t rowBytes[3], SkYUVColorSpace colorSpac e) {
269 #if SK_SUPPORT_GPU
270 if (GrTexture* texture = as_IB(this)->peekTexture()) {
271 if (GrTextureToYUVPlanes(texture, sizes, planes, rowBytes, colorSpace)) {
272 return true;
273 }
274 }
275 #endif
276 return SkRGBAToYUV(this, sizes, planes, rowBytes, colorSpace);
277 }
278
261 //////////////////////////////////////////////////////////////////////////////// /////////////////// 279 //////////////////////////////////////////////////////////////////////////////// ///////////////////
262 280
263 SkImage* SkImage::NewFromBitmap(const SkBitmap& bm) { 281 SkImage* SkImage::NewFromBitmap(const SkBitmap& bm) {
264 SkPixelRef* pr = bm.pixelRef(); 282 SkPixelRef* pr = bm.pixelRef();
265 if (nullptr == pr) { 283 if (nullptr == pr) {
266 return nullptr; 284 return nullptr;
267 } 285 }
268 286
269 #if SK_SUPPORT_GPU 287 #if SK_SUPPORT_GPU
270 if (GrTexture* tex = pr->getTexture()) { 288 if (GrTexture* tex = pr->getTexture()) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 355
338 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) { 356 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) {
339 return nullptr; 357 return nullptr;
340 } 358 }
341 359
342 SkImage* SkImage::newTextureImage(GrContext*) const { 360 SkImage* SkImage::newTextureImage(GrContext*) const {
343 return nullptr; 361 return nullptr;
344 } 362 }
345 363
346 #endif 364 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrYUVtoRGBEffect.cpp ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698