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

Side by Side Diff: src/core/SkPixelRef.cpp

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 | « include/core/SkPixelRef.h ('k') | no next file » | 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 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 #include "SkPixelRef.h" 8 #include "SkPixelRef.h"
9 #include "SkFlattenableBuffers.h" 9 #include "SkFlattenableBuffers.h"
10 #include "SkThread.h" 10 #include "SkThread.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void SkPixelRef::setMutex(SkBaseMutex* mutex) { 75 void SkPixelRef::setMutex(SkBaseMutex* mutex) {
76 if (NULL == mutex) { 76 if (NULL == mutex) {
77 mutex = get_default_mutex(); 77 mutex = get_default_mutex();
78 } 78 }
79 fMutex = mutex; 79 fMutex = mutex;
80 } 80 }
81 81
82 // just need a > 0 value, so pick a funny one to aid in debugging 82 // just need a > 0 value, so pick a funny one to aid in debugging
83 #define SKPIXELREF_PRELOCKED_LOCKCOUNT 123456789 83 #define SKPIXELREF_PRELOCKED_LOCKCOUNT 123456789
84 84
85 SkPixelRef::SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex) {
86 this->setMutex(mutex);
87 fPixels = NULL;
88 fColorTable = NULL; // we do not track ownership of this
89 fLockCount = 0;
90 this->needsNewGenID();
91 fIsImmutable = false;
92 fPreLocked = false;
93 }
94
95 SkPixelRef::SkPixelRef(const SkImageInfo&) {
96 this->setMutex(NULL);
97 fPixels = NULL;
98 fColorTable = NULL; // we do not track ownership of this
99 fLockCount = 0;
100 this->needsNewGenID();
101 fIsImmutable = false;
102 fPreLocked = false;
103 }
104
105 #ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
106 // THIS GUY IS DEPRECATED -- don't use me!
85 SkPixelRef::SkPixelRef(SkBaseMutex* mutex) { 107 SkPixelRef::SkPixelRef(SkBaseMutex* mutex) {
86 this->setMutex(mutex); 108 this->setMutex(mutex);
87 fPixels = NULL; 109 fPixels = NULL;
88 fColorTable = NULL; // we do not track ownership of this 110 fColorTable = NULL; // we do not track ownership of this
89 fLockCount = 0; 111 fLockCount = 0;
90 this->needsNewGenID(); 112 this->needsNewGenID();
91 fIsImmutable = false; 113 fIsImmutable = false;
92 fPreLocked = false; 114 fPreLocked = false;
93 } 115 }
116 #endif
94 117
95 SkPixelRef::SkPixelRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex) 118 SkPixelRef::SkPixelRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex)
96 : INHERITED(buffer) { 119 : INHERITED(buffer) {
97 this->setMutex(mutex); 120 this->setMutex(mutex);
98 fPixels = NULL; 121 fPixels = NULL;
99 fColorTable = NULL; // we do not track ownership of this 122 fColorTable = NULL; // we do not track ownership of this
100 fLockCount = 0; 123 fLockCount = 0;
101 fIsImmutable = buffer.readBool(); 124 fIsImmutable = buffer.readBool();
102 fGenerationID = buffer.readUInt(); 125 fGenerationID = buffer.readUInt();
103 fUniqueGenerationID = false; // Conservatively assuming the original still exists. 126 fUniqueGenerationID = false; // Conservatively assuming the original still exists.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 275
253 #ifdef SK_BUILD_FOR_ANDROID 276 #ifdef SK_BUILD_FOR_ANDROID
254 void SkPixelRef::globalRef(void* data) { 277 void SkPixelRef::globalRef(void* data) {
255 this->ref(); 278 this->ref();
256 } 279 }
257 280
258 void SkPixelRef::globalUnref() { 281 void SkPixelRef::globalUnref() {
259 this->unref(); 282 this->unref();
260 } 283 }
261 #endif 284 #endif
OLDNEW
« no previous file with comments | « include/core/SkPixelRef.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698