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

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

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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/lazy/SkDiscardableMemoryPool.cpp ('k') | src/opts/SkXfermode_opts_SSE2.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 SkDiscardablePixelRef_DEFINED 8 #ifndef SkDiscardablePixelRef_DEFINED
9 #define SkDiscardablePixelRef_DEFINED 9 #define SkDiscardablePixelRef_DEFINED
10 10
11 #include "SkDiscardableMemory.h" 11 #include "SkDiscardableMemory.h"
12 #include "SkImageGenerator.h" 12 #include "SkImageGenerator.h"
13 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
14 #include "SkPixelRef.h" 14 #include "SkPixelRef.h"
15 15
16 /** 16 /**
17 * A PixelRef backed by SkDiscardableMemory, with the ability to 17 * A PixelRef backed by SkDiscardableMemory, with the ability to
18 * re-generate the pixels (via a SkImageGenerator) if the DM is 18 * re-generate the pixels (via a SkImageGenerator) if the DM is
19 * purged. 19 * purged.
20 */ 20 */
21 class SkDiscardablePixelRef : public SkPixelRef { 21 class SkDiscardablePixelRef : public SkPixelRef {
22 public: 22 public:
23 SK_DECLARE_INST_COUNT(SkDiscardablePixelRef) 23 SK_DECLARE_INST_COUNT(SkDiscardablePixelRef)
24 24
25 protected: 25 protected:
26 ~SkDiscardablePixelRef(); 26 ~SkDiscardablePixelRef();
27 27
28 bool onNewLockPixels(LockRec*) SK_OVERRIDE; 28 bool onNewLockPixels(LockRec*) override;
29 void onUnlockPixels() SK_OVERRIDE; 29 void onUnlockPixels() override;
30 bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } 30 bool onLockPixelsAreWritable() const override { return false; }
31 31
32 SkData* onRefEncodedData() SK_OVERRIDE { 32 SkData* onRefEncodedData() override {
33 return fGenerator->refEncodedData(); 33 return fGenerator->refEncodedData();
34 } 34 }
35 35
36 private: 36 private:
37 SkImageGenerator* const fGenerator; 37 SkImageGenerator* const fGenerator;
38 SkDiscardableMemory::Factory* const fDMFactory; 38 SkDiscardableMemory::Factory* const fDMFactory;
39 const size_t fRowBytes; 39 const size_t fRowBytes;
40 // These const members should not change over the life of the 40 // These const members should not change over the life of the
41 // PixelRef, since the SkBitmap doesn't expect them to change. 41 // PixelRef, since the SkBitmap doesn't expect them to change.
42 42
43 SkDiscardableMemory* fDiscardableMemory; 43 SkDiscardableMemory* fDiscardableMemory;
44 bool fDiscardableMemoryIsLocked; 44 bool fDiscardableMemoryIsLocked;
45 SkAutoTUnref<SkColorTable> fCTable; 45 SkAutoTUnref<SkColorTable> fCTable;
46 46
47 /* Takes ownership of SkImageGenerator. */ 47 /* Takes ownership of SkImageGenerator. */
48 SkDiscardablePixelRef(const SkImageInfo&, SkImageGenerator*, 48 SkDiscardablePixelRef(const SkImageInfo&, SkImageGenerator*,
49 size_t rowBytes, 49 size_t rowBytes,
50 SkDiscardableMemory::Factory* factory); 50 SkDiscardableMemory::Factory* factory);
51 51
52 virtual bool onGetYUV8Planes(SkISize sizes[3], 52 virtual bool onGetYUV8Planes(SkISize sizes[3],
53 void* planes[3], 53 void* planes[3],
54 size_t rowBytes[3], 54 size_t rowBytes[3],
55 SkYUVColorSpace* colorSpace) SK_OVERRIDE { 55 SkYUVColorSpace* colorSpace) override {
56 // If the image was already decoded with lockPixels(), favor not 56 // If the image was already decoded with lockPixels(), favor not
57 // re-decoding to YUV8 planes. 57 // re-decoding to YUV8 planes.
58 if (fDiscardableMemory) { 58 if (fDiscardableMemory) {
59 return false; 59 return false;
60 } 60 }
61 return fGenerator->getYUV8Planes(sizes, planes, rowBytes, colorSpace); 61 return fGenerator->getYUV8Planes(sizes, planes, rowBytes, colorSpace);
62 } 62 }
63 63
64 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, SkBitmap*, 64 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, SkBitmap*,
65 SkDiscardableMemory::Factory*); 65 SkDiscardableMemory::Factory*);
66 66
67 typedef SkPixelRef INHERITED; 67 typedef SkPixelRef INHERITED;
68 }; 68 };
69 69
70 #endif // SkDiscardablePixelRef_DEFINED 70 #endif // SkDiscardablePixelRef_DEFINED
OLDNEW
« no previous file with comments | « src/lazy/SkDiscardableMemoryPool.cpp ('k') | src/opts/SkXfermode_opts_SSE2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698