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

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

Issue 74793011: Add SkImageGenerator Interface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: protected destructor 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
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 SK_DECLARE_UNFLATTENABLE_OBJECT()
30
31 protected:
32 ~SkDiscardablePixelRef();
33 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE;
34 virtual void onUnlockPixels() SK_OVERRIDE;
35 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; }
36
37 virtual SkData* onRefEncodedData() SK_OVERRIDE {
38 return fGenerator->refEncodedData();
39 }
40
41 private:
42 SkImageGenerator* fGenerator;
43 SkDiscardableMemory* fDiscardableMemory;
44 SkImageInfo fInfo;
scroggo 2013/11/19 22:19:27 Can fInfo, fSize, and fRowBytes be const?
hal.canary 2013/11/20 00:07:10 Done. Even the pointer can be const (but not the
45 size_t fSize; // size of memeory to be allocated
scroggo 2013/11/19 22:19:27 memory*
hal.canary 2013/11/20 00:07:10 Done.
46 size_t fRowBytes; // ???
scroggo 2013/11/19 22:19:27 ???
hal.canary 2013/11/20 00:07:10 Done.
47
48 /* Takes ownership of SkImageGenerator. */
49 SkDiscardablePixelRef(SkImageGenerator* generator,
50 const SkImageInfo& info,
51 size_t size,
52 size_t rowBytes);
53 };
54 #endif // SkDiscardablePixelRef_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698