OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "SkSurface_Base.h" | 8 #include "SkSurface_Base.h" |
9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 | 74 |
75 /////////////////////////////////////////////////////////////////////////////// | 75 /////////////////////////////////////////////////////////////////////////////// |
76 | 76 |
77 SkSurface::SkSurface(int width, int height) : fWidth(width), fHeight(height) { | 77 SkSurface::SkSurface(int width, int height) : fWidth(width), fHeight(height) { |
78 SkASSERT(fWidth >= 0); | 78 SkASSERT(fWidth >= 0); |
79 SkASSERT(fHeight >= 0); | 79 SkASSERT(fHeight >= 0); |
80 fGenerationID = 0; | 80 fGenerationID = 0; |
81 } | 81 } |
82 | 82 |
83 SkSurface::SkSurface(const SkImageInfo& info) | 83 SkSurface::SkSurface(const SkImageInfo& info) : fWidth(info.width()), fHeight(in
fo.height()) { |
84 : fWidth(info.fWidth) | |
85 , fHeight(info.fHeight) | |
86 { | |
87 SkASSERT(fWidth >= 0); | 84 SkASSERT(fWidth >= 0); |
88 SkASSERT(fHeight >= 0); | 85 SkASSERT(fHeight >= 0); |
89 fGenerationID = 0; | 86 fGenerationID = 0; |
90 } | 87 } |
91 | 88 |
92 uint32_t SkSurface::generationID() { | 89 uint32_t SkSurface::generationID() { |
93 if (0 == fGenerationID) { | 90 if (0 == fGenerationID) { |
94 fGenerationID = asSB(this)->newGenerationID(); | 91 fGenerationID = asSB(this)->newGenerationID(); |
95 } | 92 } |
96 return fGenerationID; | 93 return fGenerationID; |
(...skipping 18 matching lines...) Expand all Loading... |
115 } | 112 } |
116 | 113 |
117 void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, | 114 void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, |
118 const SkPaint* paint) { | 115 const SkPaint* paint) { |
119 return asSB(this)->onDraw(canvas, x, y, paint); | 116 return asSB(this)->onDraw(canvas, x, y, paint); |
120 } | 117 } |
121 | 118 |
122 const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { | 119 const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { |
123 return this->getCanvas()->peekPixels(info, rowBytes); | 120 return this->getCanvas()->peekPixels(info, rowBytes); |
124 } | 121 } |
OLD | NEW |