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

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

Issue 1364743002: remove unused SkCachingPixelRef (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « gyp/core.gypi ('k') | src/lazy/SkCachingPixelRef.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 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 SkCachingPixelRef_DEFINED
9 #define SkCachingPixelRef_DEFINED
10
11 #include "SkBitmapCache.h"
12 #include "SkImageInfo.h"
13 #include "SkImageGenerator.h"
14 #include "SkPixelRef.h"
15
16 class SkColorTable;
17
18 /**
19 * PixelRef which defers decoding until SkBitmap::lockPixels() is
20 * called. Caches the decoded images in the global
21 * SkScaledImageCache. When the pixels are unlocked, this cache may
22 * or be destroyed before the next lock. If so, onLockPixels will
23 * attempt to re-decode.
24 *
25 * Decoding is handled by the SkImageGenerator
26 */
27 class SkCachingPixelRef : public SkPixelRef {
28 public:
29
30 /**
31 * Takes ownership of SkImageGenerator. If this method fails for
32 * whatever reason, it will return false and immediatetely delete
33 * the generator. If it succeeds, it will modify destination
34 * bitmap.
35 *
36 * If Install fails or when the SkCachingPixelRef that is
37 * installed into destination is destroyed, it will call
38 * `delete` on the generator. Therefore, generator should be
39 * allocated with `new`.
40 */
41 static bool Install(SkImageGenerator* gen, SkBitmap* dst);
42
43 protected:
44 virtual ~SkCachingPixelRef();
45 bool onNewLockPixels(LockRec*) override;
46 void onUnlockPixels() override;
47 bool onLockPixelsAreWritable() const override { return false; }
48
49 SkData* onRefEncodedData() override {
50 return fImageGenerator->refEncodedData();
51 }
52
53 bool onIsLazyGenerated() const override { return true; }
54
55 private:
56 SkImageGenerator* const fImageGenerator;
57 bool fErrorInDecoding;
58 const size_t fRowBytes;
59
60 SkBitmap fLockedBitmap;
61
62 SkCachingPixelRef(const SkImageInfo&, SkImageGenerator*, size_t rowBytes);
63
64 typedef SkPixelRef INHERITED;
65 };
66
67 #endif // SkCachingPixelRef_DEFINED
OLDNEW
« no previous file with comments | « gyp/core.gypi ('k') | src/lazy/SkCachingPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698