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

Side by Side Diff: src/lazy/SkCachingPixelRef.h

Issue 145443004: Resolve a few memory leaks in tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 11 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/core/SkScaledImageCache.cpp ('k') | src/lazy/SkDiscardablePixelRef.h » ('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 2013 Google Inc. 2 * Copyright 2013 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 #ifndef SkCachingPixelRef_DEFINED 8 #ifndef SkCachingPixelRef_DEFINED
9 #define SkCachingPixelRef_DEFINED 9 #define SkCachingPixelRef_DEFINED
10 10
11 #include "SkImageInfo.h" 11 #include "SkImageInfo.h"
12 #include "SkImageGenerator.h" 12 #include "SkImageGenerator.h"
13 #include "SkPixelRef.h" 13 #include "SkPixelRef.h"
14 14
15 class SkColorTable; 15 class SkColorTable;
16 16
17 /** 17 /**
18 * PixelRef which defers decoding until SkBitmap::lockPixels() is 18 * PixelRef which defers decoding until SkBitmap::lockPixels() is
19 * called. Caches the decoded images in the global 19 * called. Caches the decoded images in the global
20 * SkScaledImageCache. When the pixels are unlocked, this cache may 20 * SkScaledImageCache. When the pixels are unlocked, this cache may
21 * or be destroyed before the next lock. If so, onLockPixels will 21 * or be destroyed before the next lock. If so, onLockPixels will
22 * attempt to re-decode. 22 * attempt to re-decode.
23 * 23 *
24 * Decoding is handled by the SkImageGenerator 24 * Decoding is handled by the SkImageGenerator
25 */ 25 */
26 class SkCachingPixelRef : public SkPixelRef { 26 class SkCachingPixelRef : public SkPixelRef {
27 public: 27 public:
28 SK_DECLARE_INST_COUNT(SkCachingPixelRef)
28 /** 29 /**
29 * Takes ownership of SkImageGenerator. If this method fails for 30 * Takes ownership of SkImageGenerator. If this method fails for
30 * whatever reason, it will return false and immediatetely delete 31 * whatever reason, it will return false and immediatetely delete
31 * the generator. If it succeeds, it will modify destination 32 * the generator. If it succeeds, it will modify destination
32 * bitmap. 33 * bitmap.
33 * 34 *
34 * If Install fails or when the SkCachingPixelRef that is 35 * If Install fails or when the SkCachingPixelRef that is
35 * installed into destination is destroyed, it will call 36 * installed into destination is destroyed, it will call
36 * SkDELETE() on the generator. Therefore, generator should be 37 * SkDELETE() on the generator. Therefore, generator should be
37 * allocated with SkNEW() or SkNEW_ARGS(). 38 * allocated with SkNEW() or SkNEW_ARGS().
(...skipping 21 matching lines...) Expand all
59 bool fErrorInDecoding; 60 bool fErrorInDecoding;
60 void* fScaledCacheId; 61 void* fScaledCacheId;
61 const size_t fRowBytes; 62 const size_t fRowBytes;
62 63
63 SkCachingPixelRef(const SkImageInfo&, SkImageGenerator*, size_t rowBytes); 64 SkCachingPixelRef(const SkImageInfo&, SkImageGenerator*, size_t rowBytes);
64 65
65 typedef SkPixelRef INHERITED; 66 typedef SkPixelRef INHERITED;
66 }; 67 };
67 68
68 #endif // SkCachingPixelRef_DEFINED 69 #endif // SkCachingPixelRef_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkScaledImageCache.cpp ('k') | src/lazy/SkDiscardablePixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698