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

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: rename 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
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
robertphillips 2016/01/29 20:33:13 overlength ?
bsalomon 2016/02/01 20:27:45 Done.
267 bool SkImage::readYUV8Planes(const SkISize sizes[3], void* const planes[3], cons t size_t rowBytes[3],
268 SkYUVColorSpace colorSpace) {
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 SkRGBAToYUV(this, sizes, planes, rowBytes, colorSpace);
277 return true;
278 }
279
261 //////////////////////////////////////////////////////////////////////////////// /////////////////// 280 //////////////////////////////////////////////////////////////////////////////// ///////////////////
262 281
263 SkImage* SkImage::NewFromBitmap(const SkBitmap& bm) { 282 SkImage* SkImage::NewFromBitmap(const SkBitmap& bm) {
264 SkPixelRef* pr = bm.pixelRef(); 283 SkPixelRef* pr = bm.pixelRef();
265 if (nullptr == pr) { 284 if (nullptr == pr) {
266 return nullptr; 285 return nullptr;
267 } 286 }
268 287
269 #if SK_SUPPORT_GPU 288 #if SK_SUPPORT_GPU
270 if (GrTexture* tex = pr->getTexture()) { 289 if (GrTexture* tex = pr->getTexture()) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 352
334 SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType) { 353 SkImage* SkImage::NewFromAdoptedTexture(GrContext*, const GrBackendTextureDesc&, SkAlphaType) {
335 return nullptr; 354 return nullptr;
336 } 355 }
337 356
338 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) { 357 SkImage* SkImage::NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, Sk AlphaType) {
339 return nullptr; 358 return nullptr;
340 } 359 }
341 360
342 #endif 361 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698