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

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

Issue 106183007: add SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR, initially always on (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | « no previous file | src/core/SkPixelRef.cpp » ('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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkPixelRef_DEFINED 10 #ifndef SkPixelRef_DEFINED
11 #define SkPixelRef_DEFINED 11 #define SkPixelRef_DEFINED
12 12
13 #include "SkBitmap.h" 13 #include "SkBitmap.h"
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 #include "SkString.h" 15 #include "SkString.h"
16 #include "SkFlattenable.h" 16 #include "SkFlattenable.h"
17 #include "SkTDArray.h" 17 #include "SkTDArray.h"
18 18
19 #define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
20
19 #ifdef SK_DEBUG 21 #ifdef SK_DEBUG
20 /** 22 /**
21 * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref 23 * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref
22 * subclasses to correctly handle lock/unlock pixels. For performance 24 * subclasses to correctly handle lock/unlock pixels. For performance
23 * reasons, simple malloc-based subclasses call setPreLocked() to skip 25 * reasons, simple malloc-based subclasses call setPreLocked() to skip
24 * the overhead of implementing these calls. 26 * the overhead of implementing these calls.
25 * 27 *
26 * This build-flag disables that optimization, to add in debugging our 28 * This build-flag disables that optimization, to add in debugging our
27 * call-sites, to ensure that they correctly balance their calls of 29 * call-sites, to ensure that they correctly balance their calls of
28 * lock and unlock. 30 * lock and unlock.
(...skipping 13 matching lines...) Expand all
42 This class is the smart container for pixel memory, and is used with 44 This class is the smart container for pixel memory, and is used with
43 SkBitmap. A pixelref is installed into a bitmap, and then the bitmap can 45 SkBitmap. A pixelref is installed into a bitmap, and then the bitmap can
44 access the actual pixel memory by calling lockPixels/unlockPixels. 46 access the actual pixel memory by calling lockPixels/unlockPixels.
45 47
46 This class can be shared/accessed between multiple threads. 48 This class can be shared/accessed between multiple threads.
47 */ 49 */
48 class SK_API SkPixelRef : public SkFlattenable { 50 class SK_API SkPixelRef : public SkFlattenable {
49 public: 51 public:
50 SK_DECLARE_INST_COUNT(SkPixelRef) 52 SK_DECLARE_INST_COUNT(SkPixelRef)
51 53
54 #ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
55 // DEPRECATED -- use a constructor that takes SkImageInfo
52 explicit SkPixelRef(SkBaseMutex* mutex = NULL); 56 explicit SkPixelRef(SkBaseMutex* mutex = NULL);
57 #endif
58
59 explicit SkPixelRef(const SkImageInfo&);
60 explicit SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex);
53 virtual ~SkPixelRef(); 61 virtual ~SkPixelRef();
54 62
55 /** Return the pixel memory returned from lockPixels, or null if the 63 /** Return the pixel memory returned from lockPixels, or null if the
56 lockCount is 0. 64 lockCount is 0.
57 */ 65 */
58 void* pixels() const { return fPixels; } 66 void* pixels() const { return fPixels; }
59 67
60 /** Return the current colorTable (if any) if pixels are locked, or null. 68 /** Return the current colorTable (if any) if pixels are locked, or null.
61 */ 69 */
62 SkColorTable* colorTable() const { return fColorTable; } 70 SkColorTable* colorTable() const { return fColorTable; }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 314
307 // When copying a bitmap to another with the same shape and config, we can s afely 315 // When copying a bitmap to another with the same shape and config, we can s afely
308 // clone the pixelref generation ID too, which makes them equivalent under c aching. 316 // clone the pixelref generation ID too, which makes them equivalent under c aching.
309 friend class SkBitmap; // only for cloneGenID 317 friend class SkBitmap; // only for cloneGenID
310 void cloneGenID(const SkPixelRef&); 318 void cloneGenID(const SkPixelRef&);
311 319
312 typedef SkFlattenable INHERITED; 320 typedef SkFlattenable INHERITED;
313 }; 321 };
314 322
315 #endif 323 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698