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

Side by Side Diff: include/core/SkBitmap.h

Issue 226183018: SkNonCopyable should be used with private inheritance. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: name resolution Created 6 years, 8 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 | « experimental/SkiaExamples/SkExample.h ('k') | include/core/SkDrawLooper.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 SkBitmap_DEFINED 8 #ifndef SkBitmap_DEFINED
9 #define SkBitmap_DEFINED 9 #define SkBitmap_DEFINED
10 10
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 bitmap, and return it (this is the amount to shift matrix iterators 804 bitmap, and return it (this is the amount to shift matrix iterators
805 by). If dst is not null, it is set to the correct level. 805 by). If dst is not null, it is set to the correct level.
806 */ 806 */
807 int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); 807 int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy);
808 bool hasMipMap() const; 808 bool hasMipMap() const;
809 void freeMipMap(); 809 void freeMipMap();
810 810
811 friend struct SkBitmapProcState; 811 friend struct SkBitmapProcState;
812 }; 812 };
813 813
814 class SkAutoLockPixels : public SkNoncopyable { 814 class SkAutoLockPixels : SkNoncopyable {
815 public: 815 public:
816 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { 816 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) {
817 fDidLock = doLock; 817 fDidLock = doLock;
818 if (doLock) { 818 if (doLock) {
819 bm.lockPixels(); 819 bm.lockPixels();
820 } 820 }
821 } 821 }
822 ~SkAutoLockPixels() { 822 ~SkAutoLockPixels() {
823 if (fDidLock) { 823 if (fDidLock) {
824 fBitmap.unlockPixels(); 824 fBitmap.unlockPixels();
825 } 825 }
826 } 826 }
827 827
828 private: 828 private:
829 const SkBitmap& fBitmap; 829 const SkBitmap& fBitmap;
830 bool fDidLock; 830 bool fDidLock;
831 }; 831 };
832 //TODO(mtklein): uncomment when 71713004 lands and Chromium's fixed. 832 //TODO(mtklein): uncomment when 71713004 lands and Chromium's fixed.
833 //#define SkAutoLockPixels(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockPixels) 833 //#define SkAutoLockPixels(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockPixels)
834 834
835 /** Helper class that performs the lock/unlockColors calls on a colortable. 835 /** Helper class that performs the lock/unlockColors calls on a colortable.
836 The destructor will call unlockColors(false) if it has a bitmap's colortable 836 The destructor will call unlockColors(false) if it has a bitmap's colortable
837 */ 837 */
838 class SkAutoLockColors : public SkNoncopyable { 838 class SkAutoLockColors : SkNoncopyable {
839 public: 839 public:
840 /** Initialize with no bitmap. Call lockColors(bitmap) to lock bitmap's 840 /** Initialize with no bitmap. Call lockColors(bitmap) to lock bitmap's
841 colortable 841 colortable
842 */ 842 */
843 SkAutoLockColors() : fCTable(NULL), fColors(NULL) {} 843 SkAutoLockColors() : fCTable(NULL), fColors(NULL) {}
844 /** Initialize with bitmap, locking its colortable if present 844 /** Initialize with bitmap, locking its colortable if present
845 */ 845 */
846 explicit SkAutoLockColors(const SkBitmap& bm) { 846 explicit SkAutoLockColors(const SkBitmap& bm) {
847 fCTable = bm.getColorTable(); 847 fCTable = bm.getColorTable();
848 fColors = fCTable ? fCTable->lockColors() : NULL; 848 fColors = fCTable ? fCTable->lockColors() : NULL;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 } 918 }
919 919
920 /////////////////////////////////////////////////////////////////////////////// 920 ///////////////////////////////////////////////////////////////////////////////
921 // 921 //
922 // Helpers until we can fully deprecate SkBitmap::Config 922 // Helpers until we can fully deprecate SkBitmap::Config
923 // 923 //
924 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); 924 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType);
925 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); 925 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config);
926 926
927 #endif 927 #endif
OLDNEW
« no previous file with comments | « experimental/SkiaExamples/SkExample.h ('k') | include/core/SkDrawLooper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698