1 /* 2 * Copyright 2015 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkYUVPlanesCache_DEFINED 9 #define SkYUVPlanesCache_DEFINED 10 11 #include "include/core/SkTypes.h" 12 13 class SkCachedData; 14 class SkResourceCache; 15 class SkYUVAPixmaps; 16 17 class SkYUVPlanesCache { 18 public: 19 /** 20 * On success, return a ref to the SkCachedData that holds the pixel data. The SkYUVAPixmaps 21 * contains a description of the YUVA data and has a SkPixmap for each plane that points 22 * into the SkCachedData. 23 * 24 * On failure, return nullptr. 25 */ 26 static SkCachedData* FindAndRef(uint32_t genID, 27 SkYUVAPixmaps* pixmaps, 28 SkResourceCache* localCache = nullptr); 29 30 /** 31 * Add a pixelRef ID and its YUV planes data to the cache. The SkYUVAPixmaps should contain 32 * SkPixmaps that store their pixel data in the SkCachedData. 33 */ 34 static void Add(uint32_t genID, SkCachedData* data, const SkYUVAPixmaps& pixmaps, 35 SkResourceCache* localCache = nullptr); 36 }; 37 38 #endif 39