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

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

Issue 110843006: Initialize SkPixelRef::fInfo. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add note to make const. 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) { 85 SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) {
86 this->setMutex(mutex); 86 this->setMutex(mutex);
87 fInfo = info;
87 fPixels = NULL; 88 fPixels = NULL;
88 fColorTable = NULL; // we do not track ownership of this 89 fColorTable = NULL; // we do not track ownership of this
89 fLockCount = 0; 90 fLockCount = 0;
90 this->needsNewGenID(); 91 this->needsNewGenID();
91 fIsImmutable = false; 92 fIsImmutable = false;
92 fPreLocked = false; 93 fPreLocked = false;
93 } 94 }
94 95
95 SkPixelRef::SkPixelRef(const SkImageInfo&) { 96 SkPixelRef::SkPixelRef(const SkImageInfo& info) {
96 this->setMutex(NULL); 97 this->setMutex(NULL);
98 fInfo = info;
97 fPixels = NULL; 99 fPixels = NULL;
98 fColorTable = NULL; // we do not track ownership of this 100 fColorTable = NULL; // we do not track ownership of this
99 fLockCount = 0; 101 fLockCount = 0;
100 this->needsNewGenID(); 102 this->needsNewGenID();
101 fIsImmutable = false; 103 fIsImmutable = false;
102 fPreLocked = false; 104 fPreLocked = false;
103 } 105 }
104 106
105 #ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR 107 #ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
106 // THIS GUY IS DEPRECATED -- don't use me! 108 // THIS GUY IS DEPRECATED -- don't use me!
107 SkPixelRef::SkPixelRef(SkBaseMutex* mutex) { 109 SkPixelRef::SkPixelRef(SkBaseMutex* mutex) {
108 this->setMutex(mutex); 110 this->setMutex(mutex);
111 // Fill with dummy values.
112 sk_bzero(&fInfo, sizeof(fInfo));
109 fPixels = NULL; 113 fPixels = NULL;
110 fColorTable = NULL; // we do not track ownership of this 114 fColorTable = NULL; // we do not track ownership of this
111 fLockCount = 0; 115 fLockCount = 0;
112 this->needsNewGenID(); 116 this->needsNewGenID();
113 fIsImmutable = false; 117 fIsImmutable = false;
114 fPreLocked = false; 118 fPreLocked = false;
115 } 119 }
116 #endif 120 #endif
117 121
118 SkPixelRef::SkPixelRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex) 122 SkPixelRef::SkPixelRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex)
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 279
276 #ifdef SK_BUILD_FOR_ANDROID 280 #ifdef SK_BUILD_FOR_ANDROID
277 void SkPixelRef::globalRef(void* data) { 281 void SkPixelRef::globalRef(void* data) {
278 this->ref(); 282 this->ref();
279 } 283 }
280 284
281 void SkPixelRef::globalUnref() { 285 void SkPixelRef::globalUnref() {
282 this->unref(); 286 this->unref();
283 } 287 }
284 #endif 288 #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