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 #include <cstdint> 14 15 class SkCachedData; 16 class SkResourceCache; 17 class SkYUVAPixmaps; 18 19 class SkYUVPlanesCache { 20 public: 21 /** 22 * On success, return a ref to the SkCachedData that holds the pixel data. The SkYUVAPixmaps 23 * contains a description of the YUVA data and has a SkPixmap for each plane that points 24 * into the SkCachedData. 25 * 26 * On failure, return nullptr. 27 */ 28 static SkCachedData* FindAndRef(uint32_t genID, 29 SkYUVAPixmaps* pixmaps, 30 SkResourceCache* localCache = nullptr); 31 32 /** 33 * Add a pixelRef ID and its YUV planes data to the cache. The SkYUVAPixmaps should contain 34 * SkPixmaps that store their pixel data in the SkCachedData. 35 */ 36 static void Add(uint32_t genID, SkCachedData* data, const SkYUVAPixmaps& pixmaps, 37 SkResourceCache* localCache = nullptr); 38 }; 39 40 #endif 41