| OLD | NEW |
| 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 #ifndef SkPictureRecord_DEFINED | 8 #ifndef SkPictureRecord_DEFINED |
| 9 #define SkPictureRecord_DEFINED | 9 #define SkPictureRecord_DEFINED |
| 10 | 10 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 void addScalar(SkScalar scalar) { | 159 void addScalar(SkScalar scalar) { |
| 160 fWriter.writeScalar(scalar); | 160 fWriter.writeScalar(scalar); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void addBitmap(const SkBitmap& bitmap); | 163 void addBitmap(const SkBitmap& bitmap); |
| 164 void addMatrix(const SkMatrix& matrix); | 164 void addMatrix(const SkMatrix& matrix); |
| 165 void addMatrixPtr(const SkMatrix* matrix); | 165 void addMatrixPtr(const SkMatrix* matrix); |
| 166 const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr(
&paint); } | 166 const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr(
&paint); } |
| 167 const SkFlatData* addPaintPtr(const SkPaint* paint); | 167 const SkFlatData* addPaintPtr(const SkPaint* paint); |
| 168 void addFlatPaint(const SkFlatData* flatPaint); |
| 168 void addPath(const SkPath& path); | 169 void addPath(const SkPath& path); |
| 169 void addPicture(SkPicture& picture); | 170 void addPicture(SkPicture& picture); |
| 170 void addPoint(const SkPoint& point); | 171 void addPoint(const SkPoint& point); |
| 171 void addPoints(const SkPoint pts[], int count); | 172 void addPoints(const SkPoint pts[], int count); |
| 172 void addRect(const SkRect& rect); | 173 void addRect(const SkRect& rect); |
| 173 void addRectPtr(const SkRect* rect); | 174 void addRectPtr(const SkRect* rect); |
| 174 void addIRect(const SkIRect& rect); | 175 void addIRect(const SkIRect& rect); |
| 175 void addIRectPtr(const SkIRect* rect); | 176 void addIRectPtr(const SkIRect* rect); |
| 176 void addRRect(const SkRRect&); | 177 void addRRect(const SkRRect&); |
| 177 void addRegion(const SkRegion& region); | 178 void addRegion(const SkRegion& region); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 void validatePaths() const; | 210 void validatePaths() const; |
| 210 void validateRegions() const; | 211 void validateRegions() const; |
| 211 #else | 212 #else |
| 212 public: | 213 public: |
| 213 void validate(uint32_t initialOffset, uint32_t size) const { | 214 void validate(uint32_t initialOffset, uint32_t size) const { |
| 214 SkASSERT(fWriter.size() == initialOffset + size); | 215 SkASSERT(fWriter.size() == initialOffset + size); |
| 215 } | 216 } |
| 216 #endif | 217 #endif |
| 217 | 218 |
| 218 protected: | 219 protected: |
| 220 // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been |
| 221 // tweaked by paint.computeFastBounds(). |
| 222 static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbo
t[2]); |
| 223 |
| 224 // Make sure that flat has fTopBot written. |
| 225 static void WriteTopBot(const SkPaint& paint, const SkFlatData& flat) { |
| 226 if (!flat.isTopBotWritten()) { |
| 227 ComputeFontMetricsTopBottom(paint, flat.writableTopBot()); |
| 228 SkASSERT(flat.isTopBotWritten()); |
| 229 } |
| 230 } |
| 231 // Will return a cached version when possible. |
| 232 const SkFlatData* getFlatPaintData(const SkPaint& paint); |
| 233 /** |
| 234 * SkBBoxRecord::drawPosTextH gets a flat paint and uses it, |
| 235 * then it calls this, using the extra parameter, to avoid duplication. |
| 236 */ |
| 237 void drawPosTextHImpl(const void* text, size_t byteLength, |
| 238 const SkScalar xpos[], SkScalar constY, |
| 239 const SkPaint& paint, const SkFlatData* flatPaintData)
; |
| 219 | 240 |
| 220 // These are set to NULL in our constructor, but may be changed by | 241 // These are set to NULL in our constructor, but may be changed by |
| 221 // subclasses, in which case they will be SkSafeUnref'd in our destructor. | 242 // subclasses, in which case they will be SkSafeUnref'd in our destructor. |
| 222 SkBBoxHierarchy* fBoundingHierarchy; | 243 SkBBoxHierarchy* fBoundingHierarchy; |
| 223 SkPictureStateTree* fStateTree; | 244 SkPictureStateTree* fStateTree; |
| 224 | 245 |
| 225 // Allocated in the constructor and managed by this class. | 246 // Allocated in the constructor and managed by this class. |
| 226 SkBitmapHeap* fBitmapHeap; | 247 SkBitmapHeap* fBitmapHeap; |
| 227 | 248 |
| 228 private: | 249 private: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 241 uint32_t fRecordFlags; | 262 uint32_t fRecordFlags; |
| 242 int fInitialSaveCount; | 263 int fInitialSaveCount; |
| 243 | 264 |
| 244 friend class SkPicturePlayback; | 265 friend class SkPicturePlayback; |
| 245 friend class SkPictureTester; // for unit testing | 266 friend class SkPictureTester; // for unit testing |
| 246 | 267 |
| 247 typedef SkCanvas INHERITED; | 268 typedef SkCanvas INHERITED; |
| 248 }; | 269 }; |
| 249 | 270 |
| 250 #endif | 271 #endif |
| OLD | NEW |