OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |