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

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

Issue 74793011: Add SkImageGenerator Interface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: SkDiscardablePixelRef Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | src/lazy/SkDiscardablePixelRef.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 SkDiscardablePixelRef_DEFINED
9 #define SkDiscardablePixelRef_DEFINED
10
11 #include "SkPixelRef.h"
12 #include "SkImageGenerator.h"
13 #include "SkImageInfo.h"
14
15 class SkDiscardableMemory;
16
17 /**
18 * An interface that allows a purgable PixelRef to re-decode an image.
19 */
20
21 class SkDiscardablePixelRef : public SkPixelRef {
22 public:
23 /**
24 * Takes ownership of SkImageGenerator.
25 * Will modify SkBitmap
26 */
27 static bool Install(SkImageGenerator* generator, SkBitmap* destination);
28
29 ~SkDiscardablePixelRef();
reed1 2013/11/19 15:51:54 this can be protected (or private I think)
hal.canary 2013/11/19 21:38:19 Done.
30
31 SK_DECLARE_UNFLATTENABLE_OBJECT()
32
33 protected:
34 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE;
35 virtual void onUnlockPixels() SK_OVERRIDE;
36 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; }
37
38 virtual SkData* onRefEncodedData() SK_OVERRIDE {
39 return fGenerator->refEncodedData();
40 }
41
42 private:
43 SkImageGenerator* fGenerator;
44 SkDiscardableMemory* fDiscardableMemory;
45 SkImageInfo fInfo;
46 size_t fSize; // size of memeory to be allocated
47 size_t fRowBytes; // ???
48
49 /* Takes ownership of SkImageGenerator. */
50 SkDiscardablePixelRef(SkImageGenerator* generator,
51 const SkImageInfo& info,
52 size_t size,
53 size_t rowBytes);
54 };
55 #endif // SkDiscardablePixelRef_DEFINED
OLDNEW
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698